Closed
Description
We want to be able to specialize iteration over generators and awaiting coroutines. Both for PEP 659 and for higher tier optimizers.
For the theory see faster-cpython/ideas#457
To do this we need:
- Shim frames to keep the various returns simple GH-96421: Insert shim frame on entry to interpreter #96319
- Modify
FOR_ITER
to leave iterator and value on the stack when exiting GH-96793: ChangeFOR_ITER
to not pop the iterator on exhaustion. #96801 - Implement specialization of
FOR_ITER
for generators GH-96793: Specialize FOR_ITER for generators. #98772 - Implement specialization of
SEND
for coroutines
Edited:
Remove the requirement for a GEN_RETURN_VALUE
instruction. We might want one to simplify frame popping, but it isn't needed for specializing.