diff --git a/Zend/Optimizer/zend_optimizer.c b/Zend/Optimizer/zend_optimizer.c index a206238b552..5d18fc60158 100644 --- a/Zend/Optimizer/zend_optimizer.c +++ b/Zend/Optimizer/zend_optimizer.c @@ -1727,11 +1727,13 @@ ZEND_API void zend_optimize_script(zend_script *script, zend_long optimization_l ZEND_ASSERT(orig_op_array != NULL); if (orig_op_array != op_array) { uint32_t fn_flags = op_array->fn_flags; + uint32_t fn_flags2 = op_array->fn_flags2; zend_function *prototype = op_array->prototype; HashTable *ht = op_array->static_variables; *op_array = *orig_op_array; op_array->fn_flags = fn_flags; + op_array->fn_flags2 = fn_flags2; op_array->prototype = prototype; op_array->static_variables = ht; } diff --git a/Zend/zend.h b/Zend/zend.h index 53d5602a2c2..163b48015d9 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -154,6 +154,7 @@ struct _zend_class_entry { }; int refcount; uint32_t ce_flags; + uint32_t ce_flags2; int default_properties_count; int default_static_members_count; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ff790137a90..57c012ac71a 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2048,6 +2048,7 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, bool nullify_hand ce->refcount = 1; ce->ce_flags = ZEND_ACC_CONSTANTS_UPDATED; + ce->ce_flags2 = 0; if (CG(compiler_options) & ZEND_COMPILE_GUARDS) { ce->ce_flags |= ZEND_ACC_USE_GUARDS; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index ab90b2dcaa8..4a10ad99e24 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -341,6 +341,11 @@ typedef struct _zend_oparray_context { /* Class cannot be serialized or unserialized | | | */ #define ZEND_ACC_NOT_SERIALIZABLE (1 << 29) /* X | | | */ /* | | | */ +/* Class Flags 2 (ce_flags2) (unused: 0-31) | | | */ +/* ========================= | | | */ +/* | | | */ +/* #define ZEND_ACC2_EXAMPLE (1 << 0) X | | | */ +/* | | | */ /* Function Flags (unused: 30) | | | */ /* ============== | | | */ /* | | | */ @@ -407,6 +412,11 @@ typedef struct _zend_oparray_context { /* | | | */ /* op_array uses strict mode types | | | */ #define ZEND_ACC_STRICT_TYPES (1U << 31) /* | X | | */ +/* | | | */ +/* Function Flags 2 (fn_flags2) (unused: 0-31) | | | */ +/* ============================ | | | */ +/* | | | */ +/* #define ZEND_ACC2_EXAMPLE (1 << 0) | X | | */ #define ZEND_ACC_PPP_MASK (ZEND_ACC_PUBLIC | ZEND_ACC_PROTECTED | ZEND_ACC_PRIVATE) #define ZEND_ACC_PPP_SET_MASK (ZEND_ACC_PUBLIC_SET | ZEND_ACC_PROTECTED_SET | ZEND_ACC_PRIVATE_SET) @@ -527,6 +537,7 @@ struct _zend_op_array { ZEND_MAP_PTR_DEF(void **, run_time_cache); zend_string *doc_comment; uint32_t T; /* number of temporary variables */ + uint32_t fn_flags2; const zend_property_info *prop_info; /* The corresponding prop_info if this is a hook. */ /* END of common elements */ @@ -586,6 +597,7 @@ typedef struct _zend_internal_function { ZEND_MAP_PTR_DEF(void **, run_time_cache); zend_string *doc_comment; uint32_t T; /* number of temporary variables */ + uint32_t fn_flags2; const zend_property_info *prop_info; /* The corresponding prop_info if this is a hook. */ /* END of common elements */ @@ -615,6 +627,7 @@ union _zend_function { ZEND_MAP_PTR_DEF(void **, run_time_cache); zend_string *doc_comment; uint32_t T; /* number of temporary variables */ + uint32_t fn_flags2; const zend_property_info *prop_info; /* The corresponding prop_info if this is a hook. */ } common; diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 331043d3fef..c8863a4b27a 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -153,6 +153,7 @@ ZEND_API const zend_internal_function zend_pass_function = { NULL, /* run_time_cache */ NULL, /* doc_comment */ 0, /* T */ + 0, /* fn_flags2 */ NULL, /* prop_info */ ZEND_FN(pass), /* handler */ NULL, /* module */ diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 361ddde6eba..5d1ec65ccda 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1696,6 +1696,7 @@ ZEND_API zend_function *zend_get_call_trampoline_func(const zend_class_entry *ce | ZEND_ACC_PUBLIC | ZEND_ACC_VARIADIC | (fbc->common.fn_flags & (ZEND_ACC_RETURN_REFERENCE|ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED|ZEND_ACC_NODISCARD)); + func->fn_flags2 = 0; /* Attributes outlive the trampoline because they are created by the compiler. */ func->attributes = fbc->common.attributes; if (is_static) { @@ -1797,6 +1798,7 @@ ZEND_API zend_function *zend_get_property_hook_trampoline( func->common.arg_flags[1] = 0; func->common.arg_flags[2] = 0; func->common.fn_flags = ZEND_ACC_CALL_VIA_TRAMPOLINE; + func->common.fn_flags2 = 0; func->common.function_name = zend_string_concat3( "$", 1, ZSTR_VAL(prop_name), ZSTR_LEN(prop_name), kind == ZEND_PROPERTY_HOOK_GET ? "::get" : "::set", 5); diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index bf02d6a4164..1962c7b5a56 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -84,6 +84,7 @@ void init_op_array(zend_op_array *op_array, uint8_t type, int initial_ops_size) op_array->last_try_catch = 0; op_array->fn_flags = 0; + op_array->fn_flags2 = 0; op_array->last_literal = 0; op_array->literals = NULL; diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 8e9f4290e1b..86b8d29209f 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -2190,6 +2190,7 @@ static zend_result zend_ffi_cdata_get_closure(zend_object *obj, zend_class_entry func->common.arg_flags[1] = 0; func->common.arg_flags[2] = 0; func->common.fn_flags = ZEND_ACC_CALL_VIA_TRAMPOLINE; + func->common.fn_flags2 = 0; func->common.function_name = ZSTR_KNOWN(ZEND_STR_MAGIC_INVOKE); /* set to 0 to avoid arg_info[] allocation, because all values are passed by value anyway */ func->common.num_args = 0; @@ -2969,6 +2970,7 @@ static zend_function *zend_ffi_get_func(zend_object **obj, zend_string *name, co func->common.arg_flags[1] = 0; func->common.arg_flags[2] = 0; func->common.fn_flags = ZEND_ACC_CALL_VIA_TRAMPOLINE; + func->common.fn_flags2 = 0; func->common.function_name = zend_string_copy(name); /* set to 0 to avoid arg_info[] allocation, because all values are passed by value anyway */ func->common.num_args = 0; diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 0456017dae0..9ef74973a4d 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -4367,12 +4367,14 @@ static void preload_fix_trait_op_array(zend_op_array *op_array) zend_string *function_name = op_array->function_name; zend_class_entry *scope = op_array->scope; uint32_t fn_flags = op_array->fn_flags; + uint32_t fn_flags2 = op_array->fn_flags2; zend_function *prototype = op_array->prototype; HashTable *ht = op_array->static_variables; *op_array = *orig_op_array; op_array->function_name = function_name; op_array->scope = scope; op_array->fn_flags = fn_flags; + op_array->fn_flags2 = fn_flags2; op_array->prototype = prototype; op_array->static_variables = ht; } diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index 50c0a57ae8e..4e06b2106ce 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -1053,6 +1053,7 @@ static zend_function *zend_test_class_method_get(zend_object **object, zend_stri fptr->num_args = 0; fptr->scope = (*object)->ce; fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER; + fptr->fn_flags2 = 0; fptr->function_name = zend_string_copy(name); fptr->handler = ZEND_FN(zend_test_func); fptr->doc_comment = NULL; @@ -1077,6 +1078,7 @@ static zend_function *zend_test_class_static_method_get(zend_class_entry *ce, ze fptr->num_args = 0; fptr->scope = ce; fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_STATIC; + fptr->fn_flags2 = 0; fptr->function_name = zend_string_copy(name); fptr->handler = ZEND_FN(zend_test_func); fptr->doc_comment = NULL;