Skip to content

Commit 69bcd93

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Tracing JIT: Fixed incorrect assumption about stack slot type
2 parents c72e962 + 5b048dd commit 69bcd93

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

ext/opcache/jit/zend_jit_internal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,9 @@ typedef union _zend_jit_trace_stack {
562562
(_stack)[_slot].reg = _reg; \
563563
(_stack)[_slot].flags = _flags; \
564564
} while (0)
565+
#define RESET_STACK_MEM_TYPE(_stack, _slot) do { \
566+
(_stack)[_slot].mem_type = IS_UNKNOWN; \
567+
} while (0)
565568

566569
/* trace info flags */
567570
#define ZEND_JIT_TRACE_CHECK_INTERRUPT (1<<0)

ext/opcache/jit/zend_jit_trace.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6225,6 +6225,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
62256225
} else {
62266226
SET_STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var), type,
62276227
(type == IS_UNKNOWN || !ra || !ra[ssa_op->result_def]));
6228+
if (ssa->var_info[ssa_op->result_def].type & MAY_BE_INDIRECT) {
6229+
RESET_STACK_MEM_TYPE(stack, EX_VAR_TO_NUM(opline->result.var));
6230+
}
62286231
if (type != IS_UNKNOWN) {
62296232
ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
62306233
if (opline->opcode == ZEND_FETCH_THIS
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
JIT FETCH_DIM_R: 014
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+
$s =+ $y;
12+
$tokenthiss[$i=$s][] = $y = $y;
13+
$tokenthiss[$i][$i] + $y;
14+
}
15+
@foo();
16+
?>
17+
DONE
18+
--EXPECT--
19+
DONE

0 commit comments

Comments
 (0)