Skip to content

Commit bba2dc3

Browse files
committed
Merge branch 'PHP-8.5'
2 parents c0af268 + 0dae1e7 commit bba2dc3

2 files changed

Lines changed: 39 additions & 5 deletions

File tree

ext/opcache/jit/zend_jit_ir.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8000,14 +8000,12 @@ static int zend_jit_escape_if_undef(zend_jit_ctx *jit, int var, uint32_t flags,
80008000
zend_jit_op_array_trace_extension *jit_extension =
80018001
(zend_jit_op_array_trace_extension*)ZEND_FUNC_INFO(op_array);
80028002
size_t offset = jit_extension->offset;
8003-
ir_ref ref = ir_CONST_ADDR(ZEND_OP_TRACE_INFO((opline - 1), offset)->orig_handler);
8003+
ir_ref ref = ir_CONST_FC_FUNC(ZEND_OP_TRACE_INFO((opline - 1), offset)->orig_handler);
80048004
if (GCC_GLOBAL_REGS || ZEND_VM_KIND == ZEND_VM_KIND_TAILCALL) {
80058005
ir_TAILCALL(IR_OPCODE_HANDLER_RET, ref);
80068006
} else {
8007-
#if defined(IR_TARGET_X86)
8008-
ref = ir_CAST_FC_FUNC(ref);
8009-
#endif
8010-
ir_TAILCALL_2(IR_ADDR, ref, jit_FP(jit), jit_IP(jit));
8007+
ir_ref opline_ref = ir_CALL_2(IR_OPCODE_HANDLER_RET, ref, jit_FP(jit), jit_IP(jit));
8008+
zend_jit_vm_enter(jit, opline_ref);
80118009
}
80128010

80138011
ir_IF_TRUE(if_def);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--TEST--
2+
GH-21368 (JIT escape_if_undef SEGV on CALL VM with aggressive trace counters)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.jit_buffer_size=64M
7+
opcache.jit=tracing
8+
opcache.protect_memory=1
9+
opcache.jit_hot_loop=1
10+
opcache.jit_hot_func=1
11+
opcache.jit_hot_return=1
12+
opcache.jit_hot_side_exit=1
13+
--FILE--
14+
<?php
15+
class C {
16+
public $x = true;
17+
public function __get($name) { return null; }
18+
public function getX() { return $this->x; }
19+
}
20+
21+
$o1 = new C;
22+
$o2 = new C;
23+
$o2->x = false;
24+
$o3 = new C;
25+
unset($o3->x);
26+
$a = [$o1, $o2, $o3];
27+
28+
for ($i = 0; $i < 8; $i++) {
29+
$m = $a[$i % 3];
30+
$m->getX();
31+
$m->getX();
32+
}
33+
?>
34+
OK
35+
--EXPECT--
36+
OK

0 commit comments

Comments
 (0)