diff --git a/Zend/Optimizer/block_pass.c b/Zend/Optimizer/block_pass.c index b3f2099fb1955..41f6234652bac 100644 --- a/Zend/Optimizer/block_pass.c +++ b/Zend/Optimizer/block_pass.c @@ -519,7 +519,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) { - zend_uchar tmp_type; + uint8_t tmp_type; uint32_t tmp; src->opcode = ZEND_IS_SMALLER_OR_EQUAL; @@ -537,7 +537,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) { - zend_uchar tmp_type; + uint8_t tmp_type; uint32_t tmp; src->opcode = ZEND_IS_SMALLER; diff --git a/Zend/Optimizer/dce.c b/Zend/Optimizer/dce.c index 4aca34c943ca7..15c9cf5e6e22a 100644 --- a/Zend/Optimizer/dce.c +++ b/Zend/Optimizer/dce.c @@ -413,7 +413,7 @@ static inline bool is_free_of_live_var(context *ctx, zend_op *opline, zend_ssa_o static bool dce_instr(context *ctx, zend_op *opline, zend_ssa_op *ssa_op) { zend_ssa *ssa = ctx->ssa; int free_var = -1; - zend_uchar free_var_type; + uint8_t free_var_type; if (opline->opcode == ZEND_NOP) { return 0; diff --git a/Zend/Optimizer/dfa_pass.c b/Zend/Optimizer/dfa_pass.c index 6ef0bfb2e0745..ac99455c1f808 100644 --- a/Zend/Optimizer/dfa_pass.c +++ b/Zend/Optimizer/dfa_pass.c @@ -932,7 +932,7 @@ static int zend_dfa_optimize_jmps(zend_op_array *op_array, zend_ssa *ssa) case ZEND_MATCH: if (opline->op1_type == IS_CONST) { zval *zv = CT_CONSTANT_EX(op_array, opline->op1.constant); - zend_uchar type = Z_TYPE_P(zv); + uint8_t type = Z_TYPE_P(zv); bool correct_type = (opline->opcode == ZEND_SWITCH_LONG && type == IS_LONG) || (opline->opcode == ZEND_SWITCH_STRING && type == IS_STRING) diff --git a/Zend/Optimizer/sccp.c b/Zend/Optimizer/sccp.c index ff27c2941b268..b039501c921f9 100644 --- a/Zend/Optimizer/sccp.c +++ b/Zend/Optimizer/sccp.c @@ -83,10 +83,10 @@ typedef struct _sccp_ctx { zval bot; } sccp_ctx; -#define TOP ((zend_uchar)-1) -#define BOT ((zend_uchar)-2) -#define PARTIAL_ARRAY ((zend_uchar)-3) -#define PARTIAL_OBJECT ((zend_uchar)-4) +#define TOP ((uint8_t)-1) +#define BOT ((uint8_t)-2) +#define PARTIAL_ARRAY ((uint8_t)-3) +#define PARTIAL_OBJECT ((uint8_t)-4) #define IS_TOP(zv) (Z_TYPE_P(zv) == TOP) #define IS_BOT(zv) (Z_TYPE_P(zv) == BOT) #define IS_PARTIAL_ARRAY(zv) (Z_TYPE_P(zv) == PARTIAL_ARRAY) @@ -314,7 +314,7 @@ static bool try_replace_op2( return 0; } -static inline zend_result ct_eval_binary_op(zval *result, zend_uchar binop, zval *op1, zval *op2) { +static inline zend_result ct_eval_binary_op(zval *result, uint8_t binop, zval *op1, zval *op2) { /* TODO: We could implement support for evaluation of + on partial arrays. */ if (IS_PARTIAL_ARRAY(op1) || IS_PARTIAL_ARRAY(op2)) { return FAILURE; @@ -662,7 +662,7 @@ static inline zend_result ct_eval_assign_obj(zval *result, zval *value, const zv } } -static inline zend_result ct_eval_incdec(zval *result, zend_uchar opcode, zval *op1) { +static inline zend_result ct_eval_incdec(zval *result, uint8_t opcode, zval *op1) { if (Z_TYPE_P(op1) == IS_ARRAY || IS_PARTIAL_ARRAY(op1)) { return FAILURE; } @@ -1843,7 +1843,7 @@ static void sccp_mark_feasible_successors( case ZEND_MATCH: { bool strict_comparison = opline->opcode == ZEND_MATCH; - zend_uchar type = Z_TYPE_P(op1); + uint8_t type = Z_TYPE_P(op1); bool correct_type = (opline->opcode == ZEND_SWITCH_LONG && type == IS_LONG) || (opline->opcode == ZEND_SWITCH_STRING && type == IS_STRING) @@ -2134,7 +2134,7 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var, && opline->opcode != ZEND_ADD_ARRAY_ELEMENT && opline->opcode != ZEND_ADD_ARRAY_UNPACK) { /* Replace with QM_ASSIGN */ - zend_uchar old_type = opline->result_type; + uint8_t old_type = opline->result_type; uint32_t old_var = opline->result.var; ssa_op->result_def = -1; diff --git a/Zend/Optimizer/ssa_integrity.c b/Zend/Optimizer/ssa_integrity.c index 779edd2934843..69c6e6e901a72 100644 --- a/Zend/Optimizer/ssa_integrity.c +++ b/Zend/Optimizer/ssa_integrity.c @@ -85,7 +85,7 @@ static inline bool is_in_successors(zend_basic_block *block, int check) { return 0; } -static inline bool is_var_type(zend_uchar type) { +static inline bool is_var_type(uint8_t type) { return (type & (IS_CV|IS_VAR|IS_TMP_VAR)) != 0; } diff --git a/Zend/Optimizer/zend_cfg.c b/Zend/Optimizer/zend_cfg.c index 6d538f71316cc..219738e6f692b 100644 --- a/Zend/Optimizer/zend_cfg.c +++ b/Zend/Optimizer/zend_cfg.c @@ -41,7 +41,7 @@ static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_bloc zend_basic_block *succ = blocks + b->successors[i]; if (b->len != 0) { - zend_uchar opcode = opcodes[b->start + b->len - 1].opcode; + uint8_t opcode = opcodes[b->start + b->len - 1].opcode; if (opcode == ZEND_MATCH) { succ->flags |= ZEND_BB_TARGET; } else if (opcode == ZEND_SWITCH_LONG || opcode == ZEND_SWITCH_STRING) { diff --git a/Zend/Optimizer/zend_dump.c b/Zend/Optimizer/zend_dump.c index 41146bdad97ec..bc697ba8ba9e5 100644 --- a/Zend/Optimizer/zend_dump.c +++ b/Zend/Optimizer/zend_dump.c @@ -132,7 +132,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, zend_uchar var_type, int var_num) +ZEND_API void zend_dump_var(const zend_op_array *op_array, uint8_t var_type, int 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); @@ -348,7 +348,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, zend_uchar var_type, int 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, uint8_t var_type, int 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 57f0be0f97fb7..8eba47641575b 100644 --- a/Zend/Optimizer/zend_dump.h +++ b/Zend/Optimizer/zend_dump.h @@ -22,6 +22,8 @@ #include "zend_ssa.h" #include "zend_dfg.h" +#include + #define ZEND_DUMP_HIDE_UNREACHABLE (1<<0) #define ZEND_DUMP_RC_INFERENCE (1<<1) #define ZEND_DUMP_CFG (1<<2) @@ -39,8 +41,8 @@ void zend_dump_dfg(const zend_op_array *op_array, const zend_cfg *cfg, const zen void zend_dump_phi_placement(const zend_op_array *op_array, const zend_ssa *ssa); void zend_dump_variables(const zend_op_array *op_array); 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, zend_uchar var_type, int var_num, uint32_t dump_flags); -ZEND_API void zend_dump_var(const zend_op_array *op_array, zend_uchar var_type, int var_num); +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, int var_num, uint32_t dump_flags); +ZEND_API void zend_dump_var(const zend_op_array *op_array, uint8_t var_type, int 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(HashTable *ht); diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index e72e7b474bb39..7ae93147f1e8b 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -562,7 +562,7 @@ static void float_div(zend_long a, zend_long b, zend_long *r1, zend_long *r2) { static bool zend_inference_calc_binary_op_range( const zend_op_array *op_array, const zend_ssa *ssa, - const zend_op *opline, const zend_ssa_op *ssa_op, zend_uchar opcode, zend_ssa_range *tmp) { + const zend_op *opline, const zend_ssa_op *ssa_op, uint8_t opcode, zend_ssa_range *tmp) { zend_long op1_min, op2_min, op1_max, op2_max, t1, t2, t3, t4; switch (opcode) { @@ -1881,7 +1881,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, zend_uchar op_type, int write, int insert) +ZEND_API uint32_t zend_array_element_type(uint32_t t1, uint8_t op_type, int write, int insert) { uint32_t tmp = 0; @@ -1943,7 +1943,7 @@ ZEND_API uint32_t zend_array_element_type(uint32_t t1, zend_uchar op_type, int w } static uint32_t assign_dim_array_result_type( - uint32_t arr_type, uint32_t dim_type, uint32_t value_type, zend_uchar dim_op_type) { + uint32_t arr_type, uint32_t dim_type, uint32_t value_type, uint8_t 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. */ @@ -1987,7 +1987,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, zend_uchar dim_op_type) { + uint32_t arr_type, uint32_t dim_type, uint32_t value_type, uint8_t 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)) { @@ -2008,7 +2008,7 @@ static uint32_t assign_dim_result_type( /* For binary ops that have compound assignment operators */ static uint32_t binary_op_result_type( - zend_ssa *ssa, zend_uchar opcode, uint32_t t1, uint32_t t2, int result_var, + zend_ssa *ssa, uint8_t opcode, uint32_t t1, uint32_t t2, int result_var, zend_long optimization_level) { uint32_t tmp = 0; uint32_t t1_type = (t1 & MAY_BE_ANY) | (t1 & MAY_BE_UNDEF ? MAY_BE_NULL : 0); @@ -3335,7 +3335,7 @@ static zend_always_inline zend_result _zend_update_type_info( tmp |= key_type | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_NULL; } while (j >= 0) { - zend_uchar opcode; + uint8_t opcode; if (!ssa_opcodes) { ZEND_ASSERT(j == (opline - op_array->opcodes) + 1 && "Use must be in next opline"); @@ -3978,7 +3978,7 @@ static bool can_convert_to_double( return 0; } } else { - zend_uchar opcode = opline->opcode; + uint8_t opcode = opline->opcode; if (opcode == ZEND_ASSIGN_OP) { opcode = opline->extended_value; diff --git a/Zend/Optimizer/zend_inference.h b/Zend/Optimizer/zend_inference.h index f27c5ecdc485b..2266800197936 100644 --- a/Zend/Optimizer/zend_inference.h +++ b/Zend/Optimizer/zend_inference.h @@ -26,6 +26,8 @@ /* Bitmask for type inference (zend_ssa_var_info.type) */ #include "zend_type_info.h" +#include + #define MAY_BE_PACKED_GUARD (1<<27) /* needs packed array guard */ #define MAY_BE_CLASS_GUARD (1<<27) /* needs class guard */ #define MAY_BE_GUARD (1<<28) /* needs type guard */ @@ -220,7 +222,7 @@ ZEND_API void zend_ssa_find_false_dependencies(const zend_op_array *op_array, ze ZEND_API void zend_ssa_find_sccs(const zend_op_array *op_array, zend_ssa *ssa); ZEND_API int 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, zend_uchar op_type, int write, int insert); +ZEND_API uint32_t zend_array_element_type(uint32_t t1, uint8_t op_type, int write, int 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 5bb6e1d55e02b..c4461ef56b472 100644 --- a/Zend/Optimizer/zend_optimizer.c +++ b/Zend/Optimizer/zend_optimizer.c @@ -54,7 +54,7 @@ void zend_optimizer_collect_constant(zend_optimizer_ctx *ctx, zval *name, zval* } } -zend_result zend_optimizer_eval_binary_op(zval *result, zend_uchar opcode, zval *op1, zval *op2) /* {{{ */ +zend_result zend_optimizer_eval_binary_op(zval *result, uint8_t opcode, zval *op1, zval *op2) /* {{{ */ { if (zend_binary_op_produces_error(opcode, op1, op2)) { return FAILURE; @@ -65,7 +65,7 @@ zend_result zend_optimizer_eval_binary_op(zval *result, zend_uchar opcode, zval } /* }}} */ -zend_result zend_optimizer_eval_unary_op(zval *result, zend_uchar opcode, zval *op1) /* {{{ */ +zend_result zend_optimizer_eval_unary_op(zval *result, uint8_t opcode, zval *op1) /* {{{ */ { unary_op_type unary_op = get_unary_op(opcode); @@ -620,7 +620,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, - zend_uchar type, + uint8_t type, uint32_t var, zval *val) { diff --git a/Zend/Optimizer/zend_optimizer_internal.h b/Zend/Optimizer/zend_optimizer_internal.h index 769db6357bcf7..2f708471ab1d5 100644 --- a/Zend/Optimizer/zend_optimizer_internal.h +++ b/Zend/Optimizer/zend_optimizer_internal.h @@ -25,6 +25,8 @@ #include "zend_ssa.h" #include "zend_func_info.h" +#include + #define ZEND_OP1_LITERAL(opline) (op_array)->literals[(opline)->op1.constant] #define ZEND_OP1_JMP_ADDR(opline) OP_JMP_ADDR(opline, (opline)->op1) #define ZEND_OP2_LITERAL(opline) (op_array)->literals[(opline)->op2.constant] @@ -81,8 +83,8 @@ int zend_optimizer_add_literal(zend_op_array *op_array, const zval *zv); bool zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy); void zend_optimizer_collect_constant(zend_optimizer_ctx *ctx, zval *name, zval* value); bool zend_optimizer_get_collected_constant(HashTable *constants, zval *name, zval* value); -zend_result zend_optimizer_eval_binary_op(zval *result, zend_uchar opcode, zval *op1, zval *op2); -zend_result zend_optimizer_eval_unary_op(zval *result, zend_uchar opcode, zval *op1); +zend_result zend_optimizer_eval_binary_op(zval *result, uint8_t opcode, zval *op1, zval *op2); +zend_result zend_optimizer_eval_unary_op(zval *result, uint8_t opcode, zval *op1); zend_result zend_optimizer_eval_cast(zval *result, uint32_t type, zval *op1); zend_result zend_optimizer_eval_strlen(zval *result, const zval *op1); zend_result zend_optimizer_eval_special_func_call( @@ -95,7 +97,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, - zend_uchar type, + uint8_t 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_API.c b/Zend/zend_API.c index 11c00f7732c68..0d667c7d620cc 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -552,7 +552,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, zend_long } } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { double d; - zend_uchar type; + uint8_t type; if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) { if (EXPECTED(type != 0)) { @@ -613,7 +613,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_double_weak(const zval *arg, double * *dest = (double)Z_LVAL_P(arg); } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { zend_long l; - zend_uchar type; + uint8_t type; if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), &l, dest)) != IS_DOUBLE)) { if (EXPECTED(type != 0)) { @@ -660,7 +660,7 @@ ZEND_API bool ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest, u zend_string *str = Z_STR_P(arg); zend_long lval; double dval; - zend_uchar type = is_numeric_str_function(str, &lval, &dval); + uint8_t type = is_numeric_str_function(str, &lval, &dval); if (type == IS_LONG) { ZVAL_LONG(arg, lval); } else if (type == IS_DOUBLE) { diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ba6e955795d4c..74d791c63a222 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -57,8 +57,8 @@ #define FC(member) (CG(file_context).member) typedef struct _zend_loop_var { - zend_uchar opcode; - zend_uchar var_type; + uint8_t opcode; + uint8_t var_type; uint32_t var_num; uint32_t try_catch_offset; } zend_loop_var; @@ -89,7 +89,7 @@ ZEND_API zend_compiler_globals compiler_globals; ZEND_API zend_executor_globals executor_globals; #endif -static zend_op *zend_emit_op(znode *result, zend_uchar opcode, znode *op1, znode *op2); +static zend_op *zend_emit_op(znode *result, uint8_t opcode, znode *op1, znode *op2); static bool zend_try_ct_eval_array(zval *result, zend_ast *ast); static void zend_eval_const_expr(zend_ast **ast_ptr); @@ -213,7 +213,7 @@ void zend_assert_valid_class_name(const zend_string *name) /* {{{ */ typedef struct _builtin_type_info { const char* name; const size_t name_len; - const zend_uchar type; + const uint8_t type; } builtin_type_info; static const builtin_type_info builtin_types[] = { @@ -246,7 +246,7 @@ static const confusable_type_info confusable_types[] = { {NULL, 0, NULL}, }; -static zend_always_inline zend_uchar zend_lookup_builtin_type_by_name(const zend_string *name) /* {{{ */ +static zend_always_inline uint8_t zend_lookup_builtin_type_by_name(const zend_string *name) /* {{{ */ { const builtin_type_info *info = &builtin_types[0]; @@ -659,7 +659,7 @@ void zend_stop_lexing(void) } static inline void zend_begin_loop( - zend_uchar free_opcode, const znode *loop_var, bool is_switch) /* {{{ */ + uint8_t free_opcode, const znode *loop_var, bool is_switch) /* {{{ */ { zend_brk_cont_element *brk_cont_element; int parent = CG(context).current_brk_cont; @@ -2110,7 +2110,7 @@ ZEND_API size_t zend_dirname(char *path, size_t len) static void zend_adjust_for_fetch_type(zend_op *opline, znode *result, uint32_t type) /* {{{ */ { - zend_uchar factor = (opline->opcode == ZEND_FETCH_STATIC_PROP_R) ? 1 : 3; + uint_fast8_t factor = (opline->opcode == ZEND_FETCH_STATIC_PROP_R) ? 1 : 3; switch (type) { case BP_VAR_R: @@ -2155,7 +2155,7 @@ static inline void zend_make_tmp_result(znode *result, zend_op *opline) /* {{{ * } /* }}} */ -static zend_op *zend_emit_op(znode *result, zend_uchar opcode, znode *op1, znode *op2) /* {{{ */ +static zend_op *zend_emit_op(znode *result, uint8_t opcode, znode *op1, znode *op2) /* {{{ */ { zend_op *opline = get_next_op(); opline->opcode = opcode; @@ -2175,7 +2175,7 @@ static zend_op *zend_emit_op(znode *result, zend_uchar opcode, znode *op1, znode } /* }}} */ -static zend_op *zend_emit_op_tmp(znode *result, zend_uchar opcode, znode *op1, znode *op2) /* {{{ */ +static zend_op *zend_emit_op_tmp(znode *result, uint8_t opcode, znode *op1, znode *op2) /* {{{ */ { zend_op *opline = get_next_op(); opline->opcode = opcode; @@ -2255,7 +2255,7 @@ ZEND_API bool zend_is_smart_branch(const zend_op *opline) /* {{{ */ } /* }}} */ -static inline uint32_t zend_emit_cond_jump(zend_uchar opcode, znode *cond, uint32_t opnum_target) /* {{{ */ +static inline uint32_t zend_emit_cond_jump(uint8_t opcode, znode *cond, uint32_t opnum_target) /* {{{ */ { uint32_t opnum = get_next_op_number(); zend_op *opline; @@ -2306,7 +2306,7 @@ static inline void zend_update_jump_target_to_next(uint32_t opnum_jump) /* {{{ * } /* }}} */ -static inline zend_op *zend_delayed_emit_op(znode *result, zend_uchar opcode, znode *op1, znode *op2) /* {{{ */ +static inline zend_op *zend_delayed_emit_op(znode *result, uint8_t opcode, znode *op1, znode *op2) /* {{{ */ { zend_op tmp_opline; @@ -3594,7 +3594,7 @@ static uint32_t zend_compile_args( znode arg_node; zend_op *opline; - zend_uchar opcode; + uint8_t opcode; if (arg->kind == ZEND_AST_UNPACK) { if (uses_named_args) { @@ -3773,7 +3773,7 @@ static uint32_t zend_compile_args( } /* }}} */ -ZEND_API zend_uchar zend_get_call_op(const zend_op *init_op, zend_function *fbc) /* {{{ */ +ZEND_API uint8_t zend_get_call_op(const zend_op *init_op, zend_function *fbc) /* {{{ */ { if (fbc) { ZEND_ASSERT(!(fbc->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)); @@ -5546,9 +5546,9 @@ static void zend_compile_if(zend_ast *ast) /* {{{ */ } /* }}} */ -static zend_uchar determine_switch_jumptable_type(zend_ast_list *cases) { +static uint8_t determine_switch_jumptable_type(zend_ast_list *cases) { uint32_t i; - zend_uchar common_type = IS_UNDEF; + uint8_t common_type = IS_UNDEF; for (i = 0; i < cases->children; i++) { zend_ast *case_ast = cases->child[i]; zend_ast **cond_ast = &case_ast->child[0]; @@ -5587,7 +5587,7 @@ static zend_uchar determine_switch_jumptable_type(zend_ast_list *cases) { return common_type; } -static bool should_use_jumptable(zend_ast_list *cases, zend_uchar jumptable_type) { +static bool should_use_jumptable(zend_ast_list *cases, uint8_t jumptable_type) { if (CG(compiler_options) & ZEND_COMPILE_NO_JUMPTABLES) { return 0; } @@ -5613,7 +5613,7 @@ static void zend_compile_switch(zend_ast *ast) /* {{{ */ znode expr_node, case_node; zend_op *opline; uint32_t *jmpnz_opnums, opnum_default_jmp, opnum_switch = (uint32_t)-1; - zend_uchar jumptable_type; + uint8_t jumptable_type; HashTable *jumptable = NULL; zend_compile_expr(&expr_node, expr_ast); @@ -5795,7 +5795,7 @@ static void zend_compile_match(znode *result, zend_ast *ast) case_node.u.op.var = get_temporary_variable(); uint32_t num_conds = count_match_conds(arms); - zend_uchar can_use_jumptable = can_match_use_jumptable(arms); + uint8_t can_use_jumptable = can_match_use_jumptable(arms); bool uses_jumptable = can_use_jumptable && num_conds >= 2; HashTable *jumptable = NULL; uint32_t *jmpnz_opnums = NULL; @@ -6325,7 +6325,7 @@ static zend_type zend_compile_single_typename(zend_ast *ast) return (zend_type) ZEND_TYPE_INIT_CODE(ast->attr, 0, 0); } else { zend_string *class_name = zend_ast_get_str(ast); - zend_uchar type_code = zend_lookup_builtin_type_by_name(class_name); + uint8_t type_code = zend_lookup_builtin_type_by_name(class_name); if (type_code != 0) { if ((ast->attr & ZEND_NAME_NOT_FQ) != ZEND_NAME_NOT_FQ) { @@ -6873,7 +6873,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32 uint32_t property_flags = param_ast->attr & (ZEND_ACC_PPP_MASK | ZEND_ACC_READONLY); znode var_node, default_node; - zend_uchar opcode; + uint8_t opcode; zend_op *opline; zend_arg_info *arg_info; @@ -8532,7 +8532,7 @@ ZEND_API bool zend_is_op_long_compatible(const zval *op) if (Z_TYPE_P(op) == IS_STRING) { double dval = 0; - zend_uchar is_num = is_numeric_str_function(Z_STR_P(op), NULL, &dval); + uint8_t is_num = is_numeric_str_function(Z_STR_P(op), NULL, &dval); if (is_num == 0 || (is_num == IS_DOUBLE && !zend_is_long_compatible(dval, zend_dval_to_lval(dval)))) { return false; } @@ -10714,7 +10714,7 @@ static void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */ } } else if (Z_TYPE_P(container) == IS_STRING) { zend_long offset; - zend_uchar c; + uint8_t c; if (Z_TYPE_P(dim) == IS_LONG) { offset = Z_LVAL_P(dim); } else if (Z_TYPE_P(dim) != IS_STRING || is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), &offset, NULL, 1) != IS_LONG) { @@ -10723,7 +10723,7 @@ static void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */ if (offset < 0 || (size_t)offset >= Z_STRLEN_P(container)) { return; } - c = (zend_uchar) Z_STRVAL_P(container)[offset]; + c = (uint8_t) Z_STRVAL_P(container)[offset]; ZVAL_CHAR(&result, c); } else if (Z_TYPE_P(container) <= IS_FALSE) { return; /* warning... handle at runtime */ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index d32b14dda9813..22221f2265c3f 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -24,6 +24,7 @@ #include "zend_ast.h" #include +#include #include "zend_llist.h" @@ -79,8 +80,8 @@ typedef union _znode_op { } znode_op; typedef struct _znode { /* used only during compilation */ - zend_uchar op_type; - zend_uchar flag; + uint8_t op_type; + uint8_t flag; union { znode_op op; zval constant; /* replaced by literal/zv */ @@ -140,10 +141,10 @@ struct _zend_op { znode_op result; uint32_t extended_value; uint32_t lineno; - zend_uchar opcode; /* Opcodes defined in Zend/zend_vm_opcodes.h */ - zend_uchar op1_type; /* IS_UNUSED, IS_CONST, IS_TMP_VAR, IS_VAR, IS_CV */ - zend_uchar op2_type; /* IS_UNUSED, IS_CONST, IS_TMP_VAR, IS_VAR, IS_CV */ - zend_uchar result_type; /* IS_UNUSED, IS_CONST, IS_TMP_VAR, IS_VAR, IS_CV */ + 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 */ }; @@ -438,8 +439,8 @@ typedef struct _zend_internal_function_info { struct _zend_op_array { /* Common elements */ - zend_uchar type; - zend_uchar arg_flags[3]; /* bitset of arg_info.pass_by_reference */ + uint8_t type; + uint8_t arg_flags[3]; /* bitset of arg_info.pass_by_reference */ uint32_t fn_flags; zend_string *function_name; zend_class_entry *scope; @@ -493,8 +494,8 @@ typedef void (ZEND_FASTCALL *zif_handler)(INTERNAL_FUNCTION_PARAMETERS); typedef struct _zend_internal_function { /* Common elements */ - zend_uchar type; - zend_uchar arg_flags[3]; /* bitset of arg_info.pass_by_reference */ + uint8_t type; + uint8_t arg_flags[3]; /* bitset of arg_info.pass_by_reference */ uint32_t fn_flags; zend_string* function_name; zend_class_entry *scope; @@ -515,12 +516,12 @@ typedef struct _zend_internal_function { #define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? ZSTR_VAL((function)->common.scope->name) : "") union _zend_function { - zend_uchar type; /* MUST be the first element of this struct! */ + uint8_t type; /* MUST be the first element of this struct! */ uint32_t quick_arg_flags; struct { - zend_uchar type; /* never used */ - zend_uchar arg_flags[3]; /* bitset of arg_info.pass_by_reference */ + uint8_t type; /* never used */ + uint8_t arg_flags[3]; /* bitset of arg_info.pass_by_reference */ uint32_t fn_flags; zend_string *function_name; zend_class_entry *scope; @@ -848,7 +849,7 @@ ZEND_API zend_ast *zend_compile_string_to_ast( zend_string *code, struct _zend_arena **ast_arena, zend_string *filename); ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...); ZEND_API int open_file_for_scanning(zend_file_handle *file_handle); -ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size); +ZEND_API void init_op_array(zend_op_array *op_array, uint8_t type, int initial_ops_size); ZEND_API void destroy_op_array(zend_op_array *op_array); ZEND_API void zend_destroy_static_vars(zend_op_array *op_array); ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle); @@ -897,7 +898,7 @@ ZEND_API bool zend_is_compiling(void); ZEND_API char *zend_make_compiled_string_description(const char *name); ZEND_API void zend_initialize_class_data(zend_class_entry *ce, bool nullify_handlers); uint32_t zend_get_class_fetch_type(const zend_string *name); -ZEND_API zend_uchar zend_get_call_op(const zend_op *init_op, zend_function *fbc); +ZEND_API uint8_t zend_get_call_op(const zend_op *init_op, zend_function *fbc); ZEND_API bool zend_is_smart_branch(const zend_op *opline); typedef bool (*zend_auto_global_callback)(zend_string *name); diff --git a/Zend/zend_enum.c b/Zend/zend_enum.c index 99c828f974598..435ebfeaf109c 100644 --- a/Zend/zend_enum.c +++ b/Zend/zend_enum.c @@ -481,7 +481,7 @@ static const zend_function_entry backed_enum_methods[] = { }; ZEND_API zend_class_entry *zend_register_internal_enum( - const char *name, zend_uchar type, const zend_function_entry *functions) + const char *name, uint8_t type, const zend_function_entry *functions) { ZEND_ASSERT(type == IS_UNDEF || type == IS_LONG || type == IS_STRING); diff --git a/Zend/zend_enum.h b/Zend/zend_enum.h index dbb230c4175c3..7b58592d42bd5 100644 --- a/Zend/zend_enum.h +++ b/Zend/zend_enum.h @@ -22,6 +22,8 @@ #include "zend.h" #include "zend_types.h" +#include + BEGIN_EXTERN_C() extern ZEND_API zend_class_entry *zend_ce_unit_enum; @@ -37,7 +39,7 @@ void zend_enum_register_funcs(zend_class_entry *ce); void zend_enum_register_props(zend_class_entry *ce); ZEND_API zend_class_entry *zend_register_internal_enum( - const char *name, zend_uchar type, const zend_function_entry *functions); + const char *name, uint8_t type, const zend_function_entry *functions); ZEND_API void zend_enum_add_case(zend_class_entry *ce, zend_string *case_name, zval *value); ZEND_API void zend_enum_add_case_cstr(zend_class_entry *ce, const char *name, zval *value); ZEND_API zend_object *zend_enum_get_case(zend_class_entry *ce, zend_string *name); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 51d68294ec528..a2d7e8f2aaf20 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -734,7 +734,7 @@ static bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg) /* For an int|float union type and string value, * determine chosen type by is_numeric_string() semantics. */ if ((type_mask & MAY_BE_DOUBLE) && Z_TYPE_P(arg) == IS_STRING) { - zend_uchar type = is_numeric_str_function(Z_STR_P(arg), &lval, &dval); + uint8_t type = is_numeric_str_function(Z_STR_P(arg), &lval, &dval); if (type == IS_LONG) { zend_string_release(Z_STR_P(arg)); ZVAL_LONG(arg, lval); @@ -894,7 +894,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_indirect_modificati ZSTR_VAL(info->ce->name), zend_get_unmangled_property_name(info->name)); } -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_invalid_class_constant_type_error(zend_uchar type) +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_invalid_class_constant_type_error(uint8_t type) { zend_type_error("Cannot use value of type %s as class constant name", zend_get_type_by_const(type)); } @@ -2287,7 +2287,7 @@ static ZEND_COLD void zend_binary_assign_op_dim_slow(zval *container, zval *dim } } -static zend_never_inline zend_uchar slow_index_convert(HashTable *ht, const zval *dim, zend_value *value EXECUTE_DATA_DC) +static zend_never_inline uint8_t slow_index_convert(HashTable *ht, const zval *dim, zend_value *value EXECUTE_DATA_DC) { switch (Z_TYPE_P(dim)) { case IS_UNDEF: { @@ -2355,7 +2355,7 @@ static zend_never_inline zend_uchar slow_index_convert(HashTable *ht, const zval } } -static zend_never_inline zend_uchar slow_index_convert_w(HashTable *ht, const zval *dim, zend_value *value EXECUTE_DATA_DC) +static zend_never_inline uint8_t slow_index_convert_w(HashTable *ht, const zval *dim, zend_value *value EXECUTE_DATA_DC) { switch (Z_TYPE_P(dim)) { case IS_UNDEF: { @@ -2490,7 +2490,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht goto try_again; } else { zend_value val; - zend_uchar t; + uint8_t t; if (type != BP_VAR_W && type != BP_VAR_RW) { t = slow_index_convert(ht, dim, &val EXECUTE_DATA_CC); @@ -2630,7 +2630,7 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval * } if (type != BP_VAR_UNSET) { HashTable *ht = zend_new_array(0); - zend_uchar old_type = Z_TYPE_P(container); + uint8_t old_type = Z_TYPE_P(container); ZVAL_ARR(container, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -3314,7 +3314,7 @@ static zend_never_inline zend_result zend_fetch_static_property_address_ex(zval zend_class_entry *ce; zend_property_info *property_info; - zend_uchar op1_type = opline->op1_type, op2_type = opline->op2_type; + uint8_t op1_type = opline->op1_type, op2_type = opline->op2_type; if (EXPECTED(op2_type == IS_CONST)) { zval *class_name = RT_CONSTANT(opline, opline->op2); @@ -3471,7 +3471,7 @@ static zend_always_inline int i_zend_verify_type_assignable_zval( const zend_property_info *info, const zval *zv, bool strict) { zend_type type = info->type; uint32_t type_mask; - zend_uchar zv_type = Z_TYPE_P(zv); + uint8_t zv_type = Z_TYPE_P(zv); if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(type, zv_type))) { return 1; @@ -3587,7 +3587,7 @@ static zend_always_inline void i_zval_ptr_dtor_noref(zval *zval_ptr) { } } -ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *orig_value, zend_uchar value_type, bool strict) +ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *orig_value, uint8_t value_type, bool strict) { bool ret; zval value; @@ -4579,7 +4579,7 @@ ZEND_API HashTable *zend_unfinished_execution_gc_ex(zend_execute_data *execute_d static void zend_swap_operands(zend_op *op) /* {{{ */ { znode_op tmp; - zend_uchar tmp_type; + uint8_t tmp_type; tmp = op->op1; tmp_type = op->op1_type; diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index c0f8017248e24..2370c3045fc67 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -26,6 +26,8 @@ #include "zend_operators.h" #include "zend_variables.h" +#include + BEGIN_EXTERN_C() struct _zend_fcall_info; ZEND_API extern void (*zend_execute_ex)(zend_execute_data *execute_data); @@ -82,7 +84,7 @@ ZEND_API ZEND_COLD void zend_wrong_string_offset_error(void); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_modification_error(const zend_property_info *info); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_readonly_property_indirect_modification_error(const zend_property_info *info); -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_invalid_class_constant_type_error(zend_uchar type); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_invalid_class_constant_type_error(uint8_t type); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_object_released_while_assigning_to_property_error(const zend_property_info *info); @@ -118,9 +120,9 @@ ZEND_API bool zend_verify_internal_return_type(zend_function *zf, zval *ret); 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, zend_uchar value_type, bool strict); +ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *value, uint8_t value_type, bool strict); -static zend_always_inline void zend_copy_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type) +static zend_always_inline void zend_copy_to_variable(zval *variable_ptr, zval *value, uint8_t value_type) { zend_refcounted *ref = NULL; @@ -147,7 +149,7 @@ static zend_always_inline void zend_copy_to_variable(zval *variable_ptr, zval *v } } -static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type, bool strict) +static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, uint8_t value_type, bool strict) { do { if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) { @@ -382,8 +384,8 @@ ZEND_API bool zend_gcc_global_regs(void); #define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of returned opcode */ -ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler); -ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode); +ZEND_API int 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); diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index 4ccc42b92f668..b3fb44c353355 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -20,6 +20,8 @@ #ifndef ZEND_GENERATORS_H #define ZEND_GENERATORS_H +#include + BEGIN_EXTERN_C() extern ZEND_API zend_class_entry *zend_ce_generator; @@ -85,14 +87,14 @@ struct _zend_generator { zend_execute_data execute_fake; /* ZEND_GENERATOR_* flags */ - zend_uchar flags; + uint8_t flags; }; -static const zend_uchar ZEND_GENERATOR_CURRENTLY_RUNNING = 0x1; -static const zend_uchar ZEND_GENERATOR_FORCED_CLOSE = 0x2; -static const zend_uchar ZEND_GENERATOR_AT_FIRST_YIELD = 0x4; -static const zend_uchar ZEND_GENERATOR_DO_INIT = 0x8; -static const zend_uchar ZEND_GENERATOR_IN_FIBER = 0x10; +static const uint8_t ZEND_GENERATOR_CURRENTLY_RUNNING = 0x1; +static const uint8_t ZEND_GENERATOR_FORCED_CLOSE = 0x2; +static const uint8_t ZEND_GENERATOR_AT_FIRST_YIELD = 0x4; +static const uint8_t ZEND_GENERATOR_DO_INIT = 0x8; +static const uint8_t ZEND_GENERATOR_IN_FIBER = 0x10; void zend_register_generator_ce(void); ZEND_API void zend_generator_close(zend_generator *generator, bool finished_execution); diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index a2439b80eabcb..d21bb0bbeddb3 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -22,6 +22,7 @@ #include +#include #include "zend_globals_macros.h" @@ -87,7 +88,7 @@ struct _zend_compiler_globals { HashTable *auto_globals; /* Refer to zend_yytnamerr() in zend_language_parser.y for meaning of values */ - zend_uchar parse_error; + uint8_t parse_error; bool in_compilation; bool short_tags; @@ -238,7 +239,7 @@ struct _zend_executor_globals { struct _zend_module_entry *current_module; bool active; - zend_uchar flags; + uint8_t flags; zend_long assertions; diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index 84a778b958cde..6e6ffc7bbb78c 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -153,7 +153,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals; static inline zend_result convert_to_number(zval *retval, const char *str, const int str_len) { - zend_uchar type; + uint8_t type; int overflow; zend_long lval; double dval; diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 20d773e1d3713..a0ac789e95400 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1664,7 +1664,7 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */ object_lhs = false; } ZEND_ASSERT(Z_TYPE_P(value) != IS_OBJECT); - zend_uchar target_type = (Z_TYPE_P(value) == IS_FALSE || Z_TYPE_P(value) == IS_TRUE) + uint8_t target_type = (Z_TYPE_P(value) == IS_FALSE || Z_TYPE_P(value) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(value); if (Z_OBJ_HT_P(object)->cast_object(Z_OBJ_P(object), &casted, target_type) == FAILURE) { // TODO: Less crazy. diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 8cea9c59e96d4..475ba6263825d 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -20,6 +20,8 @@ #ifndef ZEND_OBJECT_HANDLERS_H #define ZEND_OBJECT_HANDLERS_H +#include + struct _zend_property_info; #define ZEND_WRONG_PROPERTY_INFO \ @@ -154,7 +156,7 @@ typedef zend_result (*zend_object_get_closure_t)(zend_object *obj, zend_class_en typedef HashTable *(*zend_object_get_gc_t)(zend_object *object, zval **table, int *n); -typedef zend_result (*zend_object_do_operation_t)(zend_uchar opcode, zval *result, zval *op1, zval *op2); +typedef zend_result (*zend_object_do_operation_t)(uint8_t opcode, zval *result, zval *op1, zval *op2); struct _zend_object_handlers { /* offset of real object header (usually zero) */ diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 6d42379b2022e..0502aeeda0713 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -45,7 +45,7 @@ static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend } } -void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size) +void init_op_array(zend_op_array *op_array, uint8_t type, int initial_ops_size) { op_array->type = type; op_array->arg_flags[0] = 0; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 6ffe6e36b1f7f..1abed40012723 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -371,7 +371,7 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(zval *op, bo } case IS_STRING: { - zend_uchar type; + uint8_t type; zend_long lval; double dval; bool trailing_data = false; @@ -891,7 +891,7 @@ ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(const zval *op, bool is_stri } case IS_STRING: { - zend_uchar type; + uint8_t type; zend_long lval; double dval; if (0 == (type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, true))) { @@ -1054,7 +1054,7 @@ static zend_never_inline void ZEND_FASTCALL add_function_array(zval *result, zva static zend_always_inline zend_result add_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { - zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); + uint8_t type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); if (EXPECTED(type_pair == TYPE_PAIR(IS_LONG, IS_LONG))) { fast_long_add_function(result, op1, op2); @@ -1120,7 +1120,7 @@ ZEND_API zend_result ZEND_FASTCALL add_function(zval *result, zval *op1, zval *o static zend_always_inline zend_result sub_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { - zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); + uint8_t type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); if (EXPECTED(type_pair == TYPE_PAIR(IS_LONG, IS_LONG))) { fast_long_sub_function(result, op1, op2); @@ -1185,7 +1185,7 @@ ZEND_API zend_result ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *o static zend_always_inline zend_result mul_function_fast(zval *result, zval *op1, zval *op2) /* {{{ */ { - zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); + uint8_t type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); if (EXPECTED(type_pair == TYPE_PAIR(IS_LONG, IS_LONG))) { zend_long overflow; @@ -1254,7 +1254,7 @@ ZEND_API zend_result ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *o static zend_result ZEND_FASTCALL pow_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ { - zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); + uint8_t type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); if (EXPECTED(type_pair == TYPE_PAIR(IS_LONG, IS_LONG))) { if (Z_LVAL_P(op2) >= 0) { @@ -1347,7 +1347,7 @@ ZEND_API zend_result ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *o #define DIV_BY_ZERO 2 static int ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ { - zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); + uint8_t type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); if (EXPECTED(type_pair == TYPE_PAIR(IS_LONG, IS_LONG))) { if (Z_LVAL_P(op2) == 0) { @@ -2118,7 +2118,7 @@ static int compare_long_to_string(zend_long lval, zend_string *str) /* {{{ */ { zend_long str_lval; double str_dval; - zend_uchar type = is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &str_lval, &str_dval, 0); + uint8_t type = is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &str_lval, &str_dval, 0); if (type == IS_LONG) { return lval > str_lval ? 1 : lval < str_lval ? -1 : 0; @@ -2141,7 +2141,7 @@ static int compare_double_to_string(double dval, zend_string *str) /* {{{ */ { zend_long str_lval; double str_dval; - zend_uchar type = is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &str_lval, &str_dval, 0); + uint8_t type = is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &str_lval, &str_dval, 0); if (type == IS_LONG) { double diff = dval - (double) str_lval; @@ -3110,7 +3110,7 @@ ZEND_API int ZEND_FASTCALL zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3 ZEND_API bool ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2) /* {{{ */ { - zend_uchar ret1, ret2; + uint8_t ret1, ret2; int oflow1, oflow2; zend_long lval1 = 0, lval2 = 0; double dval1 = 0.0, dval2 = 0.0; @@ -3158,7 +3158,7 @@ ZEND_API bool ZEND_FASTCALL zendi_smart_streq(zend_string *s1, zend_string *s2) ZEND_API int ZEND_FASTCALL zendi_smart_strcmp(zend_string *s1, zend_string *s2) /* {{{ */ { - zend_uchar ret1, ret2; + uint8_t ret1, ret2; int oflow1, oflow2; zend_long lval1 = 0, lval2 = 0; double dval1 = 0.0, dval2 = 0.0; @@ -3334,19 +3334,19 @@ ZEND_API zend_string* ZEND_FASTCALL zend_double_to_str(double num) return str; } -ZEND_API zend_uchar ZEND_FASTCALL is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval) /* {{{ */ +ZEND_API uint8_t ZEND_FASTCALL is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval) /* {{{ */ { return is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), lval, dval, false); } /* }}} */ -ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, +ZEND_API uint8_t ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, bool allow_errors, int *oflow_info, bool *trailing_data) /* {{{ */ { const char *ptr; int digits = 0, dp_or_e = 0; double local_dval = 0.0; - zend_uchar type; + uint8_t type; zend_ulong tmp_lval = 0; int neg = 0; diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index a7fa5850587d7..acb7fb0c0a038 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -27,6 +27,7 @@ #include #include #include +#include #ifdef HAVE_IEEEFP_H #include @@ -88,7 +89,7 @@ static zend_always_inline bool instanceof_function( * could not be represented as such due to overflow. It writes 1 to oflow_info * if the integer is larger than ZEND_LONG_MAX and -1 if it's smaller than ZEND_LONG_MIN. */ -ZEND_API zend_uchar ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, +ZEND_API uint8_t ZEND_FASTCALL _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, bool allow_errors, int *oflow_info, bool *trailing_data); ZEND_API const char* ZEND_FASTCALL zend_memnstr_ex(const char *haystack, const char *needle, size_t needle_len, const char *end); @@ -144,7 +145,7 @@ static zend_always_inline zend_long zend_dval_to_lval_safe(double d) #define ZEND_IS_DIGIT(c) ((c) >= '0' && (c) <= '9') #define ZEND_IS_XDIGIT(c) (((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f')) -static zend_always_inline zend_uchar is_numeric_string_ex(const char *str, size_t length, zend_long *lval, +static zend_always_inline uint8_t is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, bool allow_errors, int *oflow_info, bool *trailing_data) { if (*str > '9') { @@ -153,11 +154,11 @@ static zend_always_inline zend_uchar is_numeric_string_ex(const char *str, size_ return _is_numeric_string_ex(str, length, lval, dval, allow_errors, oflow_info, trailing_data); } -static zend_always_inline zend_uchar is_numeric_string(const char *str, size_t length, zend_long *lval, double *dval, bool allow_errors) { +static zend_always_inline uint8_t is_numeric_string(const char *str, size_t length, zend_long *lval, double *dval, bool allow_errors) { return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL, NULL); } -ZEND_API zend_uchar ZEND_FASTCALL is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval); +ZEND_API uint8_t ZEND_FASTCALL is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval); static zend_always_inline const char * zend_memnstr(const char *haystack, const char *needle, size_t needle_len, const char *end) diff --git a/Zend/zend_stream.h b/Zend/zend_stream.h index 39cec8e7ce1a8..1c6ee0a556267 100644 --- a/Zend/zend_stream.h +++ b/Zend/zend_stream.h @@ -57,7 +57,7 @@ typedef struct _zend_file_handle { } handle; zend_string *filename; zend_string *opened_path; - zend_uchar type; /* packed zend_stream_type */ + uint8_t type; /* packed zend_stream_type */ bool primary_script; bool in_list; /* added into CG(open_file) */ char *buf; diff --git a/Zend/zend_system_id.c b/Zend/zend_system_id.c index 8390bba8b0f25..27adf3fe1a4a2 100644 --- a/Zend/zend_system_id.c +++ b/Zend/zend_system_id.c @@ -63,7 +63,7 @@ void zend_startup_system_id(void) void zend_finalize_system_id(void) { unsigned char digest[16]; - zend_uchar hooks = 0; + uint8_t hooks = 0; if (zend_ast_process) { hooks |= ZEND_HOOK_AST_PROCESS; @@ -80,7 +80,7 @@ void zend_finalize_system_id(void) PHP_MD5Update(&context, &hooks, sizeof hooks); for (int16_t i = 0; i < 256; i++) { - if (zend_get_user_opcode_handler((zend_uchar) i) != NULL) { + if (zend_get_user_opcode_handler((uint8_t) i) != NULL) { PHP_MD5Update(&context, &i, sizeof i); } } diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 1d72b842defe4..7ba5f8625c1b2 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -27,6 +27,7 @@ #include "zend_result.h" #include +#include #ifdef __SSE2__ # include @@ -309,8 +310,8 @@ struct _zval_struct { uint32_t type_info; struct { ZEND_ENDIAN_LOHI_3( - zend_uchar type, /* active type */ - zend_uchar type_flags, + uint8_t type, /* active type */ + uint8_t type_flags, union { uint16_t extra; /* not further specified */ } u) @@ -361,10 +362,10 @@ struct _zend_array { union { struct { ZEND_ENDIAN_LOHI_4( - zend_uchar flags, - zend_uchar _unused, - zend_uchar nIteratorsCount, - zend_uchar _unused2) + uint8_t flags, + uint8_t _unused, + uint8_t nIteratorsCount, + uint8_t _unused2) } v; uint32_t flags; } u; @@ -569,7 +570,7 @@ struct _zend_ast_ref { #define _IS_BOOL 18 #define _IS_NUMBER 19 -static zend_always_inline zend_uchar zval_get_type(const zval* pz) { +static zend_always_inline uint8_t zval_get_type(const zval* pz) { return pz->u1.v.type; } @@ -638,7 +639,7 @@ static zend_always_inline zend_uchar zval_get_type(const zval* pz) { #define GC_FLAGS_SHIFT 0 #define GC_INFO_SHIFT 10 -static zend_always_inline zend_uchar zval_gc_type(uint32_t gc_type_info) { +static zend_always_inline uint8_t zval_gc_type(uint32_t gc_type_info) { return (gc_type_info & GC_TYPE_MASK); } @@ -1170,7 +1171,7 @@ extern ZEND_API bool zend_rc_debug; * Skip checks for OBJECT/NULL type to avoid interpreting the flag incorrectly. */ # define ZEND_RC_MOD_CHECK(p) do { \ if (zend_rc_debug) { \ - zend_uchar type = zval_gc_type((p)->u.type_info); \ + uint8_t type = zval_gc_type((p)->u.type_info); \ if (type != IS_OBJECT && type != IS_NULL) { \ ZEND_ASSERT(!(zval_gc_flags((p)->u.type_info) & GC_IMMUTABLE)); \ ZEND_ASSERT((zval_gc_flags((p)->u.type_info) & (GC_PERSISTENT|GC_PERSISTENT_LOCAL)) != GC_PERSISTENT); \ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index a06d277baf71d..6d31c99f91e28 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1216,7 +1216,7 @@ ZEND_VM_C_LABEL(assign_dim_op_new_array): } zend_binary_assign_op_obj_dim(obj, dim OPLINE_CC EXECUTE_DATA_CC); } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) { - zend_uchar old_type; + uint8_t old_type; if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); @@ -2654,7 +2654,7 @@ ZEND_VM_C_LABEL(try_assign_dim_array): UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -2960,7 +2960,7 @@ ZEND_VM_HOT_NOCONST_HANDLER(43, ZEND_JMPZ, CONST|TMPVAR|CV, JMP_ADDR) { USE_OPLINE zval *val; - zend_uchar op1_type; + uint8_t op1_type; val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -2994,7 +2994,7 @@ ZEND_VM_HOT_NOCONST_HANDLER(44, ZEND_JMPNZ, CONST|TMPVAR|CV, JMP_ADDR) { USE_OPLINE zval *val; - zend_uchar op1_type; + uint8_t op1_type; val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R); @@ -8066,7 +8066,7 @@ ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY) case ZEND_USER_OPCODE_DISPATCH: ZEND_VM_DISPATCH(opline->opcode, opline); default: - ZEND_VM_DISPATCH((zend_uchar)(ret & 0xff), opline); + ZEND_VM_DISPATCH((uint8_t)(ret & 0xff), opline); } } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 3768d869dc3be..d4f0e28594010 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -287,7 +287,7 @@ static user_opcode_handler_t zend_user_opcode_handlers[256] = { (user_opcode_handler_t)NULL }; -static zend_uchar zend_user_opcodes[256] = {0, +static uint8_t zend_user_opcodes[256] = {0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48, @@ -326,11 +326,11 @@ static const void * const * zend_opcode_handler_funcs; static zend_op hybrid_halt_op; #endif #if (ZEND_VM_KIND != ZEND_VM_KIND_HYBRID) || !ZEND_VM_SPEC -static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op); +static const void *zend_vm_get_opcode_handler(uint8_t opcode, const zend_op* op); #endif #if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) -static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend_op* op); +static const void *zend_vm_get_opcode_handler_func(uint8_t opcode, const zend_op* op); #else # define zend_vm_get_opcode_handler_func zend_vm_get_opcode_handler #endif @@ -3278,7 +3278,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_ case ZEND_USER_OPCODE_DISPATCH: ZEND_VM_DISPATCH(opline->opcode, opline); default: - ZEND_VM_DISPATCH((zend_uchar)(ret & 0xff), opline); + ZEND_VM_DISPATCH((uint8_t)(ret & 0xff), opline); } } @@ -4141,7 +4141,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_CONST_H { USE_OPLINE zval *val; - zend_uchar op1_type; + uint8_t op1_type; val = RT_CONSTANT(opline, opline->op1); @@ -4175,7 +4175,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_CONST_ { USE_OPLINE zval *val; - zend_uchar op1_type; + uint8_t op1_type; val = RT_CONSTANT(opline, opline->op1); @@ -14424,7 +14424,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_TMPVAR_H { USE_OPLINE zval *val; - zend_uchar op1_type; + uint8_t op1_type; val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC); @@ -14458,7 +14458,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_TMPVAR_ { USE_OPLINE zval *val; - zend_uchar op1_type; + uint8_t op1_type; val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC); @@ -22900,7 +22900,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CONST_H } zend_binary_assign_op_obj_dim(obj, dim OPLINE_CC EXECUTE_DATA_CC); } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) { - zend_uchar old_type; + uint8_t old_type; if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); @@ -23890,7 +23890,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -24039,7 +24039,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -24188,7 +24188,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -24336,7 +24336,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -25751,7 +25751,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_TMPVAR_ } zend_binary_assign_op_obj_dim(obj, dim OPLINE_CC EXECUTE_DATA_CC); } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) { - zend_uchar old_type; + uint8_t old_type; if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); @@ -26746,7 +26746,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -26895,7 +26895,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -27044,7 +27044,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -27192,7 +27192,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -28079,7 +28079,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED_ } zend_binary_assign_op_obj_dim(obj, dim OPLINE_CC EXECUTE_DATA_CC); } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) { - zend_uchar old_type; + uint8_t old_type; if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); @@ -28277,7 +28277,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -28426,7 +28426,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -28575,7 +28575,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -28723,7 +28723,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -29959,7 +29959,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CV_HAND } zend_binary_assign_op_obj_dim(obj, dim OPLINE_CC EXECUTE_DATA_CC); } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) { - zend_uchar old_type; + uint8_t old_type; if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); @@ -30949,7 +30949,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -31098,7 +31098,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -31247,7 +31247,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -31395,7 +31395,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -38866,7 +38866,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_CV_HANDL { USE_OPLINE zval *val; - zend_uchar op1_type; + uint8_t op1_type; val = EX_VAR(opline->op1.var); @@ -38900,7 +38900,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_CV_HAND { USE_OPLINE zval *val; - zend_uchar op1_type; + uint8_t op1_type; val = EX_VAR(opline->op1.var); @@ -40935,7 +40935,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CONST_HA } zend_binary_assign_op_obj_dim(obj, dim OPLINE_CC EXECUTE_DATA_CC); } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) { - zend_uchar old_type; + uint8_t old_type; if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); @@ -42196,7 +42196,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -42345,7 +42345,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -42494,7 +42494,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -42642,7 +42642,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -44725,7 +44725,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_TMPVAR_H } zend_binary_assign_op_obj_dim(obj, dim OPLINE_CC EXECUTE_DATA_CC); } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) { - zend_uchar old_type; + uint8_t old_type; if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); @@ -45985,7 +45985,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -46134,7 +46134,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -46283,7 +46283,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -46431,7 +46431,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -47642,7 +47642,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED_H } zend_binary_assign_op_obj_dim(obj, dim OPLINE_CC EXECUTE_DATA_CC); } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) { - zend_uchar old_type; + uint8_t old_type; if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); @@ -47968,7 +47968,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -48117,7 +48117,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -48266,7 +48266,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -48414,7 +48414,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -50057,7 +50057,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CV_HANDL } zend_binary_assign_op_obj_dim(obj, dim OPLINE_CC EXECUTE_DATA_CC); } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) { - zend_uchar old_type; + uint8_t old_type; if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(container) == IS_UNDEF)) { ZVAL_UNDEFINED_OP1(); @@ -51313,7 +51313,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -51462,7 +51462,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -51611,7 +51611,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -51759,7 +51759,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_ UNDEF_RESULT(); } else { HashTable *ht = zend_new_array(8); - zend_uchar old_type = Z_TYPE_P(object_ptr); + uint8_t old_type = Z_TYPE_P(object_ptr); ZVAL_ARR(object_ptr, ht); if (UNEXPECTED(old_type == IS_FALSE)) { @@ -64805,14 +64805,14 @@ static uint32_t ZEND_FASTCALL zend_vm_get_opcode_handler_idx(uint32_t spec, cons } #if (ZEND_VM_KIND != ZEND_VM_KIND_HYBRID) || !ZEND_VM_SPEC -static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op) +static const void *zend_vm_get_opcode_handler(uint8_t opcode, const zend_op* op) { return zend_opcode_handlers[zend_vm_get_opcode_handler_idx(zend_spec_handlers[opcode], op)]; } #endif #if ZEND_VM_KIND == ZEND_VM_KIND_HYBRID -static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend_op* op) +static const void *zend_vm_get_opcode_handler_func(uint8_t opcode, const zend_op* op) { uint32_t spec = zend_spec_handlers[opcode]; return zend_opcode_handler_funcs[zend_vm_get_opcode_handler_idx(spec, op)]; @@ -64822,7 +64822,7 @@ static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler(zend_op* op) { - zend_uchar opcode = zend_user_opcodes[op->opcode]; + uint8_t opcode = zend_user_opcodes[op->opcode]; if (zend_spec_handlers[op->opcode] & SPEC_RULE_COMMUTATIVE) { if (op->op1_type < op->op2_type) { @@ -64834,7 +64834,7 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler(zend_op* op) ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t op1_info, uint32_t op2_info, uint32_t res_info) { - zend_uchar opcode = zend_user_opcodes[op->opcode]; + uint8_t opcode = zend_user_opcodes[op->opcode]; uint32_t spec = zend_spec_handlers[opcode]; switch (opcode) { case ZEND_ADD: diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index e94db4f359a05..0f6154c64db9f 100755 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -1819,11 +1819,11 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) out($f,"#endif\n"); } out($f,"#if (ZEND_VM_KIND != ZEND_VM_KIND_HYBRID) || !ZEND_VM_SPEC\n"); - out($f,"static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op);\n"); + out($f,"static const void *zend_vm_get_opcode_handler(uint8_t opcode, const zend_op* op);\n"); out($f,"#endif\n\n"); if ($kind == ZEND_VM_KIND_HYBRID) { out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n"); - out($f,"static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend_op* op);\n"); + out($f,"static const void *zend_vm_get_opcode_handler_func(uint8_t opcode, const zend_op* op);\n"); out($f,"#else\n"); out($f,"# define zend_vm_get_opcode_handler_func zend_vm_get_opcode_handler\n"); out($f,"#endif\n\n"); @@ -2350,9 +2350,9 @@ function gen_vm_opcodes_header( $str .= "#define ZEND_VM_OP2_FLAGS(flags) ((flags >> 8) & 0xff)\n"; $str .= "\n"; $str .= "BEGIN_EXTERN_C()\n\n"; - $str .= "ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode);\n"; - $str .= "ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode);\n"; - $str .= "ZEND_API zend_uchar zend_get_opcode_id(const char *name, size_t length);\n\n"; + $str .= "ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(uint8_t opcode);\n"; + $str .= "ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(uint8_t opcode);\n"; + $str .= "ZEND_API uint8_t zend_get_opcode_id(const char *name, size_t length);\n\n"; $str .= "END_EXTERN_C()\n\n"; $code_len = strlen((string) $max_opcode); @@ -2636,22 +2636,22 @@ function gen_vm($def, $skel) { } fputs($f, "};\n\n"); - fputs($f, "ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode) {\n"); + fputs($f, "ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(uint8_t opcode) {\n"); fputs($f, "\tif (UNEXPECTED(opcode > ZEND_VM_LAST_OPCODE)) {\n"); fputs($f, "\t\treturn NULL;\n"); fputs($f, "\t}\n"); fputs($f, "\treturn zend_vm_opcodes_names[opcode];\n"); fputs($f, "}\n"); - fputs($f, "ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode) {\n"); + fputs($f, "ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(uint8_t opcode) {\n"); fputs($f, "\tif (UNEXPECTED(opcode > ZEND_VM_LAST_OPCODE)) {\n"); fputs($f, "\t\topcode = ZEND_NOP;\n"); fputs($f, "\t}\n"); fputs($f, "\treturn zend_vm_opcodes_flags[opcode];\n"); fputs($f, "}\n"); - fputs($f, "ZEND_API zend_uchar zend_get_opcode_id(const char *name, size_t length) {\n"); - fputs($f, "\tzend_uchar opcode;\n"); + fputs($f, "ZEND_API uint8_t zend_get_opcode_id(const char *name, size_t length) {\n"); + fputs($f, "\tuint8_t opcode;\n"); fputs($f, "\tfor (opcode = 0; opcode < (sizeof(zend_vm_opcodes_names) / sizeof(zend_vm_opcodes_names[0])) - 1; opcode++) {\n"); fputs($f, "\t\tconst char *opcode_name = zend_vm_opcodes_names[opcode];\n"); fputs($f, "\t\tif (opcode_name && strncmp(opcode_name, name, length) == 0) {\n"); @@ -2699,7 +2699,7 @@ function gen_vm($def, $skel) { } out($f, "\t(user_opcode_handler_t)NULL\n};\n\n"); - out($f, "static zend_uchar zend_user_opcodes[256] = {"); + out($f, "static uint8_t zend_user_opcodes[256] = {"); for ($i = 0; $i < 255; ++$i) { if ($i % 16 == 1) out($f, "\n\t"); out($f, "$i,"); @@ -2791,7 +2791,7 @@ function gen_vm($def, $skel) { } out($f, "}\n\n"); out($f, "#if (ZEND_VM_KIND != ZEND_VM_KIND_HYBRID) || !ZEND_VM_SPEC\n"); - out($f, "static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op)\n"); + out($f, "static const void *zend_vm_get_opcode_handler(uint8_t opcode, const zend_op* op)\n"); out($f, "{\n"); if (!ZEND_VM_SPEC) { out($f, "\treturn zend_opcode_handlers[zend_vm_get_opcode_handler_idx(opcode, op)];\n"); @@ -2804,7 +2804,7 @@ function gen_vm($def, $skel) { if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) { // Generate zend_vm_get_opcode_handler_func() function out($f, "#if ZEND_VM_KIND == ZEND_VM_KIND_HYBRID\n"); - out($f,"static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend_op* op)\n"); + out($f,"static const void *zend_vm_get_opcode_handler_func(uint8_t opcode, const zend_op* op)\n"); out($f, "{\n"); out($f, "\tuint32_t spec = zend_spec_handlers[opcode];\n"); if (!ZEND_VM_SPEC) { @@ -2819,7 +2819,7 @@ function gen_vm($def, $skel) { // Generate zend_vm_get_opcode_handler() function out($f, "ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler(zend_op* op)\n"); out($f, "{\n"); - out($f, "\tzend_uchar opcode = zend_user_opcodes[op->opcode];\n"); + out($f, "\tuint8_t opcode = zend_user_opcodes[op->opcode];\n"); if (!ZEND_VM_SPEC) { out($f, "\top->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(opcode, op)];\n"); } else { @@ -2836,7 +2836,7 @@ function gen_vm($def, $skel) { // Generate zend_vm_set_opcode_handler_ex() function out($f, "ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t op1_info, uint32_t op2_info, uint32_t res_info)\n"); out($f, "{\n"); - out($f, "\tzend_uchar opcode = zend_user_opcodes[op->opcode];\n"); + out($f, "\tuint8_t opcode = zend_user_opcodes[op->opcode];\n"); if (!ZEND_VM_SPEC) { out($f, "\top->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(opcode, op)];\n"); } else { diff --git a/Zend/zend_vm_opcodes.c b/Zend/zend_vm_opcodes.c index 8cd152a635ee2..a9e4317e04e2d 100644 --- a/Zend/zend_vm_opcodes.c +++ b/Zend/zend_vm_opcodes.c @@ -434,20 +434,20 @@ static uint32_t zend_vm_opcodes_flags[203] = { 0x00000101, }; -ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode) { +ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(uint8_t opcode) { if (UNEXPECTED(opcode > ZEND_VM_LAST_OPCODE)) { return NULL; } return zend_vm_opcodes_names[opcode]; } -ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode) { +ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(uint8_t opcode) { if (UNEXPECTED(opcode > ZEND_VM_LAST_OPCODE)) { opcode = ZEND_NOP; } return zend_vm_opcodes_flags[opcode]; } -ZEND_API zend_uchar zend_get_opcode_id(const char *name, size_t length) { - zend_uchar opcode; +ZEND_API uint8_t zend_get_opcode_id(const char *name, size_t length) { + uint8_t opcode; for (opcode = 0; opcode < (sizeof(zend_vm_opcodes_names) / sizeof(zend_vm_opcodes_names[0])) - 1; opcode++) { const char *opcode_name = zend_vm_opcodes_names[opcode]; if (opcode_name && strncmp(opcode_name, name, length) == 0) { diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 165e914e1cd53..43bd8bc252802 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -77,9 +77,9 @@ BEGIN_EXTERN_C() -ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode); -ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode); -ZEND_API zend_uchar zend_get_opcode_id(const char *name, size_t length); +ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(uint8_t opcode); +ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(uint8_t opcode); +ZEND_API uint8_t zend_get_opcode_id(const char *name, size_t length); END_EXTERN_C() diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index b40ac6a5c31f9..14580ef6a8a7c 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -95,7 +95,7 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage) static void php_com_variant_from_zval_ex(VARIANT *v, zval *z, int codepage, VARTYPE vt) { php_com_dotnet_object *obj; - zend_uchar ztype = IS_NULL; + uint8_t ztype = IS_NULL; if (z) { ZVAL_DEREF(z); diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 0c236f2b71da2..e82b81fe3bdb1 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -1838,7 +1838,7 @@ static zend_object* zend_ffi_add(zend_ffi_cdata *base_cdata, zend_ffi_type *base } /* }}} */ -static zend_result zend_ffi_cdata_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_result zend_ffi_cdata_do_operation(uint8_t opcode, zval *result, zval *op1, zval *op2) /* {{{ */ { zend_long offset; diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 442269f6d8a35..96536ff3bde39 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -333,7 +333,7 @@ static zend_object *gmp_clone_obj(zend_object *obj) /* {{{ */ } /* }}} */ -static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zval *op1, zval *op2, zend_uchar opcode) { +static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zval *op1, zval *op2, uint8_t opcode) { zend_long shift = zval_get_long(op2); if (shift < 0) { @@ -370,7 +370,7 @@ static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zva } \ return SUCCESS; -static zend_result gmp_do_operation_ex(zend_uchar opcode, zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_result gmp_do_operation_ex(uint8_t opcode, zval *result, zval *op1, zval *op2) /* {{{ */ { switch (opcode) { case ZEND_ADD: @@ -407,7 +407,7 @@ static zend_result gmp_do_operation_ex(zend_uchar opcode, zval *result, zval *op } /* }}} */ -static zend_result gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op2) /* {{{ */ +static zend_result gmp_do_operation(uint8_t opcode, zval *result, zval *op1, zval *op2) /* {{{ */ { zval op1_copy; int retval; diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index 55f2995895b88..3c29910698d99 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -308,7 +308,7 @@ zval* collator_convert_string_to_double( zval* str, zval *rv ) */ zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv ) { - zend_uchar is_numeric = 0; + uint8_t is_numeric = 0; zend_long lval = 0; double dval = 0; diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c index 823fb4088d8fd..cf18c8a672223 100644 --- a/ext/intl/collator/collator_is_numeric.c +++ b/ext/intl/collator/collator_is_numeric.c @@ -204,7 +204,7 @@ static zend_long collator_u_strtol(const UChar *nptr, UChar **endptr, int base) /* {{{ collator_is_numeric] * Taken from PHP6:is_numeric_unicode() */ -zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, bool allow_errors ) +uint8_t collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, bool allow_errors ) { zend_long local_lval; double local_dval; diff --git a/ext/intl/collator/collator_is_numeric.h b/ext/intl/collator/collator_is_numeric.h index 16afa64ae2240..d30acd0b5843a 100644 --- a/ext/intl/collator/collator_is_numeric.h +++ b/ext/intl/collator/collator_is_numeric.h @@ -18,7 +18,8 @@ #include #include +#include -zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, bool allow_errors ); +uint8_t collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, bool allow_errors ); #endif // COLLATOR_IS_NUMERIC_H diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 99fb0154b4bfa..48078c57df091 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -91,7 +91,7 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int num_vars, zval *a goto end; } for (i = 0; i < num_vars; i++) { - zend_uchar type; + uint8_t type; switch (types[i]) { case 'd': /* Double */ type = MYSQL_TYPE_DOUBLE; diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 2cc983fa439ca..da88d9afbde81 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -150,7 +150,7 @@ static int zend_jit_assign_to_variable(dasm_State **Dst, zend_jit_addr var_addr, uint32_t var_info, uint32_t var_def_info, - zend_uchar val_type, + uint8_t val_type, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, @@ -214,7 +214,7 @@ static bool zend_ival_is_last_use(const zend_lifetime_interval *ival, int use) return 0; } -static bool zend_is_commutative(zend_uchar opcode) +static bool zend_is_commutative(uint8_t opcode) { return opcode == ZEND_ADD || @@ -2646,7 +2646,7 @@ static bool zend_jit_next_is_send_result(const zend_op *opline) return 0; } -static bool zend_jit_supported_binary_op(zend_uchar op, uint32_t op1_info, uint32_t op2_info) +static bool zend_jit_supported_binary_op(uint8_t op, uint32_t op1_info, uint32_t op2_info) { if ((op1_info & MAY_BE_UNDEF) || (op2_info & MAY_BE_UNDEF)) { return false; @@ -2685,7 +2685,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op zend_lifetime_interval **ra = NULL; bool is_terminated = 1; /* previous basic block is terminated by jump */ bool recv_emitted = 0; /* emitted at least one RECV opcode */ - zend_uchar smart_branch_opcode; + uint8_t smart_branch_opcode; uint32_t target_label, target_label2; uint32_t op1_info, op1_def_info, op2_info, res_info, res_use_info; zend_jit_addr op1_addr, op1_def_addr, op2_addr, op2_def_addr, res_addr; diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc index 5e89fc1bcc7e7..8df7d4f88eae7 100644 --- a/ext/opcache/jit/zend_jit_arm64.dasc +++ b/ext/opcache/jit/zend_jit_arm64.dasc @@ -1464,7 +1464,7 @@ static bool logical_immediate_p(uint64_t value, uint32_t reg_size) || do { || if (!((var_info) & MAY_BE_GUARD) || && has_concrete_type((var_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) { -|| zend_uchar type = concrete_type((var_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); +|| uint8_t type = concrete_type((var_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); || if (type == IS_STRING && !ZEND_DEBUG) { | EXT_CALL _efree, tmp_reg || break; @@ -3606,7 +3606,7 @@ static int zend_jit_load_var(dasm_State **Dst, uint32_t info, int var, zend_reg return zend_jit_load_reg(Dst, src, dst, info); } -static int zend_jit_invalidate_var_if_necessary(dasm_State **Dst, zend_uchar op_type, zend_jit_addr addr, znode_op op) +static int zend_jit_invalidate_var_if_necessary(dasm_State **Dst, uint8_t 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)) { zend_jit_addr dst = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op.var); @@ -4001,7 +4001,7 @@ static int zend_jit_opline_uses_reg(const zend_op *opline, int8_t reg) static int zend_jit_math_long_long(dasm_State **Dst, const zend_op *opline, - zend_uchar opcode, + uint8_t opcode, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, @@ -4219,7 +4219,7 @@ static int zend_jit_math_long_long(dasm_State **Dst, } static int zend_jit_math_long_double(dasm_State **Dst, - zend_uchar opcode, + uint8_t opcode, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, @@ -4252,7 +4252,7 @@ static int zend_jit_math_long_double(dasm_State **Dst, } static int zend_jit_math_double_long(dasm_State **Dst, - zend_uchar opcode, + uint8_t opcode, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, @@ -4315,7 +4315,7 @@ static int zend_jit_math_double_long(dasm_State **Dst, } static int zend_jit_math_double_double(dasm_State **Dst, - zend_uchar opcode, + uint8_t opcode, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, @@ -4376,12 +4376,12 @@ static int zend_jit_math_double_double(dasm_State **Dst, static int zend_jit_math_helper(dasm_State **Dst, const zend_op *opline, - zend_uchar opcode, - zend_uchar op1_type, + uint8_t opcode, + uint8_t op1_type, znode_op op1, zend_jit_addr op1_addr, uint32_t op1_info, - zend_uchar op2_type, + uint8_t op2_type, znode_op op2, zend_jit_addr op2_addr, uint32_t op2_info, @@ -4654,13 +4654,13 @@ static int zend_jit_add_arrays(dasm_State **Dst, const zend_op *opline, uint32_t static int zend_jit_long_math_helper(dasm_State **Dst, const zend_op *opline, - zend_uchar opcode, - zend_uchar op1_type, + uint8_t opcode, + uint8_t op1_type, znode_op op1, zend_jit_addr op1_addr, uint32_t op1_info, zend_ssa_range *op1_range, - zend_uchar op2_type, + uint8_t op2_type, znode_op op2, zend_jit_addr op2_addr, uint32_t op2_info, @@ -4995,11 +4995,11 @@ static int zend_jit_long_math(dasm_State **Dst, const zend_op *opline, uint32_t static int zend_jit_concat_helper(dasm_State **Dst, const zend_op *opline, - zend_uchar op1_type, + uint8_t op1_type, znode_op op1, zend_jit_addr op1_addr, uint32_t op1_info, - zend_uchar op2_type, + uint8_t op2_type, znode_op op2, zend_jit_addr op2_addr, uint32_t op2_info, @@ -5569,7 +5569,7 @@ static int zend_jit_simple_assign(dasm_State **Dst, zend_jit_addr var_addr, uint32_t var_info, uint32_t var_def_info, - zend_uchar val_type, + uint8_t val_type, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, @@ -5727,7 +5727,7 @@ static int zend_jit_simple_assign(dasm_State **Dst, static int zend_jit_assign_to_typed_ref(dasm_State **Dst, const zend_op *opline, - zend_uchar val_type, + uint8_t val_type, zend_jit_addr val_addr, zend_jit_addr res_addr, bool check_exception) @@ -5779,7 +5779,7 @@ static int zend_jit_assign_to_variable_call(dasm_State **Dst, zend_jit_addr var_addr, uint32_t __var_info, uint32_t __var_def_info, - zend_uchar val_type, + uint8_t val_type, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr __res_addr, @@ -5862,7 +5862,7 @@ static int zend_jit_assign_to_variable(dasm_State **Dst, zend_jit_addr var_addr, uint32_t var_info, uint32_t var_def_info, - zend_uchar val_type, + uint8_t val_type, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, @@ -6536,7 +6536,7 @@ static int zend_jit_cmp_long_long(dasm_State **Dst, zend_ssa_range *op2_range, zend_jit_addr op2_addr, zend_jit_addr res_addr, - zend_uchar smart_branch_opcode, + uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr, @@ -6796,7 +6796,7 @@ static int zend_jit_cmp_long_long(dasm_State **Dst, return 1; } -static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline, zend_jit_addr res_addr, bool swap, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline, zend_jit_addr res_addr, bool swap, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { if (smart_branch_opcode) { if (smart_branch_opcode == ZEND_JMPZ) { @@ -7095,7 +7095,7 @@ static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline, z return 1; } -static int zend_jit_cmp_long_double(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_cmp_long_double(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { zend_reg tmp_reg = ZREG_FPR0; @@ -7105,7 +7105,7 @@ static int zend_jit_cmp_long_double(dasm_State **Dst, const zend_op *opline, zen return zend_jit_cmp_double_common(Dst, opline, res_addr, 0, smart_branch_opcode, target_label, target_label2, exit_addr); } -static int zend_jit_cmp_double_long(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_cmp_double_long(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { zend_reg tmp_reg = ZREG_FPR0; @@ -7115,7 +7115,7 @@ static int zend_jit_cmp_double_long(dasm_State **Dst, const zend_op *opline, zen return zend_jit_cmp_double_common(Dst, opline, res_addr, /* swap */ 1, smart_branch_opcode, target_label, target_label2, exit_addr); } -static int zend_jit_cmp_double_double(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_cmp_double_double(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { bool swap = 0; @@ -7134,7 +7134,7 @@ static int zend_jit_cmp_double_double(dasm_State **Dst, const zend_op *opline, z return zend_jit_cmp_double_common(Dst, opline, res_addr, swap, smart_branch_opcode, target_label, target_label2, exit_addr); } -static int zend_jit_cmp_slow(dasm_State **Dst, const zend_op *opline, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_cmp_slow(dasm_State **Dst, const zend_op *opline, zend_jit_addr res_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { | tst RETVALw, RETVALw if (smart_branch_opcode) { @@ -7268,7 +7268,7 @@ static int zend_jit_cmp(dasm_State **Dst, zend_jit_addr op2_addr, zend_jit_addr res_addr, int may_throw, - zend_uchar smart_branch_opcode, + uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr, @@ -7496,7 +7496,7 @@ static int zend_jit_identical(dasm_State **Dst, zend_jit_addr op2_addr, zend_jit_addr res_addr, int may_throw, - zend_uchar smart_branch_opcode, + uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr, @@ -7878,7 +7878,7 @@ static int zend_jit_identical(dasm_State **Dst, return 1; } -static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, zend_jit_addr res_addr, uint32_t target_label, uint32_t target_label2, int may_throw, zend_uchar branch_opcode, const void *exit_addr) +static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, zend_jit_addr res_addr, uint32_t target_label, uint32_t target_label2, int may_throw, uint8_t branch_opcode, const void *exit_addr) { uint32_t true_label = -1; uint32_t false_label = -1; @@ -10187,7 +10187,7 @@ static int zend_jit_check_func_arg(dasm_State **Dst, const zend_op *opline) return 1; } -static int zend_jit_smart_true(dasm_State **Dst, const zend_op *opline, int jmp, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2) +static int zend_jit_smart_true(dasm_State **Dst, const zend_op *opline, int jmp, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2) { if (smart_branch_opcode) { if (smart_branch_opcode == ZEND_JMPZ) { @@ -10211,7 +10211,7 @@ static int zend_jit_smart_true(dasm_State **Dst, const zend_op *opline, int jmp, return 1; } -static int zend_jit_smart_false(dasm_State **Dst, const zend_op *opline, int jmp, zend_uchar smart_branch_opcode, uint32_t target_label) +static int zend_jit_smart_false(dasm_State **Dst, const zend_op *opline, int jmp, uint8_t smart_branch_opcode, uint32_t target_label) { if (smart_branch_opcode) { if (smart_branch_opcode == ZEND_JMPZ) { @@ -10235,7 +10235,7 @@ static int zend_jit_smart_false(dasm_State **Dst, const zend_op *opline, int jmp return 1; } -static int zend_jit_defined(dasm_State **Dst, const zend_op *opline, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_defined(dasm_State **Dst, const zend_op *opline, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { uint32_t defined_label = (uint32_t)-1; uint32_t undefined_label = (uint32_t)-1; @@ -10326,7 +10326,7 @@ static int zend_jit_defined(dasm_State **Dst, const zend_op *opline, zend_uchar return 1; } -static int zend_jit_type_check(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_type_check(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { uint32_t mask; zend_jit_addr op1_addr = OP1_ADDR(); @@ -10392,7 +10392,7 @@ static int zend_jit_type_check(dasm_State **Dst, const zend_op *opline, uint32_t } } else { bool invert = 0; - zend_uchar type; + uint8_t type; switch (mask) { case MAY_BE_NULL: type = IS_NULL; break; @@ -11618,7 +11618,7 @@ static int zend_jit_isset_isempty_dim(dasm_State **Dst, uint32_t op2_info, uint8_t dim_type, int may_throw, - zend_uchar smart_branch_opcode, + uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) @@ -14315,7 +14315,7 @@ static bool zend_jit_verify_return_type(dasm_State **Dst, const zend_op *opline, return 1; } -static int zend_jit_isset_isempty_cv(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_isset_isempty_cv(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); @@ -14405,7 +14405,7 @@ static int zend_jit_fe_reset(dasm_State **Dst, const zend_op *opline, uint32_t o return 1; } -static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, uint32_t op2_info, unsigned int target_label, zend_uchar exit_opcode, const void *exit_addr) +static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, uint32_t op2_info, unsigned int target_label, uint8_t exit_opcode, const void *exit_addr) { zend_jit_addr op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var); @@ -14698,7 +14698,7 @@ static int zend_jit_fetch_constant(dasm_State **Dst, return 1; } -static int zend_jit_in_array(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_in_array(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2)); zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index bf830ec3b8b12..1ed5e0aaab912 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -1080,13 +1080,13 @@ static zend_always_inline zend_string* zend_jit_fetch_dim_str_offset(zend_string zend_long real_offset = (zend_long)ZSTR_LEN(str) + offset; if (EXPECTED(real_offset >= 0)) { - return ZSTR_CHAR((zend_uchar)ZSTR_VAL(str)[real_offset]); + return ZSTR_CHAR((uint8_t)ZSTR_VAL(str)[real_offset]); } } zend_error(E_WARNING, "Uninitialized string offset " ZEND_LONG_FMT, offset); return ZSTR_EMPTY_ALLOC(); } else { - return ZSTR_CHAR((zend_uchar)ZSTR_VAL(str)[offset]); + return ZSTR_CHAR((uint8_t)ZSTR_VAL(str)[offset]); } } @@ -1155,13 +1155,13 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_str_is_helper(zend_string *str, zva zend_long real_offset = (zend_long)ZSTR_LEN(str) + offset; if (real_offset >= 0) { - ZVAL_CHAR(result, (zend_uchar)ZSTR_VAL(str)[real_offset]); + ZVAL_CHAR(result, (uint8_t)ZSTR_VAL(str)[real_offset]); return; } } ZVAL_NULL(result); } else { - ZVAL_CHAR(result, (zend_uchar)ZSTR_VAL(str)[offset]); + ZVAL_CHAR(result, (uint8_t)ZSTR_VAL(str)[offset]); } } @@ -1221,7 +1221,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_obj_is_helper(zval *container, zval static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, zval *value, zval *result) { - zend_uchar c; + uint8_t c; size_t string_len; zend_long offset; zend_string *s; @@ -1310,11 +1310,11 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, } string_len = ZSTR_LEN(tmp); - c = (zend_uchar)ZSTR_VAL(tmp)[0]; + c = (uint8_t)ZSTR_VAL(tmp)[0]; zend_string_release(tmp); } else { string_len = Z_STRLEN_P(value); - c = (zend_uchar)Z_STRVAL_P(value)[0]; + c = (uint8_t)Z_STRVAL_P(value)[0]; } @@ -2146,7 +2146,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, zend_uchar value_type) +static zend_always_inline zval* zend_jit_assign_to_typed_ref_helper(zend_reference *ref, zval *value, uint8_t value_type) { zval variable; diff --git a/ext/opcache/jit/zend_jit_internal.h b/ext/opcache/jit/zend_jit_internal.h index fb640ff9b97ca..606efebe0ea9d 100644 --- a/ext/opcache/jit/zend_jit_internal.h +++ b/ext/opcache/jit/zend_jit_internal.h @@ -157,7 +157,7 @@ typedef uintptr_t zend_jit_addr; zend_ival_is_last_use(ra[ssa_op->op], ssa_op - ssa->ops) \ ) : ZREG_NONE) -static zend_always_inline zend_jit_addr _zend_jit_decode_op(zend_uchar op_type, znode_op op, const zend_op *opline, zend_reg reg) +static zend_always_inline zend_jit_addr _zend_jit_decode_op(uint8_t op_type, znode_op op, const zend_op *opline, zend_reg reg) { if (op_type == IS_CONST) { #if ZEND_USE_ABS_CONST_ADDR diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index ce7bb1374440a..97a92848d7a6e 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -371,7 +371,7 @@ static int zend_jit_trace_may_exit(const zend_op_array *op_array, const zend_op return 0; } -static zend_always_inline uint32_t zend_jit_trace_type_to_info_ex(zend_uchar type, uint32_t info) +static zend_always_inline uint32_t zend_jit_trace_type_to_info_ex(uint8_t type, uint32_t info) { if (type == IS_UNKNOWN) { return info; @@ -386,7 +386,7 @@ static zend_always_inline uint32_t zend_jit_trace_type_to_info_ex(zend_uchar typ } } -static zend_always_inline uint32_t zend_jit_trace_type_to_info(zend_uchar type) +static zend_always_inline uint32_t zend_jit_trace_type_to_info(uint8_t type) { return zend_jit_trace_type_to_info_ex(type, -1); } @@ -479,7 +479,7 @@ static zend_jit_trace_stack_frame* zend_jit_trace_ret_frame(zend_jit_trace_stack return (zend_jit_trace_stack_frame*)((char*)frame - zend_jit_trace_frame_size(op_array)); } -static void zend_jit_trace_send_type(const zend_op *opline, zend_jit_trace_stack_frame *call, zend_uchar type) +static void zend_jit_trace_send_type(const zend_op *opline, zend_jit_trace_stack_frame *call, uint8_t type) { zend_jit_trace_stack *stack = call->stack; const zend_op_array *op_array = &call->func->op_array; @@ -1595,7 +1595,7 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin } if (i < parent_vars_count) { /* Initialize TSSA variable from parent trace */ - zend_uchar op_type = STACK_TYPE(parent_stack, i); + uint8_t op_type = STACK_TYPE(parent_stack, i); if (op_type != IS_UNKNOWN) { ssa_var_info[i].type &= zend_jit_trace_type_to_info(op_type); @@ -3857,7 +3857,7 @@ static void zend_jit_trace_update_condition_ranges(const zend_op *opline, const static bool zend_jit_may_skip_comparison(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_ssa *ssa, const zend_op **ssa_opcodes, const zend_op_array *op_array) { - zend_uchar prev_opcode; + uint8_t prev_opcode; if (opline->op1_type == IS_CONST && Z_TYPE_P(RT_CONSTANT(opline, opline->op1)) == IS_LONG @@ -3993,7 +3993,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par int num_op_arrays = 0; zend_jit_trace_info *t; const zend_op_array *op_arrays[ZEND_JIT_TRACE_MAX_FUNCS]; - zend_uchar smart_branch_opcode; + uint8_t smart_branch_opcode; const void *exit_addr; uint32_t op1_info, op1_def_info, op2_info, res_info, res_use_info, op1_data_info; bool send_result = 0; @@ -4010,7 +4010,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par uint32_t i; zend_jit_trace_stack_frame *frame, *top, *call; zend_jit_trace_stack *stack; - zend_uchar res_type = IS_UNKNOWN; + uint8_t res_type = IS_UNKNOWN; const zend_op *opline, *orig_opline; const zend_ssa_op *ssa_op, *orig_ssa_op; int checked_stack; @@ -5386,7 +5386,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par if (!left_frame) { for (j = 0 ; j < op_array->last_var; j++) { uint32_t info; - zend_uchar type; + uint8_t type; info = zend_ssa_cv_info(op_array, op_array_ssa, j); type = STACK_TYPE(stack, j); @@ -6225,7 +6225,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par /* Keep information about known types on abstract stack */ if (ssa_op->result_def >= 0) { - zend_uchar type = IS_UNKNOWN; + uint8_t type = IS_UNKNOWN; if ((opline->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0 || send_result) { @@ -6293,7 +6293,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par && (opline->opcode != ZEND_QM_ASSIGN || opline->result_type != IS_CV || opline->result.var != opline->op1.var)) { - zend_uchar type = IS_UNKNOWN; + uint8_t type = IS_UNKNOWN; if (!(ssa->var_info[ssa_op->op1_def].type & MAY_BE_GUARD) && has_concrete_type(ssa->var_info[ssa_op->op1_def].type)) { @@ -6354,7 +6354,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par && (opline->opcode != ZEND_ASSIGN || opline->op1_type != IS_CV || opline->op1.var != opline->op2.var)) { - zend_uchar type = IS_UNKNOWN; + uint8_t type = IS_UNKNOWN; if (!(ssa->var_info[ssa_op->op2_def].type & MAY_BE_GUARD) && has_concrete_type(ssa->var_info[ssa_op->op2_def].type)) { @@ -6405,7 +6405,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par ssa_op++; opline++; if (ssa_op->op1_def >= 0) { - zend_uchar type = IS_UNKNOWN; + uint8_t type = IS_UNKNOWN; if (!(ssa->var_info[ssa_op->op1_def].type & MAY_BE_GUARD) && has_concrete_type(ssa->var_info[ssa_op->op1_def].type)) { @@ -6441,7 +6441,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par opline++; while (opline->opcode == ZEND_RECV_INIT) { if (ssa_op->result_def >= 0) { - zend_uchar type = IS_UNKNOWN; + uint8_t type = IS_UNKNOWN; if (!(ssa->var_info[ssa_op->result_def].type & MAY_BE_GUARD) && has_concrete_type(ssa->var_info[ssa_op->result_def].type)) { @@ -6463,7 +6463,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par opline++; while (opline->opcode == ZEND_BIND_GLOBAL) { if (ssa_op->op1_def >= 0) { - zend_uchar type = IS_UNKNOWN; + uint8_t type = IS_UNKNOWN; if (!(ssa->var_info[ssa_op->op1_def].type & MAY_BE_GUARD) && has_concrete_type(ssa->var_info[ssa_op->op1_def].type)) { @@ -7539,7 +7539,7 @@ static void zend_jit_dump_exit_info(zend_jit_trace_info *t) fprintf(stderr, "/FREE_OP2"); } for (j = 0; j < stack_size; j++) { - zend_uchar type = STACK_TYPE(stack, j); + uint8_t type = STACK_TYPE(stack, j); if (type != IS_UNKNOWN) { fprintf(stderr, " "); zend_dump_var(op_array, (j < op_array->last_var) ? IS_CV : 0, j); diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index dc0f911ef613c..42785e285f7a3 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -1070,7 +1070,7 @@ static size_t tsrm_tls_offset; || has_concrete_type(src_info & MAY_BE_ANY)) { || if (Z_MODE(dst_addr) == IS_MEM_ZVAL) { || if ((dst_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_GUARD)) != (src_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_GUARD))) { -|| zend_uchar type = concrete_type(src_info); +|| uint8_t type = concrete_type(src_info); | SET_ZVAL_TYPE_INFO dst_addr, type || } || } @@ -1194,7 +1194,7 @@ static size_t tsrm_tls_offset; || } || if ((src_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE)) && || has_concrete_type(src_info & MAY_BE_ANY)) { -|| zend_uchar type = concrete_type(src_info); +|| uint8_t type = concrete_type(src_info); || if (Z_MODE(dst_addr) == IS_MEM_ZVAL) { || if ((dst_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_GUARD)) != (src_info & (MAY_BE_ANY|MAY_BE_UNDEF))) { | SET_ZVAL_TYPE_INFO dst_addr, type @@ -1375,7 +1375,7 @@ static size_t tsrm_tls_offset; || do { || if (!((var_info) & MAY_BE_GUARD) || && has_concrete_type((var_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) { -|| zend_uchar type = concrete_type((var_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); +|| uint8_t type = concrete_type((var_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); || if (type == IS_STRING && !ZEND_DEBUG) { | EXT_CALL _efree, r0 || break; @@ -3969,7 +3969,7 @@ static int zend_jit_load_var(dasm_State **Dst, uint32_t info, int var, zend_reg return zend_jit_load_reg(Dst, src, dst, info); } -static int zend_jit_invalidate_var_if_necessary(dasm_State **Dst, zend_uchar op_type, zend_jit_addr addr, znode_op op) +static int zend_jit_invalidate_var_if_necessary(dasm_State **Dst, uint8_t 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)) { zend_jit_addr dst = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op.var); @@ -4383,7 +4383,7 @@ static int zend_jit_opline_uses_reg(const zend_op *opline, int8_t reg) static int zend_jit_math_long_long(dasm_State **Dst, const zend_op *opline, - zend_uchar opcode, + uint8_t opcode, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, @@ -4593,7 +4593,7 @@ static int zend_jit_math_long_long(dasm_State **Dst, } static int zend_jit_math_long_double(dasm_State **Dst, - zend_uchar opcode, + uint8_t opcode, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, @@ -4638,7 +4638,7 @@ static int zend_jit_math_long_double(dasm_State **Dst, } static int zend_jit_math_double_long(dasm_State **Dst, - zend_uchar opcode, + uint8_t opcode, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, @@ -4731,7 +4731,7 @@ static int zend_jit_math_double_long(dasm_State **Dst, } static int zend_jit_math_double_double(dasm_State **Dst, - zend_uchar opcode, + uint8_t opcode, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, @@ -4811,12 +4811,12 @@ static int zend_jit_math_double_double(dasm_State **Dst, static int zend_jit_math_helper(dasm_State **Dst, const zend_op *opline, - zend_uchar opcode, - zend_uchar op1_type, + uint8_t opcode, + uint8_t op1_type, znode_op op1, zend_jit_addr op1_addr, uint32_t op1_info, - zend_uchar op2_type, + uint8_t op2_type, znode_op op2, zend_jit_addr op2_addr, uint32_t op2_info, @@ -5098,13 +5098,13 @@ static int zend_jit_add_arrays(dasm_State **Dst, const zend_op *opline, uint32_t static int zend_jit_long_math_helper(dasm_State **Dst, const zend_op *opline, - zend_uchar opcode, - zend_uchar op1_type, + uint8_t opcode, + uint8_t op1_type, znode_op op1, zend_jit_addr op1_addr, uint32_t op1_info, zend_ssa_range *op1_range, - zend_uchar op2_type, + uint8_t op2_type, znode_op op2, zend_jit_addr op2_addr, uint32_t op2_info, @@ -5494,11 +5494,11 @@ static int zend_jit_long_math(dasm_State **Dst, const zend_op *opline, uint32_t static int zend_jit_concat_helper(dasm_State **Dst, const zend_op *opline, - zend_uchar op1_type, + uint8_t op1_type, znode_op op1, zend_jit_addr op1_addr, uint32_t op1_info, - zend_uchar op2_type, + uint8_t op2_type, znode_op op2, zend_jit_addr op2_addr, uint32_t op2_info, @@ -6105,7 +6105,7 @@ static int zend_jit_simple_assign(dasm_State **Dst, zend_jit_addr var_addr, uint32_t var_info, uint32_t var_def_info, - zend_uchar val_type, + uint8_t val_type, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, @@ -6269,7 +6269,7 @@ static int zend_jit_simple_assign(dasm_State **Dst, static int zend_jit_assign_to_typed_ref(dasm_State **Dst, const zend_op *opline, - zend_uchar val_type, + uint8_t val_type, zend_jit_addr val_addr, zend_jit_addr res_addr, bool check_exception) @@ -6321,7 +6321,7 @@ static int zend_jit_assign_to_variable_call(dasm_State **Dst, zend_jit_addr var_addr, uint32_t __var_info, uint32_t __var_def_info, - zend_uchar val_type, + uint8_t val_type, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr __res_addr, @@ -6403,7 +6403,7 @@ static int zend_jit_assign_to_variable(dasm_State **Dst, zend_jit_addr var_addr, uint32_t var_info, uint32_t var_def_info, - zend_uchar val_type, + uint8_t val_type, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, @@ -7117,7 +7117,7 @@ static int zend_jit_cmp_long_long(dasm_State **Dst, zend_ssa_range *op2_range, zend_jit_addr op2_addr, zend_jit_addr res_addr, - zend_uchar smart_branch_opcode, + uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr, @@ -7379,7 +7379,7 @@ static int zend_jit_cmp_long_long(dasm_State **Dst, return 1; } -static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline, zend_jit_addr res_addr, bool swap, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline, zend_jit_addr res_addr, bool swap, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { if (smart_branch_opcode) { if (smart_branch_opcode == ZEND_JMPZ) { @@ -7682,7 +7682,7 @@ static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline, z return 1; } -static int zend_jit_cmp_long_double(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_cmp_long_double(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { zend_reg tmp_reg = ZREG_XMM0; @@ -7692,7 +7692,7 @@ static int zend_jit_cmp_long_double(dasm_State **Dst, const zend_op *opline, zen return zend_jit_cmp_double_common(Dst, opline, res_addr, 0, smart_branch_opcode, target_label, target_label2, exit_addr); } -static int zend_jit_cmp_double_long(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_cmp_double_long(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { zend_reg tmp_reg = ZREG_XMM0; @@ -7702,7 +7702,7 @@ static int zend_jit_cmp_double_long(dasm_State **Dst, const zend_op *opline, zen return zend_jit_cmp_double_common(Dst, opline, res_addr, /* swap */ 1, smart_branch_opcode, target_label, target_label2, exit_addr); } -static int zend_jit_cmp_double_double(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_cmp_double_double(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { bool swap = 0; @@ -7721,7 +7721,7 @@ static int zend_jit_cmp_double_double(dasm_State **Dst, const zend_op *opline, z return zend_jit_cmp_double_common(Dst, opline, res_addr, swap, smart_branch_opcode, target_label, target_label2, exit_addr); } -static int zend_jit_cmp_slow(dasm_State **Dst, const zend_op *opline, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_cmp_slow(dasm_State **Dst, const zend_op *opline, zend_jit_addr res_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { | test, eax, eax if (smart_branch_opcode) { @@ -7857,7 +7857,7 @@ static int zend_jit_cmp(dasm_State **Dst, zend_jit_addr op2_addr, zend_jit_addr res_addr, int may_throw, - zend_uchar smart_branch_opcode, + uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr, @@ -8101,7 +8101,7 @@ static int zend_jit_identical(dasm_State **Dst, zend_jit_addr op2_addr, zend_jit_addr res_addr, int may_throw, - zend_uchar smart_branch_opcode, + uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr, @@ -8485,7 +8485,7 @@ static int zend_jit_identical(dasm_State **Dst, return 1; } -static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, zend_jit_addr res_addr, uint32_t target_label, uint32_t target_label2, int may_throw, zend_uchar branch_opcode, const void *exit_addr) +static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, zend_jit_addr res_addr, uint32_t target_label, uint32_t target_label2, int may_throw, uint8_t branch_opcode, const void *exit_addr) { uint32_t true_label = -1; uint32_t false_label = -1; @@ -10866,7 +10866,7 @@ static int zend_jit_check_func_arg(dasm_State **Dst, const zend_op *opline) return 1; } -static int zend_jit_smart_true(dasm_State **Dst, const zend_op *opline, int jmp, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2) +static int zend_jit_smart_true(dasm_State **Dst, const zend_op *opline, int jmp, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2) { if (smart_branch_opcode) { if (smart_branch_opcode == ZEND_JMPZ) { @@ -10890,7 +10890,7 @@ static int zend_jit_smart_true(dasm_State **Dst, const zend_op *opline, int jmp, return 1; } -static int zend_jit_smart_false(dasm_State **Dst, const zend_op *opline, int jmp, zend_uchar smart_branch_opcode, uint32_t target_label) +static int zend_jit_smart_false(dasm_State **Dst, const zend_op *opline, int jmp, uint8_t smart_branch_opcode, uint32_t target_label) { if (smart_branch_opcode) { if (smart_branch_opcode == ZEND_JMPZ) { @@ -10914,7 +10914,7 @@ static int zend_jit_smart_false(dasm_State **Dst, const zend_op *opline, int jmp return 1; } -static int zend_jit_defined(dasm_State **Dst, const zend_op *opline, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_defined(dasm_State **Dst, const zend_op *opline, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { uint32_t defined_label = (uint32_t)-1; uint32_t undefined_label = (uint32_t)-1; @@ -11007,7 +11007,7 @@ static int zend_jit_defined(dasm_State **Dst, const zend_op *opline, zend_uchar return 1; } -static int zend_jit_type_check(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_type_check(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { uint32_t mask; zend_jit_addr op1_addr = OP1_ADDR(); @@ -11073,7 +11073,7 @@ static int zend_jit_type_check(dasm_State **Dst, const zend_op *opline, uint32_t } } else { bool invert = 0; - zend_uchar type; + uint8_t type; switch (mask) { case MAY_BE_NULL: type = IS_NULL; break; @@ -12017,7 +12017,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, |8: if (res_exit_addr) { - zend_uchar type = concrete_type(res_info); + uint8_t type = concrete_type(res_info); if ((op1_info & MAY_BE_ARRAY_OF_REF) && dim_type != IS_UNKNOWN @@ -12349,7 +12349,7 @@ static int zend_jit_isset_isempty_dim(dasm_State **Dst, uint32_t op2_info, uint8_t dim_type, int may_throw, - zend_uchar smart_branch_opcode, + uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) @@ -13129,7 +13129,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, zend_jit_trace_stack *stack = JIT_G(current_frame)->stack; int32_t exit_point; const void *exit_addr; - zend_uchar type; + uint8_t type; zend_jit_addr val_addr = prop_addr; if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) @@ -15232,7 +15232,7 @@ static bool zend_jit_verify_return_type(dasm_State **Dst, const zend_op *opline, return 1; } -static int zend_jit_isset_isempty_cv(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_isset_isempty_cv(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); @@ -15322,7 +15322,7 @@ static int zend_jit_fe_reset(dasm_State **Dst, const zend_op *opline, uint32_t o return 1; } -static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, uint32_t op2_info, unsigned int target_label, zend_uchar exit_opcode, const void *exit_addr) +static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, uint32_t op2_info, unsigned int target_label, uint8_t exit_opcode, const void *exit_addr) { zend_jit_addr op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var); @@ -15575,7 +15575,7 @@ static int zend_jit_fetch_constant(dasm_State **Dst, res_info &= ~MAY_BE_GUARD; ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD; - zend_uchar type = concrete_type(res_info); + uint8_t type = concrete_type(res_info); if (type < IS_STRING) { | IF_NOT_ZVAL_TYPE const_addr, type, &exit_addr @@ -15617,7 +15617,7 @@ static int zend_jit_fetch_constant(dasm_State **Dst, return 1; } -static int zend_jit_in_array(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) +static int zend_jit_in_array(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, uint8_t smart_branch_opcode, uint32_t target_label, uint32_t target_label2, const void *exit_addr) { HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2)); zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); @@ -16023,7 +16023,7 @@ static bool zend_jit_may_be_in_reg(const zend_op_array *op_array, zend_ssa *ssa, return 1; } -static bool zend_needs_extra_reg_for_const(const zend_op *opline, zend_uchar op_type, znode_op op) +static bool zend_needs_extra_reg_for_const(const zend_op *opline, uint8_t op_type, znode_op op) { |.if X64 || if (op_type == IS_CONST) { diff --git a/ext/zend_test/observer.c b/ext/zend_test/observer.c index e6be124b44458..5568755fe87ff 100644 --- a/ext/zend_test/observer.c +++ b/ext/zend_test/observer.c @@ -39,7 +39,7 @@ static void observer_set_user_opcode_handler(const char *opcode_names, user_opco while (1) { if (*e == ' ' || *e == ',' || *e == '\0') { if (s) { - zend_uchar opcode = zend_get_opcode_id(s, e - s); + uint8_t opcode = zend_get_opcode_id(s, e - s); if (opcode <= ZEND_VM_LAST_OPCODE) { zend_set_user_opcode_handler(opcode, handler); } else { diff --git a/main/main.c b/main/main.c index 65d7d4a03df10..c0a71b2afa9bd 100644 --- a/main/main.c +++ b/main/main.c @@ -417,7 +417,7 @@ static PHP_INI_MH(OnUpdateTimeout) /* }}} */ /* {{{ php_get_display_errors_mode() helper function */ -static zend_uchar php_get_display_errors_mode(zend_string *value) +static uint8_t php_get_display_errors_mode(zend_string *value) { if (!value) { return PHP_DISPLAY_ERRORS_STDOUT; @@ -440,7 +440,7 @@ static zend_uchar php_get_display_errors_mode(zend_string *value) return PHP_DISPLAY_ERRORS_STDOUT; } - zend_uchar mode = ZEND_ATOL(ZSTR_VAL(value)); + uint8_t mode = ZEND_ATOL(ZSTR_VAL(value)); if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode != PHP_DISPLAY_ERRORS_STDERR) { return PHP_DISPLAY_ERRORS_STDOUT; } @@ -461,7 +461,7 @@ static PHP_INI_MH(OnUpdateDisplayErrors) /* {{{ PHP_INI_DISP */ static PHP_INI_DISP(display_errors_mode) { - zend_uchar mode; + uint8_t mode; bool cgi_or_cli; zend_string *temporary_value; diff --git a/main/php_globals.h b/main/php_globals.h index 0e004bd011181..d5e372cf2b408 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -19,6 +19,8 @@ #include "zend_globals.h" +#include + typedef struct _php_core_globals php_core_globals; #ifdef ZTS @@ -65,7 +67,7 @@ struct _php_core_globals { zend_long memory_limit; zend_long max_input_time; - zend_uchar display_errors; + uint8_t display_errors; bool display_startup_errors; bool log_errors; bool ignore_repeated_errors; diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index fb2a7978dda85..de9a73ea45412 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -429,7 +429,7 @@ PHP_FUNCTION(phpdbg_start_oplog) PHPDBG_G(oplog_cur)->next = NULL; } -static zend_always_inline bool phpdbg_is_ignored_opcode(zend_uchar opcode) { +static zend_always_inline bool phpdbg_is_ignored_opcode(uint8_t opcode) { return opcode == ZEND_NOP || opcode == ZEND_OP_DATA || opcode == ZEND_FE_FREE || opcode == ZEND_FREE || opcode == ZEND_ASSERT_CHECK || opcode == ZEND_VERIFY_RETURN_TYPE || opcode == ZEND_DECLARE_CONST || opcode == ZEND_DECLARE_CLASS || opcode == ZEND_DECLARE_FUNCTION @@ -457,7 +457,7 @@ static void phpdbg_oplog_fill_executable(zend_op_array *op_array, HashTable *ins } for (; cur < end; cur++) { - zend_uchar opcode = cur->opcode; + uint8_t opcode = cur->opcode; if (phpdbg_is_ignored_opcode(opcode)) { continue; } diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c index 07a1fc7a0be5d..90f8ed7bb1295 100644 --- a/sapi/phpdbg/phpdbg_bp.c +++ b/sapi/phpdbg/phpdbg_bp.c @@ -31,7 +31,7 @@ static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_file(zend_op_array*); static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_symbol(zend_function*); static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_method(zend_op_array*); static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_opline(phpdbg_opline_ptr_t); -static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_opcode(zend_uchar); +static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_opcode(uint8_t); static inline phpdbg_breakbase_t *phpdbg_find_conditional_breakpoint(zend_execute_data *execute_data); /* }}} */ /* @@ -1009,7 +1009,7 @@ static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_opline(phpdbg_opline_pt return (phpdbg_breakbase_t *) brake; } /* }}} */ -static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_opcode(zend_uchar opcode) /* {{{ */ +static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_opcode(uint8_t opcode) /* {{{ */ { const char *opname = zend_get_opcode_name(opcode); diff --git a/sapi/phpdbg/phpdbg_bp.h b/sapi/phpdbg/phpdbg_bp.h index a6d6f29e5a985..e357b7388e699 100644 --- a/sapi/phpdbg/phpdbg_bp.h +++ b/sapi/phpdbg/phpdbg_bp.h @@ -39,7 +39,7 @@ typedef struct _zend_op *phpdbg_opline_ptr_t; /* }}} */ /* {{{ breakpoint base structure */ #define phpdbg_breakbase(name) \ int id; \ - zend_uchar type; \ + uint8_t type; \ zend_ulong hits; \ bool disabled; \ const char *name /* }}} */