From c781896a192c368797b8941b7c156fea7b3313ec Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 7 Feb 2025 11:57:07 -0800 Subject: [PATCH 1/2] Don't project traces that end in underflow --- Python/instrumentation.c | 3 +-- Python/optimizer.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Python/instrumentation.c b/Python/instrumentation.c index 0e7b4810726434..12fd35f43562ae 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 340770ae55ec57..27bd222ac3975f 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 From 4685062349cd61ea127bb4c92ecd5e60bfb3fbe2 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Tue, 11 Feb 2025 22:20:31 -0800 Subject: [PATCH 2/2] blurb add --- .../2025-02-11-22-20-21.gh-issue-129715.mopO8n.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2025-02-11-22-20-21.gh-issue-129715.mopO8n.rst 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 00000000000000..e71602b06a33ce --- /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.