GH-96793: Specialize FOR_ITER for generators. (GH-98772)

This commit is contained in:
Mark Shannon 2022-11-07 06:49:51 -08:00 committed by GitHub
parent 80c08d1cd6
commit 4a1c58d504
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 207 additions and 71 deletions

View file

@ -61,6 +61,7 @@ typedef struct _PyInterpreterFrame {
// over, or (in the case of a newly-created frame) a totally invalid value:
_Py_CODEUNIT *prev_instr;
int stacktop; /* Offset of TOS from localsplus */
uint16_t yield_offset;
bool is_entry; // Whether this is the "root" frame for the current _PyCFrame.
char owner;
/* Locals and stack */
@ -110,6 +111,7 @@ _PyFrame_InitializeSpecials(
frame->frame_obj = NULL;
frame->prev_instr = _PyCode_CODE(code) - 1;
frame->is_entry = false;
frame->yield_offset = 0;
frame->owner = FRAME_OWNED_BY_THREAD;
}