86# include <sys/types.h>
106#if defined(COMPILE_DL_OPCACHE)
116char accel_uname_id[32];
119static const char *zps_failure_reason =
NULL;
122#if ENABLE_FILE_CACHE_FALLBACK
123bool fallback_process =
false;
138static void preload_shutdown(
void);
139static void preload_activate(
void);
140static void preload_restart(
void);
143# define INCREMENT(v) InterlockedIncrement64(&ZCSG(v))
144# define DECREMENT(v) InterlockedDecrement64(&ZCSG(v))
145# define LOCKVAL(v) (ZCSG(v))
148#define ZCG_KEY_LEN (MAXPATHLEN * 8)
153static void bzero_aligned(
void *mem,
size_t size)
155#if defined(__x86_64__)
157#elif defined(__AVX__)
158 char *
p = (
char*)mem;
160 __m256i ymm0 = _mm256_setzero_si256();
163 _mm256_store_si256((__m256i*)
p, ymm0);
164 _mm256_store_si256((__m256i*)(
p+32), ymm0);
167#elif defined(__SSE2__)
168 char *
p = (
char*)mem;
170 __m128i xmm0 = _mm_setzero_si128();
173 _mm_store_si128((__m128i*)
p, xmm0);
174 _mm_store_si128((__m128i*)(
p+16), xmm0);
175 _mm_store_si128((__m128i*)(
p+32), xmm0);
176 _mm_store_si128((__m128i*)(
p+48), xmm0);
188 GetSystemTimeAsFileTime(&
now);
190 return (time_t) ((((((__int64)
now.dwHighDateTime) << 32)|
now.dwLowDateTime) - 116444736000000000L)/10000000);
193# define zend_accel_get_time() time(NULL)
196static inline bool is_cacheable_stream_path(
const char *filename)
198 return memcmp(filename,
"file://",
sizeof(
"file://") - 1) == 0 ||
199 memcmp(filename,
"phar://",
sizeof(
"phar://") - 1) == 0;
222 ZCG(cwd_key_len) = 0;
223 ZCG(cwd_check) =
true;
237 ZCG(cwd_key_len) = 0;
238 ZCG(cwd_check) =
true;
245 if ((((
double)
ZSMMG(wasted_shared_memory)) /
ZCG(accel_directives).memory_consumption) >=
ZCG(accel_directives).max_wasted_percentage) {
257 int ret = orig_include_path_on_modify(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
260 ZCG(include_path) = new_value;
261 ZCG(include_path_key_len) = 0;
262 ZCG(include_path_check) =
true;
267static inline void accel_restart_enter(
void)
270 INCREMENT(restart_in);
272 struct flock restart_in_progress;
274 restart_in_progress.l_type = F_WRLCK;
275 restart_in_progress.l_whence =
SEEK_SET;
276 restart_in_progress.l_start = 2;
277 restart_in_progress.l_len = 1;
279 if (fcntl(
lock_file, F_SETLK, &restart_in_progress) == -1) {
283 ZCSG(restart_in_progress) =
true;
286static inline void accel_restart_leave(
void)
289 ZCSG(restart_in_progress) =
false;
290 DECREMENT(restart_in);
292 struct flock restart_finished;
294 restart_finished.l_type = F_UNLCK;
295 restart_finished.l_whence =
SEEK_SET;
296 restart_finished.l_start = 2;
297 restart_finished.l_len = 1;
299 ZCSG(restart_in_progress) =
false;
300 if (fcntl(
lock_file, F_SETLK, &restart_finished) == -1) {
306static inline int accel_restart_is_active(
void)
308 if (
ZCSG(restart_in_progress)) {
310 struct flock restart_check;
312 restart_check.l_type = F_WRLCK;
314 restart_check.l_start = 2;
315 restart_check.l_len = 1;
317 if (fcntl(
lock_file, F_GETLK, &restart_check) == -1) {
321 if (restart_check.l_type == F_UNLCK) {
322 ZCSG(restart_in_progress) =
false;
328 return LOCKVAL(restart_in) != 0;
339 INCREMENT(mem_usage);
342 struct flock mem_usage_lock;
344 mem_usage_lock.l_type = F_RDLCK;
346 mem_usage_lock.l_start = 1;
347 mem_usage_lock.l_len = 1;
349 if (fcntl(
lock_file, F_SETLK, &mem_usage_lock) == -1) {
358static inline void accel_deactivate_sub(
void)
363 DECREMENT(mem_usage);
364 ZCG(counted) =
false;
368 struct flock mem_usage_unlock;
370 mem_usage_unlock.l_type = F_UNLCK;
371 mem_usage_unlock.l_whence =
SEEK_SET;
372 mem_usage_unlock.l_start = 1;
373 mem_usage_unlock.l_len = 1;
375 if (fcntl(
lock_file, F_SETLK, &mem_usage_unlock) == -1) {
381static inline void accel_unlock_all(
void)
384 accel_deactivate_sub();
390 struct flock mem_usage_unlock_all;
392 mem_usage_unlock_all.l_type = F_UNLCK;
393 mem_usage_unlock_all.l_whence =
SEEK_SET;
394 mem_usage_unlock_all.l_start = 0;
395 mem_usage_unlock_all.l_len = 0;
397 if (fcntl(
lock_file, F_SETLK, &mem_usage_unlock_all) == -1) {
410#define STRTAB_INVALID_POS 0
412#define STRTAB_HASH_TO_SLOT(tab, h) \
413 ((zend_string_table_pos_t*)((char*)(tab) + sizeof(*(tab)) + ((h) & (tab)->nTableMask)))
414#define STRTAB_STR_TO_POS(tab, s) \
415 ((zend_string_table_pos_t)(((char*)s - (char*)(tab)) / ZEND_STRING_TABLE_POS_ALIGNMENT))
416#define STRTAB_POS_TO_STR(tab, pos) \
417 ((zend_string*)((char*)(tab) + ((uintptr_t)(pos) * ZEND_STRING_TABLE_POS_ALIGNMENT)))
418#define STRTAB_COLLISION(s) \
419 (*((zend_string_table_pos_t*)((char*)s - sizeof(zend_string_table_pos_t))))
420#define STRTAB_STR_SIZE(s) \
421 ZEND_MM_ALIGNED_SIZE_EX(_ZSTR_STRUCT_SIZE(ZSTR_LEN(s)) + sizeof(zend_string_table_pos_t), ZEND_STRING_TABLE_POS_ALIGNMENT)
422#define STRTAB_NEXT(s) \
423 ((zend_string*)((char*)(s) + STRTAB_STR_SIZE(s)))
425static void accel_interned_strings_restore_state(
void)
432 0, (
char*)
ZCSG(interned_strings).
top - (
char*)
ZCSG(interned_strings).saved_top);
435 ZCSG(interned_strings).top =
ZCSG(interned_strings).saved_top;
442 s =
ZCSG(interned_strings).start;
443 top =
ZCSG(interned_strings).top;
450 if (idx >=
ZCSG(map_ptr_last)) {
463 ZCSG(interned_strings).nNumOfElements =
n;
466static void accel_interned_strings_save_state(
void)
468 ZCSG(interned_strings).saved_top =
ZCSG(interned_strings).top;
483 if (!
ZCG(accelerator_enabled) || accel_activate_add() ==
FAILURE) {
489 h = zend_string_hash_val(str);
521 h = zend_string_hash_val(str);
543 ZCSG(interned_strings).nNumOfElements++;
544 s =
ZCSG(interned_strings).top;
564 zend_string_release(str);
570 zend_string_hash_val(str);
575 zend_string_release(str);
608 ret = zend_string_init(str,
size, permanent);
615 return zend_string_init(str,
size, permanent);
618static inline void accel_copy_permanent_list_types(
625 accel_copy_permanent_list_types(new_interned_string, *single_type);
642 for (
j = 0;
j < 256;
j++) {
652 p->key = new_interned_string(
p->key);
654 if (
Z_FUNC(
p->val)->common.function_name) {
655 Z_FUNC(
p->val)->common.function_name = new_interned_string(
Z_FUNC(
p->val)->common.function_name);
657 if (
Z_FUNC(
p->val)->common.arg_info &&
667 accel_copy_permanent_list_types(new_interned_string, arg_info[i].
type);
679 p->key = new_interned_string(
p->key);
683 ce->
name = new_interned_string(ce->
name);
693 q->
key = new_interned_string(q->
key);
697 info->
name = new_interned_string(info->
name);
703 q->
key = new_interned_string(q->
key);
705 if (
Z_FUNC(q->
val)->common.function_name) {
706 Z_FUNC(q->
val)->common.function_name = new_interned_string(
Z_FUNC(q->
val)->common.function_name);
714 q->
key = new_interned_string(q->
key);
728 p->key = new_interned_string(
p->key);
732 c->
name = new_interned_string(c->
name);
745 zend_string_addref(auto_global->
name);
746 auto_global->
name = new_interned_string(auto_global->
name);
748 p->key = new_interned_string(
p->key);
754 p->key = new_interned_string(
p->key);
762 p->key = new_interned_string(
p->key);
765 entry->
name = new_interned_string(entry->
name);
768 entry->
value = new_interned_string(entry->
value);
778 p->key = new_interned_string(
p->key);
785 p->key = new_interned_string(
p->key);
792 p->key = new_interned_string(
p->key);
802 zend_string_release(str);
808static void accel_use_shm_interned_strings(
void)
814 if (
ZCSG(interned_strings).saved_top ==
NULL) {
818 accel_copy_permanent_strings(accel_replace_string_by_shm_permanent);
819 ZCG(counted) =
false;
821 accel_interned_strings_save_state();
829static inline void kill_all_lockers(
struct flock *mem_usage_check)
833 ZCSG(force_restart_time) = 0;
834 while (mem_usage_check->l_pid > 0) {
838 bool success =
false;
843 if (kill(mem_usage_check->l_pid, signal)) {
844 if (
errno == ESRCH) {
848 }
else if (
errno != 0) {
855 if (kill(mem_usage_check->l_pid, 0)) {
856 if (
errno == ESRCH) {
860 }
else if (
errno != 0) {
876 mem_usage_check->l_type = F_WRLCK;
877 mem_usage_check->l_whence =
SEEK_SET;
878 mem_usage_check->l_start = 1;
879 mem_usage_check->l_len = 1;
880 mem_usage_check->l_pid = -1;
881 if (fcntl(
lock_file, F_GETLK, mem_usage_check) == -1) {
886 if (mem_usage_check->l_type == F_UNLCK || mem_usage_check->l_pid <= 0) {
893static inline bool accel_is_inactive(
void)
903 if (LOCKVAL(mem_usage) == 0) {
907 struct flock mem_usage_check;
909 mem_usage_check.l_type = F_WRLCK;
910 mem_usage_check.l_whence =
SEEK_SET;
911 mem_usage_check.l_start = 1;
912 mem_usage_check.l_len = 1;
913 mem_usage_check.l_pid = -1;
914 if (fcntl(
lock_file, F_GETLK, &mem_usage_check) == -1) {
918 if (mem_usage_check.l_type == F_UNLCK) {
922 if (
ZCG(accel_directives).force_restart_timeout
923 &&
ZCSG(force_restart_time)
926 kill_all_lockers(&mem_usage_check);
935static int zend_get_stream_timestamp(
const char *filename,
zend_stat_t *statbuf)
950 statbuf->st_mtime = 1;
967 *statbuf = stream_statbuf.
sb;
974 static unsigned __int64 utc_base = 0;
975 static FILETIME utc_base_ft;
976 WIN32_FILE_ATTRIBUTE_DATA fdata;
991 st.wMilliseconds = 0;
993 SystemTimeToFileTime (&st, &utc_base_ft);
994 utc_base = (((
unsigned __int64)utc_base_ft.dwHighDateTime) << 32) + utc_base_ft.dwLowDateTime;
997 if (file_handle->
opened_path && GetFileAttributesEx(file_handle->
opened_path->
val, GetFileExInfoStandard, &fdata) != 0) {
998 unsigned __int64 ftime;
1000 if (CompareFileTime (&fdata.ftLastWriteTime, &utc_base_ft) < 0) {
1004 ftime = (((
unsigned __int64)fdata.ftLastWriteTime.dwHighDateTime) << 32) + fdata.ftLastWriteTime.dwLowDateTime - utc_base;
1008 *
size = (size_t)((((
unsigned __int64)fdata.nFileSizeHigh) << 32) + (
unsigned __int64)fdata.nFileSizeLow);
1024 !
EG(current_execute_data) &&
1031 *
size = tmpbuf->st_size;
1033 return tmpbuf->st_mtime;
1038 res = zend_get_file_handle_timestamp_win(file_handle,
size);
1044 switch (file_handle->
type) {
1056 if (php_is_stream_path(file_path)) {
1057 if (zend_get_stream_timestamp(file_path, &statbuf) ==
SUCCESS) {
1061 if (
VCWD_STAT(file_path, &statbuf) != -1) {
1103 *
size = statbuf.st_size;
1105 return statbuf.st_mtime;
1124 full_path_ptr = accelerator_orig_zend_resolve_path(file_handle->
filename);
1125 if (full_path_ptr &&
1127 !zend_string_equal_content(persistent_script->
script.
filename, full_path_ptr)) {
1134 if (persistent_script->
timestamp == 0) {
1135 if (full_path_ptr) {
1143 if (full_path_ptr) {
1149 if (full_path_ptr) {
1167 if (persistent_script->
timestamp == 0) {
1169 }
else if (
ZCG(accel_directives).revalidate_freq &&
1172 }
else if (do_validate_timestamps(persistent_script, file_handle) ==
FAILURE) {
1195 size_t path_length =
ZSTR_LEN(str);
1205 }
else if (
UNEXPECTED(php_is_stream_path(path))) {
1206 if (!is_cacheable_stream_path(path)) {
1214 int include_path_len = 0,
cwd_len = 0;
1216 size_t parent_script_len = 0;
1231 if (
ZCG(cwd_check)) {
1232 ZCG(cwd_check) =
false;
1233 if (
ZCG(accelerator_enabled)) {
1235 zend_string *str = accel_find_interned_string(cwd_str);
1241 if (str == cwd_str) {
1266 include_path =
ZCG(include_path_key);
1267 include_path_len =
ZCG(include_path_key_len);
1268 }
else if (!
ZCG(include_path) ||
ZSTR_LEN(
ZCG(include_path)) == 0) {
1270 include_path_len = 0;
1275 if (
ZCG(include_path_check)) {
1276 ZCG(include_path_check) =
false;
1277 if (
ZCG(accelerator_enabled)) {
1279 zend_string *str = accel_find_interned_string(
ZCG(include_path));
1285 if (str ==
ZCG(include_path)) {
1286 zend_string_release(str);
1297 include_path_len =
ZCG(include_path_key_len) =
buf +
sizeof(
buf) - 1 -
res;
1298 include_path =
ZCG(include_path_key);
1299 memcpy(
ZCG(include_path_key),
res, include_path_len + 1);
1321 key[path_length] =
':';
1322 key_length = path_length + 1;
1326 if (include_path_len) {
1327 key[key_length] =
':';
1329 memcpy(
key + key_length, include_path, include_path_len);
1330 key_length += include_path_len;
1340 parent_script_len =
ZSTR_LEN(parent_script);
1341 while (parent_script_len > 0) {
1342 --parent_script_len;
1351 key[key_length] =
':';
1354 key_length += parent_script_len;
1356 key[key_length] =
'\0';
1382 if (
ZSMMG(memory_exhausted)) {
1396 zend_accel_discard_script(persistent_script);
1410 realpath = accelerator_orig_zend_resolve_path(filename);
1415 realpath = zend_string_copy(filename);
1419 if (
ZCG(accel_directives).file_cache) {
1424 if (persistent_script && !persistent_script->
corrupted) {
1430 !
ZCG(accel_directives).validate_timestamps ||
1431 do_validate_timestamps(persistent_script, &file_handle) ==
FAILURE) {
1434 zend_accel_lock_discard_script(persistent_script);
1477 if (zend_accel_hash_is_full(&
ZCSG(
hash))) {
1479 ZSMMG(memory_exhausted) =
true;
1496 return filename &&
ZSTR_LEN(filename) >=
sizeof(
".phar") &&
1497 !memcmp(
ZSTR_VAL(filename) +
ZSTR_LEN(filename) - (
sizeof(
".phar")-1),
".phar",
sizeof(
".phar")-1) &&
1503 uint32_t memory_used;
1511#if defined(__AVX__) || defined(__SSE2__)
1513 ZCG(mem) = zend_arena_alloc(&
CG(
arena), memory_used + 64);
1514 ZCG(mem) = (
void*)(((uintptr_t)
ZCG(mem) + 63L) & ~63L);
1515#elif ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT
1517 ZCG(mem) = zend_arena_alloc(&
CG(
arena), memory_used + 8);
1518 ZCG(mem) = (
void*)(((uintptr_t)
ZCG(mem) + 7L) & ~7L);
1520 ZCG(mem) = zend_arena_alloc(&
CG(
arena), memory_used);
1533 if ((
char*)new_persistent_script->
mem + new_persistent_script->
size != (
char*)
ZCG(mem)) {
1536 "Internal error: wrong size calculation: %s start=" ZEND_ADDR_FMT
", end=" ZEND_ADDR_FMT
", real=" ZEND_ADDR_FMT
"\n",
1538 (
size_t)new_persistent_script->
mem,
1539 (
size_t)((
char *)new_persistent_script->
mem + new_persistent_script->
size),
1545 return new_persistent_script;
1550 uint32_t orig_compiler_options;
1552 orig_compiler_options =
CG(compiler_options);
1556 CG(compiler_options) = orig_compiler_options;
1558 *from_shared_memory =
true;
1559 return store_script_in_file_cache(new_persistent_script);
1565 uint32_t memory_used;
1566 uint32_t orig_compiler_options;
1568 orig_compiler_options =
CG(compiler_options);
1569 if (
ZCG(accel_directives).file_cache) {
1574 CG(compiler_options) = orig_compiler_options;
1586 if (!existing_persistent_script->corrupted) {
1588 (!
ZCG(accel_directives).validate_timestamps ||
1589 (new_persistent_script->
timestamp == existing_persistent_script->timestamp))) {
1590 zend_accel_add_key(
key, bucket);
1596 *from_shared_memory =
true;
1597 return existing_persistent_script;
1599 return new_persistent_script;
1604 if (zend_accel_hash_is_full(&
ZCSG(
hash))) {
1606 ZSMMG(memory_exhausted) =
true;
1609 if (
ZCG(accel_directives).file_cache) {
1610 new_persistent_script = store_script_in_file_cache(new_persistent_script);
1611 *from_shared_memory =
true;
1613 return new_persistent_script;
1622 ZCG(mem) = zend_shared_alloc_aligned(memory_used);
1627 if (
ZCG(accel_directives).file_cache) {
1628 new_persistent_script = store_script_in_file_cache(new_persistent_script);
1629 *from_shared_memory =
true;
1631 return new_persistent_script;
1634 bzero_aligned(
ZCG(mem), memory_used);
1646 if ((
char*)new_persistent_script->
mem + new_persistent_script->
size != (
char*)
ZCG(mem)) {
1649 "Internal error: wrong size calculation: %s start=" ZEND_ADDR_FMT
", end=" ZEND_ADDR_FMT
", real=" ZEND_ADDR_FMT
"\n",
1651 (
size_t)new_persistent_script->
mem,
1652 (
size_t)((
char *)new_persistent_script->
mem + new_persistent_script->
size),
1672 ZSMMG(memory_exhausted) =
true;
1685 if (
ZCG(accel_directives).file_cache) {
1691 *from_shared_memory =
true;
1692 return new_persistent_script;
1695#define ZEND_AUTOGLOBAL_MASK_SERVER (1 << 0)
1696#define ZEND_AUTOGLOBAL_MASK_ENV (1 << 1)
1697#define ZEND_AUTOGLOBAL_MASK_REQUEST (1 << 2)
1699static int zend_accel_get_auto_globals(
void)
1702 if (zend_hash_exists(&
EG(symbol_table),
ZSTR_KNOWN(ZEND_STR_AUTOGLOBAL_SERVER))) {
1705 if (zend_hash_exists(&
EG(symbol_table),
ZSTR_KNOWN(ZEND_STR_AUTOGLOBAL_ENV))) {
1708 if (zend_hash_exists(&
EG(symbol_table),
ZSTR_KNOWN(ZEND_STR_AUTOGLOBAL_REQUEST))) {
1714static void zend_accel_set_auto_globals(
int mask)
1725 ZCG(auto_globals_mask) |= mask;
1728static void replay_warnings(uint32_t num_warnings,
zend_error_info **warnings) {
1729 for (uint32_t i = 0; i < num_warnings; i++) {
1738 uint32_t orig_functions_count, orig_class_count;
1740 zval orig_user_error_handler;
1742 bool do_bailout =
false;
1744 uint32_t orig_compiler_options = 0;
1748 if (accelerator_orig_zend_stream_open_function(file_handle) !=
SUCCESS) {
1764 ZCSG(blacklist_misses)++;
1766 *op_array_p = accelerator_orig_compile_file(file_handle,
type);
1770 if (
ZCG(accel_directives).validate_timestamps ||
1771 ZCG(accel_directives).file_update_protection ||
1772 ZCG(accel_directives).max_file_size > 0) {
1783 if (timestamp == 0) {
1784 *op_array_p = accelerator_orig_compile_file(file_handle,
type);
1789 if (
ZCG(accel_directives).file_update_protection &&
1790 ((
accel_time_t)(
ZCG(request_time) -
ZCG(accel_directives).file_update_protection) < timestamp)) {
1791 *op_array_p = accelerator_orig_compile_file(file_handle,
type);
1795 if (
ZCG(accel_directives).max_file_size > 0 &&
size > (
size_t)
ZCG(accel_directives).max_file_size) {
1797 ZCSG(blacklist_misses)++;
1799 *op_array_p = accelerator_orig_compile_file(file_handle,
type);
1805 orig_active_op_array =
CG(active_op_array);
1806 orig_functions_count =
EG(function_table)->nNumUsed;
1807 orig_class_count =
EG(class_table)->nNumUsed;
1812 if (
ZCG(accel_directives).record_warnings) {
1817 orig_compiler_options =
CG(compiler_options);
1828 if (
ZCG(accel_directives).file_cache) {
1834 op_array = *op_array_p = accelerator_orig_compile_file(file_handle,
type);
1835 CG(compiler_options) = orig_compiler_options;
1839 CG(compiler_options) = orig_compiler_options;
1843 CG(active_op_array) = orig_active_op_array;
1844 EG(user_error_handler) = orig_user_error_handler;
1845 EG(record_errors) = 0;
1866 new_persistent_script->
warnings =
EG(errors);
1874 if (
PG(auto_globals_jit)) {
1878 if (
ZCG(accel_directives).validate_timestamps) {
1882 new_persistent_script->
timestamp = timestamp;
1894 return new_persistent_script;
1905 return accelerator_orig_compile_file(file_handle,
type);
1910 accelerator_orig_zend_stream_open_function(file_handle) ==
FAILURE) {
1927 if (persistent_script) {
1930 if (!
EG(current_execute_data) || !
EG(current_execute_data)->opline ||
1931 !
EG(current_execute_data)->
func ||
1938 if (persistent_script->
is_phar) {
1942 memcpy(fname,
"phar://",
sizeof(
"phar://") - 1);
1961 if (persistent_script) {
1962 from_memory =
false;
1963 persistent_script = cache_script_in_file_cache(persistent_script, &from_memory);
1972 char *phar_path, *
ptr;
1983 *(
ptr+
sizeof(
".phar/")-2) = 0;
1985 bool ret = access(phar_path,
R_OK) != 0;
1996 bool from_shared_memory;
1998 if (!file_handle->
filename || !
ZCG(accelerator_enabled)) {
2001 ZCG(cache_persistent_script) =
NULL;
2003 &&
ZCG(accel_directives).file_cache
2005 return file_cache_compile_file(file_handle,
type);
2007 return accelerator_orig_compile_file(file_handle,
type);
2010 ZCG(cache_persistent_script) =
NULL;
2011 return file_cache_compile_file(file_handle,
type);
2012 }
else if ((
ZCSG(restart_in_progress) && accel_restart_is_active())) {
2013 if (
ZCG(accel_directives).file_cache) {
2014 return file_cache_compile_file(file_handle,
type);
2017 ZCG(cache_persistent_script) =
NULL;
2018 return accelerator_orig_compile_file(file_handle,
type);
2024 if (
ZCG(cache_persistent_script) &&
2025 ((!
EG(current_execute_data) &&
2028 (
EG(current_execute_data) &&
2029 EG(current_execute_data)->
func &&
2031 ZCG(cache_opline) ==
EG(current_execute_data)->opline))) {
2033 persistent_script =
ZCG(cache_persistent_script);
2039 if (!
ZCG(accel_directives).revalidate_path) {
2044 ZCG(cache_persistent_script) =
NULL;
2045 return accelerator_orig_compile_file(file_handle,
type);
2050 ZCG(cache_persistent_script) =
NULL;
2051 return accelerator_orig_compile_file(file_handle,
type);
2054 if (!persistent_script) {
2060 && accelerator_orig_zend_stream_open_function(file_handle) ==
FAILURE) {
2081 zend_accel_add_key(
key, bucket);
2093 ZCG(cache_persistent_script) =
NULL;
2095 if (persistent_script && persistent_script->
corrupted) {
2096 persistent_script =
NULL;
2103 if (!
ZCG(counted)) {
2104 if (accel_activate_add() ==
FAILURE) {
2105 if (
ZCG(accel_directives).file_cache) {
2106 return file_cache_compile_file(file_handle,
type);
2108 return accelerator_orig_compile_file(file_handle,
type);
2110 ZCG(counted) =
true;
2117 UNEXPECTED(check_persistent_script_access(persistent_script))) {
2132 if (persistent_script &&
ZCG(accel_directives).validate_timestamps) {
2134 zend_accel_lock_discard_script(persistent_script);
2135 persistent_script =
NULL;
2140 if (!persistent_script &&
ZCG(accel_directives).file_cache) {
2145 if (!persistent_script) {
2146 uint32_t old_const_num = zend_hash_next_free_element(
EG(zend_constants));
2153 if (
ZSMMG(memory_exhausted) ||
ZCSG(restart_pending)) {
2156 if (
ZCG(accel_directives).file_cache) {
2157 return file_cache_compile_file(file_handle,
type);
2159 return accelerator_orig_compile_file(file_handle,
type);
2171 from_shared_memory =
false;
2172 if (persistent_script) {
2175 persistent_script = cache_script_in_shared_memory(persistent_script,
key, &from_shared_memory);
2182 if (!persistent_script) {
2187 if (from_shared_memory) {
2189 uint32_t new_const_num = zend_hash_next_free_element(
EG(zend_constants));
2190 while (new_const_num > old_const_num) {
2204#ifdef ZEND_ENABLE_ZVAL_LONG64
2205 InterlockedIncrement64(&
ZCSG(hits));
2208 InterlockedIncrement(&
ZCSG(hits));
2215 if (!
EG(current_execute_data) ||
2216 !
EG(current_execute_data)->
func ||
2218 !
EG(current_execute_data)->opline ||
2224 if (persistent_script->
is_phar) {
2228 memcpy(fname,
"phar://",
sizeof(
"phar://") - 1);
2241 from_shared_memory =
true;
2261 bool needs_autoload =
false;
2263 if (entry->
parent != parent) {
2278 needs_autoload =
true;
2288 *needs_autoload_ptr = needs_autoload;
2291 entry = entry->
next;
2300 bool needs_autoload;
2304 entry = zend_accel_inheritance_cache_find(entry, ce, parent, traits_and_interfaces, &needs_autoload);
2306 if (!needs_autoload) {
2308 if (
ZCSG(map_ptr_last) >
CG(map_ptr_last)) {
2336 bool needs_autoload;
2343 if (!
ZCG(accelerator_enabled) ||
2344 (
ZCSG(restart_in_progress) && accel_restart_is_active())) {
2348 if (traits_and_interfaces && dependencies) {
2350 if (traits_and_interfaces[i]) {
2361 entry = zend_accel_inheritance_cache_find(entry, proto, parent, traits_and_interfaces, &needs_autoload);
2365 if (!needs_autoload) {
2376 memset(&dummy, 0,
sizeof(dummy));
2384 ZCG(current_persistent_script) = &dummy;
2391#if ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT
2407#if ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT
2409 ZCG(mem) = (
void*)(((uintptr_t)
ZCG(mem) + 7L) & ~7L);
2414 ZCG(mem) = (
char*)
ZCG(mem) +
2423 if (dependencies && zend_hash_num_elements(dependencies)) {
2445 bool jit_on_old =
JIT_G(on);
2453 JIT_G(on) = jit_on_old;
2464 ZCSG(map_ptr_last) =
CG(map_ptr_last);
2472 if ((
char*)entry +
size != (
char*)
ZCG(mem)) {
2475 "Internal error: wrong class size calculation: %s start=" ZEND_ADDR_FMT
", end=" ZEND_ADDR_FMT
", real=" ZEND_ADDR_FMT
"\n",
2478 (
size_t)((
char *)entry +
size),
2491 unsigned char digest[16];
2492 wchar_t uname[UNLEN + 1];
2493 DWORD unsize = UNLEN;
2495 if (!GetUserNameW(uname, &unsize)) {
2499 PHP_MD5Update(&ctx, (
void *) uname, (unsize - 1) *
sizeof(
wchar_t));
2502 php_hash_bin2hex(accel_uname_id, digest,
sizeof digest);
2510 if (
ZCG(cache_persistent_script)) {
2512 if ((!
EG(current_execute_data) &&
2513 handle->primary_script &&
2515 (
EG(current_execute_data) &&
2516 EG(current_execute_data)->
func &&
2518 ZCG(cache_opline) ==
EG(current_execute_data)->opline)) {
2521 handle->opened_path = zend_string_copy(
ZCG(cache_persistent_script)->script.filename);
2525 ZCG(cache_persistent_script) =
NULL;
2527 return accelerator_orig_zend_stream_open_function(
handle);
2534 ZCG(accelerator_enabled)) {
2537 if ((!
EG(current_execute_data)) ||
2538 (
EG(current_execute_data) &&
2539 EG(current_execute_data)->
func &&
2549 if (!
ZCG(accel_directives).revalidate_path) {
2554 if (bucket !=
NULL) {
2557 ZCG(cache_opline) =
EG(current_execute_data) ?
EG(current_execute_data)->opline :
NULL;
2558 ZCG(cache_persistent_script) = persistent_script;
2564 ZCG(cache_persistent_script) =
NULL;
2565 return accelerator_orig_zend_resolve_path(filename);
2570 resolved_path = accelerator_orig_zend_resolve_path(filename);
2572 if (resolved_path) {
2583 zend_accel_add_key(
key, bucket);
2590 ZCG(cache_opline) =
EG(current_execute_data) ?
EG(current_execute_data)->opline :
NULL;
2591 ZCG(cache_persistent_script) = persistent_script;
2592 return resolved_path;
2598 ZCG(cache_persistent_script) =
NULL;
2599 return resolved_path;
2603 ZCG(cache_persistent_script) =
NULL;
2604 return accelerator_orig_zend_resolve_path(filename);
2607static void zend_reset_cache_vars(
void)
2609 ZSMMG(memory_exhausted) =
false;
2612 ZCSG(blacklist_misses) = 0;
2613 ZSMMG(wasted_shared_memory) = 0;
2614 ZCSG(restart_pending) =
false;
2615 ZCSG(force_restart_time) = 0;
2616 ZCSG(map_ptr_last) =
CG(map_ptr_last);
2620static void accel_reset_pcre_cache(
void)
2636 ZCG(accelerator_enabled) =
false;
2641 ZCG(auto_globals_mask) = 0;
2644 ZCG(cache_persistent_script) =
NULL;
2645 ZCG(include_path_key_len) = 0;
2646 ZCG(include_path_check) =
true;
2649 ZCG(cwd_key_len) = 0;
2650 ZCG(cwd_check) =
true;
2653 ZCG(accelerator_enabled) =
false;
2658 if (
ZCG(accel_directives).validate_root) {
2664 ZCG(root_hash) =
buf.st_ino;
2665 if (
sizeof(
buf.st_ino) >
sizeof(
ZCG(root_hash))) {
2666 if (
ZCG(root_hash) !=
buf.st_ino) {
2690 ZCG(counted) =
false;
2693 if (
ZCSG(restart_pending)) {
2695 if (
ZCSG(restart_pending)) {
2696 if (accel_is_inactive()) {
2698 ZCSG(restart_pending) =
false;
2699 switch ZCSG(restart_reason) {
2701 ZCSG(oom_restarts)++;
2704 ZCSG(hash_restarts)++;
2707 ZCSG(manual_restarts)++;
2710 accel_restart_enter();
2713 zend_reset_cache_vars();
2716 if (
ZCG(accel_directives).interned_strings_buffer) {
2717 accel_interned_strings_restore_state();
2721 if (
ZCSG(preload_script)) {
2729 ZCSG(accelerator_enabled) =
ZCSG(cache_status_before_restart);
2730 if (
ZCSG(last_restart_time) <
ZCG(request_time)) {
2731 ZCSG(last_restart_time) =
ZCG(request_time);
2733 ZCSG(last_restart_time)++;
2735 accel_restart_leave();
2741 ZCG(accelerator_enabled) =
ZCSG(accelerator_enabled);
2746 if (
ZCG(accelerator_enabled) &&
ZCSG(last_restart_time) !=
ZCG(last_restart_time)) {
2748 ZCG(last_restart_time) =
ZCSG(last_restart_time);
2753 accel_reset_pcre_cache();
2754 ZCG(pcre_reseted) =
false;
2755 }
else if (!
ZCG(accelerator_enabled) && !
ZCG(pcre_reseted)) {
2756 accel_reset_pcre_cache();
2757 ZCG(pcre_reseted) =
true;
2765 if (
ZCSG(preload_script)) {
2773void accel_deactivate(
void)
2792 ZCG(counted) =
false;
2811#ifdef __DEBUG_MESSAGES__
2823 zps_failure_reason = reason;
2830 static const char *supported_sapis[] = {
2845 const char **sapi_name;
2848 for (sapi_name = supported_sapis; *sapi_name; sapi_name++) {
2853 if (
ZCG(accel_directives).enable_cli && (
2866 size_t accel_shared_globals_size;
2870 if (
ZCG(accel_directives).interned_strings_buffer) {
2882 "Insufficient shared memory for interned strings buffer! (tried to allocate %zu bytes)",
2883 accel_shared_globals_size);
2891 if (
ZCG(accel_directives).interned_strings_buffer) {
2895 hash_size =
ZCG(accel_directives).interned_strings_buffer * (32 * 1024);
2896 hash_size |= (hash_size >> 1);
2897 hash_size |= (hash_size >> 2);
2898 hash_size |= (hash_size >> 4);
2899 hash_size |= (hash_size >> 8);
2900 hash_size |= (hash_size >> 16);
2902 ZCSG(interned_strings).nTableMask =
2904 ZCSG(interned_strings).nNumOfElements = 0;
2905 ZCSG(interned_strings).start =
2912 ZCSG(interned_strings).top =
2913 ZCSG(interned_strings).start;
2914 ZCSG(interned_strings).end =
2916 ZCG(accel_directives).interned_strings_buffer * 1024 * 1024);
2918 ZCSG(interned_strings).saved_top =
NULL;
2931 accel_new_interned_string_for_php,
2932 accel_init_interned_string_for_php,
2933 accel_init_interned_string_for_php);
2935 zend_reset_cache_vars();
2937 ZCSG(oom_restarts) = 0;
2938 ZCSG(hash_restarts) = 0;
2939 ZCSG(manual_restarts) = 0;
2941 ZCSG(accelerator_enabled) =
true;
2943 ZCSG(last_restart_time) = 0;
2944 ZCSG(restart_in_progress) =
false;
2957#if defined(COMPILE_DL_OPCACHE) && defined(ZTS)
2973#ifdef HAVE_HUGE_CODE_PAGES
2975# include <sys/mman.h>
2977# ifdef MAP_ANONYMOUS
2978# define MAP_ANON MAP_ANONYMOUS
2982# define MAP_FAILED ((void*)-1)
2984# ifdef MAP_ALIGNED_SUPER
2985# include <sys/types.h>
2986# include <sys/sysctl.h>
2987# include <sys/user.h>
2988# define MAP_HUGETLB MAP_ALIGNED_SUPER
2992# if defined(MAP_HUGETLB) || defined(MADV_HUGEPAGE)
3000 MAP_PRIVATE | MAP_ANONYMOUS,
3013 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED | MAP_HUGETLB,
3019 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,
3023# ifdef MADV_HUGEPAGE
3024 if (-1 == madvise(
start,
size, MADV_HUGEPAGE)) {
3046 zend_mmap_set_name(
start,
size,
"zend_huge_code_pages");
3055static void accel_move_code_to_huge_pages(
void)
3057#if defined(__linux__)
3059 long unsigned int huge_page_size = 2 * 1024 * 1024;
3061 f =
fopen(
"/proc/self/maps",
"r");
3066 extern char *__progname;
3074 if (
ret > 6 && perm[0] ==
'r' && perm[1] ==
'-' && perm[2] ==
'x' &&
name[0] ==
'/' \
3077 long unsigned int seg_end = (
end & ~(huge_page_size-1L));
3078 long unsigned int real_end;
3081 if (
ret == 1 &&
start == seg_end + huge_page_size) {
3088 if (seg_end > seg_start) {
3090 accel_remap_huge_pages((
void*)seg_start, seg_end - seg_start, real_end - seg_start,
name,
offset + seg_start -
start);
3098#elif defined(__FreeBSD__)
3100 int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()};
3101 long unsigned int huge_page_size = 2 * 1024 * 1024;
3102 if (sysctl(mib, 4,
NULL, &
s,
NULL, 0) == 0) {
3106 if (sysctl(mib, 4,
addr, &
s,
NULL, 0) == 0) {
3110 struct kinfo_vmentry *entry = (
struct kinfo_vmentry *)
start;
3111 size_t sz = entry->kve_structsize;
3115 int permflags = entry->kve_protection;
3116 if ((permflags & KVME_PROT_READ) && !(permflags & KVME_PROT_WRITE) &&
3117 (permflags & KVME_PROT_EXEC) && entry->kve_path[0] !=
'\0') {
3119 long unsigned int seg_end = (
end & ~(huge_page_size-1L));
3120 if (seg_end > seg_start) {
3122 accel_remap_huge_pages((
void*)seg_start, seg_end - seg_start, seg_end - seg_start, entry->kve_path, entry->kve_offset + seg_start -
start);
3136static void accel_move_code_to_huge_pages(
void)
3147 accel_globals_id = ts_allocate_id(&accel_globals_id,
sizeof(
zend_accel_globals), (ts_allocate_ctor) accel_globals_ctor, (ts_allocate_dtor) accel_globals_dtor);
3157# if !defined(__has_feature) || !__has_feature(address_sanitizer)
3170 zps_startup_failure(
"Unable to get user name",
NULL, accelerator_remove_cb);
3175#ifdef HAVE_HUGE_CODE_PAGES
3176 if (
ZCG(accel_directives).huge_code_pages &&
3181 accel_move_code_to_huge_pages();
3186 if (accel_find_sapi() ==
FAILURE) {
3188 if (!
ZCG(accel_directives).enable_cli &&
3190 zps_startup_failure(
"Opcode Caching is disabled for CLI",
NULL, accelerator_remove_cb);
3192 zps_startup_failure(
"Opcode Caching is only supported in Apache, FPM, FastCGI, FrankenPHP, LiteSpeed and uWSGI SAPIs",
NULL, accelerator_remove_cb);
3197 if (
ZCG(enabled) == 0) {
3215 if (orig_post_startup_cb) {
3218 orig_post_startup_cb =
NULL;
3229 size_t shm_size =
ZCG(accel_directives).memory_consumption;
3231 size_t jit_size = 0;
3232 bool reattached =
false;
3239 if (!page_size || (page_size & (page_size - 1))) {
3243 jit_size =
JIT_G(buffer_size);
3245 shm_size += jit_size;
3253 if (zend_accel_init_shm() ==
FAILURE) {
3269 accel_new_interned_string_for_php,
3270 accel_init_interned_string_for_php,
3271 accel_init_interned_string_for_php);
3279#if ENABLE_FILE_CACHE_FALLBACK
3283 fallback_process =
true;
3285 goto file_cache_fallback;
3293 ZCG(last_restart_time) =
ZCSG(last_restart_time);
3297 if (
JIT_G(enabled)) {
3298 if (
JIT_G(buffer_size) == 0) {
3299 JIT_G(enabled) =
false;
3301 }
else if (!
ZSMMG(reserved)) {
3313 }
else if (!
ZCG(accel_directives).file_cache) {
3319 JIT_G(enabled) =
false;
3324#if ENABLE_FILE_CACHE_FALLBACK
3343 if ((
func = zend_hash_str_find_ptr(
CG(function_table),
"chdir",
sizeof(
"chdir")-1)) !=
NULL &&
3345 orig_chdir =
func->internal_function.handler;
3346 func->internal_function.handler =
ZEND_FN(accel_chdir);
3352 if ((ini_entry = zend_hash_str_find_ptr(
EG(ini_directives),
"include_path",
sizeof(
"include_path")-1)) !=
NULL) {
3353 ZCG(include_path) = ini_entry->
value;
3354 orig_include_path_on_modify = ini_entry->on_modify;
3355 ini_entry->on_modify = accel_include_path_on_modify;
3366 ZCG(accel_directives).user_blacklist_filename &&
3367 *
ZCG(accel_directives.user_blacklist_filename)) {
3373 accel_use_shm_interned_strings();
3376 if (accel_finish_startup() !=
SUCCESS) {
3391static void (*orig_post_shutdown_cb)(
void);
3393static void accel_post_shutdown(
void)
3401 bool _file_cache_only =
false;
3411 ts_free_id(accel_globals_id);
3418 if (
ZCSG(preload_script)) {
3424 accel_reset_pcre_cache();
3427 ts_free_id(accel_globals_id);
3432 if (!_file_cache_only) {
3442 if ((ini_entry = zend_hash_str_find_ptr(
EG(ini_directives),
"include_path",
sizeof(
"include_path")-1)) !=
NULL) {
3443 ini_entry->on_modify = orig_include_path_on_modify;
3455 if (
ZCSG(restart_pending)) {
3465 zend_accel_restart_reason_text[reason]);
3469 ZCSG(restart_pending) =
true;
3470 ZCSG(restart_reason) = reason;
3471 ZCSG(cache_status_before_restart) =
ZCSG(accelerator_enabled);
3472 ZCSG(accelerator_enabled) =
false;
3474 if (
ZCG(accel_directives).force_restart_timeout) {
3477 ZCSG(force_restart_time) = 0;
3483static void accel_deactivate_now(
void)
3487 ZCG(counted) =
true;
3489 accel_deactivate_sub();
3505 if (accel_activate_add() ==
FAILURE) {
3509 if (
ZCSG(restart_in_progress)) {
3511 accel_deactivate_now();
3514 ZCG(counted) =
true;
3522 if (!
ZCG(counted)) {
3524 accel_deactivate_now();
3532static void preload_shutdown(
void)
3537 if (
EG(zend_constants)) {
3547 if (
EG(function_table)) {
3556 if (
EG(class_table)) {
3566static void preload_activate(
void)
3568 if (
ZCSG(preload_script)->ping_auto_globals_mask & ~
ZCG(auto_globals_mask)) {
3569 zend_accel_set_auto_globals(
ZCSG(preload_script)->ping_auto_globals_mask & ~
ZCG(auto_globals_mask));
3573static void preload_restart(
void)
3576 if (
ZCSG(saved_scripts)) {
3585static size_t preload_try_strip_filename(
zend_string *filename) {
3587 if (
ZSTR_LEN(filename) >
sizeof(
" eval()'d code")
3588 && *(
ZSTR_VAL(filename) +
ZSTR_LEN(filename) -
sizeof(
" eval()'d code")) ==
':') {
3589 const char *cfilename =
ZSTR_VAL(filename);
3590 size_t cfilenamelen =
ZSTR_LEN(filename) -
sizeof(
" eval()'d code") - 1 ;
3591 while (cfilenamelen && cfilename[--cfilenamelen] !=
'(');
3592 return cfilenamelen;
3610 if (
function->op_array.filename != filename) {
3611 filename =
function->op_array.filename;
3613 if (!(
copy = zend_hash_exists(preload_scripts, filename))) {
3614 size_t eval_len = preload_try_strip_filename(filename);
3616 copy = zend_hash_str_exists(preload_scripts,
ZSTR_VAL(filename), eval_len);
3624 _zend_hash_append_ptr(dst,
p->key,
function);
3651 _zend_hash_append(dst,
p->key, &
p->val);
3659 if (!(
copy = zend_hash_exists(preload_scripts, filename))) {
3660 size_t eval_len = preload_try_strip_filename(filename);
3662 copy = zend_hash_str_exists(preload_scripts,
ZSTR_VAL(filename), eval_len);
3670 _zend_hash_append(dst,
p->key, &
p->val);
3683 if (op_array && op_array->
refcount) {
3694 zend_hash_add_ptr(preload_scripts, script->
script.
filename, script);
3760 zend_string_release(
key);
3762 error->kind =
"Unknown parent ";
3771 zend_hash_find_ptr(
EG(class_table), ce->interface_names[i].lc_name);
3773 error->kind =
"Unknown interface ";
3781 for (uint32_t i = 0; i < ce->
num_traits; i++) {
3785 error->kind =
"Unknown trait ";
3797 bool ok, changed, was_changed =
false;
3810 was_changed = changed =
true;
3821 bool resolved =
true;
3832 resolved = ok =
false;
3842 bool resolved =
true;
3848 resolved = ok =
false;
3858 }
while (changed && !ok);
3860 CG(in_compilation) =
false;
3866 return ok || was_changed;
3884 uint32_t skip_dynamic_func_count = 0;
3888 while (opline !=
end) {
3889 switch (opline->
opcode) {
3893 if (!zend_hash_exists(
CG(class_table),
key)) {
3898 opline->
op2.
num -= skip_dynamic_func_count;
3900 func = zend_hash_find_ptr(
EG(function_table),
key);
3906 dynamic_func_defs =
NULL;
3909 if (opline->
op2.
num > 0) {
3917 dynamic_func_defs + opline->
op2.
num,
3924 skip_dynamic_func_count++;
3929 opline->
op2.
num -= skip_dynamic_func_count;
3936static void preload_link(
void)
3967 if (zend_hash_exists(
EG(class_table),
lcname)) {
3968 zend_string_release(
lcname);
3974 if (preload_resolve_deps(&error_info, ce) ==
FAILURE) {
3975 zend_string_release(
lcname);
3980 ZEND_ASSERT(
zv &&
"We already checked above that the class doesn't exist yet");
3984 void *checkpoint = zend_arena_checkpoint(
CG(
arena));
3998 CG(in_compilation) =
true;
4014 if (
CG(delayed_variance_obligations)) {
4016 CG(delayed_variance_obligations), (uintptr_t)
Z_CE_P(
zv));
4022 orig_ce->
ce_flags &= ~temporary_flags;
4023 zend_arena_release(&
CG(
arena), checkpoint);
4027 EG(record_errors) =
false;
4029 zend_hash_update_ptr(&errors,
key,
EG(errors)[
EG(num_errors)-1]);
4032 CG(in_compilation) =
false;
4033 CG(compiled_filename) =
NULL;
4035 zend_string_release(
lcname);
4055 CG(in_compilation) =
true;
4056 if (preload_try_resolve_constants(ce)) {
4059 CG(in_compilation) =
false;
4067 EG(class_table),
key,
zv,
EG(persistent_classes_count)) {
4081 && zend_hash_exists(
EG(class_table),
lcname)) {
4084 "Can't preload already declared class %s",
ZSTR_VAL(ce->
name));
4085 }
else if (preload_resolve_deps(&
error, ce) ==
FAILURE) {
4088 "Can't preload unlinked class %s: %s%s",
4094 "Can't preload unlinked class %s: %s",
4097 zend_string_release(
lcname);
4105 preload_remove_declares(op_array);
4120 preload_remove_declares(op_array);
4125 preload_remove_declares(op_array);
4133 if (php_is_stream_path(
ZSTR_VAL(filename))) {
4139static void preload_remove_empty_includes(
void)
4146 script->
empty =
true;
4153 if (script->
empty) {
4158 while (opline <
end) {
4167 if (resolved_path) {
4169 zend_string_release(resolved_path);
4170 if (!incl || !incl->
empty) {
4187 script->
empty =
false;
4199 while (opline <
end) {
4207 if (resolved_path) {
4218 zend_string_release(resolved_path);
4241 if (info->
hooks[i]) {
4254static void preload_fix_trait_op_array(
zend_op_array *op_array)
4261 ZEND_ASSERT(orig_op_array &&
"Must be in xlat table");
4265 uint32_t fn_flags = op_array->
fn_flags;
4268 *op_array = *orig_op_array;
4281 preload_fix_trait_op_array(op_array);
4289 if (info->
hooks[i]) {
4291 preload_fix_trait_op_array(op_array);
4308 preload_register_trait_methods(ce);
4315 preload_register_trait_methods(ce);
4324 preload_fix_trait_methods(ce);
4329 preload_fix_trait_methods(ce);
4344 uint32_t memory_used;
4345 uint32_t checkpoint;
4347 if (zend_accel_hash_is_full(&
ZCSG(
hash))) {
4358 ZCG(mem) = zend_shared_alloc_aligned(memory_used);
4364 bzero_aligned(
ZCG(mem), memory_used);
4374 if ((
char*)new_persistent_script->
mem + new_persistent_script->
size != (
char*)
ZCG(mem)) {
4377 "Internal error: wrong size calculation: %s start=" ZEND_ADDR_FMT
", end=" ZEND_ADDR_FMT
", real=" ZEND_ADDR_FMT
"\n",
4379 (
size_t)new_persistent_script->
mem,
4380 (
size_t)((
char *)new_persistent_script->
mem + new_persistent_script->
size),
4392 return new_persistent_script;
4395static void preload_load(
size_t orig_map_ptr_static_last)
4405 for (;
p !=
end;
p++) {
4406 _zend_hash_append_ptr_ex(
CG(function_table),
p->key,
Z_PTR(
p->val), 1);
4410 if (zend_hash_num_elements(&script->
class_table)) {
4416 for (;
p !=
end;
p++) {
4417 _zend_hash_append_ex(
CG(class_table),
p->key, &
p->val, 1);
4421 if (
EG(zend_constants)) {
4422 EG(persistent_constants_count) =
EG(zend_constants)->nNumUsed;
4424 if (
EG(function_table)) {
4425 EG(persistent_functions_count) =
EG(function_table)->nNumUsed;
4427 if (
EG(class_table)) {
4428 EG(persistent_classes_count) =
EG(class_table)->nNumUsed;
4431 size_t old_map_ptr_last =
CG(map_ptr_last);
4433 CG(map_ptr_last) =
ZCSG(map_ptr_last);
4440 void *new_base =
pemalloc((new_static_size +
CG(map_ptr_size)) *
sizeof(
void *), 1);
4441 if (
CG(map_ptr_real_base)) {
4445 CG(map_ptr_real_base) = new_base;
4459 char *cache =
pemalloc(
ZCG(preloaded_internal_run_time_cache_size), 1);
4460 ZCG(preloaded_internal_run_time_cache) = cache;
4462 for (
size_t cur_static_map_ptr = orig_map_ptr_static_last; cur_static_map_ptr <
zend_map_ptr_static_last; ++cur_static_map_ptr) {
4464 cache += runtime_cache_size;
4469static zend_result accel_preload(
const char *config,
bool in_child)
4473 char *orig_open_basedir;
4474 size_t orig_map_ptr_last, orig_map_ptr_static_last;
4475 uint32_t orig_compiler_options;
4477 ZCG(enabled) =
false;
4478 ZCG(accelerator_enabled) =
false;
4479 orig_open_basedir =
PG(open_basedir);
4481 preload_orig_compile_file = accelerator_orig_compile_file;
4482 accelerator_orig_compile_file = preload_compile_file;
4484 orig_map_ptr_last =
CG(map_ptr_last);
4493 orig_compiler_options =
CG(compiler_options);
4502 CG(skip_shebang) =
true;
4523 CG(unclean_shutdown) =
true;
4534 CG(unclean_shutdown) =
true;
4541 PG(open_basedir) = orig_open_basedir;
4542 accelerator_orig_compile_file = preload_orig_compile_file;
4543 ZCG(enabled) =
true;
4549 int ping_auto_globals_mask;
4552 if (
PG(auto_globals_jit)) {
4553 ping_auto_globals_mask = zend_accel_get_auto_globals();
4555 ping_auto_globals_mask = 0;
4558 if (
EG(zend_constants)) {
4566 memset(&fake_execute_data, 0,
sizeof(fake_execute_data));
4568 EG(current_execute_data) = &fake_execute_data;
4572 EG(current_execute_data) = orig_execute_data;
4595 ZEND_ASSERT(zend_hash_num_elements(
EG(zend_constants)) ==
EG(persistent_constants_count));
4599 CG(map_ptr_last) = orig_map_ptr_last;
4601 if (
EG(full_tables_cleanup)) {
4611 CG(map_ptr_last) = orig_map_ptr_last;
4616 preload_remove_empty_includes();
4623#if ZEND_USE_ABS_CONST_ADDR
4632#if ZEND_USE_ABS_CONST_ADDR
4646 CG(compiled_filename) =
NULL;
4653 preload_optimize(script);
4660 ZCSG(preload_script) = preload_script_in_shared_memory(script);
4665 preload_load(orig_map_ptr_static_last);
4672 ZCSG(saved_scripts) =
zend_shared_alloc((zend_hash_num_elements(preload_scripts) + 1) *
sizeof(
void*));
4677 ZCSG(saved_scripts)[i++] = preload_script_in_shared_memory(script);
4682 accel_interned_strings_save_state();
4689 CG(map_ptr_last) = orig_map_ptr_last;
4693 CG(compiler_options) = orig_compiler_options;
4695 efree(preload_scripts);
4696 preload_scripts =
NULL;
4701static size_t preload_ub_write(
const char *str,
size_t str_length)
4703 return fwrite(str, 1, str_length, stdout);
4706static void preload_flush(
void *server_context)
4721static void preload_send_header(
sapi_header_struct *sapi_header,
void *server_context)
4726static zend_result accel_finish_startup_preload(
bool in_child)
4729 int orig_error_reporting;
4733 void (*orig_register_server_variables)(
zval *track_vars_array) =
sapi_module.register_server_variables;
4737 char *(*orig_getenv)(
const char *
name,
size_t name_len) =
sapi_module.getenv;
4738 size_t (*orig_ub_write)(
const char *str,
size_t str_length) =
sapi_module.ub_write;
4741 bool old_reset_signals = SIGG(
reset);
4747 sapi_module.header_handler = preload_header_handler;
4757 SIGG(
reset) =
false;
4768 bool orig_report_memleaks;
4772 SG(request_info).no_headers =
true;
4775 ZCG(auto_globals_mask) = 0;
4778 ZCG(cache_persistent_script) =
NULL;
4779 ZCG(include_path_key_len) = 0;
4780 ZCG(include_path_check) =
true;
4783 ZCG(cwd_key_len) = 0;
4784 ZCG(cwd_check) =
true;
4789 preload_flush(
NULL);
4791 orig_report_memleaks =
PG(report_memleaks);
4792 PG(report_memleaks) =
false;
4796 SIGG(check) =
false;
4800 EG(function_table) =
NULL;
4801 PG(report_memleaks) = orig_report_memleaks;
4812 SIGG(
reset) = old_reset_signals;
4817 sapi_module.register_server_variables = orig_register_server_variables;
4830static zend_result accel_finish_startup_preload_subprocess(pid_t *pid)
4832 uid_t euid = geteuid();
4834 if (
ZCG(accel_directives).preload_user
4835 && *
ZCG(accel_directives).preload_user) {
4843 if (!
ZCG(accel_directives).preload_user
4844 || !*
ZCG(accel_directives).preload_user) {
4849 if (!sapi_requires_preload_user) {
4859 struct passwd *pw = getpwnam(
ZCG(accel_directives).preload_user);
4866 if (pw->pw_uid == euid) {
4879 if (setgid(pw->pw_gid) < 0) {
4883 if (initgroups(pw->pw_name, pw->pw_gid) < 0) {
4887 if (setuid(pw->pw_uid) < 0) {
4920 if (
ZCSG(preload_script)) {
4929 if (accel_finish_startup_preload_subprocess(&pid) ==
FAILURE) {
4936 return accel_finish_startup_preload(
false);
4937 }
else if (pid == 0) {
4944 if (waitpid(pid, &
status, 0) < 0) {
4949 if (
ZCSG(preload_script)) {
4964static void accel_activate(
void) {
4965 if (
ZCG(preloaded_internal_run_time_cache)) {
4966 memset(
ZCG(preloaded_internal_run_time_cache), 0,
ZCG(preloaded_internal_run_time_cache_size));
4973 "Zend Technologies",
4974 "http://www.zend.com/",
SAPI_API double sapi_get_request_time(void)
SAPI_API sapi_module_struct sapi_module
SAPI_API void sapi_activate(void)
#define SAPI_HEADER_SENT_SUCCESSFULLY
#define STRTAB_STR_TO_POS(tab, s)
zend_accel_globals accel_globals
zend_result validate_timestamp_and_record_ex(zend_persistent_script *persistent_script, zend_file_handle *file_handle)
accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size)
#define STRTAB_COLLISION(s)
#define STRTAB_INVALID_POS
void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason)
zend_result zend_accel_invalidate(zend_string *filename, bool force)
zend_result accelerator_shm_read_lock(void)
zend_op_array * persistent_compile_file(zend_file_handle *file_handle, int type)
zend_result validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle)
void zend_accel_schedule_restart(zend_accel_restart_reason reason)
zend_string * accel_make_persistent_key(zend_string *str)
#define STRTAB_HASH_TO_SLOT(tab, h)
#define ZEND_AUTOGLOBAL_MASK_REQUEST
zend_string *ZEND_FASTCALL accel_new_interned_string(zend_string *str)
void accelerator_shm_read_unlock(void)
zend_result accel_post_deactivate(void)
#define STRTAB_POS_TO_STR(tab, pos)
#define ZEND_AUTOGLOBAL_MASK_SERVER
void accel_shutdown(void)
#define STRTAB_STR_SIZE(s)
#define ZEND_AUTOGLOBAL_MASK_ENV
zend_accel_shared_globals * accel_shared_globals
ZEND_EXT_API zend_extension zend_extension_entry
#define zend_accel_get_time()
const char * zps_api_failure_reason
#define ACCELERATOR_PRODUCT_NAME
#define ZEND_STRING_TABLE_POS_ALIGNMENT
#define IS_ACCEL_INTERNED(str)
uint32_t zend_string_table_pos_t
struct _zend_persistent_script zend_persistent_script
struct _zend_string_table zend_string_table
struct _zend_accel_shared_globals zend_accel_shared_globals
enum _zend_accel_restart_reason zend_accel_restart_reason
#define ZEND_STRING_TABLE_POS_MAX
struct _zend_accel_globals zend_accel_globals
PHPAPI void php_call_shutdown_functions(void)
PHPAPI void php_free_shutdown_functions(void)
usleep(int $microseconds)
sscanf(string $string, string $format, mixed &... $vars)
fprintf($stream, string $format, mixed ... $values)
copy(string $from, string $to, $context=null)
fwrite($stream, string $data, ?int $length=null)
reset(array|object &$array)
fopen(string $filename, string $mode, bool $use_include_path=false, $context=null)
count(Countable|array $value, int $mode=COUNT_NORMAL)
fscanf($stream, string $format, mixed &... $vars)
strstr(string $haystack, string $needle, bool $before_needle=false)
flock($stream, int $operation, &$would_block=null)
fgets($stream, ?int $length=null)
headers_sent(&$filename=null, &$line=null)
memset(ptr, 0, type->size)
zend_ffi_ctype_name_buf buf
hash(string $algo, string $data, bool $binary=false, array $options=[])
void php_request_shutdown(void *dummy)
zend_result php_request_startup(void)
PHPAPI void PHP_MD5Final(unsigned char *result, PHP_MD5_CTX *ctx)
PHPAPI void PHP_MD5Update(PHP_MD5_CTX *ctx, const void *data, size_t size)
opcache_compile_file(string $filename)
PHPAPI void php_output_end_all(void)
PHPAPI void php_output_set_status(int status)
unsigned const char * end
unsigned const char * pos
unsigned char key[REFLECTION_KEY_LEN]
PHPAPI HashTable * php_stream_xport_get_hash(void)
#define php_stream_stat_path(path, ssb)
struct _php_stream php_stream
PHPAPI HashTable * php_stream_get_url_stream_wrappers_hash_global(void)
PHPAPI HashTable * php_get_stream_filters_hash_global(void)
struct _php_stream_wrapper php_stream_wrapper
#define STREAM_LOCATE_WRAPPERS_ONLY
PHPAPI php_stream_wrapper * php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options)
#define PHP_STREAM_URL_STAT_QUIET
struct _php_stream_statbuf php_stream_statbuf
int mprotect(void *addr, size_t size, int protection)
int(* stat)(php_stream *stream, php_stream_statbuf *ssb)
int(* url_stat)(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context)
const php_stream_wrapper_ops * wops
const php_stream_ops * ops
HashTable constants_table
zval * default_static_members_table
struct _zend_class_entry::@126215362204241324314155352336150042254204116267::@166057154351252324007362117353350250255142166322 user
uint32_t num_hooked_props
HashTable properties_info
zend_class_name * trait_names
zend_class_name * interface_names
union _zend_class_entry::@126215362204241324314155352336150042254204116267 info
zend_string * parent_name
int default_properties_count
zend_class_entry ** interfaces
int default_static_members_count
zend_inheritance_cache_entry * inheritance_cache
struct _zend_property_info ** properties_info_table
zend_class_entry * parent
zval * default_properties_table
op_array_handler_func_t op_array_handler
deactivate_func_t deactivate
zend_string * opened_path
union _zend_file_handle::@045057025306333206016200356074063117305134322373 handle
zend_class_entry * parent
zend_error_info ** warnings
zend_class_entry * traits_and_interfaces[1]
zend_inheritance_cache_entry * next
zend_class_dependency * dependencies
uint32_t dependencies_count
zend_function * prototype
HashTable * static_variables
zend_op_array ** dynamic_func_defs
zend_string * function_name
uint32_t num_dynamic_func_defs
unsigned int memory_consumption
int ping_auto_globals_mask
uint32_t num_early_bindings
struct _zend_persistent_script::zend_persistent_script_dynamic_members dynamic_members
zend_error_info ** warnings
zend_long compiler_halt_offset
zend_op_array main_op_array
ZEND_API size_t zend_map_ptr_static_size
ZEND_API void(* zend_error_cb)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message)
ZEND_API ZEND_COLD void zend_error_at(int type, zend_string *filename, uint32_t lineno, const char *format,...)
ZEND_API ZEND_COLD void zend_error_zstr_at(int orig_type, zend_string *error_filename, uint32_t error_lineno, zend_string *message)
ZEND_API size_t zend_map_ptr_static_last
ZEND_API zend_result(* zend_stream_open_function)(zend_file_handle *handle)
ZEND_API zend_result(* zend_post_startup_cb)(void)
ZEND_API void(* zend_post_shutdown_cb)(void)
void zend_call_destructors(void)
ZEND_API size_t zend_get_page_size(void)
ZEND_API ZEND_COLD void zend_error(int type, const char *format,...)
ZEND_API zend_string *(* zend_resolve_path)(zend_string *filename)
ZEND_API void(* zend_accel_schedule_restart_hook)(int reason)
ZEND_API void zend_map_ptr_reset(void)
ZEND_API ZEND_COLD void zend_user_exception_handler(void)
ZEND_API void zend_map_ptr_extend(size_t last)
ZEND_API void zend_free_recorded_errors(void)
ZEND_API void zend_begin_record_errors(void)
ZEND_API void zend_emit_recorded_errors(void)
ZEND_API void zend_message_dispatcher(zend_long message, const void *data)
#define ZMSG_FAILED_REQUIRE_FOPEN
#define ZEND_TSRMLS_CACHE_UPDATE()
struct _zend_inheritance_cache_entry zend_inheritance_cache_entry
#define HANDLE_UNBLOCK_INTERRUPTIONS()
struct _zend_class_dependency zend_class_dependency
struct _zend_error_info zend_error_info
#define ZMSG_FAILED_INCLUDE_FOPEN
#define HANDLE_BLOCK_INTERRUPTIONS()
#define ZEND_TSRMLS_CACHE_DEFINE()
#define INTERNAL_FUNCTION_PARAM_PASSTHRU
ZEND_API HashTable module_registry
ZEND_API zend_result zend_update_class_constant(zend_class_constant *c, const zend_string *name, zend_class_entry *scope)
#define ZEND_RINIT_FUNCTION
#define ZEND_FUNCTION(name)
bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *verify_path, size_t verify_path_len)
void zend_accel_blacklist_shutdown(zend_blacklist *blacklist)
void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename)
void zend_accel_blacklist_init(zend_blacklist *blacklist)
zend_blacklist accel_blacklist
ZEND_NORETURN void zend_accel_error_noreturn(int type, const char *format,...)
void zend_accel_error(int type, const char *format,...)
#define ACCEL_LOG_WARNING
void zend_accel_hash_init(zend_accel_hash *accel_hash, uint32_t hash_size)
zend_accel_hash_entry * zend_accel_hash_find_entry(zend_accel_hash *accel_hash, zend_string *key)
void * zend_accel_hash_find(zend_accel_hash *accel_hash, zend_string *key)
zend_accel_hash_entry * zend_accel_hash_update(zend_accel_hash *accel_hash, zend_string *key, bool indirect, void *data)
void zend_accel_hash_clean(zend_accel_hash *accel_hash)
struct _zend_accel_hash_entry zend_accel_hash_entry
int start_accel_module(void)
void zend_accel_override_file_functions(void)
void zend_accel_move_user_classes(HashTable *src, uint32_t count, zend_script *script)
void zend_accel_finalize_delayed_early_binding_list(zend_persistent_script *persistent_script)
void zend_accel_free_delayed_early_binding_list(zend_persistent_script *persistent_script)
void free_persistent_script(zend_persistent_script *persistent_script, int destroy_elements)
zend_persistent_script * create_persistent_script(void)
zend_op_array * zend_accel_load_script(zend_persistent_script *persistent_script, int from_shared_memory)
void zend_accel_build_delayed_early_binding_list(zend_persistent_script *persistent_script)
void zend_accel_move_user_functions(HashTable *src, uint32_t count, zend_script *script)
#define efree_size(ptr, size)
#define ZEND_MM_ALIGNED_SIZE_EX(size, alignment)
#define perealloc(ptr, size, persistent)
#define pefree(ptr, persistent)
#define pemalloc(size, persistent)
error_reporting(?int $error_level=null)
exit(string|int $status=0)
strcmp(string $string1, string $string2)
zend_string_release_ex(func->internal_function.function_name, 0)
ZEND_API zend_op_array *(* zend_compile_file)(zend_file_handle *file_handle, int type)
ZEND_API bool zend_is_auto_global(zend_string *name)
#define ZEND_PROPERTY_HOOK_COUNT
#define OBJ_PROP_TO_NUM(offset)
#define ZEND_USER_CODE(type)
#define ZEND_ACC_IMMUTABLE
ZEND_API void destroy_op_array(zend_op_array *op_array)
#define ZEND_COMPILE_PRELOAD
#define ZEND_ACC_HAS_TYPE_HINTS
#define ZEND_INTERNAL_FUNCTION
#define ZEND_ACC_DONE_PASS_TWO
#define ZEND_ACC_TRAIT_CLONE
#define ZEND_COMPILE_IGNORE_OTHER_FILES
#define ZEND_COMPILE_DELAYED_BINDING
#define ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, node)
#define ZEND_FETCH_CLASS_NO_AUTOLOAD
#define ZEND_ACC_TOP_LEVEL
#define ZEND_USER_FUNCTION
#define ZEND_ACC_HAS_AST_CONSTANTS
struct _zend_op_array zend_op_array
struct _zend_class_constant zend_class_constant
struct _zend_property_info zend_property_info
#define ZEND_ACC_HAS_AST_PROPERTIES
#define ZEND_COMPILE_IGNORE_INTERNAL_CLASSES
#define ZEND_ACC_CONSTANTS_UPDATED
ZEND_API void init_op_array(zend_op_array *op_array, uint8_t type, int initial_ops_size)
#define ZEND_INCLUDE_ONCE
#define ZEND_ACC_ANON_CLASS
#define ZEND_ACC_HAS_AST_STATICS
#define RT_CONSTANT(opline, node)
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle)
#define ZEND_ACC_HAS_RETURN_TYPE
struct _zend_arg_info zend_arg_info
#define ZEND_COMPILE_WITH_FILE_CACHE
#define ZEND_ACC_FILE_CACHED
#define ZEND_REQUIRE_ONCE
#define ZEND_ACC_VARIADIC
#define ZEND_ACC_EARLY_BINDING
struct _zend_auto_global zend_auto_global
#define ZEND_INTERNAL_CLASS
#define ZEND_COMPILE_IGNORE_OBSERVER
#define ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION
void(ZEND_FASTCALL * zif_handler)(INTERNAL_FUNCTION_PARAMETERS)
#define ZEND_COMPILE_HANDLE_OP_ARRAY
#define ZEND_COMPILE_PRELOAD_IN_CHILD
ZEND_API zval * zend_get_constant_str(const char *name, size_t name_len)
#define ZEND_CONSTANT_FLAGS(c)
struct _zend_constant zend_constant
void zend_exception_restore(void)
ZEND_API ZEND_COLD zend_result zend_exception_error(zend_object *ex, int severity)
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value)
ZEND_API zend_string * zend_get_executed_filename_ex(void)
ZEND_API void zend_shutdown_executor_values(bool fast_shutdown)
ZEND_API zend_result ZEND_FASTCALL zval_update_constant_ex(zval *pp, zend_class_entry *scope)
ZEND_API zend_class_entry * zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags)
ZEND_API zend_llist zend_extensions
ZEND_API size_t zend_internal_run_time_cache_reserved_size(void)
struct _zend_extension zend_extension
#define STANDARD_ZEND_EXTENSION_PROPERTIES
int zend_file_cache_script_store(zend_persistent_script *script, bool in_shm)
void zend_file_cache_invalidate(zend_string *full_path)
zend_persistent_script * zend_file_cache_script_load(zend_file_handle *file_handle)
union _zend_function zend_function
struct _zend_ini_entry zend_ini_entry
#define EG_FLAGS_IN_SHUTDOWN
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
ZEND_API zval *ZEND_FASTCALL zend_hash_set_bucket_key(HashTable *ht, Bucket *b, zend_string *key)
ZEND_API void ZEND_FASTCALL zend_hash_del_bucket(HashTable *ht, Bucket *p)
ZEND_API zend_result ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h)
ZEND_API void ZEND_FASTCALL zend_hash_extend(HashTable *ht, uint32_t nSize, bool packed)
ZEND_API zval *ZEND_FASTCALL zend_hash_add_empty_element(HashTable *ht, zend_string *key)
ZEND_API zend_result ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key)
ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, bucket_compare_func_t compar, bool renumber)
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
#define ZEND_HASH_MAP_FOREACH_BUCKET(ht, _bucket)
#define ZEND_HASH_MAP_FOREACH_STR_KEY_VAL_FROM(ht, _key, _val, _from)
#define ZEND_HASH_MAP_FOREACH_PTR(ht, _ptr)
#define ZEND_HASH_MAP_FOREACH_PTR_FROM(ht, _ptr, _from)
#define ZEND_HASH_MAP_REVERSE_FOREACH_VAL(ht, _val)
#define ZEND_HASH_MAP_FOREACH_BUCKET_FROM(ht, _bucket, _from)
#define ZEND_HASH_MAP_REVERSE_FOREACH_BUCKET(ht, _bucket)
#define ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(ht, _key, _ptr)
#define ZEND_HASH_FOREACH_END()
#define ZEND_HASH_MAP_FOREACH_END_DEL()
ZEND_API zend_class_entry *(* zend_inheritance_cache_add)(zend_class_entry *ce, zend_class_entry *proto, zend_class_entry *parent, zend_class_entry **traits_and_interfaces, HashTable *dependencies)
ZEND_API zend_class_entry * zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name, zend_string *key)
ZEND_API zend_class_entry *(* zend_inheritance_cache_get)(zend_class_entry *ce, zend_class_entry *parent, zend_class_entry **traits_and_interfaces)
ZEND_API zend_result zend_alter_ini_entry_chars(zend_string *name, const char *value, size_t value_length, int modify_type, int stage)
#define ZEND_INI_MH(name)
#define ZEND_INI_STAGE_RUNTIME
struct _zend_file_handle zend_file_handle
void zend_jit_activate(void)
void zend_jit_deactivate(void)
void zend_jit_shutdown(void)
int zend_jit_check_support(void)
void zend_jit_restart(void)
void zend_jit_startup(void *jit_buffer, size_t size, bool reattached)
ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int(*compare)(void *element1, void *element2))
#define ZEND_MAP_PTR_STATIC_NUM_TO_PTR(num)
struct _zend_string zend_string
#define ZEND_MAP_PTR_BIASED_BASE(real_base)
#define ZEND_OBSERVER_ENABLED
ZEND_API void zend_optimize_script(zend_script *script, zend_long optimization_level, zend_long debug_level)
struct _zend_script zend_script
zend_class_entry * zend_persist_class_entry(zend_class_entry *orig_ce)
zend_persistent_script * zend_accel_script_persist(zend_persistent_script *script, int for_shm)
void zend_update_parent_ce(zend_class_entry *ce)
zend_error_info ** zend_persist_warnings(uint32_t num_warnings, zend_error_info **warnings)
void zend_persist_warnings_calc(uint32_t num_warnings, zend_error_info **warnings)
void zend_persist_class_entry_calc(zend_class_entry *ce)
uint32_t zend_accel_script_persist_calc(zend_persistent_script *script, int for_shm)
#define EXPECTED(condition)
#define zend_always_inline
#define UNEXPECTED(condition)
struct _zend_class_entry zend_class_entry
uint32_t zend_shared_alloc_checkpoint_xlat_table(void)
void zend_shared_alloc_save_state(void)
void zend_shared_alloc_lock(void)
void zend_shared_alloc_shutdown(void)
bool zend_accel_in_shm(void *ptr)
void zend_shared_alloc_init_xlat_table(void)
void * zend_shared_alloc_get_xlat_entry(const void *key_pointer)
void zend_shared_alloc_safe_unlock(void)
void zend_shared_alloc_unlock(void)
void zend_shared_alloc_restore_xlat_table(uint32_t checkpoint)
void zend_shared_alloc_clear_xlat_table(void)
void zend_shared_alloc_destroy_xlat_table(void)
void zend_shared_alloc_restore_state(void)
void zend_shared_alloc_register_xlat_entry(const void *key_pointer, const void *value)
void * zend_shared_alloc(size_t size)
int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size)
#define ZEND_ALIGNED_SIZE(size)
#define FAILED_REATTACHED
#define SUCCESSFULLY_REATTACHED
ZEND_API void zend_stream_init_filename_ex(zend_file_handle *handle, zend_string *filename)
ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *filename)
ZEND_API zend_string * zend_one_char_string[256]
ZEND_API void zend_interned_strings_set_request_storage_handlers(zend_new_interned_string_func_t handler, zend_string_init_interned_func_t init_handler, zend_string_init_existing_interned_func_t init_existing_handler)
ZEND_API zend_string ** zend_known_strings
ZEND_API void zend_interned_strings_switch_storage(bool request)
ZEND_API zend_string * zend_empty_string
#define ZSTR_IS_VALID_UTF8(s)
#define _ZSTR_STRUCT_SIZE(len)
#define ZSTR_INIT_LITERAL(s, persistent)
zend_string *(ZEND_FASTCALL * zend_new_interned_string_func_t)(zend_string *str)
#define zend_string_starts_with_literal(str, prefix)
ZEND_API int zend_shutdown_strtod(void)
int(* compare_func_t)(const void *, const void *)
#define IS_STR_CLASS_NAME_MAP_PTR
#define ZEND_TYPE_NAME(t)
#define GC_SET_REFCOUNT(p, rc)
#define Z_STRVAL_P(zval_p)
#define ZEND_TYPE_IS_INTERSECTION(t)
#define ZVAL_STR_COPY(z, s)
struct _zend_array HashTable
#define ZEND_TYPE_HAS_NAME(t)
#define IS_STR_VALID_UTF8
void(* dtor_func_t)(zval *pDest)
#define ZSTR_HAS_CE_CACHE(s)
#define GC_MAKE_PERSISTENT_LOCAL(p)
#define ZEND_TYPE_FOREACH(type, type_ptr)
#define ZEND_TYPE_HAS_LIST(t)
#define Z_STRLEN_P(zval_p)
#define ZEND_TYPE_FOREACH_END()
void(* swap_func_t)(void *, void *)
#define ZSTR_SET_CE_CACHE_EX(s, ce, validate)
ZEND_RESULT_CODE zend_result
#define ZEND_TYPE_SET_PTR(t, _ptr)
#define GC_DEL_FLAGS(p, flags)
struct _zend_execute_data zend_execute_data
#define ZVAL_COPY_VALUE(z, v)
#define GC_ADD_FLAGS(p, flags)
CWD_API void virtual_cwd_activate(void)
CWD_API void realpath_cache_clean(void)
#define IS_ABSOLUTE_PATH(path, len)
#define VCWD_GETCWD(buff, size)
#define VCWD_STAT(path, buff)
ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler(zend_op *opcode)
function(EX_VAR(opline->result.var))
#define ZEND_INCLUDE_OR_EVAL
#define ZEND_DECLARE_CLASS_DELAYED
#define ZEND_DECLARE_FUNCTION
#define ZEND_HANDLE_EXCEPTION
#define ZEND_DECLARE_LAMBDA_FUNCTION
#define ZEND_DECLARE_CLASS