Skip to content

Commit c94bb37

Browse files
committed
Fixed indirect variable access detection when opcache.jit=1252
This fixes `make test TESTS="-d opcache.jit=1252 --repeat 3 Zend/tests/global_with_side_effect_name.phpt"`
1 parent 96adc80 commit c94bb37

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,25 @@ static zend_ssa *zend_jit_trace_build_ssa(const zend_op_array *op_array, zend_sc
507507

508508
memset(ssa, 0, sizeof(zend_ssa));
509509
ssa->cfg.blocks_count = 1;
510+
511+
if (JIT_G(opt_level) == ZEND_JIT_LEVEL_INLINE) {
512+
zend_cfg cfg;
513+
void *checkpoint = zend_arena_checkpoint(CG(arena));
514+
515+
if (zend_jit_build_cfg(op_array, &cfg) == SUCCESS) {
516+
ssa->cfg.flags = cfg.flags;
517+
} else{
518+
ssa->cfg.flags |= ZEND_FUNC_INDIRECT_VAR_ACCESS;
519+
}
520+
521+
/* TODO: move this to zend_cfg.c ? */
522+
if (!op_array->function_name) {
523+
ssa->cfg.flags |= ZEND_FUNC_INDIRECT_VAR_ACCESS;
524+
}
525+
526+
zend_arena_release(&CG(arena), checkpoint);
527+
}
528+
510529
return ssa;
511530
}
512531

0 commit comments

Comments
 (0)