Skip to content

Commit d3dda1e

Browse files
committed
Fixed overflow handling
1 parent 66f2ebe commit d3dda1e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,6 +1899,10 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
18991899
ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
19001900
}
19011901
}
1902+
if (opline->result_type != IS_UNUSED
1903+
&& (res_info & (MAY_BE_ANY|MAY_BE_GUARD)) == (MAY_BE_LONG|MAY_BE_GUARD)) {
1904+
ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
1905+
}
19021906
goto done;
19031907
case ZEND_BW_OR:
19041908
case ZEND_BW_AND:

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3411,10 +3411,14 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_
34113411
| LONG_OP_WITH_CONST sub, op1_def_addr, Z_L(1)
34123412
}
34133413

3414-
if (may_overflow && (op1_def_info & MAY_BE_GUARD)) {
3414+
if (may_overflow && ((op1_def_info & MAY_BE_GUARD) || (opline->result_type != IS_UNUSED && (res_info & MAY_BE_GUARD)))) {
34153415
int32_t exit_point = zend_jit_trace_get_exit_point(opline, opline, NULL);
34163416
const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point);
34173417
| jo &exit_addr
3418+
if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
3419+
opline->result_type != IS_UNUSED) {
3420+
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
3421+
}
34183422
} else if (may_overflow) {
34193423
| jo >1
34203424
if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&

0 commit comments

Comments
 (0)