Skip to content

Commit 1082669

Browse files
committed
JIT: Fixed failures of tracing JIT with CALL VM
This fixes: - tests/lang/bug28800.phpt - Zend/tests/settype_resource.phpt - Zend/tests/type_declarations/scalar_return_basic_64bit.phpt
1 parent 8daed6d commit 1082669

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6452,11 +6452,11 @@ static const void *zend_jit_trace_exit_to_vm(uint32_t trace_num, uint32_t exit_n
64526452

64536453
opline = zend_jit_traces[trace_num].exit_info[exit_num].opline;
64546454
if (opline) {
6455-
zend_jit_set_ip(&dasm_state, opline);
64566455
if (opline == zend_jit_traces[zend_jit_traces[trace_num].root].opline) {
64576456
/* prevent endless loop */
64586457
original_handler = 1;
64596458
}
6459+
zend_jit_set_ip_ex(&dasm_state, opline, original_handler);
64606460
}
64616461

64626462
zend_jit_trace_return(&dasm_state, original_handler);

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3053,6 +3053,24 @@ static int zend_jit_set_ip(dasm_State **Dst, const zend_op *opline)
30533053
return 1;
30543054
}
30553055

3056+
static int zend_jit_set_ip_ex(dasm_State **Dst, const zend_op *opline, bool set_ip_reg)
3057+
{
3058+
if (last_valid_opline == opline) {
3059+
zend_jit_use_last_valid_opline();
3060+
} else if (GCC_GLOBAL_REGS && last_valid_opline) {
3061+
zend_jit_use_last_valid_opline();
3062+
| ADD_IP (opline - last_valid_opline) * sizeof(zend_op);
3063+
} else if (!GCC_GLOBAL_REGS && set_ip_reg) {
3064+
| LOAD_ADDR RX, opline
3065+
| mov aword EX->opline, RX
3066+
} else {
3067+
| LOAD_IP_ADDR opline
3068+
}
3069+
zend_jit_set_last_valid_opline(opline);
3070+
3071+
return 1;
3072+
}
3073+
30563074
static int zend_jit_set_valid_ip(dasm_State **Dst, const zend_op *opline)
30573075
{
30583076
if (delayed_call_chain) {

0 commit comments

Comments
 (0)