forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[multithreading] diff facebook#2-2, implemented fiberMarshal/Unmarsha…
…l() coding Summary: So i'm correctly handling references and objects now. I'll need diff facebook#2-3 to have globals, which really isn't different from params with all references and objects. So, all marshaling unmarshaling code are done, just hooking up with global states and thread locals. Also fixed call_user_func() to respect references! Test Plan: the new unit tests DiffCamp Revision: 122452 Reviewed By: iproctor Commenters: qixin CC: hphp-diffs@lists, iproctor, hzhao, qixin Tasks: #141384: add multi-threading support to PHP Revert Plan: OK
- Loading branch information
Showing
22 changed files
with
528 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
+----------------------------------------------------------------------+ | ||
| HipHop for PHP | | ||
+----------------------------------------------------------------------+ | ||
| Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | | ||
+----------------------------------------------------------------------+ | ||
| This source file is subject to version 3.01 of the PHP license, | | ||
| that is bundled with this package in the file LICENSE, and is | | ||
| available through the world-wide-web at the following url: | | ||
| http://www.php.net/license/3_01.txt | | ||
| If you did not receive a copy of the PHP license and are unable to | | ||
| obtain it through the world-wide-web, please send a note to | | ||
| license@php.net so we can mail you a copy immediately. | | ||
+----------------------------------------------------------------------+ | ||
*/ | ||
|
||
#include <runtime/base/fiber_reference_map.h> | ||
|
||
namespace HPHP { | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
void FiberReferenceMap::insert(void *src, void *copy) { | ||
ASSERT(lookup(src) == NULL); | ||
ASSERT(copy == NULL || reverseLookup(copy) == NULL); | ||
m_forward_references[src] = copy; | ||
if (copy) { | ||
m_reverse_references[copy] = src; | ||
} | ||
} | ||
|
||
void *FiberReferenceMap::lookup(void *src) { | ||
PointerMap::iterator iter = m_forward_references.find(src); | ||
if (iter != m_forward_references.end()) { | ||
return iter->second; | ||
} | ||
return NULL; | ||
} | ||
|
||
void *FiberReferenceMap::reverseLookup(void *copy) { | ||
PointerMap::iterator iter = m_reverse_references.find(copy); | ||
if (iter != m_reverse_references.end()) { | ||
return iter->second; | ||
} | ||
return NULL; | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
} |
Oops, something went wrong.