bpo-46329: Split calls into precall and call instructions. (GH-30855)

* Add PRECALL_FUNCTION opcode.

* Move 'call shape' varaibles into struct.

* Replace CALL_NO_KW and CALL_KW with KW_NAMES and CALL instructions.

* Specialize for builtin methods taking using the METH_FASTCALL | METH_KEYWORDS protocol.

* Allow kwnames for specialized calls to builtin types.

* Specialize calls to tuple(arg) and str(arg).
This commit is contained in:
Mark Shannon 2022-01-28 12:42:30 +00:00 committed by GitHub
parent 5a9e423473
commit 89fd7c3452
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 957 additions and 674 deletions

View file

@ -384,9 +384,14 @@ _code_type = type(_write_atomic.__code__)
# Python 3.11a5 3476 (Add ASYNC_GEN_WRAP opcode)
# Python 3.11a5 3477 (Replace DUP_TOP/DUP_TOP_TWO with COPY and
# ROT_TWO/ROT_THREE/ROT_FOUR/ROT_N with SWAP)
# Python 3.11a5 3478 (New CALL opcodes)
# Python 3.12 will start with magic number 3500
# Python 3.12 will start with magic number 3500
#
# MAGIC must change whenever the bytecode emitted by the compiler may no
# longer be understood by older implementations of the eval loop (usually
@ -397,7 +402,7 @@ _code_type = type(_write_atomic.__code__)
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# in PC/launcher.c must also be updated.
MAGIC_NUMBER = (3477).to_bytes(2, 'little') + b'\r\n'
MAGIC_NUMBER = (3478).to_bytes(2, 'little') + b'\r\n'
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c
_PYCACHE = '__pycache__'