Message410209
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. |
|
Date |
User |
Action |
Args |
2022-01-10 12:54:45 | Mark.Shannon | set | recipients:
+ Mark.Shannon, kj |
2022-01-10 12:54:45 | Mark.Shannon | set | messageid: <1641819285.76.0.605357810946.issue46329@roundup.psfhosted.org> |
2022-01-10 12:54:45 | Mark.Shannon | link | issue46329 messages |
2022-01-10 12:54:45 | Mark.Shannon | create | |
|