Skip to content

Commit bbd8752

Browse files
committed
JIT: Fixed incorrect double/long register hinting
1 parent 617c156 commit bbd8752

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2822,7 +2822,9 @@ static zend_lifetime_interval** zend_jit_trace_allocate_registers(zend_jit_trace
28222822

28232823
while (phi) {
28242824
if (intervals[phi->ssa_var]) {
2825-
if (intervals[phi->sources[1]]) {
2825+
if (intervals[phi->sources[1]]
2826+
&& (ssa->var_info[phi->sources[1]].type & MAY_BE_ANY) ==
2827+
(ssa->var_info[phi->ssa_var].type & MAY_BE_ANY)) {
28262828
intervals[phi->sources[1]]->hint = intervals[phi->ssa_var];
28272829
}
28282830
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Register Alloction 005: Incorrect double/long register hinting
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 test() {
11+
$j = 0;
12+
for ($i = 1; $i < 10; $i++) {
13+
$i = 0.0;
14+
$j++;
15+
if ($j > 10) break;
16+
}
17+
}
18+
test();
19+
?>
20+
DONE
21+
--EXPECT--
22+
DONE

0 commit comments

Comments
 (0)