bpo-44525: Split calls into PRECALL and CALL (GH-30011)

* Add 3 new opcodes for calls: PRECALL_METHOD, CALL_NO_KW, CALL_KW.

* Update specialization to handle new CALL opcodes.

* Specialize call to method descriptors.

* Remove old CALL opcodes: CALL_FUNCTION, CALL_METHOD, CALL_METHOD_KW, CALL_FUNCTION_KW.
This commit is contained in:
Mark Shannon 2021-12-14 18:22:44 +00:00 committed by GitHub
parent d60457a667
commit 9f8f45144b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 395 additions and 236 deletions

View file

@ -23,7 +23,7 @@ compiles as follows in 3.10:
3 2 LOAD_GLOBAL 0 (g)
4 LOAD_CONST 1 (0)
6 CALL_FUNCTION 1
6 CALL_NO_KW 1
8 POP_TOP
10 POP_BLOCK
12 LOAD_CONST 0 (None)
@ -47,7 +47,7 @@ a table to determine where to jump to when an exception is raised.
3 2 LOAD_GLOBAL 0 (g)
4 LOAD_CONST 1 (0)
6 CALL_FUNCTION 1
6 CALL_NO_KW 1
8 POP_TOP
10 LOAD_CONST 0 (None)
12 RETURN_VALUE
@ -68,7 +68,7 @@ ExceptionTable:
(Note this code is from an early 3.11 alpha, the NOP may well have be removed before release).
If an instruction raises an exception then its offset is used to find the target to jump to.
For example, the CALL_FUNCTION at offset 6, falls into the range 2 to 8.
For example, the CALL_NO_KW at offset 6, falls into the range 2 to 8.
So, if g() raises an exception, then control jumps to offset 14.

View file

@ -188,7 +188,7 @@ which compiles to this:
3 6 LOAD_GLOBAL 0 (print)
8 LOAD_CONST 1 (1)
10 CALL_FUNCTION 1
10 CALL_NO_KW 1
12 POP_TOP
4 14 BREAK_LOOP
@ -197,7 +197,7 @@ which compiles to this:
6 20 LOAD_GLOBAL 0 (print)
22 LOAD_CONST 2 (2)
24 CALL_FUNCTION 1
24 CALL_NO_KW 1
26 POP_TOP
>> 28 LOAD_CONST 0 (None)
30 RETURN_VALUE