Skip to content

Commit 62a1c06

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: JIT: Fix register clobbering
2 parents 21b0da8 + cf83bdd commit 62a1c06

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15162,6 +15162,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1516215162
if (op1_info & MAY_BE_DOUBLE) {
1516315163
regset = ZEND_REGSET(ZREG_FPR0);
1516415164
}
15165+
if (opline->result_type != IS_UNUSED && (op1_info & MAY_BE_LONG)) {
15166+
ZEND_REGSET_INCL(regset, ZREG_REG1);
15167+
}
1516515168
}
1516615169
break;
1516715170
case ZEND_ADD:

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16074,6 +16074,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1607416074
if (op1_info & MAY_BE_DOUBLE) {
1607516075
regset = ZEND_REGSET(ZREG_XMM0);
1607616076
}
16077+
if (opline->result_type != IS_UNUSED && (op1_info & MAY_BE_LONG)) {
16078+
ZEND_REGSET_INCL(regset, ZREG_R1);
16079+
}
1607716080
}
1607816081
break;
1607916082
case ZEND_ADD:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Register Alloction 014: Register clobbering
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
function foo() {
11+
for($cnt = 0; $cnt < 6; $cnt++) {
12+
$e = $a-- + $a-- + $a *= $a;
13+
for ($i = 0; $i <= .1; $i++);
14+
}
15+
}
16+
foo();
17+
?>
18+
DONE
19+
--EXPECTF--
20+
Warning: Undefined variable $a in %sreg_alloc_014.php on line 4
21+
DONE

0 commit comments

Comments
 (0)