38#define zend_set_str_gc_flags(str) do { \
39 GC_SET_REFCOUNT(str, 2); \
40 uint32_t flags = GC_STRING | (ZSTR_IS_VALID_UTF8(str) ? IS_STR_VALID_UTF8 : 0); \
42 || (ZCG(current_persistent_script) && ZCG(current_persistent_script)->corrupted)) { \
43 GC_TYPE_INFO(str) = GC_STRING | (IS_STR_INTERNED << GC_FLAGS_SHIFT); \
44 flags |= (IS_STR_INTERNED << GC_FLAGS_SHIFT); \
46 flags |= ((IS_STR_INTERNED | IS_STR_PERMANENT) << GC_FLAGS_SHIFT); \
48 GC_TYPE_INFO(str) = flags; \
51#define zend_accel_store_string(str) do { \
52 zend_string *new_str = zend_shared_alloc_get_xlat_entry(str); \
54 zend_string_release_ex(str, 0); \
57 new_str = zend_shared_memdup_put((void*)str, _ZSTR_STRUCT_SIZE(ZSTR_LEN(str))); \
58 zend_string_release_ex(str, 0); \
60 zend_string_hash_val(str); \
61 zend_set_str_gc_flags(str); \
64#define zend_accel_memdup_string(str) do { \
65 zend_string *new_str = zend_shared_alloc_get_xlat_entry(str); \
69 new_str = zend_shared_memdup_put((void*)str, _ZSTR_STRUCT_SIZE(ZSTR_LEN(str))); \
71 zend_string_hash_val(str); \
72 zend_set_str_gc_flags(str); \
75#define zend_accel_store_interned_string(str) do { \
76 if (!IS_ACCEL_INTERNED(str)) { \
77 zend_accel_store_string(str); \
80#define zend_accel_memdup_interned_string(str) do { \
81 if (!IS_ACCEL_INTERNED(str)) { \
82 zend_accel_memdup_string(str); \
88static void zend_persist_zval(
zval *z);
89static void zend_persist_op_array(
zval *
zv);
91static const uint32_t uninitialized_bucket[-
HT_MIN_MASK] =
101 ht->nInternalPointer = 0;
104 if (
EXPECTED(!
ZCG(current_persistent_script)->corrupted)) {
111 if (
ht->nNumUsed == 0) {
114 if (
EXPECTED(!
ZCG(current_persistent_script)->corrupted)) {
130 }
else if (
ht->nNumUsed >
HT_MIN_SIZE &&
ht->nNumUsed < (uint32_t)(-(int32_t)
ht->nTableMask) / 4) {
136 hash_size = (uint32_t)(-(int32_t)
ht->nTableMask);
137 while (hash_size >> 2 >
ht->nNumUsed) {
140 ht->nTableMask = (uint32_t)(-(int32_t)hash_size);
151 for (idx = 0; idx <
ht->nNumUsed; idx++) {
152 p =
ht->arData + idx;
154 nIndex =
p->h |
ht->nTableMask;
156 HT_HASH(
ht, nIndex) = HT_IDX_TO_HASH(idx);
179 zend_persist_zval(&
copy->val);
181 }
else if (zend_ast_is_list(ast)) {
185 for (i = 0; i < list->
children; i++) {
186 if (
copy->child[i]) {
187 copy->child[i] = zend_persist_ast(
copy->child[i]);
192 uint32_t children = zend_ast_get_num_children(ast);
194 for (i = 0; i < children; i++) {
195 if (node->
child[i]) {
196 node->
child[i] = zend_persist_ast(node->
child[i]);
204static void zend_persist_zval(
zval *z)
218 }
else if (!
ZCG(current_persistent_script)->corrupted
231 zend_hash_persist(
ht);
236 zend_persist_zval(
zv);
245 zend_persist_zval(&
p->val);
259 }
else if (
ZCG(current_persistent_script)->corrupted
263 zend_persist_ast(
GC_AST(old_ref));
291 zend_hash_persist(attributes);
300 for (i = 0; i <
copy->argc; i++) {
301 if (
copy->args[i].name) {
304 zend_persist_zval(&
copy->args[i].value);
359 zend_persist_type(single_type);
366 if (!
ZCG(current_persistent_script)->corrupted) {
383 if (main_persistent_script) {
388 memset(&fake_execute_data, 0,
sizeof(fake_execute_data));
390 EG(current_execute_data) = &fake_execute_data;
394 EG(current_execute_data) = orig_execute_data;
407 if (op_array->
scope) {
424 op_array->
opcodes = persist_ptr;
454 if (
ZCG(accel_directives).save_comments) {
470 if (op_array->
vars) {
499 zend_persist_zval(&
p->val);
511#if ZEND_USE_ABS_CONST_ADDR
519 zend_persist_zval(
p);
530 for (; opline <
end ; opline++,
offset++) {
531#if ZEND_USE_ABS_CONST_ADDR
533 opline->
op1.zv = (
zval*)((
char*)opline->
op1.zv + ((
char*)op_array->
literals - (
char*)orig_literals));
542 opline->
op2.zv = (
zval*)((
char*)opline->
op2.zv + ((
char*)op_array->
literals - (
char*)orig_literals));
548 ((
zval*)((
char*)(op_array->
opcodes + (opline - new_opcodes)) +
560 ((
zval*)((
char*)(op_array->
opcodes + (opline - new_opcodes)) +
565#if ZEND_USE_ABS_JMP_ADDR
571 opline->
op1.jmp_addr = &new_opcodes[opline->
op1.jmp_addr - op_array->
opcodes];
585 opline->
op2.jmp_addr = &new_opcodes[opline->
op2.jmp_addr - op_array->
opcodes];
589 opline->
op2.jmp_addr = &new_opcodes[opline->
op2.jmp_addr - op_array->
opcodes];
605 op_array->
opcodes = new_opcodes;
626 if (arg_info[i].
name) {
629 zend_persist_type(&arg_info[i].
type);
642 if (
ZCG(accel_directives).save_comments) {
658 if (op_array->
vars) {
661 for (i = 0; i < op_array->
last_var; i++) {
672 zend_persist_op_array(&tmp);
680static void zend_persist_op_array(
zval *
zv)
689 zend_persist_op_array_ex(op_array,
NULL);
690 if (!
ZCG(current_persistent_script)->corrupted) {
700 && (!
ZCG(current_persistent_script)
701 || !
ZCG(current_persistent_script)->corrupted)) {
723 if (op_array->
scope) {
750 && !
ZCG(current_persistent_script)->corrupted
766 if (old_function_name) {
773 zend_persist_op_array_ex(op_array,
NULL);
799 if (
ZCG(accel_directives).save_comments) {
821 if (prop->
hooks[i]) {
826 && (!
ZCG(current_persistent_script)
827 || !
ZCG(current_persistent_script)->corrupted)) {
841 zend_persist_type(&prop->
type);
845static void zend_persist_class_constant(
zval *
zv)
858 }
else if (!
ZCG(current_persistent_script)->corrupted
863 zend_persist_zval(&c->
value);
869 if (
ZCG(accel_directives).save_comments) {
888 zend_persist_type(&c->
type);
903 if (
EXPECTED(!
ZCG(current_persistent_script)->corrupted)) {
922 && !
ZCG(current_persistent_script)->corrupted) {
934 Z_PTR(
p->val) = zend_persist_class_method(
Z_PTR(
p->val), ce);
969 zend_persist_class_constant(&
p->val);
978 if (prop->
ce == orig_ce) {
979 Z_PTR(
p->val) = zend_persist_property_info(prop);
1030 if (
ZCG(accel_directives).save_comments) {
1128 while (parent && parent->default_static_members_table) {
1129 end = parent->parent ? parent->parent->default_static_members_count : 0;
1130 for (; i >=
end; i--) {
1143 parent = parent->parent;
1265static void zend_accel_persist_class_table(
HashTable *class_table)
1270 bool orig_jit_on =
JIT_G(on);
1274 zend_hash_persist(class_table);
1287 JIT_G(on) = orig_jit_on;
1289 !
ZCG(current_persistent_script)->corrupted) {
1297 if (op_array->
scope == ce
1315 if ((op_array->
scope != ce
1323 if (jit_extension) {
1338 for (uint32_t i = 0; i < num_warnings; i++) {
1349 if (early_bindings) {
1352 for (uint32_t i = 0; i < num_early_bindings; i++) {
1358 return early_bindings;
1371 ZCG(current_persistent_script) = script;
1380#if defined(__AVX__) || defined(__SSE2__)
1382 ZCG(mem) = (
void*)(((uintptr_t)
ZCG(mem) + 63L) & ~63L);
1388 if (
JIT_G(on) && for_shm) {
1400 zend_persist_op_array(&
p->val);
1419 ZCSG(map_ptr_last) =
CG(map_ptr_last);
1424 if (
JIT_G(on) && for_shm) {
1433 ZCG(current_persistent_script) =
NULL;
struct _zend_persistent_script zend_persistent_script
struct _zend_early_binding zend_early_binding
copy(string $from, string $to, $context=null)
memset(ptr, 0, type->size)
unsigned const char * end
zend_function * zf_offsetget
zend_function * zf_offsetunset
zend_function * zf_offsetset
zend_function * zf_offsetexists
zend_string * doc_comment
HashTable constants_table
zend_function * __debugInfo
zend_function * __tostring
zend_class_iterator_funcs * iterator_funcs_ptr
zval * default_static_members_table
HashTable * backed_enum_table
struct _zend_class_entry::@126215362204241324314155352336150042254204116267::@166057154351252324007362117353350250255142166322 user
HashTable properties_info
zend_trait_precedence ** trait_precedences
zend_class_name * trait_names
zend_class_name * interface_names
zend_function * __unserialize
union _zend_class_entry::@126215362204241324314155352336150042254204116267 info
zend_class_arrayaccess_funcs * arrayaccess_funcs_ptr
zend_string * parent_name
int default_properties_count
zend_function * __serialize
zend_trait_alias ** trait_aliases
zend_class_entry ** interfaces
int default_static_members_count
zend_function * constructor
zend_inheritance_cache_entry * inheritance_cache
struct _zend_property_info ** properties_info_table
zend_class_entry * parent
zend_string * doc_comment
zval * default_properties_table
zend_function * __callstatic
zend_function * destructor
zend_function * zf_new_iterator
zend_function * zf_current
zend_function * zf_rewind
zend_function * prototype
HashTable * static_variables
zend_op_array ** dynamic_func_defs
const zend_property_info * prop_info
zend_string * doc_comment
zend_try_catch_element * try_catch_array
zend_live_range * live_range
zend_string * function_name
uint32_t num_dynamic_func_defs
uint32_t num_early_bindings
zend_early_binding * early_bindings
zend_error_info ** warnings
zend_long compiler_halt_offset
const zend_property_info * prototype
zend_string * doc_comment
zend_op_array main_op_array
zend_trait_method_reference trait_method
zend_string * method_name
zend_trait_method_reference trait_method
zend_string * exclude_class_names[1]
ZEND_API size_t zend_map_ptr_static_last
ZEND_API void zend_map_ptr_extend(size_t last)
struct _zend_class_name zend_class_name
struct _zend_trait_precedence zend_trait_precedence
struct _zend_error_info zend_error_info
struct _zend_trait_alias zend_trait_alias
struct _zend_ast_zval zend_ast_zval
struct _zend_ast_list zend_ast_list
#define ZEND_ATTRIBUTE_SIZE(argc)
struct _zend_attribute zend_attribute
zend_string_release_ex(func->internal_function.function_name, 0)
#define ZEND_PROPERTY_HOOK_COUNT
#define ZEND_ACC_IMMUTABLE
#define ZEND_INTERNAL_FUNCTION
#define ZEND_ACC_DONE_PASS_TWO
#define ZEND_ACC_ABSTRACT
#define ZEND_ACC_TRAIT_CLONE
#define ZEND_USER_FUNCTION
struct _zend_op_array zend_op_array
#define ZEND_PROPERTY_HOOK_STRUCT_SIZE
struct _zend_class_constant zend_class_constant
struct _zend_property_info zend_property_info
#define ZEND_ACC_PRELOADED
#define ZEND_ACC_CONSTANTS_UPDATED
#define ZEND_ACC_ANON_CLASS
#define ZEND_ACC_HAS_RETURN_TYPE
struct _zend_arg_info zend_arg_info
#define ZEND_ACC_FILE_CACHED
#define ZEND_ACC_ARENA_ALLOCATED
#define ZEND_ACC_VARIADIC
struct _zend_try_catch_element zend_try_catch_element
struct _zend_live_range zend_live_range
#define ZEND_INTERNAL_CLASS
struct _zend_internal_function zend_internal_function
ZEND_API zval * zend_get_constant_str(const char *name, size_t name_len)
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
ZEND_API size_t zend_extensions_op_array_persist(zend_op_array *op_array, void *mem)
union _zend_function zend_function
#define ZEND_SET_FUNC_INFO(op_array, info)
#define GC_REMOVE_FROM_BUFFER(p)
#define ZEND_HASH_MAP_FOREACH_BUCKET(ht, _bucket)
#define ZEND_HASH_MAP_FOREACH_PTR(ht, _ptr)
#define HASH_FLAG_STATIC_KEYS
#define HASH_FLAG_UNINITIALIZED
#define ZEND_HASH_PACKED_FOREACH_VAL(ht, _val)
#define ZEND_HASH_FOREACH_END()
ZEND_API zend_class_entry * zend_ce_iterator
ZEND_API zend_class_entry * zend_ce_arrayaccess
ZEND_API zend_class_entry * zend_ce_aggregate
struct _zend_class_arrayaccess_funcs zend_class_arrayaccess_funcs
struct _zend_class_iterator_funcs zend_class_iterator_funcs
#define ZEND_JIT_LEVEL_OPT_SCRIPT
int zend_jit_script(zend_script *script)
void zend_jit_unprotect(void)
#define ZEND_JIT_ON_FIRST_EXEC
#define ZEND_JIT_ON_HOT_COUNTERS
void zend_jit_protect(void)
#define ZEND_JIT_ON_PROF_REQUEST
#define ZEND_JIT_ON_HOT_TRACE
#define ZEND_JIT_LEVEL_OPT_FUNCS
int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
struct _zend_string zend_string
#define ZEND_MAP_PTR_INIT(ptr, val)
#define ZEND_MAP_PTR_NEW(ptr)
#define ZEND_MAP_PTR_NEW_OFFSET()
#define ZEND_MAP_PTR_NEW_STATIC(ptr)
ZEND_API bool ZEND_FASTCALL zend_class_implements_interface(const zend_class_entry *class_ce, const zend_class_entry *interface_ce)
#define zend_accel_store_interned_string(str)
uint32_t zend_accel_get_class_name_map_ptr(zend_string *type_name)
void(* zend_persist_func_t)(zval *)
#define zend_accel_store_string(str)
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)
#define EXPECTED(condition)
struct _zend_array zend_array
struct _zend_class_entry zend_class_entry
void * zend_shared_memdup_free(void *source, size_t size)
bool zend_accel_in_shm(void *ptr)
void * zend_shared_memdup_put_free(void *source, size_t size)
void * zend_shared_alloc_get_xlat_entry(const void *key_pointer)
void * zend_shared_memdup_put(void *source, size_t size)
void zend_shared_alloc_register_xlat_entry(const void *key_pointer, const void *value)
void * zend_shared_memdup(void *source, size_t size)
#define ZEND_ALIGNED_SIZE(size)
#define zend_string_equals_literal_ci(str, c)
#define IS_STR_CLASS_NAME_MAP_PTR
struct _zend_ast_ref zend_ast_ref
#define ZEND_TYPE_NAME(t)
#define GC_SET_REFCOUNT(p, rc)
#define Z_CONSTANT_FLAGS(zval)
#define _ZEND_TYPE_ARENA_BIT
#define Z_REFCOUNTED_P(zval_p)
#define ZVAL_INDIRECT(z, v)
struct _zend_array HashTable
#define ZEND_TYPE_LIST_SIZE(num_types)
#define ZEND_TYPE_HAS_NAME(t)
#define Z_COUNTED_P(zval_p)
#define ZSTR_HAS_CE_CACHE(s)
#define ZEND_TYPE_FULL_MASK(t)
#define ZEND_TYPE_FOREACH(type, type_ptr)
#define ZEND_TYPE_HAS_LIST(t)
#define ZEND_TYPE_FOREACH_END()
#define HT_HASH_RESET(ht)
#define ZEND_TYPE_USES_ARENA(t)
#define HT_GET_DATA_ADDR(ht)
#define HT_SET_DATA_ADDR(ht, ptr)
#define ZSTR_SET_CE_CACHE_EX(s, ce, validate)
#define IS_ARRAY_IMMUTABLE
#define Z_TYPE_FLAGS_P(zval_p)
#define ZEND_TYPE_SET_PTR(t, _ptr)
#define GC_NOT_COLLECTABLE
#define ZEND_TYPE_LIST(t)
struct _zend_ast zend_ast
#define HT_PACKED_USED_SIZE(ht)
struct _zend_execute_data zend_execute_data
#define GC_ADD_FLAGS(p, flags)
ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op *opcode, uint32_t op1_info, uint32_t op2_info, uint32_t res_info)
zend_property_info * prop_info
#define ZEND_ASSERT_CHECK
#define ZEND_SWITCH_STRING
#define ZEND_BIND_INIT_STATIC_OR_JMP
#define ZEND_JMP_FRAMELESS