diff options
Diffstat (limited to 'ext/opcache/jit')
-rw-r--r-- | ext/opcache/jit/zend_jit.c | 30 | ||||
-rw-r--r-- | ext/opcache/jit/zend_jit.h | 8 | ||||
-rw-r--r-- | ext/opcache/jit/zend_jit_helpers.c | 119 | ||||
-rw-r--r-- | ext/opcache/jit/zend_jit_internal.h | 6 | ||||
-rw-r--r-- | ext/opcache/jit/zend_jit_trace.c | 52 | ||||
-rw-r--r-- | ext/opcache/jit/zend_jit_vm_helpers.c | 2 | ||||
-rw-r--r-- | ext/opcache/jit/zend_jit_x86.dasc | 279 | ||||
-rw-r--r-- | ext/opcache/jit/zend_jit_x86.h | 2 |
8 files changed, 193 insertions, 305 deletions
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 1306bb36ba..ca3d9eccf0 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -124,14 +124,14 @@ static uint32_t zend_jit_trace_get_exit_point(const zend_op *to_opline, uint32_t static const void *zend_jit_trace_get_exit_addr(uint32_t n); static void zend_jit_trace_add_code(const void *start, uint32_t size); -static zend_bool dominates(const zend_basic_block *blocks, int a, int b) { +static bool dominates(const zend_basic_block *blocks, int a, int b) { while (blocks[b].level > blocks[a].level) { b = blocks[b].idom; } return a == b; } -static zend_bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa *ssa, int var, int use) +static bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa *ssa, int var, int use) { int next_use; @@ -165,7 +165,7 @@ static zend_bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ return 0; } -static zend_bool zend_ival_is_last_use(const zend_lifetime_interval *ival, int use) +static bool zend_ival_is_last_use(const zend_lifetime_interval *ival, int use) { if (ival->flags & ZREG_LAST_USE) { const zend_life_range *range = &ival->range; @@ -178,7 +178,7 @@ static zend_bool zend_ival_is_last_use(const zend_lifetime_interval *ival, int u return 0; } -static zend_bool zend_is_commutative(zend_uchar opcode) +static bool zend_is_commutative(zend_uchar opcode) { return opcode == ZEND_ADD || @@ -188,7 +188,7 @@ static zend_bool zend_is_commutative(zend_uchar opcode) opcode == ZEND_BW_XOR; } -static zend_bool zend_long_is_power_of_two(zend_long x) +static bool zend_long_is_power_of_two(zend_long x) { return (x > 0) && !(x & (x - 1)); } @@ -1044,7 +1044,7 @@ static int zend_jit_compute_block_order(zend_ssa *ssa, int *block_order) return end - block_order; } -static zend_bool zend_jit_in_loop(zend_ssa *ssa, int header, zend_basic_block *b) +static bool zend_jit_in_loop(zend_ssa *ssa, int header, zend_basic_block *b) { while (b->loop_header >= 0) { if (b->loop_header == header) { @@ -1435,7 +1435,7 @@ static uint32_t zend_interval_end(zend_lifetime_interval *ival) return range->end; } -static zend_bool zend_interval_covers(zend_lifetime_interval *ival, uint32_t position) +static bool zend_interval_covers(zend_lifetime_interval *ival, uint32_t position) { zend_life_range *range = &ival->range; @@ -1997,7 +1997,7 @@ static zend_lifetime_interval** zend_jit_allocate_registers(const zend_op_array ((intervals[i]->flags & ZREG_LOAD) || ((intervals[i]->flags & ZREG_STORE) && ssa->vars[i].definition >= 0)) && ssa->vars[i].use_chain < 0) { - zend_bool may_remove = 1; + bool may_remove = 1; zend_ssa_phi *phi = ssa->vars[i].phi_use_chain; while (phi) { @@ -2020,7 +2020,7 @@ static zend_lifetime_interval** zend_jit_allocate_registers(const zend_op_array (intervals[i]->flags & ZREG_STORE) && (ssa->vars[i].use_chain < 0 || zend_ssa_next_use(ssa->ops, i, ssa->vars[i].use_chain) < 0)) { - zend_bool may_remove = 1; + bool may_remove = 1; zend_ssa_phi *phi = ssa->vars[i].phi_use_chain; while (phi) { @@ -2070,14 +2070,14 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op int call_level = 0; void *checkpoint = NULL; zend_lifetime_interval **ra = NULL; - zend_bool is_terminated = 1; /* previous basic block is terminated by jump */ - zend_bool recv_emitted = 0; /* emitted at least one RECV opcode */ + 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; 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; zend_class_entry *ce; - zend_bool ce_is_instanceof; + bool ce_is_instanceof; if (JIT_G(bisect_limit)) { jit_bisect_pos++; @@ -2932,7 +2932,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op } } else { int j; - zend_bool left_frame = 0; + bool left_frame = 0; if (!zend_jit_return(&dasm_state, opline, op_array, op1_info, OP1_REG_ADDR())) { @@ -3629,7 +3629,7 @@ static void ZEND_FASTCALL zend_runtime_jit(void) /* JIT-ed code is going to be called by VM */ } -void zend_jit_check_funcs(HashTable *function_table, zend_bool is_method) { +void zend_jit_check_funcs(HashTable *function_table, bool is_method) { zend_op *opline; zend_function *func; zend_op_array *op_array; @@ -4209,7 +4209,7 @@ ZEND_EXT_API int zend_jit_check_support(void) return SUCCESS; } -ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, zend_bool reattached) +ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, bool reattached) { int ret; diff --git a/ext/opcache/jit/zend_jit.h b/ext/opcache/jit/zend_jit.h index fffac1edc2..0d71efa470 100644 --- a/ext/opcache/jit/zend_jit.h +++ b/ext/opcache/jit/zend_jit.h @@ -81,8 +81,8 @@ typedef struct _zend_jit_trace_stack_frame zend_jit_trace_stack_frame; typedef struct _sym_node zend_sym_node; typedef struct _zend_jit_globals { - zend_bool enabled; - zend_bool on; + bool enabled; + bool on; uint8_t trigger; uint8_t opt_level; uint32_t opt_flags; @@ -108,7 +108,7 @@ typedef struct _zend_jit_globals { zend_sym_node *symbols; /* symbols for disassembler */ - zend_bool tracing; + bool tracing; zend_jit_trace_rec *current_trace; zend_jit_trace_stack_frame *current_frame; @@ -137,7 +137,7 @@ ZEND_EXT_API void zend_jit_init(void); ZEND_EXT_API int zend_jit_config(zend_string *jit_options, int stage); ZEND_EXT_API int zend_jit_debug_config(zend_long old_val, zend_long new_val, int stage); ZEND_EXT_API int zend_jit_check_support(void); -ZEND_EXT_API int zend_jit_startup(void *jit_buffer, size_t size, zend_bool reattached); +ZEND_EXT_API int zend_jit_startup(void *jit_buffer, size_t size, bool reattached); ZEND_EXT_API void zend_jit_shutdown(void); ZEND_EXT_API void zend_jit_activate(void); ZEND_EXT_API void zend_jit_deactivate(void); diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 9fd4bddf15..696013f60f 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -272,18 +272,7 @@ static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_w(HashTable *ht, zend_long static zval* ZEND_FASTCALL zend_jit_hash_lookup_rw(HashTable *ht, zend_string *str) { zval *retval = zend_hash_find_ex(ht, str, 1); - - if (retval) { - if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) { - retval = Z_INDIRECT_P(retval); - if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { - if (UNEXPECTED(zend_undefined_index_write(ht, str) == FAILURE)) { - return NULL; - } - ZVAL_NULL(retval); - } - } - } else { + if (!retval) { /* Key may be released while throwing the undefined index warning. */ zend_string_addref(str); if (UNEXPECTED(zend_undefined_index_write(ht, str) == FAILURE)) { @@ -299,15 +288,7 @@ static zval* ZEND_FASTCALL zend_jit_hash_lookup_rw(HashTable *ht, zend_string *s static zval* ZEND_FASTCALL zend_jit_hash_lookup_w(HashTable *ht, zend_string *str) { zval *retval = zend_hash_find_ex(ht, str, 1); - - if (retval) { - if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) { - retval = Z_INDIRECT_P(retval); - if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { - ZVAL_NULL(retval); - } - } - } else { + if (!retval) { retval = zend_hash_add_new(ht, str, &EG(uninitialized_zval)); } return retval; @@ -344,17 +325,7 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_rw(HashTable *ht, zend_strin } while (0); retval = zend_hash_find(ht, str); - if (retval) { - if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) { - retval = Z_INDIRECT_P(retval); - if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { - if (UNEXPECTED(zend_undefined_index_write(ht, str) == FAILURE)) { - return NULL; - } - ZVAL_NULL(retval); - } - } - } else { + if (!retval) { /* Key may be released while throwing the undefined index warning. */ zend_string_addref(str); if (UNEXPECTED(zend_undefined_index_write(ht, str) == FAILURE)) { @@ -395,14 +366,7 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string } while (0); retval = zend_hash_find(ht, str); - if (retval) { - if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) { - retval = Z_INDIRECT_P(retval); - if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { - ZVAL_NULL(retval); - } - } - } else { + if (!retval) { retval = zend_hash_add_new(ht, str, &EG(uninitialized_zval)); } return retval; @@ -482,17 +446,7 @@ str_index: goto num_index; } retval = zend_hash_find(ht, offset_key); - if (retval) { - /* support for $GLOBALS[...] */ - if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) { - retval = Z_INDIRECT_P(retval); - if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { - zend_error(E_WARNING, "Undefined array key \"%s\"", ZSTR_VAL(offset_key)); - ZVAL_NULL(result); - return; - } - } - } else { + if (!retval) { zend_error(E_WARNING, "Undefined array key \"%s\"", ZSTR_VAL(offset_key)); ZVAL_NULL(result); return; @@ -557,16 +511,7 @@ str_index: goto num_index; } retval = zend_hash_find(ht, offset_key); - if (retval) { - /* support for $GLOBALS[...] */ - if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) { - retval = Z_INDIRECT_P(retval); - if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { - ZVAL_NULL(result); - return; - } - } - } else { + if (!retval) { ZVAL_NULL(result); return; } @@ -628,18 +573,13 @@ str_index: goto num_index; } retval = zend_hash_find(ht, offset_key); - if (retval) { - /* support for $GLOBALS[...] */ - if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) { - retval = Z_INDIRECT_P(retval); - } - if (UNEXPECTED(Z_TYPE_P(retval) == IS_REFERENCE)) { - retval = Z_REFVAL_P(retval); - } - return (Z_TYPE_P(retval) > IS_NULL); - } else { + if (!retval) { return 0; } + if (UNEXPECTED(Z_TYPE_P(retval) == IS_REFERENCE)) { + retval = Z_REFVAL_P(retval); + } + return Z_TYPE_P(retval) > IS_NULL; num_index: ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef); @@ -701,18 +641,7 @@ str_index: goto num_index; } retval = zend_hash_find(ht, offset_key); - if (retval) { - /* support for $GLOBALS[...] */ - if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) { - retval = Z_INDIRECT_P(retval); - if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { - if (UNEXPECTED(zend_undefined_index_write(ht, offset_key) == FAILURE)) { - return NULL; - } - ZVAL_NULL(retval); - } - } - } else { + if (!retval) { /* Key may be released while throwing the undefined index warning. */ zend_string_addref(offset_key); if (UNEXPECTED(zend_undefined_index_write(ht, offset_key) == FAILURE)) { @@ -785,15 +714,7 @@ str_index: goto num_index; } retval = zend_hash_find(ht, offset_key); - if (retval) { - /* support for $GLOBALS[...] */ - if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) { - retval = Z_INDIRECT_P(retval); - if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { - ZVAL_NULL(retval); - } - } - } else { + if (!retval) { retval = zend_hash_add_new(ht, offset_key, &EG(uninitialized_zval)); } return retval; @@ -1452,7 +1373,7 @@ check_indirect: return ref; } -static zend_always_inline zend_bool zend_jit_verify_type_common(zval *arg, zend_arg_info *arg_info, void **cache_slot) +static zend_always_inline bool zend_jit_verify_type_common(zval *arg, zend_arg_info *arg_info, void **cache_slot) { uint32_t type_mask; @@ -1510,12 +1431,12 @@ builtin_types: return 0; } -static zend_bool ZEND_FASTCALL zend_jit_verify_arg_slow(zval *arg, zend_arg_info *arg_info) +static bool ZEND_FASTCALL zend_jit_verify_arg_slow(zval *arg, zend_arg_info *arg_info) { zend_execute_data *execute_data = EG(current_execute_data); const zend_op *opline = EX(opline); void **cache_slot = CACHE_ADDR(opline->extended_value); - zend_bool ret; + bool ret; ret = zend_jit_verify_type_common(arg, arg_info, cache_slot); if (UNEXPECTED(!ret)) { @@ -1648,12 +1569,12 @@ static void ZEND_FASTCALL zend_jit_fetch_obj_is_dynamic(zend_object *zobj, intpt zend_jit_fetch_obj_is_slow(zobj); } -static zend_always_inline zend_bool promotes_to_array(zval *val) { +static zend_always_inline bool promotes_to_array(zval *val) { return Z_TYPE_P(val) <= IS_FALSE || (Z_ISREF_P(val) && Z_TYPE_P(Z_REFVAL_P(val)) <= IS_FALSE); } -static zend_always_inline zend_bool check_type_array_assignable(zend_type type) { +static zend_always_inline bool check_type_array_assignable(zend_type type) { if (!ZEND_TYPE_IS_SET(type)) { return 1; } @@ -1695,7 +1616,7 @@ static zend_never_inline ZEND_COLD void zend_throw_access_uninit_prop_by_ref_err zend_get_unmangled_property_name(prop->name)); } -static zend_never_inline zend_bool zend_handle_fetch_obj_flags( +static zend_never_inline bool zend_handle_fetch_obj_flags( zval *result, zval *ptr, zend_object *obj, zend_property_info *prop_info, uint32_t flags) { switch (flags) { @@ -1878,7 +1799,7 @@ static zend_property_info *zend_jit_get_prop_not_accepting_double(zend_reference return NULL; } -static ZEND_COLD void zend_jit_throw_incdec_ref_error(zend_reference *ref, zend_bool inc) +static ZEND_COLD void zend_jit_throw_incdec_ref_error(zend_reference *ref, bool inc) { zend_property_info *error_prop = zend_jit_get_prop_not_accepting_double(ref); /* Currently there should be no way for a typed reference to accept both int and double. diff --git a/ext/opcache/jit/zend_jit_internal.h b/ext/opcache/jit/zend_jit_internal.h index 917fa10f2e..906262773f 100644 --- a/ext/opcache/jit/zend_jit_internal.h +++ b/ext/opcache/jit/zend_jit_internal.h @@ -128,7 +128,7 @@ ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_func_counter_helper(ZEND_OPCODE_H ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_loop_counter_helper(ZEND_OPCODE_HANDLER_ARGS); void ZEND_FASTCALL zend_jit_copy_extra_args_helper(EXECUTE_DATA_D); -zend_bool ZEND_FASTCALL zend_jit_deprecated_helper(OPLINE_D); +bool ZEND_FASTCALL zend_jit_deprecated_helper(OPLINE_D); zend_constant* ZEND_FASTCALL zend_jit_get_constant(const zval *key, uint32_t flags); zend_constant* ZEND_FASTCALL zend_jit_check_constant(const zval *key); @@ -484,7 +484,7 @@ int ZEND_FASTCALL zend_jit_trace_hot_root(zend_execute_data *execute_data, const int ZEND_FASTCALL zend_jit_trace_exit(uint32_t exit_num, zend_jit_registers_buf *regs); zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *execute_data, const zend_op *opline, zend_jit_trace_rec *trace_buffer, uint8_t start, uint32_t is_megamorphc); -static zend_always_inline const zend_op* zend_jit_trace_get_exit_opline(zend_jit_trace_rec *trace, const zend_op *opline, zend_bool *exit_if_true) +static zend_always_inline const zend_op* zend_jit_trace_get_exit_opline(zend_jit_trace_rec *trace, const zend_op *opline, bool *exit_if_true) { if (trace->op == ZEND_JIT_TRACE_VM || trace->op == ZEND_JIT_TRACE_END) { if (trace->opline == opline + 1) { @@ -505,7 +505,7 @@ static zend_always_inline const zend_op* zend_jit_trace_get_exit_opline(zend_jit return NULL; } -static zend_always_inline zend_bool zend_jit_may_be_polymorphic_call(const zend_op *opline) +static zend_always_inline bool zend_jit_may_be_polymorphic_call(const zend_op *opline) { if (opline->opcode == ZEND_INIT_FCALL || opline->opcode == ZEND_INIT_FCALL_BY_NAME diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 69c4f79fa8..d0ca0e911d 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -2423,7 +2423,7 @@ static zend_lifetime_interval** zend_jit_trace_allocate_registers(zend_jit_trace if (p->op == ZEND_JIT_TRACE_VM) { const zend_op *opline = p->opline; int len; - zend_bool support_opline; + bool support_opline; support_opline = zend_jit_opline_supports_reg(op_array, ssa, opline, ssa_op, p); @@ -3085,7 +3085,7 @@ static void zend_jit_trace_setup_ret_counter(const zend_op *opline, size_t offse } } -static zend_bool zend_jit_may_delay_fetch_this(zend_ssa *ssa, const zend_op **ssa_opcodes, int var) +static bool zend_jit_may_delay_fetch_this(zend_ssa *ssa, const zend_op **ssa_opcodes, int var) { int i; int use = ssa->vars[var].use_chain; @@ -3176,11 +3176,11 @@ static int zend_jit_trace_deoptimization(dasm_State **Dst, zend_ssa *ssa, zend_jit_trace_stack *stack, zend_lifetime_interval **ra, - zend_bool polymorphic_side_trace) + bool polymorphic_side_trace) { int i; - zend_bool has_constants = 0; - zend_bool has_unsaved_vars = 0; + bool has_constants = 0; + bool has_unsaved_vars = 0; // TODO: Merge this loop with the following register LOAD loop to implement parallel move ??? for (i = 0; i < parent_vars_count; i++) { @@ -3317,7 +3317,7 @@ static void zend_jit_trace_set_var_range(zend_ssa_var_info *info, zend_long min, info->range.overflow = 0; } -static void zend_jit_trace_update_condition_ranges(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa, zend_bool exit_if_true) +static void zend_jit_trace_update_condition_ranges(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa, bool exit_if_true) { zend_long op1_min, op1_max, op2_min, op2_max; @@ -3435,7 +3435,7 @@ static void zend_jit_trace_update_condition_ranges(const zend_op *opline, const } } -static zend_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) +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) { zend_uchar prev_opcode; @@ -3537,14 +3537,14 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par zend_uchar smart_branch_opcode; const void *exit_addr; uint32_t op1_info, op1_def_info, op2_info, res_info, res_use_info, op1_data_info; - zend_bool send_result = 0; - zend_bool skip_comparison; + bool send_result = 0; + bool skip_comparison; zend_jit_addr op1_addr, op1_def_addr, op2_addr, op2_def_addr, res_addr; zend_class_entry *ce; - zend_bool ce_is_instanceof; - zend_bool delayed_fetch_this = 0; - zend_bool avoid_refcounting = 0; - zend_bool polymorphic_side_trace = + bool ce_is_instanceof; + bool delayed_fetch_this = 0; + bool avoid_refcounting = 0; + bool polymorphic_side_trace = parent_trace && (zend_jit_traces[parent_trace].exit_info[exit_num].flags & ZEND_JIT_EXIT_METHOD_CALL); uint32_t i; @@ -3817,7 +3817,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par uint8_t op3_type = p->op3_type; uint8_t orig_op1_type = op1_type; uint8_t orig_op2_type = op2_type; - zend_bool op1_indirect; + bool op1_indirect; zend_class_entry *op1_ce = NULL; zend_class_entry *op2_ce = NULL; @@ -4773,7 +4773,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par CHECK_OP1_TRACE_TYPE(); CHECK_OP2_TRACE_TYPE(); if ((opline->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) { - zend_bool exit_if_true = 0; + bool exit_if_true = 0; const zend_op *exit_opline = zend_jit_trace_get_exit_opline(p + 1, opline + 1, &exit_if_true); uint32_t exit_point; @@ -4821,7 +4821,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par CHECK_OP1_TRACE_TYPE(); CHECK_OP2_TRACE_TYPE(); if ((opline->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) { - zend_bool exit_if_true = 0; + bool exit_if_true = 0; const zend_op *exit_opline = zend_jit_trace_get_exit_opline(p + 1, opline + 1, &exit_if_true); uint32_t exit_point; @@ -4861,7 +4861,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par goto done; case ZEND_DEFINED: if ((opline->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) { - zend_bool exit_if_true = 0; + bool exit_if_true = 0; const zend_op *exit_opline = zend_jit_trace_get_exit_opline(p + 1, opline + 1, &exit_if_true); uint32_t exit_point = zend_jit_trace_get_exit_point(exit_opline, 0); @@ -4885,7 +4885,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par } op1_info = OP1_INFO(); if ((opline->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) { - zend_bool exit_if_true = 0; + bool exit_if_true = 0; const zend_op *exit_opline = zend_jit_trace_get_exit_opline(p + 1, opline + 1, &exit_if_true); uint32_t exit_point; @@ -4925,7 +4925,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par } else { int j; int may_throw = 0; - zend_bool left_frame = 0; + bool left_frame = 0; if (!zend_jit_return(&dasm_state, opline, op_array, op1_info, OP1_REG_ADDR())) { @@ -5081,7 +5081,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par CHECK_OP1_TRACE_TYPE(); } if ((opline->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) { - zend_bool exit_if_true = 0; + bool exit_if_true = 0; const zend_op *exit_opline = zend_jit_trace_get_exit_opline(p + 1, opline + 1, &exit_if_true); uint32_t exit_point = zend_jit_trace_get_exit_point(exit_opline, 0); @@ -5111,7 +5111,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par break; } if ((opline->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) { - zend_bool exit_if_true = 0; + bool exit_if_true = 0; const zend_op *exit_opline = zend_jit_trace_get_exit_opline(p + 1, opline + 1, &exit_if_true); uint32_t exit_point = zend_jit_trace_get_exit_point(exit_opline, 0); @@ -5274,7 +5274,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par op2_info = OP2_INFO(); CHECK_OP2_TRACE_TYPE(); if ((opline->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) { - zend_bool exit_if_true = 0; + bool exit_if_true = 0; const zend_op *exit_opline = zend_jit_trace_get_exit_opline(p + 1, opline + 1, &exit_if_true); uint32_t exit_point; @@ -6408,7 +6408,7 @@ static const void *zend_jit_trace_exit_to_vm(uint32_t trace_num, uint32_t exit_n const zend_op *opline; uint32_t stack_size; zend_jit_trace_stack *stack; - zend_bool original_handler = 0; + bool original_handler = 0; if (!zend_jit_trace_exit_needs_deoptimization(trace_num, exit_num)) { return dasm_labels[zend_lbtrace_escape]; @@ -6589,7 +6589,7 @@ static void zend_jit_blacklist_root_trace(const zend_op *opline, size_t offset) zend_shared_alloc_unlock(); } -static zend_bool zend_jit_trace_is_bad_root(const zend_op *opline, zend_jit_trace_stop stop, size_t offset) +static bool zend_jit_trace_is_bad_root(const zend_op *opline, zend_jit_trace_stop stop, size_t offset) { const zend_op **cache_opline = JIT_G(bad_root_cache_opline); uint8_t *cache_count = JIT_G(bad_root_cache_count); @@ -7054,7 +7054,7 @@ static void zend_jit_blacklist_trace_exit(uint32_t trace_num, uint32_t exit_num) zend_shared_alloc_unlock(); } -static zend_bool zend_jit_trace_exit_is_bad(uint32_t trace_num, uint32_t exit_num) +static bool zend_jit_trace_exit_is_bad(uint32_t trace_num, uint32_t exit_num) { uint8_t *counter = JIT_G(exit_counters) + zend_jit_traces[trace_num].exit_counters + exit_num; @@ -7066,7 +7066,7 @@ static zend_bool zend_jit_trace_exit_is_bad(uint32_t trace_num, uint32_t exit_nu return 0; } -static zend_bool zend_jit_trace_exit_is_hot(uint32_t trace_num, uint32_t exit_num) +static bool zend_jit_trace_exit_is_hot(uint32_t trace_num, uint32_t exit_num) { uint8_t *counter = JIT_G(exit_counters) + zend_jit_traces[trace_num].exit_counters + exit_num; diff --git a/ext/opcache/jit/zend_jit_vm_helpers.c b/ext/opcache/jit/zend_jit_vm_helpers.c index d919b59c9e..9a7b205340 100644 --- a/ext/opcache/jit/zend_jit_vm_helpers.c +++ b/ext/opcache/jit/zend_jit_vm_helpers.c @@ -161,7 +161,7 @@ void ZEND_FASTCALL zend_jit_copy_extra_args_helper(EXECUTE_DATA_D) } } -zend_bool ZEND_FASTCALL zend_jit_deprecated_helper(OPLINE_D) +bool ZEND_FASTCALL zend_jit_deprecated_helper(OPLINE_D) { zend_execute_data *call = (zend_execute_data *) opline; zend_function *fbc = call->func; diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 93e95886aa..5700a92ff1 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -1628,12 +1628,12 @@ static void* dasm_labels[zend_lb_MAX]; || } |.endmacro -static zend_bool reuse_ip = 0; -static zend_bool delayed_call_chain = 0; +static bool reuse_ip = 0; +static bool delayed_call_chain = 0; static uint32_t delayed_call_level = 0; static const zend_op *last_valid_opline = NULL; -static zend_bool use_last_vald_opline = 0; -static zend_bool track_last_valid_opline = 0; +static bool use_last_vald_opline = 0; +static bool track_last_valid_opline = 0; static int jit_return_label = -1; static uint32_t current_trace_num = 0; static uint32_t allowed_opt_flags = 0; @@ -1652,7 +1652,7 @@ static void zend_jit_use_last_valid_opline(void) } } -static zend_bool zend_jit_trace_uses_initial_ip(void) +static bool zend_jit_trace_uses_initial_ip(void) { return use_last_vald_opline; } @@ -1716,12 +1716,12 @@ static uint32_t floor_log2(uint32_t x) return ones32(x) - 1; } -static zend_bool is_power_of_two(uint32_t x) +static bool is_power_of_two(uint32_t x) { return !(x & (x - 1)) && x != 0; } -static zend_bool has_concrete_type(uint32_t value_type) +static bool has_concrete_type(uint32_t value_type) { return is_power_of_two (value_type & (MAY_BE_ANY|MAY_BE_UNDEF)); } @@ -1731,7 +1731,7 @@ static uint32_t concrete_type(uint32_t value_type) return floor_log2(value_type & (MAY_BE_ANY|MAY_BE_UNDEF)); } -static inline zend_bool is_signed(double d) +static inline bool is_signed(double d) { return (((unsigned char*)&d)[sizeof(double)-1] & 0x80) != 0; } @@ -2651,7 +2651,7 @@ static int zend_jit_assign_to_variable(dasm_State **Dst, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, - zend_bool check_exception); + bool check_exception); static int zend_jit_assign_const_stub(dasm_State **Dst) { @@ -3397,7 +3397,7 @@ static int zend_jit_trace_link_to_root(dasm_State **Dst, zend_jit_trace_info *t, return 1; } -static int zend_jit_trace_return(dasm_State **Dst, zend_bool original_handler) +static int zend_jit_trace_return(dasm_State **Dst, bool original_handler) { #if 0 | jmp ->trace_escape @@ -3549,7 +3549,7 @@ static int zend_jit_trace_handler(dasm_State **Dst, const zend_op_array *op_arra zend_jit_trace_stack *stack = JIT_G(current_frame)->stack; if (zend_is_smart_branch(opline)) { - zend_bool exit_if_true = 0; + bool exit_if_true = 0; exit_opline = zend_jit_trace_get_exit_opline(trace, opline + 1, &exit_if_true); } else { switch (opline->opcode) { @@ -3756,7 +3756,7 @@ static int zend_jit_call(dasm_State **Dst, const zend_op *opline, unsigned int n #endif } -static int zend_jit_spill_store(dasm_State **Dst, zend_jit_addr src, zend_jit_addr dst, uint32_t info, zend_bool set_type) +static int zend_jit_spill_store(dasm_State **Dst, zend_jit_addr src, zend_jit_addr dst, uint32_t info, bool set_type) { ZEND_ASSERT(Z_MODE(src) == IS_REG); ZEND_ASSERT(Z_MODE(dst) == IS_MEM_ZVAL); @@ -3792,7 +3792,7 @@ static int zend_jit_load_reg(dasm_State **Dst, zend_jit_addr src, zend_jit_addr return 1; } -static int zend_jit_store_var(dasm_State **Dst, uint32_t info, int var, zend_reg reg, zend_bool set_type) +static int zend_jit_store_var(dasm_State **Dst, uint32_t info, int var, zend_reg reg, bool set_type) { zend_jit_addr src = ZEND_ADDR_REG(reg); zend_jit_addr dst = ZEND_ADDR_MEM_ZVAL(ZREG_FP, EX_NUM_TO_VAR(var)); @@ -3813,7 +3813,7 @@ static int zend_jit_store_var_if_necessary_ex(dasm_State **Dst, int var, zend_ji { if (Z_MODE(src) == IS_REG && Z_STORE(src)) { zend_jit_addr dst = ZEND_ADDR_MEM_ZVAL(ZREG_FP, var); - zend_bool set_type = 1; + bool set_type = 1; if ((info & (MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)) == (old_info & (MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF))) { @@ -4210,7 +4210,7 @@ static int zend_jit_math_long_long(dasm_State **Dst, uint32_t res_use_info, int may_overflow) { - zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr); + bool same_ops = zend_jit_same_addr(op1_addr, op2_addr); zend_reg result_reg; zend_reg tmp_reg = ZREG_R0; @@ -4520,7 +4520,7 @@ static int zend_jit_math_double_double(dasm_State **Dst, zend_jit_addr res_addr, uint32_t res_use_info) { - zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr); + bool same_ops = zend_jit_same_addr(op1_addr, op2_addr); zend_reg result_reg; if (Z_MODE(res_addr) == IS_REG) { @@ -4611,7 +4611,7 @@ static int zend_jit_math_helper(dasm_State **Dst, int may_throw) /* Labels: 1,2,3,4,5,6 */ { - zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr); + bool same_ops = zend_jit_same_addr(op1_addr, op2_addr); if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG)) { if (op1_info & (MAY_BE_ANY-MAY_BE_LONG)) { @@ -4864,7 +4864,7 @@ static int zend_jit_long_math_helper(dasm_State **Dst, int may_throw) /* Labels: 6 */ { - zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr); + bool same_ops = zend_jit_same_addr(op1_addr, op2_addr); zend_reg result_reg; zval tmp; @@ -5283,8 +5283,8 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o } if (op2_info & MAY_BE_LONG) { - zend_bool op2_loaded = 0; - zend_bool packed_loaded = 0; + bool op2_loaded = 0; + bool packed_loaded = 0; if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_LONG)) { | // if (EXPECTED(Z_TYPE_P(dim) == IS_LONG)) @@ -5572,10 +5572,6 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o } else { | jz >9 // NOT_FOUND } - | // if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) - | IF_NOT_Z_TYPE r0, IS_INDIRECT, >1 - | GET_Z_PTR r0, r0 - |1: break; case BP_VAR_R: case BP_VAR_IS: @@ -5602,40 +5598,25 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o | jz >7 // NOT_FOUND } else { | jz >2 // NOT_FOUND - } - | // if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) - | IF_Z_TYPE r0, IS_INDIRECT, >1 // SLOW - |.cold_code - |1: - | // retval = Z_INDIRECT_P(retval); - | GET_Z_PTR r0, r0 - | IF_NOT_Z_TYPE r0, IS_UNDEF, >8 - if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE && type == BP_VAR_R) { - | jmp &exit_addr - } else if (type == BP_VAR_IS && not_found_exit_addr) { - | jmp ¬_found_exit_addr - } - |2: - switch (type) { - case BP_VAR_R: - if (JIT_G(trigger) != ZEND_JIT_ON_HOT_TRACE) { + |.cold_code + |2: + switch (type) { + case BP_VAR_R: // zend_error(E_WARNING, "Undefined array key \"%s\"", ZSTR_VAL(offset_key)); | UNDEFINED_INDEX opline | jmp >9 - } - break; - case BP_VAR_IS: - case BP_VAR_UNSET: - if (!not_found_exit_addr && !found_exit_addr) { + break; + case BP_VAR_IS: + case BP_VAR_UNSET: | // retval = &EG(uninitialized_zval); | SET_ZVAL_TYPE_INFO res_addr, IS_NULL | jmp >9 - } - break; - default: - ZEND_UNREACHABLE(); + break; + default: + ZEND_UNREACHABLE(); + } + |.code } - |.code break; case BP_VAR_RW: | SET_EX_OPLINE opline, r0 @@ -5904,7 +5885,7 @@ static int zend_jit_assign_to_typed_ref(dasm_State **Dst, const zend_op *opline, zend_uchar val_type, zend_jit_addr val_addr, - zend_bool check_exception) + bool check_exception) { | // if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(variable_ptr)))) { | cmp aword [FCARG1a + offsetof(zend_reference, sources.ptr)], 0 @@ -5951,7 +5932,7 @@ static int zend_jit_assign_to_variable_call(dasm_State **Dst, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr __res_addr, - zend_bool __check_exception) + bool __check_exception) { if (Z_MODE(var_addr) != IS_MEM_ZVAL || Z_REG(var_addr) != ZREG_FCARG1a || Z_OFFSET(var_addr) != 0) { | LOAD_ZVAL_ADDR FCARG1a, var_addr @@ -5997,7 +5978,7 @@ static int zend_jit_assign_to_variable(dasm_State **Dst, zend_jit_addr val_addr, uint32_t val_info, zend_jit_addr res_addr, - zend_bool check_exception) + bool check_exception) /* Labels: 1,2,3,4,5,8 */ { int done = 0; @@ -6038,7 +6019,7 @@ static int zend_jit_assign_to_variable(dasm_State **Dst, in_cold = 1; } if (Z_REG(var_use_addr) == ZREG_FCARG1a || Z_REG(var_use_addr) == ZREG_R0) { - zend_bool keep_gc = 0; + bool keep_gc = 0; | GET_ZVAL_PTR Ra(tmp_reg), var_use_addr if (tmp_reg == ZREG_FCARG1a) { @@ -6661,7 +6642,7 @@ static int zend_jit_is_constant_cmp_long_long(const zend_op *opline, zend_jit_addr op1_addr, zend_ssa_range *op2_range, zend_jit_addr op2_addr, - zend_bool *result) + bool *result) { zend_long op1_min; zend_long op1_max; @@ -6746,10 +6727,10 @@ static int zend_jit_cmp_long_long(dasm_State **Dst, uint32_t target_label, uint32_t target_label2, const void *exit_addr, - zend_bool skip_comparison) + bool skip_comparison) { - zend_bool swap = 0; - zend_bool result; + bool swap = 0; + bool result; if (zend_jit_is_constant_cmp_long_long(opline, op1_range, op1_addr, op2_range, op2_addr, &result)) { if (!smart_branch_opcode || @@ -7040,7 +7021,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, zend_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, zend_uchar 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) { @@ -7399,7 +7380,7 @@ static int zend_jit_cmp_double_long(dasm_State **Dst, const zend_op *opline, zen 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) { - zend_bool swap = 0; + bool swap = 0; if (Z_MODE(op1_addr) == IS_REG) { | SSE_AVX_OP ucomisd, vucomisd, Z_REG(op1_addr), op2_addr @@ -7575,10 +7556,10 @@ static int zend_jit_cmp(dasm_State **Dst, uint32_t target_label, uint32_t target_label2, const void *exit_addr, - zend_bool skip_comparison) + bool skip_comparison) { - zend_bool same_ops = (opline->op1_type == opline->op2_type) && (opline->op1.var == opline->op2.var); - zend_bool has_slow; + bool same_ops = (opline->op1_type == opline->op2_type) && (opline->op1.var == opline->op2.var); + bool has_slow; has_slow = (op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) && @@ -7814,7 +7795,7 @@ static int zend_jit_identical(dasm_State **Dst, uint32_t target_label, uint32_t target_label2, const void *exit_addr, - zend_bool skip_comparison) + bool skip_comparison) { uint32_t identical_label = (uint32_t)-1; uint32_t not_identical_label = (uint32_t)-1; @@ -8190,10 +8171,10 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_ { uint32_t true_label = -1; uint32_t false_label = -1; - zend_bool set_bool = 0; - zend_bool set_bool_not = 0; - zend_bool set_delayed = 0; - zend_bool jmp_done = 0; + bool set_bool = 0; + bool set_bool_not = 0; + bool set_delayed = 0; + bool jmp_done = 0; if (branch_opcode == ZEND_BOOL) { set_bool = 1; @@ -8734,7 +8715,7 @@ static int zend_jit_stack_check(dasm_State **Dst, const zend_op *opline, uint32_ return 1; } -static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_function *func, zend_bool is_closure, zend_bool use_this, zend_bool stack_check) +static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_function *func, bool is_closure, bool use_this, bool stack_check) { uint32_t used_stack; @@ -9172,7 +9153,7 @@ static int zend_jit_init_fcall_guard(dasm_State **Dst, uint32_t level, const zen return 1; } -static int zend_jit_init_fcall(dasm_State **Dst, const zend_op *opline, uint32_t b, const zend_op_array *op_array, zend_ssa *ssa, const zend_ssa_op *ssa_op, int call_level, zend_jit_trace_rec *trace, zend_bool stack_check) +static int zend_jit_init_fcall(dasm_State **Dst, const zend_op *opline, uint32_t b, const zend_op_array *op_array, zend_ssa *ssa, const zend_ssa_op *ssa_op, int call_level, zend_jit_trace_rec *trace, bool stack_check) { zend_func_info *info = ZEND_FUNC_INFO(op_array); zend_call_info *call_info = NULL; @@ -9334,12 +9315,12 @@ static int zend_jit_init_method_call(dasm_State **Dst, uint32_t op1_info, zend_jit_addr op1_addr, zend_class_entry *ce, - zend_bool ce_is_instanceof, - zend_bool use_this, + bool ce_is_instanceof, + bool use_this, zend_class_entry *trace_ce, zend_jit_trace_rec *trace, - zend_bool stack_check, - zend_bool polymorphic_side_trace) + bool stack_check, + bool polymorphic_side_trace) { zend_func_info *info = ZEND_FUNC_INFO(op_array); zend_call_info *call_info = NULL; @@ -9583,7 +9564,7 @@ static int zend_jit_init_closure_call(dasm_State **Dst, const zend_ssa_op *ssa_op, int call_level, zend_jit_trace_rec *trace, - zend_bool stack_check) + bool stack_check) { zend_function *func = NULL; zend_jit_addr op2_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op2.var); @@ -9709,7 +9690,7 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend uint32_t i; zend_jit_addr res_addr; uint32_t call_num_args = 0; - zend_bool unknown_num_args = 0; + bool unknown_num_args = 0; const void *exit_addr = NULL; const zend_op *prev_opline; @@ -10239,7 +10220,7 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend if (!RETURN_VALUE_USED(opline)) { zend_class_entry *ce; - zend_bool ce_is_instanceof; + bool ce_is_instanceof; uint32_t func_info = call_info ? zend_get_func_info(call_info, ssa, &ce, &ce_is_instanceof) : (MAY_BE_ANY|MAY_BE_REF|MAY_BE_RC1|MAY_BE_RCN); @@ -11185,17 +11166,17 @@ static int zend_jit_leave_func(dasm_State **Dst, const zend_op_array *op_array, const zend_op *opline, uint32_t op1_info, - zend_bool left_frame, + bool left_frame, zend_jit_trace_rec *trace, zend_jit_trace_info *trace_info, int indirect_var_access, int may_throw) { - zend_bool may_be_top_frame = + bool may_be_top_frame = JIT_G(trigger) != ZEND_JIT_ON_HOT_TRACE || !JIT_G(current_frame) || !TRACE_FRAME_IS_NESTED(JIT_G(current_frame)); - zend_bool may_need_call_helper = + bool may_need_call_helper = indirect_var_access || /* may have symbol table */ !op_array->function_name || /* may have symbol table */ may_be_top_frame || @@ -11204,7 +11185,7 @@ static int zend_jit_leave_func(dasm_State **Dst, !JIT_G(current_frame) || TRACE_FRAME_NUM_ARGS(JIT_G(current_frame)) == -1 || /* unknown number of args */ (uint32_t)TRACE_FRAME_NUM_ARGS(JIT_G(current_frame)) > op_array->num_args; /* extra args */ - zend_bool may_need_release_this = + bool may_need_release_this = !(op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->scope && !(op_array->fn_flags & ZEND_ACC_STATIC) && @@ -11618,7 +11599,7 @@ static int zend_jit_zval_copy_deref(dasm_State **Dst, zend_jit_addr res_addr, ze return 1; } -static zend_bool zend_jit_may_avoid_refcounting(const zend_op *opline) +static bool zend_jit_may_avoid_refcounting(const zend_op *opline) { switch (opline->opcode) { case ZEND_FETCH_OBJ_FUNC_ARG: @@ -11661,7 +11642,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_ssa_op *ssa_op, uint32_t op1_info, zend_jit_addr op1_addr, - zend_bool op1_avoid_refcounting, + bool op1_avoid_refcounting, uint32_t op2_info, uint32_t res_info, zend_jit_addr res_addr, @@ -11671,7 +11652,7 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const void *exit_addr = NULL; const void *not_found_exit_addr = NULL; const void *res_exit_addr = NULL; - zend_bool result_avoid_refcounting = 0; + bool result_avoid_refcounting = 0; uint32_t may_be_string = (opline->opcode != ZEND_FETCH_LIST_R) ? MAY_BE_STRING : 0; orig_op1_addr = OP1_ADDR(); @@ -12172,7 +12153,7 @@ static int zend_jit_isset_isempty_dim(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, - zend_bool op1_avoid_refcounting, + bool op1_avoid_refcounting, uint32_t op2_info, int may_throw, zend_uchar smart_branch_opcode, @@ -12430,10 +12411,10 @@ static int zend_jit_bind_global(dasm_State **Dst, const zend_op *opline, uint32_ return 1; } -static int zend_jit_verify_arg_type(dasm_State **Dst, const zend_op *opline, zend_arg_info *arg_info, zend_bool check_exception) +static int zend_jit_verify_arg_type(dasm_State **Dst, const zend_op *opline, zend_arg_info *arg_info, bool check_exception) { zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); - zend_bool in_cold = 0; + bool in_cold = 0; uint32_t type_mask = ZEND_TYPE_PURE_MASK(arg_info->type) & MAY_BE_ANY; zend_reg tmp_reg = (type_mask == 0 || is_power_of_two(type_mask)) ? ZREG_FCARG1a : ZREG_R0; @@ -12554,7 +12535,7 @@ static int zend_jit_recv(dasm_State **Dst, const zend_op *opline, const zend_op_ return 1; } -static int zend_jit_recv_init(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_bool is_last, int may_throw) +static int zend_jit_recv_init(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, bool is_last, int may_throw) { uint32_t arg_num = opline->op1.num; zval *zv = RT_CONSTANT(opline, opline->op2); @@ -12630,7 +12611,7 @@ static int zend_jit_recv_init(dasm_State **Dst, const zend_op *opline, const zen return 1; } -static zend_property_info* zend_get_known_property_info(zend_class_entry *ce, zend_string *member, zend_bool on_this, zend_string *filename) +static zend_property_info* zend_get_known_property_info(zend_class_entry *ce, zend_string *member, bool on_this, zend_string *filename) { zend_property_info *info = NULL; @@ -12682,7 +12663,7 @@ static zend_property_info* zend_get_known_property_info(zend_class_entry *ce, ze return info; } -static zend_bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *member, zend_bool on_this, zend_string *filename) +static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *member, bool on_this, zend_string *filename) { zend_property_info *info; @@ -12743,17 +12724,17 @@ static int zend_jit_fetch_obj(dasm_State **Dst, const zend_ssa_op *ssa_op, uint32_t op1_info, zend_jit_addr op1_addr, - zend_bool op1_indirect, + bool op1_indirect, zend_class_entry *ce, - zend_bool ce_is_instanceof, - zend_bool use_this, - zend_bool op1_avoid_refcounting, + bool ce_is_instanceof, + bool use_this, + bool op1_avoid_refcounting, zend_class_entry *trace_ce, int may_throw) { zval *member; zend_property_info *prop_info; - zend_bool may_be_dynamic = 1; + bool may_be_dynamic = 1; zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); zend_jit_addr this_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, offsetof(zend_execute_data, This)); zend_jit_addr prop_addr; @@ -12954,7 +12935,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst, ssa->var_info[ssa_op->result_def].indirect_reference = 1; } } else { - zend_bool result_avoid_refcounting = 0; + bool result_avoid_refcounting = 0; if ((res_info & MAY_BE_GUARD) && JIT_G(current_frame) && prop_info) { uint32_t flags = 0; @@ -13134,10 +13115,10 @@ static int zend_jit_incdec_obj(dasm_State **Dst, const zend_ssa_op *ssa_op, uint32_t op1_info, zend_jit_addr op1_addr, - zend_bool op1_indirect, + bool op1_indirect, zend_class_entry *ce, - zend_bool ce_is_instanceof, - zend_bool use_this, + bool ce_is_instanceof, + bool use_this, zend_class_entry *trace_ce, int may_throw) { @@ -13147,7 +13128,7 @@ static int zend_jit_incdec_obj(dasm_State **Dst, zend_jit_addr this_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, offsetof(zend_execute_data, This)); zend_jit_addr res_addr = 0; zend_jit_addr prop_addr; - zend_bool needs_slow_path = 0; + bool needs_slow_path = 0; ZEND_ASSERT(opline->op2_type == IS_CONST); ZEND_ASSERT(op1_info & MAY_BE_OBJECT); @@ -13510,10 +13491,10 @@ static int zend_jit_assign_obj_op(dasm_State **Dst, zend_jit_addr op1_addr, uint32_t val_info, zend_ssa_range *val_range, - zend_bool op1_indirect, + bool op1_indirect, zend_class_entry *ce, - zend_bool ce_is_instanceof, - zend_bool use_this, + bool ce_is_instanceof, + bool use_this, zend_class_entry *trace_ce, int may_throw) { @@ -13523,7 +13504,7 @@ static int zend_jit_assign_obj_op(dasm_State **Dst, zend_jit_addr val_addr = OP1_DATA_ADDR(); zend_jit_addr this_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, offsetof(zend_execute_data, This)); zend_jit_addr prop_addr; - zend_bool needs_slow_path = 0; + bool needs_slow_path = 0; binary_op_type binary_op = get_binary_op(opline->extended_value); ZEND_ASSERT(opline->op2_type == IS_CONST); @@ -13840,10 +13821,10 @@ static int zend_jit_assign_obj(dasm_State **Dst, uint32_t op1_info, zend_jit_addr op1_addr, uint32_t val_info, - zend_bool op1_indirect, + bool op1_indirect, zend_class_entry *ce, - zend_bool ce_is_instanceof, - zend_bool use_this, + bool ce_is_instanceof, + bool use_this, zend_class_entry *trace_ce, int may_throw) { @@ -13854,7 +13835,7 @@ static int zend_jit_assign_obj(dasm_State **Dst, zend_jit_addr res_addr = 0; zend_jit_addr this_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, offsetof(zend_execute_data, This)); zend_jit_addr prop_addr; - zend_bool needs_slow_path = 0; + bool needs_slow_path = 0; if (RETURN_VALUE_USED(opline)) { res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var); @@ -14271,7 +14252,7 @@ static int zend_jit_load_this(dasm_State **Dst, uint32_t var) return 1; } -static int zend_jit_fetch_this(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_bool check_only) +static int zend_jit_fetch_this(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, bool check_only) { if (!op_array->scope || (op_array->fn_flags & ZEND_ACC_STATIC)) { if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) { @@ -14679,13 +14660,13 @@ static int zend_jit_switch(dasm_State **Dst, const zend_op *opline, const zend_o return 1; } -static zend_bool zend_jit_verify_return_type(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info) +static bool zend_jit_verify_return_type(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info) { zend_arg_info *arg_info = &op_array->arg_info[-1]; ZEND_ASSERT(ZEND_TYPE_IS_SET(arg_info->type)); zend_jit_addr op1_addr = OP1_ADDR(); - zend_bool needs_slow_check = 1; - zend_bool slow_check_in_cold = 1; + bool needs_slow_check = 1; + bool slow_check_in_cold = 1; uint32_t type_mask = ZEND_TYPE_PURE_MASK(arg_info->type) & MAY_BE_ANY; if (type_mask == 0) { @@ -14848,21 +14829,21 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o | // array = EX_VAR(opline->op1.var); | // fe_ht = Z_ARRVAL_P(array); - | GET_ZVAL_PTR FCARG2a, op1_addr + | GET_ZVAL_PTR FCARG1a, op1_addr | // pos = Z_FE_POS_P(array); - | mov FCARG1d, dword [FP + opline->op1.var + offsetof(zval, u2.fe_pos)] + | mov eax, dword [FP + opline->op1.var + offsetof(zval, u2.fe_pos)] | // p = fe_ht->arData + pos; |.if X64 || ZEND_ASSERT(sizeof(Bucket) == 32); - | mov eax, FCARG1d - | shl r0, 5 + | mov FCARG2d, eax + | shl FCARG2a, 5 |.else - | imul r0, FCARG1a, sizeof(Bucket) + | imul FCARG2a, r0, sizeof(Bucket) |.endif - | add r0, aword [FCARG2a + offsetof(zend_array, arData)] + | add FCARG2a, aword [FCARG1a + offsetof(zend_array, arData)] |1: | // if (UNEXPECTED(pos >= fe_ht->nNumUsed)) { - | cmp dword [FCARG2a + offsetof(zend_array, nNumUsed)], FCARG1d + | cmp dword [FCARG1a + offsetof(zend_array, nNumUsed)], eax | // ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value); | // ZEND_VM_CONTINUE(); if (exit_addr) { @@ -14875,28 +14856,16 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o | jbe =>target_label } | // pos++; - | add FCARG1d, 1 + | add eax, 1 | // value_type = Z_TYPE_INFO_P(value); | // if (EXPECTED(value_type != IS_UNDEF)) { - | IF_Z_TYPE r0, IS_UNDEF, >2 if (!exit_addr || exit_opcode == ZEND_JMP) { - | IF_NOT_Z_TYPE r0, IS_INDIRECT, >3 + | IF_NOT_Z_TYPE FCARG2a, IS_UNDEF, >3 } else { - | IF_NOT_Z_TYPE r0, IS_INDIRECT, &exit_addr + | IF_NOT_Z_TYPE FCARG2a, IS_UNDEF, &exit_addr } - | // value = Z_INDIRECT_P(value); - | GET_Z_PTR FCARG2a, r0 - | // value_type = Z_TYPE_INFO_P(value); - | // if (EXPECTED(value_type != IS_UNDEF)) { - if (!exit_addr || exit_opcode == ZEND_JMP) { - | IF_NOT_Z_TYPE FCARG2a, IS_UNDEF, >4 - } else { - | IF_NOT_Z_TYPE r0, IS_UNDEF, &exit_addr - } - | GET_ZVAL_PTR FCARG2a, op1_addr // reload - |2: | // p++; - | add r0, sizeof(Bucket) + | add FCARG2a, sizeof(Bucket) | jmp <1 |3: @@ -14905,10 +14874,8 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op2.var); uint32_t val_info; - | mov FCARG2a, r0 - |4: | // Z_FE_POS_P(array) = pos + 1; - | mov dword [FP + opline->op1.var + offsetof(zval, u2.fe_pos)], FCARG1d + | mov dword [FP + opline->op1.var + offsetof(zval, u2.fe_pos)], eax if (RETURN_VALUE_USED(opline)) { zend_jit_addr res_addr = RES_ADDR(); @@ -14916,19 +14883,19 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o if ((op1_info & MAY_BE_ARRAY_KEY_LONG) && (op1_info & MAY_BE_ARRAY_KEY_STRING)) { | // if (!p->key) { - | cmp aword [r0 + offsetof(Bucket, key)], 0 + | cmp aword [FCARG2a + offsetof(Bucket, key)], 0 | jz >2 } if (op1_info & MAY_BE_ARRAY_KEY_STRING) { | // ZVAL_STR_COPY(EX_VAR(opline->result.var), p->key); - | mov FCARG1a, aword [r0 + offsetof(Bucket, key)] - | SET_ZVAL_PTR res_addr, FCARG1a - | test dword [FCARG1a + offsetof(zend_refcounted, gc.u.type_info)], IS_STR_INTERNED + | mov r0, aword [FCARG2a + offsetof(Bucket, key)] + | SET_ZVAL_PTR res_addr, r0 + | test dword [r0 + offsetof(zend_refcounted, gc.u.type_info)], IS_STR_INTERNED | jz >1 | SET_ZVAL_TYPE_INFO res_addr, IS_STRING | jmp >3 |1: - | GC_ADDREF FCARG1a + | GC_ADDREF r0 | SET_ZVAL_TYPE_INFO res_addr, IS_STRING_EX if (op1_info & MAY_BE_ARRAY_KEY_LONG) { @@ -14938,8 +14905,8 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o } if (op1_info & MAY_BE_ARRAY_KEY_LONG) { | // ZVAL_LONG(EX_VAR(opline->result.var), p->h); - | mov FCARG1a, aword [r0 + offsetof(Bucket, h)] - | SET_ZVAL_LVAL res_addr, FCARG1a + | mov r0, aword [FCARG2a + offsetof(Bucket, h)] + | SET_ZVAL_LVAL res_addr, r0 | SET_ZVAL_TYPE_INFO res_addr, IS_LONG } |3: @@ -15094,7 +15061,7 @@ static int zend_jit_in_array(dasm_State **Dst, const zend_op *opline, uint32_t o return 1; } -static zend_bool zend_jit_noref_guard(dasm_State **Dst, const zend_op *opline, zend_jit_addr var_addr) +static bool zend_jit_noref_guard(dasm_State **Dst, const zend_op *opline, zend_jit_addr var_addr) { int32_t exit_point = zend_jit_trace_get_exit_point(opline, 0); const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point); @@ -15107,7 +15074,7 @@ static zend_bool zend_jit_noref_guard(dasm_State **Dst, const zend_op *opline, z return 1; } -static zend_bool zend_jit_fetch_reference(dasm_State **Dst, const zend_op *opline, uint8_t var_type, uint32_t *var_info_ptr, zend_jit_addr *var_addr_ptr, zend_bool add_ref_guard, zend_bool add_type_guard) +static bool zend_jit_fetch_reference(dasm_State **Dst, const zend_op *opline, uint8_t var_type, uint32_t *var_info_ptr, zend_jit_addr *var_addr_ptr, bool add_ref_guard, bool add_type_guard) { zend_jit_addr var_addr = *var_addr_ptr; uint32_t var_info = *var_info_ptr; @@ -15163,7 +15130,7 @@ static zend_bool zend_jit_fetch_reference(dasm_State **Dst, const zend_op *oplin return 1; } -static zend_bool zend_jit_fetch_indirect_var(dasm_State **Dst, const zend_op *opline, uint8_t var_type, uint32_t *var_info_ptr, zend_jit_addr *var_addr_ptr, zend_bool add_indirect_guard) +static bool zend_jit_fetch_indirect_var(dasm_State **Dst, const zend_op *opline, uint8_t var_type, uint32_t *var_info_ptr, zend_jit_addr *var_addr_ptr, bool add_indirect_guard) { zend_jit_addr var_addr = *var_addr_ptr; uint32_t var_info = *var_info_ptr; @@ -15226,7 +15193,7 @@ static zend_bool zend_jit_fetch_indirect_var(dasm_State **Dst, const zend_op *op return 1; } -static zend_bool zend_jit_may_reuse_reg(const zend_op *opline, const zend_ssa_op *ssa_op, zend_ssa *ssa, int def_var, int use_var) +static bool zend_jit_may_reuse_reg(const zend_op *opline, const zend_ssa_op *ssa_op, zend_ssa *ssa, int def_var, int use_var) { if ((ssa->var_info[def_var].type & ~MAY_BE_GUARD) != (ssa->var_info[use_var].type & ~MAY_BE_GUARD)) { return 0; @@ -15258,7 +15225,7 @@ static zend_bool zend_jit_may_reuse_reg(const zend_op *opline, const zend_ssa_op return 0; } -static zend_bool zend_jit_opline_supports_reg(const zend_op_array *op_array, zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op, zend_jit_trace_rec *trace) +static bool zend_jit_opline_supports_reg(const zend_op_array *op_array, zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op, zend_jit_trace_rec *trace) { uint32_t op1_info, op2_info; @@ -15329,7 +15296,7 @@ static zend_bool zend_jit_opline_supports_reg(const zend_op_array *op_array, zen return 0; } -static zend_bool zend_jit_var_supports_reg(zend_ssa *ssa, int var) +static bool zend_jit_var_supports_reg(zend_ssa *ssa, int var) { if (ssa->vars[var].no_val) { /* we don't need the value */ @@ -15363,7 +15330,7 @@ static zend_bool zend_jit_var_supports_reg(zend_ssa *ssa, int var) return 1; } -static zend_bool zend_jit_may_be_in_reg(const zend_op_array *op_array, zend_ssa *ssa, int var) +static bool zend_jit_may_be_in_reg(const zend_op_array *op_array, zend_ssa *ssa, int var) { if (!zend_jit_var_supports_reg(ssa, var)) { return 0; @@ -15391,7 +15358,7 @@ static zend_bool zend_jit_may_be_in_reg(const zend_op_array *op_array, zend_ssa return 1; } -static zend_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, zend_uchar op_type, znode_op op) { |.if X64 || if (op_type == IS_CONST) { @@ -15406,7 +15373,7 @@ static zend_bool zend_needs_extra_reg_for_const(const zend_op *opline, zend_ucha return 0; } -static zend_regset zend_jit_get_def_scratch_regset(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa, int current_var, zend_bool last_use) +static zend_regset zend_jit_get_def_scratch_regset(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa, int current_var, bool last_use) { uint32_t op1_info, op2_info; @@ -15428,7 +15395,7 @@ static zend_regset zend_jit_get_def_scratch_regset(const zend_op *opline, const return ZEND_REGSET_EMPTY; } -static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa, int current_var, zend_bool last_use) +static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa, int current_var, bool last_use) { uint32_t op1_info, op2_info, res_info; zend_regset regset = ZEND_REGSET_SCRATCH; diff --git a/ext/opcache/jit/zend_jit_x86.h b/ext/opcache/jit/zend_jit_x86.h index 10a82db14f..e9476ebb31 100644 --- a/ext/opcache/jit/zend_jit_x86.h +++ b/ext/opcache/jit/zend_jit_x86.h @@ -318,7 +318,7 @@ static zend_always_inline zend_jit_addr _zend_jit_decode_op(zend_uchar op_type, #define OP1_DATA_DEF_REG_ADDR() \ OP_REG_ADDR(opline + 1, op1_type, op1, op1_def) -static zend_always_inline zend_bool zend_jit_same_addr(zend_jit_addr addr1, zend_jit_addr addr2) +static zend_always_inline bool zend_jit_same_addr(zend_jit_addr addr1, zend_jit_addr addr2) { if (addr1 == addr2) { return 1; |