Skip to content

Commit 0ba9216

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: JIT: Fix register clobbering
2 parents 159a89b + 62a1c06 commit 0ba9216

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
@@ -15102,6 +15102,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1510215102
if (op1_info & MAY_BE_DOUBLE) {
1510315103
regset = ZEND_REGSET(ZREG_FPR0);
1510415104
}
15105+
if (opline->result_type != IS_UNUSED && (op1_info & MAY_BE_LONG)) {
15106+
ZEND_REGSET_INCL(regset, ZREG_REG1);
15107+
}
1510515108
}
1510615109
break;
1510715110
case ZEND_ADD:

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16012,6 +16012,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1601216012
if (op1_info & MAY_BE_DOUBLE) {
1601316013
regset = ZEND_REGSET(ZREG_XMM0);
1601416014
}
16015+
if (opline->result_type != IS_UNUSED && (op1_info & MAY_BE_LONG)) {
16016+
ZEND_REGSET_INCL(regset, ZREG_R1);
16017+
}
1601516018
}
1601616019
break;
1601716020
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)