Skip to content

Commit 0dae1e7

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
# Conflicts: # ext/opcache/jit/zend_jit_ir.c
2 parents c4aa851 + 05afc37 commit 0dae1e7

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
@@ -7979,14 +7979,12 @@ static int zend_jit_escape_if_undef(zend_jit_ctx *jit, int var, uint32_t flags,
79797979
zend_jit_op_array_trace_extension *jit_extension =
79807980
(zend_jit_op_array_trace_extension*)ZEND_FUNC_INFO(op_array);
79817981
size_t offset = jit_extension->offset;
7982-
ir_ref ref = ir_CONST_ADDR(ZEND_OP_TRACE_INFO((opline - 1), offset)->orig_handler);
7982+
ir_ref ref = ir_CONST_FC_FUNC(ZEND_OP_TRACE_INFO((opline - 1), offset)->orig_handler);
79837983
if (GCC_GLOBAL_REGS || ZEND_VM_KIND == ZEND_VM_KIND_TAILCALL) {
79847984
ir_TAILCALL(IR_OPCODE_HANDLER_RET, ref);
79857985
} else {
7986-
#if defined(IR_TARGET_X86)
7987-
ref = ir_CAST_FC_FUNC(ref);
7988-
#endif
7989-
ir_TAILCALL_2(IR_ADDR, ref, jit_FP(jit), jit_IP(jit));
7986+
ir_ref opline_ref = ir_CALL_2(IR_OPCODE_HANDLER_RET, ref, jit_FP(jit), jit_IP(jit));
7987+
zend_jit_vm_enter(jit, opline_ref);
79907988
}
79917989

79927990
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)