Skip to content

Commit 9a3b36a

Browse files
committed
Fix live range calculation
1 parent 6c0d0c8 commit 9a3b36a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Zend/zend_opcode.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,9 @@ static void emit_live_range(
649649
/* COPY_TMP has a split live-range: One from the definition until the use in
650650
* "null" branch, and another from the start of the "non-null" branch to the
651651
* FREE opcode. */
652+
uint32_t rt_var_num =
653+
(uint32_t) (intptr_t) ZEND_CALL_VAR_NUM(NULL, op_array->last_var + var_num);
654+
652655
zend_op *block_start_op = use_opline;
653656
while ((block_start_op-1)->opcode == ZEND_FREE) {
654657
block_start_op--;
@@ -659,10 +662,10 @@ static void emit_live_range(
659662

660663
do {
661664
use_opline--;
662-
} while (
663-
(use_opline->op1_type & (IS_TMP_VAR|IS_VAR) && use_opline->op1.var == var_num) ||
664-
(use_opline->op2_type & (IS_TMP_VAR|IS_VAR) && use_opline->op2.var == var_num)
665-
);
665+
} while (!(
666+
((use_opline->op1_type & (IS_TMP_VAR|IS_VAR)) && use_opline->op1.var == rt_var_num) ||
667+
((use_opline->op2_type & (IS_TMP_VAR|IS_VAR)) && use_opline->op2.var == rt_var_num)
668+
));
666669
start = def_opline + 1 - op_array->opcodes;
667670
end = use_opline - op_array->opcodes;
668671
emit_live_range_raw(

0 commit comments

Comments
 (0)