Skip to content

Commit e8f14da

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Fix incorrect compilation of FE_FETCH with predicted empty array
2 parents 9f02a11 + 733b102 commit e8f14da

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14407,6 +14407,20 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o
1440714407
{
1440814408
zend_jit_addr op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
1440914409

14410+
if (!MAY_BE_HASH(op1_info) && !MAY_BE_PACKED(op1_info)) {
14411+
/* empty array */
14412+
if (exit_addr) {
14413+
if (exit_opcode == ZEND_JMP) {
14414+
| b &exit_addr
14415+
} else {
14416+
| b >3
14417+
}
14418+
} else {
14419+
| b =>target_label
14420+
}
14421+
return 1;
14422+
}
14423+
1441014424
| // array = EX_VAR(opline->op1.var);
1441114425
| // fe_ht = Z_ARRVAL_P(array);
1441214426
| GET_ZVAL_PTR FCARG1x, op1_addr, TMP1

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15324,6 +15324,20 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o
1532415324
{
1532515325
zend_jit_addr op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
1532615326

15327+
if (!MAY_BE_HASH(op1_info) && !MAY_BE_PACKED(op1_info)) {
15328+
/* empty array */
15329+
if (exit_addr) {
15330+
if (exit_opcode == ZEND_JMP) {
15331+
| jmp &exit_addr
15332+
} else {
15333+
| jmp >3
15334+
}
15335+
} else {
15336+
| jmp =>target_label
15337+
}
15338+
return 1;
15339+
}
15340+
1532715341
| // array = EX_VAR(opline->op1.var);
1532815342
| // fe_ht = Z_ARRVAL_P(array);
1532915343
| GET_ZVAL_PTR FCARG1a, op1_addr

0 commit comments

Comments
 (0)