Skip to content

Commit 7fda8b6

Browse files
gh-137728 gh-137762: Fix bugs in the JIT with many local variables (GH-137764)
1 parent eae9d7d commit 7fda8b6

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix the JIT's handling of many local variables. This previously caused a segfault.

Python/optimizer_analysis.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,13 +484,10 @@ optimize_uops(
484484
_Py_uop_abstractcontext_init(ctx);
485485
_Py_UOpsAbstractFrame *frame = _Py_uop_frame_new(ctx, co, curr_stacklen, NULL, 0);
486486
if (frame == NULL) {
487-
return -1;
487+
return 0;
488488
}
489489
ctx->curr_frame_depth++;
490490
ctx->frame = frame;
491-
ctx->done = false;
492-
ctx->out_of_space = false;
493-
ctx->contradiction = false;
494491

495492
_PyUOpInstruction *this_instr = NULL;
496493
for (int i = 0; !ctx->done; i++) {

Python/optimizer_symbols.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,13 @@ _Py_uop_abstractcontext_init(JitOptContext *ctx)
888888

889889
// Frame setup
890890
ctx->curr_frame_depth = 0;
891+
892+
// Ctx signals.
893+
// Note: this must happen before frame_new, as it might override
894+
// the result should frame_new set things to bottom.
895+
ctx->done = false;
896+
ctx->out_of_space = false;
897+
ctx->contradiction = false;
891898
}
892899

893900
int

0 commit comments

Comments
 (0)