]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-129715: Don't project traces that return to an unknown caller (GH-130024)
authorBrandt Bucher <brandtbucher@microsoft.com>
Wed, 12 Feb 2025 18:16:43 +0000 (10:16 -0800)
committerGitHub <noreply@github.com>
Wed, 12 Feb 2025 18:16:43 +0000 (10:16 -0800)
Misc/NEWS.d/next/Core_and_Builtins/2025-02-11-22-20-21.gh-issue-129715.mopO8n.rst [new file with mode: 0644]
Python/instrumentation.c
Python/optimizer.c

diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-02-11-22-20-21.gh-issue-129715.mopO8n.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-02-11-22-20-21.gh-issue-129715.mopO8n.rst
new file mode 100644 (file)
index 0000000..e71602b
--- /dev/null
@@ -0,0 +1 @@
+Improve the experimental JIT's handling of returns to unknown callers.
index 0e7b48107264345af30b4b24549a3d3a5b392f95..12fd35f43562ae481fe3d4390f1572449a080f82 100644 (file)
@@ -185,8 +185,7 @@ is_instrumented(int opcode)
 {
     assert(opcode != 0);
     assert(opcode != RESERVED);
-    assert(opcode != ENTER_EXECUTOR);
-    return opcode >= MIN_INSTRUMENTED_OPCODE;
+    return opcode != ENTER_EXECUTOR && opcode >= MIN_INSTRUMENTED_OPCODE;
 }
 
 #ifndef NDEBUG
index bef5728349a612212b8813c7a0487942016c1805..d86d58d82e391b38f7a2c4296ade80088e43cee7 100644 (file)
@@ -671,7 +671,7 @@ translate_bytecode_to_trace(
                         if (trace_stack_depth == 0) {
                             DPRINTF(2, "Trace stack underflow\n");
                             OPT_STAT_INC(trace_stack_underflow);
-                            goto done;
+                            return 0;
                         }
                     }
                     uint32_t orig_oparg = oparg;  // For OPARG_TOP/BOTTOM