@@ -8431,13 +8431,21 @@ static int zend_jit_push_call_frame(zend_jit_ctx *jit, const zend_op *opline, co
8431
8431
used_stack_ref);
8432
8432
8433
8433
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
8434
- int32_t exit_point = zend_jit_trace_get_exit_point(opline, ZEND_JIT_EXIT_TO_VM);
8434
+ bool may_be_trampoline = !func && (opline->opcode == ZEND_INIT_METHOD_CALL);
8435
+ int32_t exit_point = zend_jit_trace_get_exit_point(opline,
8436
+ may_be_trampoline ?
8437
+ (ZEND_JIT_EXIT_TO_VM | ZEND_JIT_EXIT_METHOD_CALL) : ZEND_JIT_EXIT_TO_VM);
8435
8438
const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point);
8436
8439
8437
8440
if (!exit_addr) {
8438
8441
return 0;
8439
8442
}
8440
8443
8444
+ if (may_be_trampoline) {
8445
+ jit->trace->exit_info[exit_point].poly_func_ref = func_ref;
8446
+ jit->trace->exit_info[exit_point].poly_this_ref = this_ref;
8447
+ }
8448
+
8441
8449
ir_GUARD(ref, ir_CONST_ADDR(exit_addr));
8442
8450
} else {
8443
8451
if_enough_stack = ir_IF(ref);
@@ -9064,6 +9072,14 @@ static int zend_jit_init_method_call(zend_jit_ctx *jit,
9064
9072
jit->delayed_call_level = call_level;
9065
9073
}
9066
9074
9075
+ if (trace
9076
+ && trace->op == ZEND_JIT_TRACE_END
9077
+ && trace->stop >= ZEND_JIT_TRACE_STOP_INTERPRETER) {
9078
+ if (!zend_jit_set_ip(jit, opline + 1)) {
9079
+ return 0;
9080
+ }
9081
+ }
9082
+
9067
9083
return 1;
9068
9084
}
9069
9085
@@ -9324,7 +9340,7 @@ static int zend_jit_init_closure_call(zend_jit_ctx *jit,
9324
9340
9325
9341
if (trace
9326
9342
&& trace->op == ZEND_JIT_TRACE_END
9327
- && trace->stop = = ZEND_JIT_TRACE_STOP_INTERPRETER) {
9343
+ && trace->stop > = ZEND_JIT_TRACE_STOP_INTERPRETER) {
9328
9344
if (!zend_jit_set_ip(jit, opline + 1)) {
9329
9345
return 0;
9330
9346
}
@@ -9933,7 +9949,7 @@ static int zend_jit_do_fcall(zend_jit_ctx *jit, const zend_op *opline, const zen
9933
9949
9934
9950
if (trace && !func) {
9935
9951
if (trace->op == ZEND_JIT_TRACE_DO_ICALL) {
9936
- ZEND_ASSERT(trace->func->type == ZEND_INTERNAL_FUNCTION);
9952
+ ZEND_ASSERT(!trace->func || trace->func->type == ZEND_INTERNAL_FUNCTION);
9937
9953
#ifndef ZEND_WIN32
9938
9954
// TODO: ASLR may cause different addresses in different workers ???
9939
9955
func = trace->func;
@@ -10115,7 +10131,7 @@ static int zend_jit_do_fcall(zend_jit_ctx *jit, const zend_op *opline, const zen
10115
10131
10116
10132
if (call_num_args <= func->op_array.num_args) {
10117
10133
if (!trace || (trace->op == ZEND_JIT_TRACE_END
10118
- && trace->stop = = ZEND_JIT_TRACE_STOP_INTERPRETER)) {
10134
+ && trace->stop > = ZEND_JIT_TRACE_STOP_INTERPRETER)) {
10119
10135
uint32_t num_args;
10120
10136
10121
10137
if ((func->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0) {
@@ -10149,7 +10165,7 @@ static int zend_jit_do_fcall(zend_jit_ctx *jit, const zend_op *opline, const zen
10149
10165
}
10150
10166
} else {
10151
10167
if (!trace || (trace->op == ZEND_JIT_TRACE_END
10152
- && trace->stop = = ZEND_JIT_TRACE_STOP_INTERPRETER)) {
10168
+ && trace->stop > = ZEND_JIT_TRACE_STOP_INTERPRETER)) {
10153
10169
ir_ref ip;
10154
10170
10155
10171
if (zend_accel_in_shm(func->op_array.opcodes)) {
@@ -10275,7 +10291,7 @@ static int zend_jit_do_fcall(zend_jit_ctx *jit, const zend_op *opline, const zen
10275
10291
ir_ref observer_handler;
10276
10292
ir_ref rx = jit_FP(jit);
10277
10293
struct jit_observer_fcall_is_unobserved_data unobserved_data = jit_observer_fcall_is_unobserved_start(jit, func, &observer_handler, rx, func_ref);
10278
- if (trace && (trace->op != ZEND_JIT_TRACE_END || trace->stop != ZEND_JIT_TRACE_STOP_INTERPRETER)) {
10294
+ if (trace && (trace->op != ZEND_JIT_TRACE_END || trace->stop < ZEND_JIT_TRACE_STOP_INTERPRETER)) {
10279
10295
ZEND_ASSERT(trace[1].op == ZEND_JIT_TRACE_VM || trace[1].op == ZEND_JIT_TRACE_END);
10280
10296
jit_SET_EX_OPLINE(jit, trace[1].opline);
10281
10297
} else if (GCC_GLOBAL_REGS) {
@@ -10568,7 +10584,7 @@ static int zend_jit_do_fcall(zend_jit_ctx *jit, const zend_op *opline, const zen
10568
10584
jit_LOAD_IP_ADDR(jit, opline + 1);
10569
10585
} else if (trace
10570
10586
&& trace->op == ZEND_JIT_TRACE_END
10571
- && trace->stop = = ZEND_JIT_TRACE_STOP_INTERPRETER) {
10587
+ && trace->stop > = ZEND_JIT_TRACE_STOP_INTERPRETER) {
10572
10588
jit_LOAD_IP_ADDR(jit, opline + 1);
10573
10589
}
10574
10590
}
@@ -16908,7 +16924,7 @@ static int zend_jit_trace_handler(zend_jit_ctx *jit, const zend_op_array *op_arr
16908
16924
if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
16909
16925
if (trace->op != ZEND_JIT_TRACE_END ||
16910
16926
(trace->stop != ZEND_JIT_TRACE_STOP_RETURN &&
16911
- trace->stop != ZEND_JIT_TRACE_STOP_INTERPRETER)) {
16927
+ trace->stop < ZEND_JIT_TRACE_STOP_INTERPRETER)) {
16912
16928
/* this check may be handled by the following OPLINE guard or jmp [IP] */
16913
16929
ir_GUARD(ir_NE(jit_IP(jit), ir_CONST_ADDR(zend_jit_halt_op)),
16914
16930
jit_STUB_ADDR(jit, jit_stub_trace_halt));
@@ -16926,7 +16942,7 @@ static int zend_jit_trace_handler(zend_jit_ctx *jit, const zend_op_array *op_arr
16926
16942
}
16927
16943
if (trace->op != ZEND_JIT_TRACE_END ||
16928
16944
(trace->stop != ZEND_JIT_TRACE_STOP_RETURN &&
16929
- trace->stop != ZEND_JIT_TRACE_STOP_INTERPRETER)) {
16945
+ trace->stop < ZEND_JIT_TRACE_STOP_INTERPRETER)) {
16930
16946
16931
16947
const zend_op *next_opline = trace->opline;
16932
16948
const zend_op *exit_opline = NULL;
0 commit comments