Skip to content

Commit 2940839

Browse files
committed
Prevent incorrect trasing JIT TSSA usage for range() result type inference
1 parent e6ae1bf commit 2940839

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

ext/opcache/Optimizer/zend_func_info.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ typedef struct _func_info_t {
5555
static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa *ssa)
5656
{
5757
if (!call_info->send_unpack
58-
&& (call_info->num_args == 2 || call_info->num_args == 3)) {
58+
&& (call_info->num_args == 2 || call_info->num_args == 3)
59+
&& ssa
60+
&& !(ssa->cfg.flags & ZEND_SSA_TSSA)) {
5961
zend_op_array *op_array = call_info->caller_op_array;
6062
uint32_t t1 = _ssa_op1_info(op_array, ssa, call_info->arg_info[0].opline,
6163
&ssa->ops[call_info->arg_info[0].opline - op_array->opcodes]);

ext/opcache/Optimizer/zend_func_info.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include "zend_ssa.h"
2323

24-
/* func flags */
24+
/* func/cfg flags */
2525
#define ZEND_FUNC_INDIRECT_VAR_ACCESS (1<<0) /* accesses variables by name */
2626
#define ZEND_FUNC_HAS_CALLS (1<<1)
2727
#define ZEND_FUNC_VARARG (1<<2) /* uses func_get_args() */
@@ -33,6 +33,7 @@
3333
#define ZEND_FUNC_RECURSIVE_INDIRECTLY (1<<9)
3434
#define ZEND_FUNC_HAS_EXTENDED_FCALL (1<<10)
3535
#define ZEND_FUNC_HAS_EXTENDED_STMT (1<<11)
36+
#define ZEND_SSA_TSSA (1<<12) /* used by tracing JIT */
3637

3738
typedef struct _zend_func_info zend_func_info;
3839
typedef struct _zend_call_info zend_call_info;

ext/opcache/jit/zend_jit_trace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,7 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin
10601060

10611061
/* 2. Construct TSSA */
10621062
tssa = zend_arena_calloc(&CG(arena), 1, sizeof(zend_tssa));
1063+
tssa->cfg.flags = ZEND_SSA_TSSA;
10631064
tssa->cfg.blocks = zend_arena_calloc(&CG(arena), 2, sizeof(zend_basic_block));
10641065
tssa->blocks = zend_arena_calloc(&CG(arena), 2, sizeof(zend_ssa_block));
10651066
tssa->cfg.predecessors = zend_arena_calloc(&CG(arena), 2, sizeof(int));

0 commit comments

Comments
 (0)