[3.13] gh-119258: Backport optimizer frame fixes in GH-119365 (GH-120699)

(cherry picked from commit 55402d3)
This commit is contained in:
Ken Jin 2024-06-20 23:55:20 +08:00 committed by GitHub
parent b8fd80f91b
commit 7c7aa5a99c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 21 additions and 35 deletions

View file

@ -1696,17 +1696,11 @@
args--;
argcount++;
}
_Py_UopsSymbol **localsplus_start = ctx->n_consumed;
int n_locals_already_filled = 0;
// Can determine statically, so we interleave the new locals
// and make the current stack the new locals.
// This also sets up for true call inlining.
if (sym_is_null(self_or_null) || sym_is_not_null(self_or_null)) {
localsplus_start = args;
n_locals_already_filled = argcount;
OUT_OF_SPACE_IF_NULL(new_frame = frame_new(ctx, co, 0, args, argcount));
} else {
OUT_OF_SPACE_IF_NULL(new_frame = frame_new(ctx, co, 0, NULL, 0));
}
OUT_OF_SPACE_IF_NULL(new_frame =
frame_new(ctx, co, localsplus_start, n_locals_already_filled, 0));
stack_pointer[-2 - oparg] = (_Py_UopsSymbol *)new_frame;
stack_pointer += -1 - oparg;
break;