mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Add ce_flags2 & fn_flags2 (GH-19991)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user