mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
bpo-46329: Split calls into precall and call instructions. (GH-30855)
* Add PRECALL_FUNCTION opcode. * Move 'call shape' varaibles into struct. * Replace CALL_NO_KW and CALL_KW with KW_NAMES and CALL instructions. * Specialize for builtin methods taking using the METH_FASTCALL | METH_KEYWORDS protocol. * Allow kwnames for specialized calls to builtin types. * Specialize calls to tuple(arg) and str(arg).
This commit is contained in:
parent
5a9e423473
commit
89fd7c3452
16 changed files with 957 additions and 674 deletions
|
@ -83,7 +83,7 @@ take_ownership(PyFrameObject *f, InterpreterFrame *frame)
|
|||
}
|
||||
|
||||
void
|
||||
_PyFrame_Clear(InterpreterFrame * frame)
|
||||
_PyFrame_Clear(InterpreterFrame *frame)
|
||||
{
|
||||
/* It is the responsibility of the owning generator/coroutine
|
||||
* to have cleared the enclosing generator, if any. */
|
||||
|
@ -107,3 +107,16 @@ _PyFrame_Clear(InterpreterFrame * frame)
|
|||
Py_DECREF(frame->f_func);
|
||||
Py_DECREF(frame->f_code);
|
||||
}
|
||||
|
||||
InterpreterFrame *
|
||||
_PyFrame_Push(PyThreadState *tstate, PyFunctionObject *func)
|
||||
{
|
||||
PyCodeObject *code = (PyCodeObject *)func->func_code;
|
||||
size_t size = code->co_nlocalsplus + code->co_stacksize + FRAME_SPECIALS_SIZE;
|
||||
InterpreterFrame *new_frame = _PyThreadState_BumpFramePointer(tstate, size);
|
||||
if (new_frame == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
_PyFrame_InitializeSpecials(new_frame, func, NULL, code->co_nlocalsplus);
|
||||
return new_frame;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue