Skip to content

Commit 274131e

Browse files
committed
Fixed incorrect side exit opline of "fake" init_fcall guard
1 parent eaeceb3 commit 274131e

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4433,6 +4433,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
44334433
SET_STACK_TYPE(stack, i, IS_UNKNOWN);
44344434
}
44354435
}
4436+
opline = NULL;
44364437
}
44374438
JIT_G(current_frame) = frame;
44384439
if (res_type != IS_UNKNOWN
@@ -4504,8 +4505,19 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
45044505
skip_guard = 1;
45054506
}
45064507
}
4507-
if (!skip_guard && !zend_jit_init_fcall_guard(&dasm_state, NULL, p->func, trace_buffer[1].opline)) {
4508-
goto jit_failure;
4508+
4509+
if (!skip_guard) {
4510+
if (!opline) {
4511+
zend_jit_trace_rec *q = p + 1;
4512+
while (q->op != ZEND_JIT_TRACE_VM && q->op != ZEND_JIT_TRACE_END) {
4513+
q++;
4514+
}
4515+
opline = q->opline;
4516+
ZEND_ASSERT(opline != NULL);
4517+
}
4518+
if (!zend_jit_init_fcall_guard(&dasm_state, NULL, p->func, opline)) {
4519+
goto jit_failure;
4520+
}
45094521
}
45104522
}
45114523
}
@@ -4590,12 +4602,13 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
45904602
} else if (p->stop == ZEND_JIT_TRACE_STOP_LINK
45914603
|| p->stop == ZEND_JIT_TRACE_STOP_RETURN_HALT
45924604
|| p->stop == ZEND_JIT_TRACE_STOP_INTERPRETER) {
4593-
if (opline->opcode == ZEND_DO_UCALL
4594-
|| opline->opcode == ZEND_DO_FCALL
4595-
|| opline->opcode == ZEND_DO_FCALL_BY_NAME
4596-
|| opline->opcode == ZEND_YIELD
4597-
|| opline->opcode == ZEND_YIELD_FROM
4598-
|| opline->opcode == ZEND_INCLUDE_OR_EVAL) {
4605+
if (opline
4606+
&& (opline->opcode == ZEND_DO_UCALL
4607+
|| opline->opcode == ZEND_DO_FCALL
4608+
|| opline->opcode == ZEND_DO_FCALL_BY_NAME
4609+
|| opline->opcode == ZEND_YIELD
4610+
|| opline->opcode == ZEND_YIELD_FROM
4611+
|| opline->opcode == ZEND_INCLUDE_OR_EVAL)) {
45994612
zend_jit_trace_setup_ret_counter(opline, jit_extension->offset);
46004613
}
46014614
if (JIT_G(current_frame)

0 commit comments

Comments
 (0)