bpo-26110: Add `CALL_METHOD_KW` opcode to speedup method calls with keywords (GH-26014)

* Add CALL_METHOD_KW

* Make CALL_METHOD branchless too since it shares the same code

* Place parentheses in STACK_SHRINK
This commit is contained in:
Ken Jin 2021-05-15 23:15:23 +08:00 committed by GitHub
parent e4e931a67e
commit f24afda591
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 247 additions and 180 deletions

View file

@ -353,6 +353,7 @@ _code_type = type(_write_atomic.__code__)
# Python 3.10b1 3438 Safer line number table handling.
# Python 3.10b1 3439 (Add ROT_N)
# Python 3.11a1 3450 Use exception table for unwinding ("zero cost" exception handling)
# Python 3.11a1 3451 (Add CALL_METHOD_KW)
#
# MAGIC must change whenever the bytecode emitted by the compiler may no
@ -362,7 +363,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 = (3450).to_bytes(2, 'little') + b'\r\n'
MAGIC_NUMBER = (3451).to_bytes(2, 'little') + b'\r\n'
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c
_PYCACHE = '__pycache__'