mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
[3.13] gh-119258: Backport optimizer frame fixes in GH-119365 (GH-120699)
(cherry picked from commit 55402d3
)
This commit is contained in:
parent
b8fd80f91b
commit
7c7aa5a99c
5 changed files with 21 additions and 35 deletions
|
@ -303,9 +303,9 @@ _Py_UOpsAbstractFrame *
|
|||
_Py_uop_frame_new(
|
||||
_Py_UOpsContext *ctx,
|
||||
PyCodeObject *co,
|
||||
_Py_UopsSymbol **localsplus_start,
|
||||
int n_locals_already_filled,
|
||||
int curr_stackentries)
|
||||
int curr_stackentries,
|
||||
_Py_UopsSymbol **args,
|
||||
int arg_len)
|
||||
{
|
||||
assert(ctx->curr_frame_depth < MAX_ABSTRACT_FRAME_DEPTH);
|
||||
_Py_UOpsAbstractFrame *frame = &ctx->frames[ctx->curr_frame_depth];
|
||||
|
@ -313,21 +313,21 @@ _Py_uop_frame_new(
|
|||
frame->stack_len = co->co_stacksize;
|
||||
frame->locals_len = co->co_nlocalsplus;
|
||||
|
||||
frame->locals = localsplus_start;
|
||||
frame->locals = ctx->n_consumed;
|
||||
frame->stack = frame->locals + co->co_nlocalsplus;
|
||||
frame->stack_pointer = frame->stack + curr_stackentries;
|
||||
ctx->n_consumed = localsplus_start + (co->co_nlocalsplus + co->co_stacksize);
|
||||
ctx->n_consumed = ctx->n_consumed + (co->co_nlocalsplus + co->co_stacksize);
|
||||
if (ctx->n_consumed >= ctx->limit) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Initialize with the initial state of all local variables
|
||||
for (int i = n_locals_already_filled; i < co->co_nlocalsplus; i++) {
|
||||
for (int i = 0; i < arg_len; i++) {
|
||||
frame->locals[i] = args[i];
|
||||
}
|
||||
|
||||
for (int i = arg_len; i < co->co_nlocalsplus; i++) {
|
||||
_Py_UopsSymbol *local = _Py_uop_sym_new_unknown(ctx);
|
||||
if (local == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
frame->locals[i] = local;
|
||||
}
|
||||
|
||||
|
@ -335,9 +335,6 @@ _Py_uop_frame_new(
|
|||
// Initialize the stack as well
|
||||
for (int i = 0; i < curr_stackentries; i++) {
|
||||
_Py_UopsSymbol *stackvar = _Py_uop_sym_new_unknown(ctx);
|
||||
if (stackvar == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
frame->stack[i] = stackvar;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue