modify hash_string* code to use CRC32
[hiphop-php.git] / hphp / hhvm / process-init.h
blob98b2119a1895db86fdba4bd7696942e0ada859e8
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
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"
23 namespace HPHP {
25 extern void (*g_vmProcessInit)();
26 void hphp_process_init();
28 void ProcessInit();
29 void initialize_repo();
31 * This must be called before execute_program_impl in an hhvm build.
33 inline void register_process_init() {
34 g_vmProcessInit = &ProcessInit;
35 g_hphp_compiler_serialize_code_model_for = &HPHP::Compiler::
36 hphp_compiler_serialize_code_model_for;
37 g_hphp_compiler_parse = &HPHP::Compiler::hphp_compiler_parse;
38 g_hphp_build_native_func_unit = &HPHP::Compiler::
39 hphp_build_native_func_unit;
40 g_hphp_build_native_class_unit = &HPHP::Compiler::
41 hphp_build_native_class_unit;
45 * Initialize the runtime in a way that's appropriate for unit tests
46 * that make partial use of libhphp_runtime.a. (There will not be a
47 * real execution context or anything like that.)
49 inline void init_for_unit_test() {
50 register_process_init();
51 initialize_repo();
52 init_thread_locals();
53 IniSetting::Map ini = IniSetting::Map::object;
54 Hdf config;
55 RuntimeOption::Load(ini, config);
56 compile_file(0, 0, MD5(), 0);
57 hphp_process_init();
62 #endif