diff --git a/Zend/Optimizer/block_pass.c b/Zend/Optimizer/block_pass.c index 6f67fb0e0a78..cd4b9f7dac74 100644 --- a/Zend/Optimizer/block_pass.c +++ b/Zend/Optimizer/block_pass.c @@ -563,7 +563,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array break; case ZEND_IS_SMALLER: if (opline->opcode == ZEND_BOOL_NOT) { - uint8_t tmp_type; + zend_operand_type tmp_type; uint32_t tmp; src->opcode = ZEND_IS_SMALLER_OR_EQUAL; @@ -581,7 +581,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array break; case ZEND_IS_SMALLER_OR_EQUAL: if (opline->opcode == ZEND_BOOL_NOT) { - uint8_t tmp_type; + zend_operand_type tmp_type; uint32_t tmp; src->opcode = ZEND_IS_SMALLER; diff --git a/Zend/Optimizer/dce.c b/Zend/Optimizer/dce.c index 0780ac190cdd..1508786d6ae1 100644 --- a/Zend/Optimizer/dce.c +++ b/Zend/Optimizer/dce.c @@ -419,7 +419,7 @@ static inline bool is_free_of_live_var(const context *ctx, const zend_op *opline static bool dce_instr(const context *ctx, zend_op *opline, zend_ssa_op *ssa_op) { const zend_ssa *ssa = ctx->ssa; int free_var = -1; - uint8_t free_var_type; + zend_operand_type free_var_type; if (opline->opcode == ZEND_NOP) { return false; diff --git a/Zend/Optimizer/ssa_integrity.c b/Zend/Optimizer/ssa_integrity.c index 34a2b3a9ef64..4b81ea03c971 100644 --- a/Zend/Optimizer/ssa_integrity.c +++ b/Zend/Optimizer/ssa_integrity.c @@ -82,7 +82,7 @@ static inline bool is_in_successors(zend_basic_block *block, int check) { return false; } -static inline bool is_var_type(uint8_t type) { +static inline bool is_var_type(zend_operand_type type) { return (type & (IS_CV|IS_VAR|IS_TMP_VAR)) != 0; } diff --git a/Zend/Optimizer/zend_dump.c b/Zend/Optimizer/zend_dump.c index c6cc5193b2dc..0193ea0fd654 100644 --- a/Zend/Optimizer/zend_dump.c +++ b/Zend/Optimizer/zend_dump.c @@ -153,7 +153,7 @@ static void zend_dump_unused_op(const zend_op *opline, znode_op op, uint32_t fla } } -ZEND_API void zend_dump_var(const zend_op_array *op_array, uint8_t var_type, uint32_t var_num) +ZEND_API void zend_dump_var(const zend_op_array *op_array, zend_operand_type var_type, uint32_t var_num) { if (var_type == IS_CV && var_num < op_array->last_var) { fprintf(stderr, "CV%d($%s)", var_num, op_array->vars[var_num]->val); @@ -382,7 +382,7 @@ static void zend_dump_ssa_var_info(const zend_ssa *ssa, int ssa_var_num, uint32_ dump_flags); } -ZEND_API void zend_dump_ssa_var(const zend_op_array *op_array, const zend_ssa *ssa, int ssa_var_num, uint8_t var_type, uint32_t var_num, uint32_t dump_flags) +ZEND_API void zend_dump_ssa_var(const zend_op_array *op_array, const zend_ssa *ssa, int ssa_var_num, zend_operand_type var_type, uint32_t var_num, uint32_t dump_flags) { if (ssa_var_num >= 0) { fprintf(stderr, "#%d.", ssa_var_num); diff --git a/Zend/Optimizer/zend_dump.h b/Zend/Optimizer/zend_dump.h index 45740d9609cb..de4c2001679e 100644 --- a/Zend/Optimizer/zend_dump.h +++ b/Zend/Optimizer/zend_dump.h @@ -38,8 +38,8 @@ void zend_dump_dominators(const zend_op_array *op_array, const zend_cfg *cfg); void zend_dump_dfg(const zend_op_array *op_array, const zend_cfg *cfg, const zend_dfg *dfg); void zend_dump_phi_placement(const zend_op_array *op_array, const zend_ssa *ssa); void zend_dump_ssa_variables(const zend_op_array *op_array, const zend_ssa *ssa, uint32_t dump_flags); -ZEND_API void zend_dump_ssa_var(const zend_op_array *op_array, const zend_ssa *ssa, int ssa_var_num, uint8_t var_type, uint32_t var_num, uint32_t dump_flags); -ZEND_API void zend_dump_var(const zend_op_array *op_array, uint8_t var_type, uint32_t var_num); +ZEND_API void zend_dump_ssa_var(const zend_op_array *op_array, const zend_ssa *ssa, int ssa_var_num, zend_operand_type var_type, uint32_t var_num, uint32_t dump_flags); +ZEND_API void zend_dump_var(const zend_op_array *op_array, zend_operand_type var_type, uint32_t var_num); void zend_dump_op_array_name(const zend_op_array *op_array); void zend_dump_const(const zval *zv); void zend_dump_ht(const HashTable *ht); diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 404909102b6e..2bf71456c8a4 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -2132,7 +2132,7 @@ ZEND_API uint32_t ZEND_FASTCALL zend_array_type_info(const zval *zv) } -ZEND_API uint32_t zend_array_element_type(uint32_t t1, uint8_t op_type, bool write, bool insert) +ZEND_API uint32_t zend_array_element_type(uint32_t t1, zend_operand_type op_type, bool write, bool insert) { uint32_t tmp = 0; @@ -2194,7 +2194,7 @@ ZEND_API uint32_t zend_array_element_type(uint32_t t1, uint8_t op_type, bool wri } static uint32_t assign_dim_array_result_type( - uint32_t arr_type, uint32_t dim_type, uint32_t value_type, uint8_t dim_op_type) { + uint32_t arr_type, uint32_t dim_type, uint32_t value_type, zend_operand_type dim_op_type) { uint32_t tmp = 0; /* Only add key type if we have a value type. We want to maintain the invariant that a * key type exists iff a value type exists even in dead code that may use empty types. */ @@ -2242,7 +2242,7 @@ static uint32_t assign_dim_array_result_type( } static uint32_t assign_dim_result_type( - uint32_t arr_type, uint32_t dim_type, uint32_t value_type, uint8_t dim_op_type) { + uint32_t arr_type, uint32_t dim_type, uint32_t value_type, zend_operand_type dim_op_type) { uint32_t tmp = arr_type & ~(MAY_BE_RC1|MAY_BE_RCN); if (arr_type & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { diff --git a/Zend/Optimizer/zend_inference.h b/Zend/Optimizer/zend_inference.h index e6b4207c7494..9bd250af1a3e 100644 --- a/Zend/Optimizer/zend_inference.h +++ b/Zend/Optimizer/zend_inference.h @@ -219,7 +219,7 @@ ZEND_API void zend_ssa_find_false_dependencies(const zend_op_array *op_array, co ZEND_API void zend_ssa_find_sccs(const zend_op_array *op_array, zend_ssa *ssa); ZEND_API zend_result zend_ssa_inference(zend_arena **raena, const zend_op_array *op_array, const zend_script *script, zend_ssa *ssa, zend_long optimization_level); -ZEND_API uint32_t zend_array_element_type(uint32_t t1, uint8_t op_type, bool write, bool insert); +ZEND_API uint32_t zend_array_element_type(uint32_t t1, zend_operand_type op_type, bool write, bool insert); ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op* ssa_op, int var, zend_ssa_range *tmp); diff --git a/Zend/Optimizer/zend_optimizer.c b/Zend/Optimizer/zend_optimizer.c index 36bd2f378be9..672d4629c830 100644 --- a/Zend/Optimizer/zend_optimizer.c +++ b/Zend/Optimizer/zend_optimizer.c @@ -602,7 +602,7 @@ bool zend_optimizer_update_op2_const(zend_op_array *op_array, bool zend_optimizer_replace_by_const(zend_op_array *op_array, zend_op *opline, - uint8_t type, + zend_operand_type type, uint32_t var, zval *val) { diff --git a/Zend/Optimizer/zend_optimizer_internal.h b/Zend/Optimizer/zend_optimizer_internal.h index 6add0f76bc02..e0cfc22733e6 100644 --- a/Zend/Optimizer/zend_optimizer_internal.h +++ b/Zend/Optimizer/zend_optimizer_internal.h @@ -95,7 +95,7 @@ bool zend_optimizer_update_op2_const(zend_op_array *op_array, zval *val); bool zend_optimizer_replace_by_const(zend_op_array *op_array, zend_op *opline, - uint8_t type, + zend_operand_type type, uint32_t var, zval *val); zend_op *zend_optimizer_get_loop_var_def(const zend_op_array *op_array, zend_op *free_opline); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 7bbf111985f5..529cb2e0a5e9 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -64,7 +64,7 @@ typedef struct _zend_loop_var { uint8_t opcode; - uint8_t var_type; + zend_operand_type var_type; uint32_t var_num; uint32_t try_catch_offset; } zend_loop_var; @@ -6394,6 +6394,8 @@ static void zend_compile_void_cast(znode *result, const zend_ast *ast) case IS_CONST: zend_do_free(&expr_node); break; + default: + ZEND_UNREACHABLE(); } } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index ec6d8b09bbe7..9ebf48074cdd 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -32,6 +32,15 @@ #include "zend_frameless_function.h" #include "zend_property_hooks.h" +/* Assign as specific bits so that one can quickly check types via a bit operation */ +C23_ENUM(zend_operand_type, uint8_t) { + IS_UNUSED = 0, /* Unused operand */ + IS_CONST = (1<<0), + IS_TMP_VAR = (1<<1), + IS_VAR = (1<<2), + IS_CV = (1<<3), /* Compiled variable */ +}; + #define SET_UNUSED(op) do { \ op ## _type = IS_UNUSED; \ op.num = (uint32_t) -1; \ @@ -81,7 +90,7 @@ typedef union _znode_op { } znode_op; typedef struct _znode { /* used only during compilation */ - uint8_t op_type; + zend_operand_type op_type; uint8_t flag; union { znode_op op; @@ -142,9 +151,9 @@ struct _zend_op { uint32_t extended_value; uint32_t lineno; uint8_t opcode; /* Opcodes defined in Zend/zend_vm_opcodes.h */ - uint8_t op1_type; /* IS_UNUSED, IS_CONST, IS_TMP_VAR, IS_VAR, IS_CV */ - uint8_t op2_type; /* IS_UNUSED, IS_CONST, IS_TMP_VAR, IS_VAR, IS_CV */ - uint8_t result_type; /* IS_UNUSED, IS_CONST, IS_TMP_VAR, IS_VAR, IS_CV */ + zend_operand_type op1_type; /* IS_UNUSED, IS_CONST, IS_TMP_VAR, IS_VAR, IS_CV */ + zend_operand_type op2_type; /* IS_UNUSED, IS_CONST, IS_TMP_VAR, IS_VAR, IS_CV */ + zend_operand_type result_type; /* IS_UNUSED, IS_CONST, IS_TMP_VAR, IS_VAR, IS_CV */ #ifdef ZEND_VERIFY_TYPE_INFERENCE uint32_t op1_use_type; uint32_t op2_use_type; @@ -861,12 +870,6 @@ static_assert(ZEND_MM_ALIGNED_SIZE(sizeof(zval)) == sizeof(zval), #define ZEND_OP_ARRAY_EXTENSION(op_array, handle) \ ((void**)RUN_TIME_CACHE(op_array))[handle] -#define IS_UNUSED 0 /* Unused operand */ -#define IS_CONST (1<<0) -#define IS_TMP_VAR (1<<1) -#define IS_VAR (1<<2) -#define IS_CV (1<<3) /* Compiled variable */ - /* Used for result.type of smart branch instructions */ #define IS_SMART_BRANCH_JMPZ (1<<4) #define IS_SMART_BRANCH_JMPNZ (1<<5) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index a5700627043d..71b709242466 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -414,7 +414,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(uint32_t var EXECUTE_D return ret; } -static zend_always_inline zval *_get_zval_ptr_tmpvarcv(int op_type, znode_op node, int type EXECUTE_DATA_DC) +static zend_always_inline zval *_get_zval_ptr_tmpvarcv(zend_operand_type op_type, znode_op node, int type EXECUTE_DATA_DC) { if (op_type & (IS_TMP_VAR|IS_VAR)) { if (op_type == IS_TMP_VAR) { @@ -429,7 +429,7 @@ static zend_always_inline zval *_get_zval_ptr_tmpvarcv(int op_type, znode_op nod } } -static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC) +static zend_always_inline zval *_get_zval_ptr(zend_operand_type op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC) { if (op_type & (IS_TMP_VAR|IS_VAR)) { if (!ZEND_DEBUG || op_type == IS_VAR) { @@ -449,7 +449,7 @@ static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, int ty } } -static zend_always_inline zval *_get_op_data_zval_ptr_r(int op_type, znode_op node EXECUTE_DATA_DC OPLINE_DC) +static zend_always_inline zval *_get_op_data_zval_ptr_r(zend_operand_type op_type, znode_op node EXECUTE_DATA_DC OPLINE_DC) { if (op_type & (IS_TMP_VAR|IS_VAR)) { if (!ZEND_DEBUG || op_type == IS_VAR) { @@ -469,7 +469,7 @@ static zend_always_inline zval *_get_op_data_zval_ptr_r(int op_type, znode_op no } } -static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_zval_ptr_deref(int op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC) +static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_zval_ptr_deref(zend_operand_type op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC) { if (op_type & (IS_TMP_VAR|IS_VAR)) { if (op_type == IS_TMP_VAR) { @@ -489,7 +489,7 @@ static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_zval_ptr_deref(int op } } -static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_op_data_zval_ptr_deref_r(int op_type, znode_op node EXECUTE_DATA_DC OPLINE_DC) +static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_op_data_zval_ptr_deref_r(zend_operand_type op_type, znode_op node EXECUTE_DATA_DC OPLINE_DC) { if (op_type & (IS_TMP_VAR|IS_VAR)) { if (op_type == IS_TMP_VAR) { @@ -509,7 +509,7 @@ static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_op_data_zval_ptr_dere } } -static zend_always_inline zval *_get_zval_ptr_undef(int op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC) +static zend_always_inline zval *_get_zval_ptr_undef(zend_operand_type op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC) { if (op_type & (IS_TMP_VAR|IS_VAR)) { if (!ZEND_DEBUG || op_type == IS_VAR) { @@ -539,7 +539,7 @@ static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var EXECUTE_DATA_ return ret; } -static inline zval *_get_zval_ptr_ptr(int op_type, znode_op node, int type EXECUTE_DATA_DC) +static inline zval *_get_zval_ptr_ptr(zend_operand_type op_type, znode_op node, int type EXECUTE_DATA_DC) { if (op_type == IS_CV) { return _get_zval_ptr_cv(node.var, type EXECUTE_DATA_CC); @@ -549,7 +549,7 @@ static inline zval *_get_zval_ptr_ptr(int op_type, znode_op node, int type EXECU } } -static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr(int op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC) +static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr(zend_operand_type op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC) { if (op_type == IS_UNUSED) { return &EX(This); @@ -557,7 +557,7 @@ static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr(int op_type, znode_o return get_zval_ptr(op_type, op, type); } -static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_deref(int op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC) +static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_deref(zend_operand_type op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC) { if (op_type == IS_UNUSED) { return &EX(This); @@ -565,7 +565,7 @@ static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_deref(int op_type, z return get_zval_ptr_deref(op_type, op, type); } -static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_undef(int op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC) +static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_undef(zend_operand_type op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC) { if (op_type == IS_UNUSED) { return &EX(This); @@ -573,7 +573,7 @@ static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_undef(int op_type, z return get_zval_ptr_undef(op_type, op, type); } -static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, int type EXECUTE_DATA_DC) +static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_ptr(zend_operand_type op_type, znode_op node, int type EXECUTE_DATA_DC) { if (op_type == IS_UNUSED) { return &EX(This); @@ -3541,9 +3541,9 @@ static zend_never_inline bool zend_handle_fetch_obj_flags( static zend_always_inline void zend_fetch_property_address( zval *result, const zval *container, - uint32_t container_op_type, + zend_operand_type container_op_type, const zval *prop_ptr, - uint32_t prop_op_type, + zend_operand_type prop_op_type, void **cache_slot, int type, uint32_t flags, @@ -3696,9 +3696,9 @@ static zend_always_inline void zend_fetch_property_address( static zend_always_inline void zend_assign_to_property_reference( const zval *container, - uint32_t container_op_type, + zend_operand_type container_op_type, const zval *prop_ptr, - uint32_t prop_op_type, + zend_operand_type prop_op_type, zval *value_ptr OPLINE_DC EXECUTE_DATA_DC ) { @@ -4088,7 +4088,7 @@ static zend_always_inline void i_zval_ptr_dtor_noref(zval *zval_ptr) { } } -ZEND_API zval* zend_assign_to_typed_ref_ex(zval *variable_ptr, zval *orig_value, uint8_t value_type, bool strict, zend_refcounted **garbage_ptr) +ZEND_API zval* zend_assign_to_typed_ref_ex(zval *variable_ptr, zval *orig_value, zend_operand_type value_type, bool strict, zend_refcounted **garbage_ptr) { bool ret; zval value; @@ -4123,7 +4123,7 @@ ZEND_API zval* zend_assign_to_typed_ref_ex(zval *variable_ptr, zval *orig_value, return variable_ptr; } -ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *orig_value, uint8_t value_type, bool strict) +ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *orig_value, zend_operand_type value_type, bool strict) { zend_refcounted *garbage = NULL; zval *result = zend_assign_to_typed_ref_ex(variable_ptr, orig_value, value_type, strict, &garbage); @@ -5976,7 +5976,7 @@ ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode) return zend_user_opcode_handlers[opcode]; } -ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data) +ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, zend_operand_type op_type, const znode_op *node, const zend_execute_data *execute_data) { zval *ret; diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 78f33e2b5bd8..d771eedec6b8 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -133,8 +133,8 @@ ZEND_API bool zend_verify_internal_return_type(const zend_function *zf, zval *re ZEND_API void ZEND_FASTCALL zend_ref_add_type_source(zend_property_info_source_list *source_list, zend_property_info *prop); ZEND_API void ZEND_FASTCALL zend_ref_del_type_source(zend_property_info_source_list *source_list, const zend_property_info *prop); -ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *value, uint8_t value_type, bool strict); -ZEND_API zval* zend_assign_to_typed_ref_ex(zval *variable_ptr, zval *value, uint8_t value_type, bool strict, zend_refcounted **garbage_ptr); +ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *value, zend_operand_type value_type, bool strict); +ZEND_API zval* zend_assign_to_typed_ref_ex(zval *variable_ptr, zval *value, zend_operand_type value_type, bool strict, zend_refcounted **garbage_ptr); static zend_always_inline void zend_copy_to_variable(zval *variable_ptr, const zval *value, uint8_t value_type) { @@ -163,7 +163,7 @@ static zend_always_inline void zend_copy_to_variable(zval *variable_ptr, const z } } -static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, uint8_t value_type, bool strict) +static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_operand_type value_type, bool strict) { do { if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) { @@ -190,7 +190,7 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval return variable_ptr; } -static zend_always_inline zval* zend_assign_to_variable_ex(zval *variable_ptr, zval *value, zend_uchar value_type, bool strict, zend_refcounted **garbage_ptr) +static zend_always_inline zval* zend_assign_to_variable_ex(zval *variable_ptr, zval *value, zend_operand_type value_type, bool strict, zend_refcounted **garbage_ptr) { do { if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) { @@ -223,7 +223,7 @@ static zend_always_inline void zend_safe_assign_to_variable_noref(zval *variable } } -static zend_always_inline void zend_cast_zval_to_object(zval *result, zval *expr, uint8_t op1_type) { +static zend_always_inline void zend_cast_zval_to_object(zval *result, zval *expr, zend_operand_type op1_type) { HashTable *ht; ZVAL_OBJ(result, zend_objects_new(zend_standard_class_def)); @@ -248,7 +248,7 @@ static zend_always_inline void zend_cast_zval_to_object(zval *result, zval *expr } } -static zend_always_inline void zend_cast_zval_to_array(zval *result, zval *expr, uint8_t op1_type) { +static zend_always_inline void zend_cast_zval_to_array(zval *result, zval *expr, zend_operand_type op1_type) { extern ZEND_API zend_class_entry *zend_ce_closure; if (op1_type == IS_CONST || Z_TYPE_P(expr) != IS_OBJECT || Z_OBJCE_P(expr) == zend_ce_closure) { if (Z_TYPE_P(expr) != IS_NULL) { @@ -550,7 +550,7 @@ ZEND_API bool zend_gcc_global_regs(void); ZEND_API zend_result zend_set_user_opcode_handler(uint8_t opcode, user_opcode_handler_t handler); ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(uint8_t opcode); -ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data); +ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, zend_operand_type op_type, const znode_op *node, const zend_execute_data *execute_data); ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table); ZEND_API void ZEND_FASTCALL zend_free_compiled_variables(zend_execute_data *execute_data); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 871edf3aed79..1144aba77cab 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3138,7 +3138,7 @@ ZEND_VM_HOT_NOCONST_HANDLER(43, ZEND_JMPZ, CONST|TMP|CV, JMP_ADDR) { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -3172,7 +3172,7 @@ ZEND_VM_HOT_NOCONST_HANDLER(44, ZEND_JMPNZ, CONST|TMP|CV, JMP_ADDR) { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index bdd7bea9bc7b..cabe7426b87f 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -4608,7 +4608,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = RT_CONSTANT(opline, opline->op1); @@ -4642,7 +4642,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_ { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = RT_CONSTANT(opline, opline->op1); @@ -17062,7 +17062,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_J { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC); @@ -17096,7 +17096,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_J { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC); @@ -39831,7 +39831,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_J { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = EX_VAR(opline->op1.var); @@ -39865,7 +39865,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_FUNC_CCONV ZEND_J { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = EX_VAR(opline->op1.var); @@ -57487,7 +57487,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_JMPZ_ { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = RT_CONSTANT(opline, opline->op1); @@ -57521,7 +57521,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_JMPNZ { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = RT_CONSTANT(opline, opline->op1); @@ -69839,7 +69839,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_JMPZ_S { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC); @@ -69873,7 +69873,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_JMPNZ_ { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC); @@ -92508,7 +92508,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_JMPZ_S { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = EX_VAR(opline->op1.var); @@ -92542,7 +92542,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_OPCODE_HANDLER_CCONV ZEND_JMPNZ_ { USE_OPLINE zval *val; - uint8_t op1_type; + zend_operand_type op1_type; val = EX_VAR(opline->op1.var); diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index bd16e3abc3e4..074ffd0eadb8 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -565,7 +565,7 @@ static bool zend_jit_is_persistent_constant(zval *key, uint32_t flags) return c && (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); } -static zend_class_entry* zend_get_known_class(const zend_op_array *op_array, const zend_op *opline, uint8_t op_type, znode_op op) +static zend_class_entry* zend_get_known_class(const zend_op_array *op_array, const zend_op *opline, zend_operand_type op_type, znode_op op) { zend_class_entry *ce = NULL; diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index cfb25d72cb8a..3a9ea3893866 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -2388,7 +2388,7 @@ static void ZEND_FASTCALL zend_jit_vm_stack_free_args_helper(zend_execute_data * zend_vm_stack_free_args(call); } -static zend_always_inline zval* zend_jit_assign_to_typed_ref_helper(zend_reference *ref, zval *value, uint8_t value_type) +static zend_always_inline zval* zend_jit_assign_to_typed_ref_helper(zend_reference *ref, zval *value, zend_operand_type value_type) { zval variable; @@ -2428,7 +2428,7 @@ static zval* ZEND_FASTCALL zend_jit_assign_cv_to_typed_ref(zend_reference *ref, return zend_jit_assign_to_typed_ref_helper(ref, value, IS_CV); } -static zend_always_inline zval* zend_jit_assign_to_typed_ref2_helper(zend_reference *ref, zval *value, zval *result, uint8_t value_type) +static zend_always_inline zval* zend_jit_assign_to_typed_ref2_helper(zend_reference *ref, zval *value, zval *result, zend_operand_type value_type) { zval variable, *ret; zend_refcounted *garbage = NULL; diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c index f9b1be1b3ea2..26ee155dd510 100644 --- a/ext/opcache/jit/zend_jit_ir.c +++ b/ext/opcache/jit/zend_jit_ir.c @@ -348,7 +348,7 @@ static int zend_jit_assign_to_variable(zend_jit_ctx *jit, zend_jit_addr var_addr, uint32_t var_info, uint32_t var_def_info, - uint8_t val_type, + zend_operand_type val_type, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, @@ -1224,13 +1224,13 @@ static ir_ref jit_if_Z_TYPE_ref(zend_jit_ctx *jit, ir_ref ref, ir_ref type) return ir_IF(ir_EQ(jit_Z_TYPE_ref(jit, ref), type)); } -static ir_ref jit_if_Z_TYPE(zend_jit_ctx *jit, zend_jit_addr addr, uint8_t type) +static ir_ref jit_if_Z_TYPE(zend_jit_ctx *jit, zend_jit_addr addr, zend_operand_type type) { ZEND_ASSERT(type != IS_UNDEF); return ir_IF(ir_EQ(jit_Z_TYPE(jit, addr), ir_CONST_U8(type))); } -static ir_ref jit_if_not_Z_TYPE(zend_jit_ctx *jit, zend_jit_addr addr, uint8_t type) +static ir_ref jit_if_not_Z_TYPE(zend_jit_ctx *jit, zend_jit_addr addr, zend_operand_type type) { ir_ref ref = jit_Z_TYPE(jit, addr); @@ -1240,7 +1240,7 @@ static ir_ref jit_if_not_Z_TYPE(zend_jit_ctx *jit, zend_jit_addr addr, uint8_t t return ir_IF(ref); } -static void jit_guard_Z_TYPE(zend_jit_ctx *jit, zend_jit_addr addr, uint8_t type, const void *exit_addr) +static void jit_guard_Z_TYPE(zend_jit_ctx *jit, zend_jit_addr addr, zend_operand_type type, const void *exit_addr) { ir_ref ref = jit_Z_TYPE(jit, addr); @@ -1251,7 +1251,7 @@ static void jit_guard_Z_TYPE(zend_jit_ctx *jit, zend_jit_addr addr, uint8_t type } } -static void jit_guard_not_Z_TYPE(zend_jit_ctx *jit, zend_jit_addr addr, uint8_t type, const void *exit_addr) +static void jit_guard_not_Z_TYPE(zend_jit_ctx *jit, zend_jit_addr addr, zend_operand_type type, const void *exit_addr) { ir_ref ref = jit_Z_TYPE(jit, addr); @@ -1866,7 +1866,7 @@ static void jit_ZVAL_PTR_DTOR(zend_jit_ctx *jit, } static void jit_FREE_OP(zend_jit_ctx *jit, - uint8_t op_type, + zend_operand_type op_type, znode_op op, uint32_t op_info, const zend_op *opline) @@ -4559,7 +4559,7 @@ static int zend_jit_load_var(zend_jit_ctx *jit, uint32_t info, int var, int ssa_ return zend_jit_load_reg(jit, src, dst, info); } -static int zend_jit_invalidate_var_if_necessary(zend_jit_ctx *jit, uint8_t op_type, zend_jit_addr addr, znode_op op) +static int zend_jit_invalidate_var_if_necessary(zend_jit_ctx *jit, zend_operand_type op_type, zend_jit_addr addr, znode_op op) { if ((op_type & (IS_TMP_VAR|IS_VAR)) && Z_MODE(addr) == IS_REG && !Z_LOAD(addr) && !Z_STORE(addr)) { /* Invalidate operand type to prevent incorrect destruction by exception_handler_free_op1_op2() */ @@ -5328,11 +5328,11 @@ static int zend_jit_math_double_double(zend_jit_ctx *jit, static int zend_jit_math_helper(zend_jit_ctx *jit, const zend_op *opline, uint8_t opcode, - uint8_t op1_type, + zend_operand_type op1_type, znode_op op1, zend_jit_addr op1_addr, uint32_t op1_info, - uint8_t op2_type, + zend_operand_type op2_type, znode_op op2, zend_jit_addr op2_addr, uint32_t op2_info, @@ -5657,12 +5657,12 @@ static int zend_jit_add_arrays(zend_jit_ctx *jit, const zend_op *opline, uint32_ static int zend_jit_long_math_helper(zend_jit_ctx *jit, const zend_op *opline, uint8_t opcode, - uint8_t op1_type, + zend_operand_type op1_type, znode_op op1, zend_jit_addr op1_addr, uint32_t op1_info, zend_ssa_range *op1_range, - uint8_t op2_type, + zend_operand_type op2_type, znode_op op2, zend_jit_addr op2_addr, uint32_t op2_info, @@ -6033,11 +6033,11 @@ static int zend_jit_long_math(zend_jit_ctx *jit, const zend_op *opline, uint32_t static int zend_jit_concat_helper(zend_jit_ctx *jit, const zend_op *opline, - uint8_t op1_type, + zend_operand_type op1_type, znode_op op1, zend_jit_addr op1_addr, uint32_t op1_info, - uint8_t op2_type, + zend_operand_type op2_type, znode_op op2, zend_jit_addr op2_addr, uint32_t op2_info, @@ -6285,7 +6285,7 @@ static int zend_jit_simple_assign(zend_jit_ctx *jit, zend_jit_addr var_addr, uint32_t var_info, uint32_t var_def_info, - uint8_t val_type, + zend_operand_type val_type, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, @@ -6406,7 +6406,7 @@ static int zend_jit_assign_to_variable_call(zend_jit_ctx *jit, zend_jit_addr var_addr, uint32_t __var_info, uint32_t __var_def_info, - uint8_t val_type, + zend_operand_type val_type, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr __res_addr, @@ -6486,7 +6486,7 @@ static int zend_jit_assign_to_variable(zend_jit_ctx *jit, zend_jit_addr var_addr, uint32_t var_info, uint32_t var_def_info, - uint8_t val_type, + zend_operand_type val_type, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, @@ -13864,7 +13864,7 @@ static int zend_jit_assign_dim_op(zend_jit_ctx *jit, } if (emit_fast_path) { - uint8_t val_op_type = (opline+1)->op1_type; + zend_operand_type val_op_type = (opline+1)->op1_type; if (val_op_type & (IS_TMP_VAR|IS_VAR)) { /* prevent FREE_OP in the helpers */ @@ -15691,7 +15691,7 @@ static int zend_jit_assign_obj_op(zend_jit_ctx *jit, var_info &= ~MAY_BE_REF; } - uint8_t val_op_type = (opline+1)->op1_type; + zend_operand_type val_op_type = (opline+1)->op1_type; if (val_op_type & (IS_TMP_VAR|IS_VAR)) { /* prevent FREE_OP in the helpers */ val_op_type = IS_CV; @@ -18251,7 +18251,7 @@ static bool jit_frameless_icall3(zend_jit_ctx *jit, const zend_op *opline, uint3 } void *function = ZEND_FLF_HANDLER(opline); - uint8_t op_data_type = (opline + 1)->op1_type; + zend_operand_type op_data_type = (opline + 1)->op1_type; zend_jit_addr res_addr = RES_ADDR(); zend_jit_addr op1_addr = OP1_ADDR(); zend_jit_addr op2_addr = OP2_ADDR();