]> granicus.if.org Git - php/commitdiff
Give preference to ENTER->RECURSIVE_CALL trace over ENTER->RETURN
authorDmitry Stogov <dmitry@zend.com>
Wed, 30 Sep 2020 09:21:15 +0000 (12:21 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 30 Sep 2020 09:21:15 +0000 (12:21 +0300)
ext/opcache/jit/zend_jit_internal.h
ext/opcache/jit/zend_jit_vm_helpers.c

index d44aaae0e172d6eaa91cbe52929f66d9f6e8b19e..e1cf4ffb8dba858a55bd0d71072db9ba587ee970 100644 (file)
@@ -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") \
index f022b16e298cd02dbe05f3a9ea8070248acb97d3..48df7ff10809263b0a446569c2a12db87438825c 100644 (file)
@@ -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;