Skip to content

Commit b3eaa82

Browse files
miss-islingtonFidget-Spinner
authored andcommitted
[3.14] pythongh-137728 pythongh-137762: Fix bugs in the JIT with many local variables (pythonGH-137764) (python#137999)
Co-authored-by: Ken Jin <[email protected]>
1 parent 9588d6d commit b3eaa82

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
@@ -449,13 +449,10 @@ optimize_uops(
449449
_Py_uop_abstractcontext_init(ctx);
450450
_Py_UOpsAbstractFrame *frame = _Py_uop_frame_new(ctx, co, curr_stacklen, NULL, 0);
451451
if (frame == NULL) {
452-
return -1;
452+
return 0;
453453
}
454454
ctx->curr_frame_depth++;
455455
ctx->frame = frame;
456-
ctx->done = false;
457-
ctx->out_of_space = false;
458-
ctx->contradiction = false;
459456

460457
_PyUOpInstruction *this_instr = NULL;
461458
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
@@ -691,6 +691,13 @@ _Py_uop_abstractcontext_init(JitOptContext *ctx)
691691

692692
// Frame setup
693693
ctx->curr_frame_depth = 0;
694+
695+
// Ctx signals.
696+
// Note: this must happen before frame_new, as it might override
697+
// the result should frame_new set things to bottom.
698+
ctx->done = false;
699+
ctx->out_of_space = false;
700+
ctx->contradiction = false;
694701
}
695702

696703
int

0 commit comments

Comments
 (0)