From: Brandt Bucher Date: Wed, 12 Feb 2025 18:16:43 +0000 (-0800) Subject: GH-129715: Don't project traces that return to an unknown caller (GH-130024) X-Git-Tag: v3.14.0a6~449 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=11bb08e4ec7b546d57b0ab7a8f199747bef6e422;p=thirdparty%2FPython%2Fcpython.git GH-129715: Don't project traces that return to an unknown caller (GH-130024) --- 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 index 000000000000..e71602b06a33 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-02-11-22-20-21.gh-issue-129715.mopO8n.rst @@ -0,0 +1 @@ +Improve the experimental JIT's handling of returns to unknown callers. diff --git a/Python/instrumentation.c b/Python/instrumentation.c index 0e7b48107264..12fd35f43562 100644 --- a/Python/instrumentation.c +++ b/Python/instrumentation.c @@ -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 diff --git a/Python/optimizer.c b/Python/optimizer.c index bef5728349a6..d86d58d82e39 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -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