Skip to content

Commit f848d43

Browse files
committed
Force reload execute_data when returning from exception
1 parent 144dd19 commit f848d43

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

Zend/zend_vm_gen.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
21752175
"# endif\n" .
21762176
$m[1]."return;\n" .
21772177
"#else\n" .
2178-
$m[1]."if (EXPECTED(opline != NULL)) {\n" .
2178+
$m[1]."if (EXPECTED(opline != NULL && (uintptr_t)opline != (1ULL<<63))) {\n" .
21792179
$m[1]."\topline = (zend_op*)((uintptr_t)opline & ~(1ULL<<63));\n".
21802180
$m[1]."\texecute_data = EG(current_execute_data);\n".
21812181
$m[1]."\tZEND_VM_LOOP_INTERRUPT_CHECK();\n".

ext/opcache/jit/zend_jit_ir.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,18 @@ static void zend_jit_check_timeout(zend_jit_ctx *jit, const zend_op *opline, con
18901890
}
18911891
}
18921892

1893+
static void zend_jit_vm_enter(zend_jit_ctx *jit, ir_ref to_opline)
1894+
{
1895+
// ZEND_VM_ENTER()
1896+
ir_RETURN(ir_OR_A(to_opline, ir_CONST_ADDR((uintptr_t)1ULL<<63)));
1897+
}
1898+
1899+
static void zend_jit_vm_leave(zend_jit_ctx *jit, ir_ref to_opline)
1900+
{
1901+
// ZEND_VM_LEAVE()
1902+
ir_RETURN(ir_OR_A(to_opline, ir_CONST_ADDR((uintptr_t)1ULL<<63)));
1903+
}
1904+
18931905
/* stubs */
18941906

18951907
static int zend_jit_exception_handler_stub(zend_jit_ctx *jit)
@@ -1902,15 +1914,13 @@ static int zend_jit_exception_handler_stub(zend_jit_ctx *jit)
19021914
ir_CALL(IR_VOID, ir_CONST_FUNC(handler));
19031915
ir_TAILCALL(IR_VOID, ir_LOAD_A(jit_IP(jit)));
19041916
} else {
1905-
// TODO: zend_get_opcode_handler_func
19061917
handler = EG(exception_op)->handler;
19071918

19081919
if (GCC_GLOBAL_REGS) {
19091920
ir_TAILCALL(IR_VOID, ir_CONST_FUNC(handler));
19101921
} else {
1911-
// TODO: tail call?
19121922
ir_ref ref = ir_CALL_2(IR_ADDR, ir_CONST_FC_FUNC(handler), jit_FP(jit), jit_IP(jit));
1913-
ir_RETURN(ref);
1923+
zend_jit_vm_enter(jit, ref);
19141924
}
19151925
}
19161926
return 1;
@@ -1984,16 +1994,6 @@ static int zend_jit_exception_handler_free_op2_stub(zend_jit_ctx *jit)
19841994
return 1;
19851995
}
19861996

1987-
static void zend_jit_vm_enter(zend_jit_ctx *jit, ir_ref to_opline)
1988-
{
1989-
ir_RETURN(ir_OR_A(to_opline, ir_CONST_ADDR((uintptr_t)1ULL<<63)));
1990-
}
1991-
1992-
static void zend_jit_vm_leave(zend_jit_ctx *jit, ir_ref to_opline)
1993-
{
1994-
ir_RETURN(ir_OR_A(to_opline, ir_CONST_ADDR((uintptr_t)1ULL<<63)));
1995-
}
1996-
19971997
static int zend_jit_interrupt_handler_stub(zend_jit_ctx *jit)
19981998
{
19991999
ir_ref if_timeout, if_exception;
@@ -17355,7 +17355,7 @@ static int zend_jit_trace_return(zend_jit_ctx *jit, bool original_handler, const
1735517355
|| opline->opcode == ZEND_GENERATOR_CREATE
1735617356
|| opline->opcode == ZEND_YIELD
1735717357
|| opline->opcode == ZEND_YIELD_FROM)) {
17358-
ir_RETURN(ref);
17358+
zend_jit_vm_enter(jit, ref);
1735917359
return 1;
1736017360
}
1736117361
}

0 commit comments

Comments
 (0)