Skip to content

Commit 7d66e4f

Browse files
committed
Replace zend_jit_trace_info.loop_kind by zend_jit_trace_info.flags
1 parent 25b7df4 commit 7d66e4f

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

ext/opcache/jit/zend_jit_internal.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ typedef union _zend_jit_trace_stack {
343343
(_stack)[_slot].reg = _reg; \
344344
} while (0)
345345

346+
/* trace info flags */
347+
#define ZEND_JIT_TRACE_CHECK_INTERRUPT (1<<0)
348+
346349
typedef struct _zend_jit_trace_info {
347350
uint32_t id; /* trace id */
348351
uint32_t root; /* root trace id or self id for root traces */
@@ -353,7 +356,7 @@ typedef struct _zend_jit_trace_info {
353356
uint32_t code_size; /* size of native code */
354357
uint32_t exit_counters; /* offset in exit counters array */
355358
uint32_t stack_map_size;
356-
uint32_t loop_kind; /* LOOP, RECURSIVE_CALL or RECURSIVE_RET */
359+
uint32_t flags; /* See ZEND_JIT_TRACE_... defines above */
357360
const zend_op *opline; /* first opline */
358361
const void *code_start; /* address of native code */
359362
zend_jit_trace_exit_info *exit_info; /* info about side exits */

ext/opcache/jit/zend_jit_trace.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3981,7 +3981,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
39813981
}
39823982
}
39833983
t->link = ZEND_JIT_TRACE_NUM;
3984-
t->loop_kind = p->stop;
3984+
if (p->stop != ZEND_JIT_TRACE_STOP_RECURSIVE_RET) {
3985+
t->flags |= ZEND_JIT_TRACE_CHECK_INTERRUPT;
3986+
}
39853987
zend_jit_trace_end_loop(&dasm_state, 0, timeout_exit_addr); /* jump back to start of the trace loop */
39863988
} else if (p->stop == ZEND_JIT_TRACE_STOP_LINK) {
39873989
if (ra) {
@@ -4140,7 +4142,7 @@ static zend_jit_trace_stop zend_jit_compile_root_trace(zend_jit_trace_rec *trace
41404142
t->exit_count = 0;
41414143
t->child_count = 0;
41424144
t->stack_map_size = 0;
4143-
t->loop_kind = 0;
4145+
t->flags = 0;
41444146
t->opline = ((zend_jit_trace_start_rec*)trace_buffer)->opline;
41454147
t->exit_info = exit_info;
41464148
t->stack_map = NULL;
@@ -4701,7 +4703,7 @@ static zend_jit_trace_stop zend_jit_compile_side_trace(zend_jit_trace_rec *trace
47014703
t->exit_count = 0;
47024704
t->child_count = 0;
47034705
t->stack_map_size = 0;
4704-
t->loop_kind = 0;
4706+
t->flags = 0;
47054707
t->opline = NULL;
47064708
t->exit_info = exit_info;
47074709
t->stack_map = NULL;

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3029,7 +3029,7 @@ static int zend_jit_trace_link_to_root(dasm_State **Dst, zend_jit_trace_info *t)
30293029
}
30303030
link_addr = (const void*)((const char*)t->code_start + prologue_size);
30313031

3032-
if (t->link == t->id && t->loop_kind != ZEND_JIT_TRACE_STOP_RECURSIVE_RET) {
3032+
if (t->flags & ZEND_JIT_TRACE_CHECK_INTERRUPT) {
30333033
/* Check timeout for links to LOOP */
30343034
| MEM_OP2_1_ZTS cmp, byte, executor_globals, vm_interrupt, 0, r0
30353035
| je &link_addr

0 commit comments

Comments
 (0)