New submission from Mark Shannon <m...@hotpy.org>:
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. ---------- assignee: Mark.Shannon messages: 410209 nosy: Mark.Shannon, kj priority: normal severity: normal status: open title: Split up the CALL_NO_KW and CALL_KW instructions. type: performance versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46329> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com