GH-93897: Store frame size in code object and de-opt if insufficient space on thread frame stack. (GH-93908)

This commit is contained in:
Mark Shannon 2022-06-20 12:59:25 +01:00 committed by GitHub
parent 774ef28814
commit 45e62a2bc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 50 additions and 67 deletions

View file

@ -114,22 +114,6 @@ _PyFrame_Clear(_PyInterpreterFrame *frame)
Py_DECREF(frame->f_code);
}
/* Consumes reference to func */
_PyInterpreterFrame *
_PyFrame_Push(PyThreadState *tstate, PyFunctionObject *func)
{
PyCodeObject *code = (PyCodeObject *)func->func_code;
size_t size = code->co_nlocalsplus + code->co_stacksize + FRAME_SPECIALS_SIZE;
CALL_STAT_INC(frames_pushed);
_PyInterpreterFrame *new_frame = _PyThreadState_BumpFramePointer(tstate, size);
if (new_frame == NULL) {
Py_DECREF(func);
return NULL;
}
_PyFrame_InitializeSpecials(new_frame, func, NULL, code->co_nlocalsplus);
return new_frame;
}
int
_PyInterpreterFrame_GetLine(_PyInterpreterFrame *frame)
{