From: Dmitry Stogov Date: Thu, 30 Jul 2020 16:19:10 +0000 (+0300) Subject: We check result type guard in FETCH_DIM_R/IS only if index is long or string. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ea9e1ae4cc2fb0fda44bc2b15f648874ccac2e3;p=php We check result type guard in FETCH_DIM_R/IS only if index is long or string. --- diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 840d54a607..8dd771c302 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -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)); @@ -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) {