Skip to content

Commit 84cd1cc

Browse files
committed
Fix phpGH-10635: ARM64 function JIT causes impossible assertion
1 parent 08e7591 commit 84cd1cc

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7722,7 +7722,6 @@ static int zend_jit_identical(dasm_State **Dst,
77227722
}
77237723
op1_addr = real_addr;
77247724
}
7725-
| LOAD_ZVAL_ADDR FCARG1x, op1_addr
77267725
}
77277726
if (opline->op2_type != IS_CONST) {
77287727
if (Z_MODE(op2_addr) == IS_REG) {
@@ -7734,6 +7733,9 @@ static int zend_jit_identical(dasm_State **Dst,
77347733
}
77357734
| LOAD_ZVAL_ADDR FCARG2x, op2_addr
77367735
}
7736+
if (opline->op1_type != IS_CONST) {
7737+
| LOAD_ZVAL_ADDR FCARG1x, op1_addr
7738+
}
77377739
}
77387740

77397741
if ((op1_info & op2_info & MAY_BE_ANY) == 0) {

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8309,7 +8309,6 @@ static int zend_jit_identical(dasm_State **Dst,
83098309
}
83108310
op1_addr = real_addr;
83118311
}
8312-
| LOAD_ZVAL_ADDR FCARG1a, op1_addr
83138312
}
83148313
if (opline->op2_type != IS_CONST) {
83158314
if (Z_MODE(op2_addr) == IS_REG) {
@@ -8321,6 +8320,9 @@ static int zend_jit_identical(dasm_State **Dst,
83218320
}
83228321
| LOAD_ZVAL_ADDR FCARG2a, op2_addr
83238322
}
8323+
if (opline->op1_type != IS_CONST) {
8324+
| LOAD_ZVAL_ADDR FCARG1a, op1_addr
8325+
}
83248326
}
83258327

83268328
if ((op1_info & op2_info & MAY_BE_ANY) == 0) {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
JIT IDENTICAL: 003 register allocation
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
--EXTENSIONS--
10+
opcache
11+
--FILE--
12+
<?php
13+
function foo(array $a, int|float $n) {
14+
var_dump(count($a) === $n);
15+
}
16+
foo([1], 1);
17+
?>
18+
--EXPECT--
19+
bool(true)

0 commit comments

Comments
 (0)