Skip to content

Commit 34d22ac

Browse files
committed
Tracing JIT: Fixed incorrect guard elimination
1 parent 66d93c6 commit 34d22ac

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4130,8 +4130,10 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
41304130
zend_may_throw(opline, ssa_op, op_array, ssa))) {
41314131
goto jit_failure;
41324132
}
4133-
if ((res_info & (MAY_BE_ANY|MAY_BE_GUARD)) == (MAY_BE_LONG|MAY_BE_GUARD)
4134-
|| (res_info & (MAY_BE_ANY|MAY_BE_GUARD)) == (MAY_BE_DOUBLE|MAY_BE_GUARD)) {
4133+
if (((res_info & (MAY_BE_ANY|MAY_BE_GUARD)) == (MAY_BE_LONG|MAY_BE_GUARD)
4134+
|| (res_info & (MAY_BE_ANY|MAY_BE_GUARD)) == (MAY_BE_DOUBLE|MAY_BE_GUARD))
4135+
&& has_concrete_type(op1_info)
4136+
&& has_concrete_type(op2_info)) {
41354137
ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
41364138
}
41374139
}

ext/opcache/tests/jit/mul_006.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
JIT MUL: 006 incorrect guard elimination
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
--FILE--
10+
<?php
11+
for ($i = 0; $i<6; $i++) {
12+
$a + -$a=&$a;
13+
$a = 3*$a + 0xff000;
14+
$a += $a;
15+
}
16+
?>
17+
DONE
18+
--EXPECT--
19+
DONE

0 commit comments

Comments
 (0)