From: Dmitry Stogov Date: Tue, 12 May 2020 21:56:04 +0000 (+0300) Subject: Replace zend_jit_trace_info.loop_kind by zend_jit_trace_info.flags X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d66e4f3234a921df62d5d5746ee6b3fbc9214f3;p=php Replace zend_jit_trace_info.loop_kind by zend_jit_trace_info.flags --- diff --git a/ext/opcache/jit/zend_jit_internal.h b/ext/opcache/jit/zend_jit_internal.h index 9f6f16d627..531727a642 100644 --- a/ext/opcache/jit/zend_jit_internal.h +++ b/ext/opcache/jit/zend_jit_internal.h @@ -343,6 +343,9 @@ typedef union _zend_jit_trace_stack { (_stack)[_slot].reg = _reg; \ } while (0) +/* trace info flags */ +#define ZEND_JIT_TRACE_CHECK_INTERRUPT (1<<0) + typedef struct _zend_jit_trace_info { uint32_t id; /* trace id */ uint32_t root; /* root trace id or self id for root traces */ @@ -353,7 +356,7 @@ typedef struct _zend_jit_trace_info { uint32_t code_size; /* size of native code */ uint32_t exit_counters; /* offset in exit counters array */ uint32_t stack_map_size; - uint32_t loop_kind; /* LOOP, RECURSIVE_CALL or RECURSIVE_RET */ + uint32_t flags; /* See ZEND_JIT_TRACE_... defines above */ const zend_op *opline; /* first opline */ const void *code_start; /* address of native code */ zend_jit_trace_exit_info *exit_info; /* info about side exits */ diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 367b2335a1..4dfde5454b 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -3981,7 +3981,9 @@ done: } } t->link = ZEND_JIT_TRACE_NUM; - t->loop_kind = p->stop; + if (p->stop != ZEND_JIT_TRACE_STOP_RECURSIVE_RET) { + t->flags |= ZEND_JIT_TRACE_CHECK_INTERRUPT; + } zend_jit_trace_end_loop(&dasm_state, 0, timeout_exit_addr); /* jump back to start of the trace loop */ } else if (p->stop == ZEND_JIT_TRACE_STOP_LINK) { if (ra) { @@ -4140,7 +4142,7 @@ static zend_jit_trace_stop zend_jit_compile_root_trace(zend_jit_trace_rec *trace t->exit_count = 0; t->child_count = 0; t->stack_map_size = 0; - t->loop_kind = 0; + t->flags = 0; t->opline = ((zend_jit_trace_start_rec*)trace_buffer)->opline; t->exit_info = exit_info; t->stack_map = NULL; @@ -4701,7 +4703,7 @@ static zend_jit_trace_stop zend_jit_compile_side_trace(zend_jit_trace_rec *trace t->exit_count = 0; t->child_count = 0; t->stack_map_size = 0; - t->loop_kind = 0; + t->flags = 0; t->opline = NULL; t->exit_info = exit_info; t->stack_map = NULL; diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index e0ae11241e..9675791a78 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -3029,7 +3029,7 @@ static int zend_jit_trace_link_to_root(dasm_State **Dst, zend_jit_trace_info *t) } link_addr = (const void*)((const char*)t->code_start + prologue_size); - if (t->link == t->id && t->loop_kind != ZEND_JIT_TRACE_STOP_RECURSIVE_RET) { + if (t->flags & ZEND_JIT_TRACE_CHECK_INTERRUPT) { /* Check timeout for links to LOOP */ | MEM_OP2_1_ZTS cmp, byte, executor_globals, vm_interrupt, 0, r0 | je &link_addr