Skip to content

Commit

Permalink
Avoid redundand argument type verification
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Aug 29, 2021
1 parent 67d6c2d commit 66a4437
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ext/opcache/jit/zend_jit_arm64.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -11520,6 +11520,17 @@ static int zend_jit_verify_arg_type(dasm_State **Dst, const zend_op *opline, zen
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_FCARG1x : ZREG_REG0;

if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE
&& JIT_G(current_frame)
&& JIT_G(current_frame)->prev) {
zend_jit_trace_stack *stack = JIT_G(current_frame)->stack;
uint8_t type = STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var));

if (type != IS_UNKNOWN && (type_mask & (1u << type))) {
return 1;
}
}

if (ZEND_ARG_SEND_MODE(arg_info)) {
if (opline->opcode == ZEND_RECV_INIT) {
| LOAD_ZVAL_ADDR Rx(tmp_reg), res_addr
Expand Down
11 changes: 11 additions & 0 deletions ext/opcache/jit/zend_jit_x86.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -12186,6 +12186,17 @@ static int zend_jit_verify_arg_type(dasm_State **Dst, const zend_op *opline, zen
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;

if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE
&& JIT_G(current_frame)
&& JIT_G(current_frame)->prev) {
zend_jit_trace_stack *stack = JIT_G(current_frame)->stack;
uint8_t type = STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var));

if (type != IS_UNKNOWN && (type_mask & (1u << type))) {
return 1;
}
}

if (ZEND_ARG_SEND_MODE(arg_info)) {
if (opline->opcode == ZEND_RECV_INIT) {
| LOAD_ZVAL_ADDR Ra(tmp_reg), res_addr
Expand Down

0 comments on commit 66a4437

Please sign in to comment.