-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Differential Revision: D64869470 fbshipit-source-id: dfb8571380c508766a2e7eca8a263c9dee288dd7
- Loading branch information
1 parent
2e66943
commit 5d05ff5
Showing
3 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?hh | ||
|
||
<<__PHPStdLib>> | ||
function sb_profile_ser(string $sb_root, string $prof_path): string; | ||
<<__PHPStdLib>> | ||
function sb_profile_deser(string $sb_root, string $prof_path): string; |
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,28 @@ | ||
#include "hphp/runtime/ext/extension.h" | ||
#include "hphp/runtime/vm/jit/prof-data-serialize.h" | ||
|
||
namespace HPHP { | ||
|
||
String HHVM_FUNCTION(sb_profile_ser, | ||
const String& sb_root, | ||
const String& prof_path) { | ||
auto const status = jit::serializeSBProfData(sb_root.data(), prof_path.data()); | ||
return String{status.c_str()}; | ||
} | ||
|
||
String HHVM_FUNCTION(sb_profile_deser, | ||
const String& sb_root, | ||
const String& prof_path) { | ||
auto const status = jit::deserializeSBProfData(sb_root.data(), prof_path.data()); | ||
return String{status.c_str()}; | ||
} | ||
|
||
static struct SbProfileExtension final : Extension { | ||
SbProfileExtension() | ||
: Extension("sb_profile", NO_EXTENSION_VERSION_YET, "hphp_hphpi") {} | ||
void moduleRegisterNative() override { | ||
HHVM_FE(sb_profile_ser); | ||
HHVM_FE(sb_profile_deser); | ||
} | ||
} s_sb_profile_extension; | ||
} |
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,22 @@ | ||
<?hh | ||
|
||
/** | ||
* Serializes sandbox profile. A profile can be serialized only once for the | ||
* lifetime of the HHVM process. | ||
* | ||
* @param string $sb_root - PHP root directory of the sandbox. | ||
* @param string $prof_path - Full path of the profile file. | ||
* @return string - Status of the serialization attempt. | ||
*/ | ||
<<__Native>> | ||
function sb_profile_ser(string $sb_root, string $prof_path): string; | ||
/** | ||
* Deerializes sandbox profile. A profile can be deserialized only once for the | ||
* lifetime of the HHVM process. | ||
* | ||
* @param string $sb_root - PHP root directory of the sandbox. | ||
* @param string $prof_path - Full path of the profile file. | ||
* @return string - Status of the deserialization attempt. | ||
*/ | ||
<<__Native>> | ||
function sb_profile_deser(string $sb_root, string $prof_path): string; |