Skip to content

Commit 733b102

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix incorrect compilation of FE_FETCH with predicted empty array
2 parents 6660599 + 7d68f91 commit 733b102

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
@@ -15328,6 +15328,20 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o
1532815328
{
1532915329
zend_jit_addr op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
1533015330

15331+
if (!MAY_BE_HASH(op1_info) && !MAY_BE_PACKED(op1_info)) {
15332+
/* empty array */
15333+
if (exit_addr) {
15334+
if (exit_opcode == ZEND_JMP) {
15335+
| jmp &exit_addr
15336+
} else {
15337+
| jmp >3
15338+
}
15339+
} else {
15340+
| jmp =>target_label
15341+
}
15342+
return 1;
15343+
}
15344+
1533115345
| // array = EX_VAR(opline->op1.var);
1533215346
| // fe_ht = Z_ARRVAL_P(array);
1533315347
| GET_ZVAL_PTR FCARG1a, op1_addr

0 commit comments

Comments
 (0)