gh-90997: bpo-46841: Disassembly of quickened code by penguin-wwy · Pull Request #32099 · python/cpython
One problem is that some instructions are too long(like PRECALL_BUILTIN_FAST_WITH_KEYWORDS), do I need to increase _OPNAME_WIDTH
def adaptive_test(a, b): c = a + b print(c.__class__)
Exec dis(adaptive_test):
30 0 RESUME 0
31 2 LOAD_FAST 0 (a)
4 LOAD_FAST 1 (b)
6 BINARY_OP 0 (+)
10 STORE_FAST 2 (c)
32 12 LOAD_GLOBAL 1 (NULL + print)
24 LOAD_FAST 2 (c)
26 LOAD_ATTR 1 (__class__)
36 PRECALL 1
40 CALL 1
50 POP_TOP
52 LOAD_CONST 0 (None)
54 RETURN_VALUE
Exec dis(adaptive_test, adaptive=True):
30 0 RESUME_QUICK 0
31 2 LOAD_FAST__LOAD_FAST 0 (a)
4 LOAD_FAST 1 (b)
6 BINARY_OP_ADD_INT 0 (+)
10 STORE_FAST 2 (c)
32 12 LOAD_GLOBAL_BUILTIN 1 (NULL + print)
24 LOAD_FAST 2 (c)
26 LOAD_ATTR_SLOT 1 (__class__)
36 PRECALL_BUILTIN_FAST_WITH_KEYWORDS 1
40 CALL_ADAPTIVE 1
50 POP_TOP
52 LOAD_CONST 0 (None)
54 RETURN_VALUE