This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Mark.Shannon
Recipients Mark.Shannon, kj
Date 2022-01-10.12:54:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641819285.76.0.605357810946.issue46329@roundup.psfhosted.org>
In-reply-to
Content
Most calls (not those with *args and/or **kwargs) are compiled to the `CALL_NO_KW` and `CALL_KW` instructions, possibly with a `PRECALL_METHOD` prefix.

We want to unify the `CALL_NO_KW` and `CALL_KW` instructions into a single `CALL` instruction and add two new instructions: `PRECALL_FUNCTION` and `KW_NAMES`.
All call sequences would start with `PRECALL_FUNCTION` or `PRECALL_METHOD`. `PRECALL_METHOD` would continue to pair with `LOAD_METHOD` as it does now. `PRECALL_FUNCTION` would effectively be a no-op, but would be needed to set up internal interpreter variables.

`CALL_NO_KW` would become `CALL` and `CALL_KW` would become `KW_NAMES; CALL`.

Why?

Specializing calls is an important optimization, but calls are complicated and we want to specialized for both the type of the callable and the shape of the call.

By breaking up calls in this way, we can specialize for the type and for the shape mostly independently.
We can specialize for classes, bound-methods and other objects that ultimately call a Python function in the `PRECALL` instruction and specialize for the shape of the arguments in the `CALL` instruction.


See https://github.com/faster-cpython/ideas/discussions/210 for more rationale.
History
Date User Action Args
2022-01-10 12:54:45Mark.Shannonsetrecipients: + Mark.Shannon, kj
2022-01-10 12:54:45Mark.Shannonsetmessageid: <1641819285.76.0.605357810946.issue46329@roundup.psfhosted.org>
2022-01-10 12:54:45Mark.Shannonlinkissue46329 messages
2022-01-10 12:54:45Mark.Shannoncreate