From: Dmitry Stogov Date: Wed, 30 Sep 2020 09:21:15 +0000 (+0300) Subject: Give preference to ENTER->RECURSIVE_CALL trace over ENTER->RETURN X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aecb05f5e762ac08534dc144798571e68eba0562;p=php Give preference to ENTER->RECURSIVE_CALL trace over ENTER->RETURN --- diff --git a/ext/opcache/jit/zend_jit_internal.h b/ext/opcache/jit/zend_jit_internal.h index d44aaae0e1..e1cf4ffb8d 100644 --- a/ext/opcache/jit/zend_jit_internal.h +++ b/ext/opcache/jit/zend_jit_internal.h @@ -157,6 +157,7 @@ int ZEND_FASTCALL zend_jit_check_constant(const zval *key); _(DEEP_RECURSION, "deep recursion") \ _(LOOP_UNROLL, "loop unroll limit reached") \ _(LOOP_EXIT, "exit from loop") \ + _(RECURSION_EXIT, "return from recursive function") \ _(BLACK_LIST, "trace blacklisted") \ _(INNER_LOOP, "inner loop") /* trace it */ \ _(COMPILED_LOOP, "compiled loop") \ diff --git a/ext/opcache/jit/zend_jit_vm_helpers.c b/ext/opcache/jit/zend_jit_vm_helpers.c index f022b16e29..48df7ff108 100644 --- a/ext/opcache/jit/zend_jit_vm_helpers.c +++ b/ext/opcache/jit/zend_jit_vm_helpers.c @@ -864,6 +864,13 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex, If this doesn't work terminate it. */ stop = ZEND_JIT_TRACE_STOP_LOOP_EXIT; break; + } else if (start & ZEND_JIT_TRACE_START_ENTER + && EX(prev_execute_data) + && EX(func) == EX(prev_execute_data)->func + && zend_jit_trace_bad_stop_event(orig_opline, JIT_G(blacklist_root_trace) - 1) != + ZEND_JIT_TRACE_STOP_RECURSION_EXIT) { + stop = ZEND_JIT_TRACE_STOP_RECURSION_EXIT; + break; } else { stop = ZEND_JIT_TRACE_STOP_RETURN; break;