Skip to content

Commit a8eb697

Browse files
committed
Generalize the CALL async specializations to all generator kinds
Specialize calls of generator and async generator functions as well as coroutine functions, and rename the opcodes from *_ASYNC to *_GEN: CALL_PY_GEN_EXACT_ARGS, CALL_PY_GEN_GENERAL, CALL_BOUND_METHOD_GEN_EXACT_ARGS, CALL_BOUND_METHOD_GEN_GENERAL, CALL_KW_PY_GEN and CALL_KW_BOUND_METHOD_GEN. Only require the code to start with RETURN_GENERATOR: the new frame is left at the following instruction, as RETURN_GENERATOR leaves it, so that instruction does not need to be checked. _Py_MakeCoro now delegates to _PyGen_NewFromFunction(), which takes the caller frame used to compute cr_origin.
1 parent dbe037f commit a8eb697

20 files changed

Lines changed: 1029 additions & 929 deletions

‎Include/internal/pycore_ceval.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ _Py_VectorCall_StackRefSteal(
419419
_PyStackRef kwnames);
420420

421421
PyAPI_FUNC(PyObject *)
422-
_PyEval_MakeCoroStackRefSteal(
422+
_PyEval_MakeGenStackRefSteal(
423423
PyThreadState *tstate,
424424
_PyStackRef func,
425425
_PyStackRef *args,

‎Include/internal/pycore_genobject.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ PyAPI_FUNC(PyObject *)_PyAsyncGenValueWrapperNew(PyThreadState *state, PyObject
4848
// Exported for external JIT support
4949
PyAPI_FUNC(PyObject *) _PyCoro_ComputeOrigin(int origin_depth, _PyInterpreterFrame *current_frame);
5050

51-
extern PyObject *_PyCoro_New(PyThreadState *tstate, PyFunctionObject *func,
52-
_PyInterpreterFrame *caller);
51+
extern PyObject *_PyGen_NewFromFunction(PyThreadState *tstate,
52+
PyFunctionObject *func,
53+
_PyInterpreterFrame *caller);
5354

5455
extern PyTypeObject _PyCoroWrapper_Type;
5556
extern PyTypeObject _PyAsyncGenWrappedValue_Type;

‎Include/internal/pycore_opcode_metadata.h‎

Lines changed: 44 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Include/internal/pycore_uop_ids.h‎

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Include/internal/pycore_uop_metadata.h‎

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Include/opcode_ids.h‎

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Lib/_opcode_metadata.py‎

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)