Skip to content

Commit 8ea9e1a

Browse files
committed
We check result type guard in FETCH_DIM_R/IS only if index is long or string.
1 parent 9dacc85 commit 8ea9e1a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10449,6 +10449,21 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, cons
1044910449
if (!res_exit_addr) {
1045010450
return 0;
1045110451
}
10452+
10453+
if (!(op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF) - (MAY_BE_STRING|MAY_BE_LONG)))) {
10454+
old_info = STACK_INFO(stack, EX_VAR_TO_NUM(opline->result.var));
10455+
SET_STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var), IS_UNKNOWN);
10456+
SET_STACK_REG(stack, EX_VAR_TO_NUM(opline->result.var), ZREG_ZVAL_COPY_R0);
10457+
exit_point = zend_jit_trace_get_exit_point(opline, opline+1, NULL, flags);
10458+
SET_STACK_INFO(stack, EX_VAR_TO_NUM(opline->result.var), old_info);
10459+
res_exit_addr = zend_jit_trace_get_exit_addr(exit_point);
10460+
if (!res_exit_addr) {
10461+
return 0;
10462+
}
10463+
res_info &= ~MAY_BE_GUARD;
10464+
ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
10465+
}
10466+
1045210467
if (opline->opcode == ZEND_FETCH_DIM_IS
1045310468
&& !(res_info & MAY_BE_NULL)) {
1045410469
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
1046110476
return 0;
1046210477
}
1046310478
}
10464-
res_info &= ~MAY_BE_GUARD;
10465-
ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
1046610479
}
1046710480

1046810481
if (op1_info & MAY_BE_REF) {

0 commit comments

Comments
 (0)