diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc index 9fe23de6f97..15964a16fcb 100644 --- a/ext/opcache/jit/zend_jit_arm64.dasc +++ b/ext/opcache/jit/zend_jit_arm64.dasc @@ -2847,6 +2847,11 @@ static int zend_jit_set_ip(dasm_State **Dst, const zend_op *opline) return 1; } +static int zend_jit_set_ip_ex(dasm_State **Dst, const zend_op *opline, bool set_ip_reg) +{ + return zend_jit_set_ip(Dst, opline); +} + static int zend_jit_set_valid_ip(dasm_State **Dst, const zend_op *opline) { if (delayed_call_chain) { diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index fe4fc53e695..561ee19fc21 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -6431,11 +6431,11 @@ static const void *zend_jit_trace_exit_to_vm(uint32_t trace_num, uint32_t exit_n opline = zend_jit_traces[trace_num].exit_info[exit_num].opline; if (opline) { - zend_jit_set_ip(&dasm_state, opline); if (opline == zend_jit_traces[zend_jit_traces[trace_num].root].opline) { /* prevent endless loop */ original_handler = 1; } + zend_jit_set_ip_ex(&dasm_state, opline, original_handler); } zend_jit_trace_return(&dasm_state, original_handler); diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 49cdbf4c799..2deda0b6ab7 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -3058,6 +3058,24 @@ static int zend_jit_set_ip(dasm_State **Dst, const zend_op *opline) return 1; } +static int zend_jit_set_ip_ex(dasm_State **Dst, const zend_op *opline, bool set_ip_reg) +{ + if (last_valid_opline == opline) { + zend_jit_use_last_valid_opline(); + } else if (GCC_GLOBAL_REGS && last_valid_opline) { + zend_jit_use_last_valid_opline(); + | ADD_IP (opline - last_valid_opline) * sizeof(zend_op); + } else if (!GCC_GLOBAL_REGS && set_ip_reg) { + | LOAD_ADDR RX, opline + | mov aword EX->opline, RX + } else { + | LOAD_IP_ADDR opline + } + zend_jit_set_last_valid_opline(opline); + + return 1; +} + static int zend_jit_set_valid_ip(dasm_State **Dst, const zend_op *opline) { if (delayed_call_chain) {