Skip to content

Commit

Permalink
Fix GH-10635: ARM64 function JIT causes impossible assertion (#10638)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov authored Feb 21, 2023
1 parent 08e7591 commit 70ff10a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ext/opcache/jit/zend_jit_arm64.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -7722,7 +7722,6 @@ static int zend_jit_identical(dasm_State **Dst,
}
op1_addr = real_addr;
}
| LOAD_ZVAL_ADDR FCARG1x, op1_addr
}
if (opline->op2_type != IS_CONST) {
if (Z_MODE(op2_addr) == IS_REG) {
Expand All @@ -7734,6 +7733,9 @@ static int zend_jit_identical(dasm_State **Dst,
}
| LOAD_ZVAL_ADDR FCARG2x, op2_addr
}
if (opline->op1_type != IS_CONST) {
| LOAD_ZVAL_ADDR FCARG1x, op1_addr
}
}

if ((op1_info & op2_info & MAY_BE_ANY) == 0) {
Expand Down
4 changes: 3 additions & 1 deletion ext/opcache/jit/zend_jit_x86.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -8309,7 +8309,6 @@ static int zend_jit_identical(dasm_State **Dst,
}
op1_addr = real_addr;
}
| LOAD_ZVAL_ADDR FCARG1a, op1_addr
}
if (opline->op2_type != IS_CONST) {
if (Z_MODE(op2_addr) == IS_REG) {
Expand All @@ -8321,6 +8320,9 @@ static int zend_jit_identical(dasm_State **Dst,
}
| LOAD_ZVAL_ADDR FCARG2a, op2_addr
}
if (opline->op1_type != IS_CONST) {
| LOAD_ZVAL_ADDR FCARG1a, op1_addr
}
}

if ((op1_info & op2_info & MAY_BE_ANY) == 0) {
Expand Down
19 changes: 19 additions & 0 deletions ext/opcache/tests/jit/identical_003.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
JIT IDENTICAL: 003 register allocation
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
opcache.protect_memory=1
--EXTENSIONS--
opcache
--FILE--
<?php
function foo(array $a, int|float $n) {
var_dump(count($a) === $n);
}
foo([1], 1);
?>
--EXPECT--
bool(true)

0 comments on commit 70ff10a

Please sign in to comment.