]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-137728 gh-137762: Fix bugs in the JIT with many local variables (GH-137764...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 21 Aug 2025 14:00:05 +0000 (16:00 +0200)
committerGitHub <noreply@github.com>
Thu, 21 Aug 2025 14:00:05 +0000 (17:00 +0300)
Co-authored-by: Ken Jin <kenjin@python.org>
Misc/NEWS.d/next/Core_and_Builtins/2025-08-14-14-18-29.gh-issue-137728.HdYS9R.rst [new file with mode: 0644]
Python/optimizer_analysis.c
Python/optimizer_symbols.c

diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-08-14-14-18-29.gh-issue-137728.HdYS9R.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-08-14-14-18-29.gh-issue-137728.HdYS9R.rst
new file mode 100644 (file)
index 0000000..cc4a55d
--- /dev/null
@@ -0,0 +1 @@
+Fix the JIT's handling of many local variables. This previously caused a segfault.
index 503e6ed47913713ec66788e02818b94b47c77f89..2bcd99b8bcdc6d5188158dced430d02d6d76c775 100644 (file)
@@ -449,13 +449,10 @@ optimize_uops(
     _Py_uop_abstractcontext_init(ctx);
     _Py_UOpsAbstractFrame *frame = _Py_uop_frame_new(ctx, co, curr_stacklen, NULL, 0);
     if (frame == NULL) {
-        return -1;
+        return 0;
     }
     ctx->curr_frame_depth++;
     ctx->frame = frame;
-    ctx->done = false;
-    ctx->out_of_space = false;
-    ctx->contradiction = false;
 
     _PyUOpInstruction *this_instr = NULL;
     for (int i = 0; !ctx->done; i++) {
index e8a4f87031b76a4ff80f2f6eab9dca01ad8753e9..2387f215178624e454a8acdcea92789b323af540 100644 (file)
@@ -691,6 +691,13 @@ _Py_uop_abstractcontext_init(JitOptContext *ctx)
 
     // Frame setup
     ctx->curr_frame_depth = 0;
+
+    // Ctx signals.
+    // Note: this must happen before frame_new, as it might override
+    // the result should frame_new set things to bottom.
+    ctx->done = false;
+    ctx->out_of_space = false;
+    ctx->contradiction = false;
 }
 
 int