With the new opcodes, the sequence of instructions executed during a call looks like this:

The stats https://github.com/faster-cpython/ideas/blob/main/stats.md#call show that we only have a 72% hit rate on the standard benchmark suite.
Specialization attempts
|
Count |
Ratio |
| Success |
2909102 |
24.4% |
| Failure |
9035032 |
75.6% |
| Failure kind |
Count |
Ratio |
| bound method |
2136774 |
23.6% |
| complex parameters |
1252534 |
13.9% |
| python class |
1245231 |
13.8% |
| pycfunction with keywords |
859904 |
9.5% |
| class no vectorcall |
723781 |
8.0% |
| kwnames |
634422 |
7.0% |
| pycfunction |
586186 |
6.5% |
| pycfunction noargs |
407864 |
4.5% |
| class mutable |
327462 |
3.6% |
| other |
232681 |
2.6% |
| bad call flags |
179897 |
2.0% |
| cmethod |
168390 |
1.9% |
| pycfunction fast with keywords |
162744 |
1.8% |
| str |
79833 |
0.9% |
| method wrapper |
32561 |
0.4% |
| operator wrapper |
4768 |
0.1% |
Each of these failures need a different strategy, so multiple strategies.
Bound methods.
Bounds methods can come from two places, bound methods object explicitly used in the program, and classmethods.
The first should be handled in PRECALL_FUNCTION, the second in LOAD_METHOD.
Complex parameters.
This needs more investigation, to see if some of these can be specialized.
Python class
Should be handled in PRECALL_FUNCTION which will create the self object and push a clean-up frame, leaving the __init__ method to be handled by CALL.
Builtin functions and classes using the older caller conventions
These should be fixed by modernizing the callee, not accommodating them in the interpreter.
Mutable classes
Mystery classification. Needs investigation, possibly a bug in the classification.
With the new opcodes, the sequence of instructions executed during a call looks like this:
The stats https://github.com/faster-cpython/ideas/blob/main/stats.md#call show that we only have a 72% hit rate on the standard benchmark suite.
Specialization attempts
Each of these failures need a different strategy, so multiple strategies.
Bound methods.
Bounds methods can come from two places, bound methods object explicitly used in the program, and classmethods.
The first should be handled in
PRECALL_FUNCTION, the second inLOAD_METHOD.Complex parameters.
This needs more investigation, to see if some of these can be specialized.
Python class
Should be handled in
PRECALL_FUNCTIONwhich will create theselfobject and push a clean-up frame, leaving the__init__method to be handled byCALL.Builtin functions and classes using the older caller conventions
These should be fixed by modernizing the callee, not accommodating them in the interpreter.
Mutable classes
Mystery classification. Needs investigation, possibly a bug in the classification.