2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2014 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #ifndef incl_HPHP_HHVM_PROCESS_INIT_H_
17 #define incl_HPHP_HHVM_PROCESS_INIT_H_
19 #include "hphp/runtime/base/thread-init-fini.h"
20 #include "hphp/runtime/vm/runtime.h"
21 #include "hphp/compiler/analysis/emitter.h"
25 extern void (*g_vmProcessInit
)();
26 void hphp_process_init();
29 void initialize_repo();
32 * This must be called before execute_program_impl in an hhvm build.
34 inline void register_process_init() {
35 g_vmProcessInit
= &ProcessInit
;
36 g_hphp_compiler_serialize_code_model_for
= &HPHP::Compiler::
37 hphp_compiler_serialize_code_model_for
;
38 g_hphp_compiler_parse
= &HPHP::Compiler::hphp_compiler_parse
;
39 g_hphp_build_native_func_unit
= &HPHP::Compiler::
40 hphp_build_native_func_unit
;
41 g_hphp_build_native_class_unit
= &HPHP::Compiler::
42 hphp_build_native_class_unit
;
46 * Initialize the runtime in a way that's appropriate for unit tests
47 * that make partial use of libhphp_runtime.a. (There will not be a
48 * real execution context or anything like that.)
50 inline void init_for_unit_test() {
51 register_process_init();
54 IniSetting::Map ini
= IniSetting::Map::object
;
56 RuntimeOption::Load(ini
, config
);
57 compile_file(0, 0, MD5(), 0);