Skip to content

Commit

Permalink
JIT: Fixed incorrect double/long register hinting
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Oct 8, 2021
1 parent 617c156 commit bbd8752
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ext/opcache/jit/zend_jit_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2822,7 +2822,9 @@ static zend_lifetime_interval** zend_jit_trace_allocate_registers(zend_jit_trace

while (phi) {
if (intervals[phi->ssa_var]) {
if (intervals[phi->sources[1]]) {
if (intervals[phi->sources[1]]
&& (ssa->var_info[phi->sources[1]].type & MAY_BE_ANY) ==
(ssa->var_info[phi->ssa_var].type & MAY_BE_ANY)) {
intervals[phi->sources[1]]->hint = intervals[phi->ssa_var];
}
}
Expand Down
22 changes: 22 additions & 0 deletions ext/opcache/tests/jit/reg_alloc_005.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Register Alloction 005: Incorrect double/long register hinting
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
function test() {
$j = 0;
for ($i = 1; $i < 10; $i++) {
$i = 0.0;
$j++;
if ($j > 10) break;
}
}
test();
?>
DONE
--EXPECT--
DONE

0 comments on commit bbd8752

Please sign in to comment.