Skip to content

Commit 7d68f91

Browse files
committed
Fix incorrect compilation of FE_FETCH with predicted empty array
Fixes ext/opcache/tests/sccp_loop_var_free.phpt with opcache.jit=1205 and opcache.optimization_level=0
1 parent b5e9bf7 commit 7d68f91

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

+14
Original file line numberDiff line numberDiff line change
@@ -14536,6 +14536,20 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o
1453614536
{
1453714537
zend_jit_addr op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
1453814538

14539+
if (!MAY_BE_HASH(op1_info) && !MAY_BE_PACKED(op1_info)) {
14540+
/* empty array */
14541+
if (exit_addr) {
14542+
if (exit_opcode == ZEND_JMP) {
14543+
| b &exit_addr
14544+
} else {
14545+
| b >3
14546+
}
14547+
} else {
14548+
| b =>target_label
14549+
}
14550+
return 1;
14551+
}
14552+
1453914553
| // array = EX_VAR(opline->op1.var);
1454014554
| // fe_ht = Z_ARRVAL_P(array);
1454114555
| GET_ZVAL_PTR FCARG1x, op1_addr, TMP1

ext/opcache/jit/zend_jit_x86.dasc

+14
Original file line numberDiff line numberDiff line change
@@ -15438,6 +15438,20 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o
1543815438
{
1543915439
zend_jit_addr op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
1544015440

15441+
if (!MAY_BE_HASH(op1_info) && !MAY_BE_PACKED(op1_info)) {
15442+
/* empty array */
15443+
if (exit_addr) {
15444+
if (exit_opcode == ZEND_JMP) {
15445+
| jmp &exit_addr
15446+
} else {
15447+
| jmp >3
15448+
}
15449+
} else {
15450+
| jmp =>target_label
15451+
}
15452+
return 1;
15453+
}
15454+
1544115455
| // array = EX_VAR(opline->op1.var);
1544215456
| // fe_ht = Z_ARRVAL_P(array);
1544315457
| GET_ZVAL_PTR FCARG1a, op1_addr

0 commit comments

Comments
 (0)