Skip to content

Commit

Permalink
We check result type guard in FETCH_DIM_R/IS only if index is long or…
Browse files Browse the repository at this point in the history
… string.
  • Loading branch information
dstogov committed Jul 30, 2020
1 parent 9dacc85 commit 8ea9e1a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions ext/opcache/jit/zend_jit_x86.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -10449,6 +10449,21 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, cons
if (!res_exit_addr) {
return 0;
}

if (!(op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF) - (MAY_BE_STRING|MAY_BE_LONG)))) {
old_info = STACK_INFO(stack, EX_VAR_TO_NUM(opline->result.var));
SET_STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var), IS_UNKNOWN);
SET_STACK_REG(stack, EX_VAR_TO_NUM(opline->result.var), ZREG_ZVAL_COPY_R0);
exit_point = zend_jit_trace_get_exit_point(opline, opline+1, NULL, flags);
SET_STACK_INFO(stack, EX_VAR_TO_NUM(opline->result.var), old_info);
res_exit_addr = zend_jit_trace_get_exit_addr(exit_point);
if (!res_exit_addr) {
return 0;
}
res_info &= ~MAY_BE_GUARD;
ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
}

if (opline->opcode == ZEND_FETCH_DIM_IS
&& !(res_info & MAY_BE_NULL)) {
old_info = STACK_INFO(stack, EX_VAR_TO_NUM(opline->result.var));
Expand All @@ -10461,8 +10476,6 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, cons
return 0;
}
}
res_info &= ~MAY_BE_GUARD;
ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
}

if (op1_info & MAY_BE_REF) {
Expand Down

0 comments on commit 8ea9e1a

Please sign in to comment.