mirror of https://github.com/python/cpython
GH-90690: Remove `PRECALL` instruction (GH-92925)
This commit is contained in:
parent
41638967a0
commit
e48ac9c100
|
@ -45,9 +45,8 @@ the following command can be used to display the disassembly of
|
|||
2 2 PUSH_NULL
|
||||
4 LOAD_GLOBAL 1 (NULL + len)
|
||||
6 LOAD_FAST 0 (alist)
|
||||
8 PRECALL 1
|
||||
10 CALL 1
|
||||
12 RETURN_VALUE
|
||||
8 CALL 1
|
||||
18 RETURN_VALUE
|
||||
|
||||
(The "2" is a line number).
|
||||
|
||||
|
@ -119,7 +118,6 @@ Example::
|
|||
PUSH_NULL
|
||||
LOAD_GLOBAL
|
||||
LOAD_FAST
|
||||
PRECALL
|
||||
CALL
|
||||
RETURN_VALUE
|
||||
|
||||
|
@ -1182,15 +1180,6 @@ iterations of the loop.
|
|||
.. versionadded:: 3.7
|
||||
|
||||
|
||||
.. opcode:: PRECALL (argc)
|
||||
|
||||
Prefixes :opcode:`CALL`. Logically this is a no op.
|
||||
It exists to enable effective specialization of calls.
|
||||
``argc`` is the number of arguments as described in :opcode:`CALL`.
|
||||
|
||||
.. versionadded:: 3.11
|
||||
|
||||
|
||||
.. opcode:: PUSH_NULL
|
||||
|
||||
Pushes a ``NULL`` to the stack.
|
||||
|
@ -1202,7 +1191,7 @@ iterations of the loop.
|
|||
|
||||
.. opcode:: KW_NAMES (i)
|
||||
|
||||
Prefixes :opcode:`PRECALL`.
|
||||
Prefixes :opcode:`CALL`.
|
||||
Stores a reference to ``co_consts[consti]`` into an internal variable
|
||||
for use by :opcode:`CALL`. ``co_consts[consti]`` must be a tuple of strings.
|
||||
|
||||
|
|
|
@ -80,12 +80,6 @@ typedef struct {
|
|||
|
||||
#define INLINE_CACHE_ENTRIES_CALL CACHE_ENTRIES(_PyCallCache)
|
||||
|
||||
typedef struct {
|
||||
_Py_CODEUNIT counter;
|
||||
} _PyPrecallCache;
|
||||
|
||||
#define INLINE_CACHE_ENTRIES_PRECALL CACHE_ENTRIES(_PyPrecallCache)
|
||||
|
||||
typedef struct {
|
||||
_Py_CODEUNIT counter;
|
||||
} _PyStoreSubscrCache;
|
||||
|
@ -249,8 +243,6 @@ extern int _Py_Specialize_BinarySubscr(PyObject *sub, PyObject *container, _Py_C
|
|||
extern int _Py_Specialize_StoreSubscr(PyObject *container, PyObject *sub, _Py_CODEUNIT *instr);
|
||||
extern int _Py_Specialize_Call(PyObject *callable, _Py_CODEUNIT *instr,
|
||||
int nargs, PyObject *kwnames);
|
||||
extern int _Py_Specialize_Precall(PyObject *callable, _Py_CODEUNIT *instr,
|
||||
int nargs, PyObject *kwnames, int oparg);
|
||||
extern void _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
|
||||
int oparg, PyObject **locals);
|
||||
extern void _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs,
|
||||
|
|
|
@ -50,7 +50,6 @@ const uint8_t _PyOpcode_Caches[256] = {
|
|||
[LOAD_GLOBAL] = 5,
|
||||
[BINARY_OP] = 1,
|
||||
[LOAD_METHOD] = 10,
|
||||
[PRECALL] = 1,
|
||||
[CALL] = 4,
|
||||
};
|
||||
|
||||
|
@ -84,7 +83,22 @@ const uint8_t _PyOpcode_Deopt[256] = {
|
|||
[CACHE] = CACHE,
|
||||
[CALL] = CALL,
|
||||
[CALL_ADAPTIVE] = CALL,
|
||||
[CALL_BOUND_METHOD_EXACT_ARGS] = CALL,
|
||||
[CALL_BUILTIN_CLASS] = CALL,
|
||||
[CALL_BUILTIN_FAST_WITH_KEYWORDS] = CALL,
|
||||
[CALL_FUNCTION_EX] = CALL_FUNCTION_EX,
|
||||
[CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = CALL,
|
||||
[CALL_NO_KW_BUILTIN_FAST] = CALL,
|
||||
[CALL_NO_KW_BUILTIN_O] = CALL,
|
||||
[CALL_NO_KW_ISINSTANCE] = CALL,
|
||||
[CALL_NO_KW_LEN] = CALL,
|
||||
[CALL_NO_KW_LIST_APPEND] = CALL,
|
||||
[CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = CALL,
|
||||
[CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = CALL,
|
||||
[CALL_NO_KW_METHOD_DESCRIPTOR_O] = CALL,
|
||||
[CALL_NO_KW_STR_1] = CALL,
|
||||
[CALL_NO_KW_TUPLE_1] = CALL,
|
||||
[CALL_NO_KW_TYPE_1] = CALL,
|
||||
[CALL_PY_EXACT_ARGS] = CALL,
|
||||
[CALL_PY_WITH_DEFAULTS] = CALL,
|
||||
[CHECK_EG_MATCH] = CHECK_EG_MATCH,
|
||||
|
@ -176,24 +190,6 @@ const uint8_t _PyOpcode_Deopt[256] = {
|
|||
[POP_JUMP_FORWARD_IF_NOT_NONE] = POP_JUMP_FORWARD_IF_NOT_NONE,
|
||||
[POP_JUMP_FORWARD_IF_TRUE] = POP_JUMP_FORWARD_IF_TRUE,
|
||||
[POP_TOP] = POP_TOP,
|
||||
[PRECALL] = PRECALL,
|
||||
[PRECALL_ADAPTIVE] = PRECALL,
|
||||
[PRECALL_BOUND_METHOD] = PRECALL,
|
||||
[PRECALL_BUILTIN_CLASS] = PRECALL,
|
||||
[PRECALL_BUILTIN_FAST_WITH_KEYWORDS] = PRECALL,
|
||||
[PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = PRECALL,
|
||||
[PRECALL_NO_KW_BUILTIN_FAST] = PRECALL,
|
||||
[PRECALL_NO_KW_BUILTIN_O] = PRECALL,
|
||||
[PRECALL_NO_KW_ISINSTANCE] = PRECALL,
|
||||
[PRECALL_NO_KW_LEN] = PRECALL,
|
||||
[PRECALL_NO_KW_LIST_APPEND] = PRECALL,
|
||||
[PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST] = PRECALL,
|
||||
[PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = PRECALL,
|
||||
[PRECALL_NO_KW_METHOD_DESCRIPTOR_O] = PRECALL,
|
||||
[PRECALL_NO_KW_STR_1] = PRECALL,
|
||||
[PRECALL_NO_KW_TUPLE_1] = PRECALL,
|
||||
[PRECALL_NO_KW_TYPE_1] = PRECALL,
|
||||
[PRECALL_PYFUNC] = PRECALL,
|
||||
[PREP_RERAISE_STAR] = PREP_RERAISE_STAR,
|
||||
[PRINT_EXPR] = PRINT_EXPR,
|
||||
[PUSH_EXC_INFO] = PUSH_EXC_INFO,
|
||||
|
@ -268,7 +264,22 @@ const uint8_t _PyOpcode_Original[256] = {
|
|||
[CACHE] = CACHE,
|
||||
[CALL] = CALL,
|
||||
[CALL_ADAPTIVE] = CALL,
|
||||
[CALL_BOUND_METHOD_EXACT_ARGS] = CALL,
|
||||
[CALL_BUILTIN_CLASS] = CALL,
|
||||
[CALL_BUILTIN_FAST_WITH_KEYWORDS] = CALL,
|
||||
[CALL_FUNCTION_EX] = CALL_FUNCTION_EX,
|
||||
[CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = CALL,
|
||||
[CALL_NO_KW_BUILTIN_FAST] = CALL,
|
||||
[CALL_NO_KW_BUILTIN_O] = CALL,
|
||||
[CALL_NO_KW_ISINSTANCE] = CALL,
|
||||
[CALL_NO_KW_LEN] = CALL,
|
||||
[CALL_NO_KW_LIST_APPEND] = CALL,
|
||||
[CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = CALL,
|
||||
[CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = CALL,
|
||||
[CALL_NO_KW_METHOD_DESCRIPTOR_O] = CALL,
|
||||
[CALL_NO_KW_STR_1] = CALL,
|
||||
[CALL_NO_KW_TUPLE_1] = CALL,
|
||||
[CALL_NO_KW_TYPE_1] = CALL,
|
||||
[CALL_PY_EXACT_ARGS] = CALL,
|
||||
[CALL_PY_WITH_DEFAULTS] = CALL,
|
||||
[CHECK_EG_MATCH] = CHECK_EG_MATCH,
|
||||
|
@ -360,24 +371,6 @@ const uint8_t _PyOpcode_Original[256] = {
|
|||
[POP_JUMP_FORWARD_IF_NOT_NONE] = POP_JUMP_FORWARD_IF_NOT_NONE,
|
||||
[POP_JUMP_FORWARD_IF_TRUE] = POP_JUMP_FORWARD_IF_TRUE,
|
||||
[POP_TOP] = POP_TOP,
|
||||
[PRECALL] = PRECALL,
|
||||
[PRECALL_ADAPTIVE] = PRECALL,
|
||||
[PRECALL_BOUND_METHOD] = PRECALL,
|
||||
[PRECALL_BUILTIN_CLASS] = PRECALL,
|
||||
[PRECALL_BUILTIN_FAST_WITH_KEYWORDS] = PRECALL,
|
||||
[PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = PRECALL,
|
||||
[PRECALL_NO_KW_BUILTIN_FAST] = PRECALL,
|
||||
[PRECALL_NO_KW_BUILTIN_O] = PRECALL,
|
||||
[PRECALL_NO_KW_ISINSTANCE] = PRECALL,
|
||||
[PRECALL_NO_KW_LEN] = PRECALL,
|
||||
[PRECALL_NO_KW_LIST_APPEND] = PRECALL,
|
||||
[PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST] = PRECALL,
|
||||
[PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = PRECALL,
|
||||
[PRECALL_NO_KW_METHOD_DESCRIPTOR_O] = PRECALL,
|
||||
[PRECALL_NO_KW_STR_1] = PRECALL,
|
||||
[PRECALL_NO_KW_TUPLE_1] = PRECALL,
|
||||
[PRECALL_NO_KW_TYPE_1] = PRECALL,
|
||||
[PRECALL_PYFUNC] = PRECALL,
|
||||
[PREP_RERAISE_STAR] = PREP_RERAISE_STAR,
|
||||
[PRINT_EXPR] = PRINT_EXPR,
|
||||
[PUSH_EXC_INFO] = PUSH_EXC_INFO,
|
||||
|
@ -451,62 +444,62 @@ static const char *const _PyOpcode_OpName[256] = {
|
|||
[CALL_PY_EXACT_ARGS] = "CALL_PY_EXACT_ARGS",
|
||||
[CALL_PY_WITH_DEFAULTS] = "CALL_PY_WITH_DEFAULTS",
|
||||
[BINARY_SUBSCR] = "BINARY_SUBSCR",
|
||||
[COMPARE_OP_ADAPTIVE] = "COMPARE_OP_ADAPTIVE",
|
||||
[COMPARE_OP_FLOAT_JUMP] = "COMPARE_OP_FLOAT_JUMP",
|
||||
[COMPARE_OP_INT_JUMP] = "COMPARE_OP_INT_JUMP",
|
||||
[COMPARE_OP_STR_JUMP] = "COMPARE_OP_STR_JUMP",
|
||||
[CALL_BOUND_METHOD_EXACT_ARGS] = "CALL_BOUND_METHOD_EXACT_ARGS",
|
||||
[CALL_BUILTIN_CLASS] = "CALL_BUILTIN_CLASS",
|
||||
[CALL_BUILTIN_FAST_WITH_KEYWORDS] = "CALL_BUILTIN_FAST_WITH_KEYWORDS",
|
||||
[CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = "CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS",
|
||||
[GET_LEN] = "GET_LEN",
|
||||
[MATCH_MAPPING] = "MATCH_MAPPING",
|
||||
[MATCH_SEQUENCE] = "MATCH_SEQUENCE",
|
||||
[MATCH_KEYS] = "MATCH_KEYS",
|
||||
[EXTENDED_ARG_QUICK] = "EXTENDED_ARG_QUICK",
|
||||
[CALL_NO_KW_BUILTIN_FAST] = "CALL_NO_KW_BUILTIN_FAST",
|
||||
[PUSH_EXC_INFO] = "PUSH_EXC_INFO",
|
||||
[CHECK_EXC_MATCH] = "CHECK_EXC_MATCH",
|
||||
[CHECK_EG_MATCH] = "CHECK_EG_MATCH",
|
||||
[JUMP_BACKWARD_QUICK] = "JUMP_BACKWARD_QUICK",
|
||||
[LOAD_ATTR_ADAPTIVE] = "LOAD_ATTR_ADAPTIVE",
|
||||
[LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE",
|
||||
[LOAD_ATTR_MODULE] = "LOAD_ATTR_MODULE",
|
||||
[LOAD_ATTR_SLOT] = "LOAD_ATTR_SLOT",
|
||||
[LOAD_ATTR_WITH_HINT] = "LOAD_ATTR_WITH_HINT",
|
||||
[LOAD_CONST__LOAD_FAST] = "LOAD_CONST__LOAD_FAST",
|
||||
[LOAD_FAST__LOAD_CONST] = "LOAD_FAST__LOAD_CONST",
|
||||
[LOAD_FAST__LOAD_FAST] = "LOAD_FAST__LOAD_FAST",
|
||||
[LOAD_GLOBAL_ADAPTIVE] = "LOAD_GLOBAL_ADAPTIVE",
|
||||
[LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN",
|
||||
[CALL_NO_KW_BUILTIN_O] = "CALL_NO_KW_BUILTIN_O",
|
||||
[CALL_NO_KW_ISINSTANCE] = "CALL_NO_KW_ISINSTANCE",
|
||||
[CALL_NO_KW_LEN] = "CALL_NO_KW_LEN",
|
||||
[CALL_NO_KW_LIST_APPEND] = "CALL_NO_KW_LIST_APPEND",
|
||||
[CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = "CALL_NO_KW_METHOD_DESCRIPTOR_FAST",
|
||||
[CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = "CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS",
|
||||
[CALL_NO_KW_METHOD_DESCRIPTOR_O] = "CALL_NO_KW_METHOD_DESCRIPTOR_O",
|
||||
[CALL_NO_KW_STR_1] = "CALL_NO_KW_STR_1",
|
||||
[CALL_NO_KW_TUPLE_1] = "CALL_NO_KW_TUPLE_1",
|
||||
[CALL_NO_KW_TYPE_1] = "CALL_NO_KW_TYPE_1",
|
||||
[COMPARE_OP_ADAPTIVE] = "COMPARE_OP_ADAPTIVE",
|
||||
[WITH_EXCEPT_START] = "WITH_EXCEPT_START",
|
||||
[GET_AITER] = "GET_AITER",
|
||||
[GET_ANEXT] = "GET_ANEXT",
|
||||
[BEFORE_ASYNC_WITH] = "BEFORE_ASYNC_WITH",
|
||||
[BEFORE_WITH] = "BEFORE_WITH",
|
||||
[END_ASYNC_FOR] = "END_ASYNC_FOR",
|
||||
[LOAD_GLOBAL_MODULE] = "LOAD_GLOBAL_MODULE",
|
||||
[LOAD_METHOD_ADAPTIVE] = "LOAD_METHOD_ADAPTIVE",
|
||||
[LOAD_METHOD_CLASS] = "LOAD_METHOD_CLASS",
|
||||
[LOAD_METHOD_MODULE] = "LOAD_METHOD_MODULE",
|
||||
[LOAD_METHOD_NO_DICT] = "LOAD_METHOD_NO_DICT",
|
||||
[COMPARE_OP_FLOAT_JUMP] = "COMPARE_OP_FLOAT_JUMP",
|
||||
[COMPARE_OP_INT_JUMP] = "COMPARE_OP_INT_JUMP",
|
||||
[COMPARE_OP_STR_JUMP] = "COMPARE_OP_STR_JUMP",
|
||||
[EXTENDED_ARG_QUICK] = "EXTENDED_ARG_QUICK",
|
||||
[JUMP_BACKWARD_QUICK] = "JUMP_BACKWARD_QUICK",
|
||||
[STORE_SUBSCR] = "STORE_SUBSCR",
|
||||
[DELETE_SUBSCR] = "DELETE_SUBSCR",
|
||||
[LOAD_METHOD_WITH_DICT] = "LOAD_METHOD_WITH_DICT",
|
||||
[LOAD_METHOD_WITH_VALUES] = "LOAD_METHOD_WITH_VALUES",
|
||||
[PRECALL_ADAPTIVE] = "PRECALL_ADAPTIVE",
|
||||
[PRECALL_BOUND_METHOD] = "PRECALL_BOUND_METHOD",
|
||||
[PRECALL_BUILTIN_CLASS] = "PRECALL_BUILTIN_CLASS",
|
||||
[PRECALL_BUILTIN_FAST_WITH_KEYWORDS] = "PRECALL_BUILTIN_FAST_WITH_KEYWORDS",
|
||||
[LOAD_ATTR_ADAPTIVE] = "LOAD_ATTR_ADAPTIVE",
|
||||
[LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE",
|
||||
[LOAD_ATTR_MODULE] = "LOAD_ATTR_MODULE",
|
||||
[LOAD_ATTR_SLOT] = "LOAD_ATTR_SLOT",
|
||||
[LOAD_ATTR_WITH_HINT] = "LOAD_ATTR_WITH_HINT",
|
||||
[LOAD_CONST__LOAD_FAST] = "LOAD_CONST__LOAD_FAST",
|
||||
[GET_ITER] = "GET_ITER",
|
||||
[GET_YIELD_FROM_ITER] = "GET_YIELD_FROM_ITER",
|
||||
[PRINT_EXPR] = "PRINT_EXPR",
|
||||
[LOAD_BUILD_CLASS] = "LOAD_BUILD_CLASS",
|
||||
[PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = "PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS",
|
||||
[PRECALL_NO_KW_BUILTIN_FAST] = "PRECALL_NO_KW_BUILTIN_FAST",
|
||||
[LOAD_FAST__LOAD_CONST] = "LOAD_FAST__LOAD_CONST",
|
||||
[LOAD_FAST__LOAD_FAST] = "LOAD_FAST__LOAD_FAST",
|
||||
[LOAD_ASSERTION_ERROR] = "LOAD_ASSERTION_ERROR",
|
||||
[RETURN_GENERATOR] = "RETURN_GENERATOR",
|
||||
[PRECALL_NO_KW_BUILTIN_O] = "PRECALL_NO_KW_BUILTIN_O",
|
||||
[PRECALL_NO_KW_ISINSTANCE] = "PRECALL_NO_KW_ISINSTANCE",
|
||||
[PRECALL_NO_KW_LEN] = "PRECALL_NO_KW_LEN",
|
||||
[PRECALL_NO_KW_LIST_APPEND] = "PRECALL_NO_KW_LIST_APPEND",
|
||||
[PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST] = "PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST",
|
||||
[PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = "PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS",
|
||||
[LOAD_GLOBAL_ADAPTIVE] = "LOAD_GLOBAL_ADAPTIVE",
|
||||
[LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN",
|
||||
[LOAD_GLOBAL_MODULE] = "LOAD_GLOBAL_MODULE",
|
||||
[LOAD_METHOD_ADAPTIVE] = "LOAD_METHOD_ADAPTIVE",
|
||||
[LOAD_METHOD_CLASS] = "LOAD_METHOD_CLASS",
|
||||
[LOAD_METHOD_MODULE] = "LOAD_METHOD_MODULE",
|
||||
[LIST_TO_TUPLE] = "LIST_TO_TUPLE",
|
||||
[RETURN_VALUE] = "RETURN_VALUE",
|
||||
[IMPORT_STAR] = "IMPORT_STAR",
|
||||
|
@ -538,7 +531,7 @@ static const char *const _PyOpcode_OpName[256] = {
|
|||
[JUMP_FORWARD] = "JUMP_FORWARD",
|
||||
[JUMP_IF_FALSE_OR_POP] = "JUMP_IF_FALSE_OR_POP",
|
||||
[JUMP_IF_TRUE_OR_POP] = "JUMP_IF_TRUE_OR_POP",
|
||||
[PRECALL_NO_KW_METHOD_DESCRIPTOR_O] = "PRECALL_NO_KW_METHOD_DESCRIPTOR_O",
|
||||
[LOAD_METHOD_NO_DICT] = "LOAD_METHOD_NO_DICT",
|
||||
[POP_JUMP_FORWARD_IF_FALSE] = "POP_JUMP_FORWARD_IF_FALSE",
|
||||
[POP_JUMP_FORWARD_IF_TRUE] = "POP_JUMP_FORWARD_IF_TRUE",
|
||||
[LOAD_GLOBAL] = "LOAD_GLOBAL",
|
||||
|
@ -546,13 +539,13 @@ static const char *const _PyOpcode_OpName[256] = {
|
|||
[CONTAINS_OP] = "CONTAINS_OP",
|
||||
[RERAISE] = "RERAISE",
|
||||
[COPY] = "COPY",
|
||||
[PRECALL_NO_KW_STR_1] = "PRECALL_NO_KW_STR_1",
|
||||
[LOAD_METHOD_WITH_DICT] = "LOAD_METHOD_WITH_DICT",
|
||||
[BINARY_OP] = "BINARY_OP",
|
||||
[SEND] = "SEND",
|
||||
[LOAD_FAST] = "LOAD_FAST",
|
||||
[STORE_FAST] = "STORE_FAST",
|
||||
[DELETE_FAST] = "DELETE_FAST",
|
||||
[PRECALL_NO_KW_TUPLE_1] = "PRECALL_NO_KW_TUPLE_1",
|
||||
[LOAD_METHOD_WITH_VALUES] = "LOAD_METHOD_WITH_VALUES",
|
||||
[POP_JUMP_FORWARD_IF_NOT_NONE] = "POP_JUMP_FORWARD_IF_NOT_NONE",
|
||||
[POP_JUMP_FORWARD_IF_NONE] = "POP_JUMP_FORWARD_IF_NONE",
|
||||
[RAISE_VARARGS] = "RAISE_VARARGS",
|
||||
|
@ -566,46 +559,46 @@ static const char *const _PyOpcode_OpName[256] = {
|
|||
[STORE_DEREF] = "STORE_DEREF",
|
||||
[DELETE_DEREF] = "DELETE_DEREF",
|
||||
[JUMP_BACKWARD] = "JUMP_BACKWARD",
|
||||
[PRECALL_NO_KW_TYPE_1] = "PRECALL_NO_KW_TYPE_1",
|
||||
[RESUME_QUICK] = "RESUME_QUICK",
|
||||
[CALL_FUNCTION_EX] = "CALL_FUNCTION_EX",
|
||||
[PRECALL_PYFUNC] = "PRECALL_PYFUNC",
|
||||
[STORE_ATTR_ADAPTIVE] = "STORE_ATTR_ADAPTIVE",
|
||||
[EXTENDED_ARG] = "EXTENDED_ARG",
|
||||
[LIST_APPEND] = "LIST_APPEND",
|
||||
[SET_ADD] = "SET_ADD",
|
||||
[MAP_ADD] = "MAP_ADD",
|
||||
[LOAD_CLASSDEREF] = "LOAD_CLASSDEREF",
|
||||
[COPY_FREE_VARS] = "COPY_FREE_VARS",
|
||||
[RESUME_QUICK] = "RESUME_QUICK",
|
||||
[STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE",
|
||||
[RESUME] = "RESUME",
|
||||
[MATCH_CLASS] = "MATCH_CLASS",
|
||||
[STORE_ATTR_ADAPTIVE] = "STORE_ATTR_ADAPTIVE",
|
||||
[STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE",
|
||||
[STORE_ATTR_SLOT] = "STORE_ATTR_SLOT",
|
||||
[STORE_ATTR_WITH_HINT] = "STORE_ATTR_WITH_HINT",
|
||||
[FORMAT_VALUE] = "FORMAT_VALUE",
|
||||
[BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP",
|
||||
[BUILD_STRING] = "BUILD_STRING",
|
||||
[STORE_ATTR_SLOT] = "STORE_ATTR_SLOT",
|
||||
[STORE_ATTR_WITH_HINT] = "STORE_ATTR_WITH_HINT",
|
||||
[LOAD_METHOD] = "LOAD_METHOD",
|
||||
[STORE_FAST__LOAD_FAST] = "STORE_FAST__LOAD_FAST",
|
||||
[STORE_FAST__STORE_FAST] = "STORE_FAST__STORE_FAST",
|
||||
[LOAD_METHOD] = "LOAD_METHOD",
|
||||
[STORE_SUBSCR_ADAPTIVE] = "STORE_SUBSCR_ADAPTIVE",
|
||||
[LIST_EXTEND] = "LIST_EXTEND",
|
||||
[SET_UPDATE] = "SET_UPDATE",
|
||||
[DICT_MERGE] = "DICT_MERGE",
|
||||
[DICT_UPDATE] = "DICT_UPDATE",
|
||||
[PRECALL] = "PRECALL",
|
||||
[STORE_FAST__STORE_FAST] = "STORE_FAST__STORE_FAST",
|
||||
[STORE_SUBSCR_ADAPTIVE] = "STORE_SUBSCR_ADAPTIVE",
|
||||
[STORE_SUBSCR_DICT] = "STORE_SUBSCR_DICT",
|
||||
[STORE_SUBSCR_LIST_INT] = "STORE_SUBSCR_LIST_INT",
|
||||
[UNPACK_SEQUENCE_ADAPTIVE] = "UNPACK_SEQUENCE_ADAPTIVE",
|
||||
[UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST",
|
||||
[UNPACK_SEQUENCE_TUPLE] = "UNPACK_SEQUENCE_TUPLE",
|
||||
[CALL] = "CALL",
|
||||
[KW_NAMES] = "KW_NAMES",
|
||||
[POP_JUMP_BACKWARD_IF_NOT_NONE] = "POP_JUMP_BACKWARD_IF_NOT_NONE",
|
||||
[POP_JUMP_BACKWARD_IF_NONE] = "POP_JUMP_BACKWARD_IF_NONE",
|
||||
[POP_JUMP_BACKWARD_IF_FALSE] = "POP_JUMP_BACKWARD_IF_FALSE",
|
||||
[POP_JUMP_BACKWARD_IF_TRUE] = "POP_JUMP_BACKWARD_IF_TRUE",
|
||||
[UNPACK_SEQUENCE_ADAPTIVE] = "UNPACK_SEQUENCE_ADAPTIVE",
|
||||
[UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST",
|
||||
[UNPACK_SEQUENCE_TUPLE] = "UNPACK_SEQUENCE_TUPLE",
|
||||
[UNPACK_SEQUENCE_TWO_TUPLE] = "UNPACK_SEQUENCE_TWO_TUPLE",
|
||||
[178] = "<178>",
|
||||
[179] = "<179>",
|
||||
[180] = "<180>",
|
||||
[181] = "<181>",
|
||||
[182] = "<182>",
|
||||
[183] = "<183>",
|
||||
|
@ -685,6 +678,9 @@ static const char *const _PyOpcode_OpName[256] = {
|
|||
#endif
|
||||
|
||||
#define EXTRA_CASES \
|
||||
case 178: \
|
||||
case 179: \
|
||||
case 180: \
|
||||
case 181: \
|
||||
case 182: \
|
||||
case 183: \
|
||||
|
|
|
@ -112,7 +112,6 @@ extern "C" {
|
|||
#define SET_UPDATE 163
|
||||
#define DICT_MERGE 164
|
||||
#define DICT_UPDATE 165
|
||||
#define PRECALL 166
|
||||
#define CALL 171
|
||||
#define KW_NAMES 172
|
||||
#define POP_JUMP_BACKWARD_IF_NOT_NONE 173
|
||||
|
@ -136,60 +135,58 @@ extern "C" {
|
|||
#define CALL_ADAPTIVE 22
|
||||
#define CALL_PY_EXACT_ARGS 23
|
||||
#define CALL_PY_WITH_DEFAULTS 24
|
||||
#define COMPARE_OP_ADAPTIVE 26
|
||||
#define COMPARE_OP_FLOAT_JUMP 27
|
||||
#define COMPARE_OP_INT_JUMP 28
|
||||
#define COMPARE_OP_STR_JUMP 29
|
||||
#define EXTENDED_ARG_QUICK 34
|
||||
#define JUMP_BACKWARD_QUICK 38
|
||||
#define LOAD_ATTR_ADAPTIVE 39
|
||||
#define LOAD_ATTR_INSTANCE_VALUE 40
|
||||
#define LOAD_ATTR_MODULE 41
|
||||
#define LOAD_ATTR_SLOT 42
|
||||
#define LOAD_ATTR_WITH_HINT 43
|
||||
#define LOAD_CONST__LOAD_FAST 44
|
||||
#define LOAD_FAST__LOAD_CONST 45
|
||||
#define LOAD_FAST__LOAD_FAST 46
|
||||
#define LOAD_GLOBAL_ADAPTIVE 47
|
||||
#define LOAD_GLOBAL_BUILTIN 48
|
||||
#define LOAD_GLOBAL_MODULE 55
|
||||
#define LOAD_METHOD_ADAPTIVE 56
|
||||
#define LOAD_METHOD_CLASS 57
|
||||
#define LOAD_METHOD_MODULE 58
|
||||
#define LOAD_METHOD_NO_DICT 59
|
||||
#define LOAD_METHOD_WITH_DICT 62
|
||||
#define LOAD_METHOD_WITH_VALUES 63
|
||||
#define PRECALL_ADAPTIVE 64
|
||||
#define PRECALL_BOUND_METHOD 65
|
||||
#define PRECALL_BUILTIN_CLASS 66
|
||||
#define PRECALL_BUILTIN_FAST_WITH_KEYWORDS 67
|
||||
#define PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 72
|
||||
#define PRECALL_NO_KW_BUILTIN_FAST 73
|
||||
#define PRECALL_NO_KW_BUILTIN_O 76
|
||||
#define PRECALL_NO_KW_ISINSTANCE 77
|
||||
#define PRECALL_NO_KW_LEN 78
|
||||
#define PRECALL_NO_KW_LIST_APPEND 79
|
||||
#define PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST 80
|
||||
#define PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 81
|
||||
#define PRECALL_NO_KW_METHOD_DESCRIPTOR_O 113
|
||||
#define PRECALL_NO_KW_STR_1 121
|
||||
#define PRECALL_NO_KW_TUPLE_1 127
|
||||
#define PRECALL_NO_KW_TYPE_1 141
|
||||
#define PRECALL_PYFUNC 143
|
||||
#define RESUME_QUICK 150
|
||||
#define STORE_ATTR_ADAPTIVE 153
|
||||
#define STORE_ATTR_INSTANCE_VALUE 154
|
||||
#define STORE_ATTR_SLOT 158
|
||||
#define STORE_ATTR_WITH_HINT 159
|
||||
#define STORE_FAST__LOAD_FAST 161
|
||||
#define STORE_FAST__STORE_FAST 167
|
||||
#define STORE_SUBSCR_ADAPTIVE 168
|
||||
#define STORE_SUBSCR_DICT 169
|
||||
#define STORE_SUBSCR_LIST_INT 170
|
||||
#define UNPACK_SEQUENCE_ADAPTIVE 177
|
||||
#define UNPACK_SEQUENCE_LIST 178
|
||||
#define UNPACK_SEQUENCE_TUPLE 179
|
||||
#define UNPACK_SEQUENCE_TWO_TUPLE 180
|
||||
#define CALL_BOUND_METHOD_EXACT_ARGS 26
|
||||
#define CALL_BUILTIN_CLASS 27
|
||||
#define CALL_BUILTIN_FAST_WITH_KEYWORDS 28
|
||||
#define CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 29
|
||||
#define CALL_NO_KW_BUILTIN_FAST 34
|
||||
#define CALL_NO_KW_BUILTIN_O 38
|
||||
#define CALL_NO_KW_ISINSTANCE 39
|
||||
#define CALL_NO_KW_LEN 40
|
||||
#define CALL_NO_KW_LIST_APPEND 41
|
||||
#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 42
|
||||
#define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 43
|
||||
#define CALL_NO_KW_METHOD_DESCRIPTOR_O 44
|
||||
#define CALL_NO_KW_STR_1 45
|
||||
#define CALL_NO_KW_TUPLE_1 46
|
||||
#define CALL_NO_KW_TYPE_1 47
|
||||
#define COMPARE_OP_ADAPTIVE 48
|
||||
#define COMPARE_OP_FLOAT_JUMP 55
|
||||
#define COMPARE_OP_INT_JUMP 56
|
||||
#define COMPARE_OP_STR_JUMP 57
|
||||
#define EXTENDED_ARG_QUICK 58
|
||||
#define JUMP_BACKWARD_QUICK 59
|
||||
#define LOAD_ATTR_ADAPTIVE 62
|
||||
#define LOAD_ATTR_INSTANCE_VALUE 63
|
||||
#define LOAD_ATTR_MODULE 64
|
||||
#define LOAD_ATTR_SLOT 65
|
||||
#define LOAD_ATTR_WITH_HINT 66
|
||||
#define LOAD_CONST__LOAD_FAST 67
|
||||
#define LOAD_FAST__LOAD_CONST 72
|
||||
#define LOAD_FAST__LOAD_FAST 73
|
||||
#define LOAD_GLOBAL_ADAPTIVE 76
|
||||
#define LOAD_GLOBAL_BUILTIN 77
|
||||
#define LOAD_GLOBAL_MODULE 78
|
||||
#define LOAD_METHOD_ADAPTIVE 79
|
||||
#define LOAD_METHOD_CLASS 80
|
||||
#define LOAD_METHOD_MODULE 81
|
||||
#define LOAD_METHOD_NO_DICT 113
|
||||
#define LOAD_METHOD_WITH_DICT 121
|
||||
#define LOAD_METHOD_WITH_VALUES 127
|
||||
#define RESUME_QUICK 141
|
||||
#define STORE_ATTR_ADAPTIVE 143
|
||||
#define STORE_ATTR_INSTANCE_VALUE 150
|
||||
#define STORE_ATTR_SLOT 153
|
||||
#define STORE_ATTR_WITH_HINT 154
|
||||
#define STORE_FAST__LOAD_FAST 158
|
||||
#define STORE_FAST__STORE_FAST 159
|
||||
#define STORE_SUBSCR_ADAPTIVE 161
|
||||
#define STORE_SUBSCR_DICT 166
|
||||
#define STORE_SUBSCR_LIST_INT 167
|
||||
#define UNPACK_SEQUENCE_ADAPTIVE 168
|
||||
#define UNPACK_SEQUENCE_LIST 169
|
||||
#define UNPACK_SEQUENCE_TUPLE 170
|
||||
#define UNPACK_SEQUENCE_TWO_TUPLE 177
|
||||
#define DO_TRACING 255
|
||||
|
||||
#define HAS_CONST(op) (false\
|
||||
|
|
|
@ -402,9 +402,11 @@ _code_type = type(_write_atomic.__code__)
|
|||
# add JUMP_BACKWARD_NO_INTERRUPT, make JUMP_NO_INTERRUPT virtual)
|
||||
# Python 3.11a7 3492 (make POP_JUMP_IF_NONE/NOT_NONE/TRUE/FALSE relative)
|
||||
# Python 3.11a7 3493 (Make JUMP_IF_TRUE_OR_POP/JUMP_IF_FALSE_OR_POP relative)
|
||||
# Python 3.11a7 3494 (New location info table)
|
||||
# Python 3.12 will start with magic number 3500
|
||||
# Python 3.11a7 3494 (New location info table)
|
||||
|
||||
# Python 3.12a1 3500 (Remove PRECALL opcode)
|
||||
|
||||
# Python 3.13 will start with 3550
|
||||
|
||||
#
|
||||
# MAGIC must change whenever the bytecode emitted by the compiler may no
|
||||
|
@ -416,7 +418,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 = (3494).to_bytes(2, 'little') + b'\r\n'
|
||||
MAGIC_NUMBER = (3500).to_bytes(2, 'little') + b'\r\n'
|
||||
|
||||
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c
|
||||
|
||||
|
|
|
@ -188,7 +188,6 @@ def_op('LIST_EXTEND', 162)
|
|||
def_op('SET_UPDATE', 163)
|
||||
def_op('DICT_MERGE', 164)
|
||||
def_op('DICT_UPDATE', 165)
|
||||
def_op('PRECALL', 166)
|
||||
|
||||
def_op('CALL', 171)
|
||||
def_op('KW_NAMES', 172)
|
||||
|
@ -254,6 +253,21 @@ _specializations = {
|
|||
"CALL_ADAPTIVE",
|
||||
"CALL_PY_EXACT_ARGS",
|
||||
"CALL_PY_WITH_DEFAULTS",
|
||||
"CALL_BOUND_METHOD_EXACT_ARGS",
|
||||
"CALL_BUILTIN_CLASS",
|
||||
"CALL_BUILTIN_FAST_WITH_KEYWORDS",
|
||||
"CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS",
|
||||
"CALL_NO_KW_BUILTIN_FAST",
|
||||
"CALL_NO_KW_BUILTIN_O",
|
||||
"CALL_NO_KW_ISINSTANCE",
|
||||
"CALL_NO_KW_LEN",
|
||||
"CALL_NO_KW_LIST_APPEND",
|
||||
"CALL_NO_KW_METHOD_DESCRIPTOR_FAST",
|
||||
"CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS",
|
||||
"CALL_NO_KW_METHOD_DESCRIPTOR_O",
|
||||
"CALL_NO_KW_STR_1",
|
||||
"CALL_NO_KW_TUPLE_1",
|
||||
"CALL_NO_KW_TYPE_1",
|
||||
],
|
||||
"COMPARE_OP": [
|
||||
"COMPARE_OP_ADAPTIVE",
|
||||
|
@ -294,25 +308,6 @@ _specializations = {
|
|||
"LOAD_METHOD_WITH_DICT",
|
||||
"LOAD_METHOD_WITH_VALUES",
|
||||
],
|
||||
"PRECALL": [
|
||||
"PRECALL_ADAPTIVE",
|
||||
"PRECALL_BOUND_METHOD",
|
||||
"PRECALL_BUILTIN_CLASS",
|
||||
"PRECALL_BUILTIN_FAST_WITH_KEYWORDS",
|
||||
"PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS",
|
||||
"PRECALL_NO_KW_BUILTIN_FAST",
|
||||
"PRECALL_NO_KW_BUILTIN_O",
|
||||
"PRECALL_NO_KW_ISINSTANCE",
|
||||
"PRECALL_NO_KW_LEN",
|
||||
"PRECALL_NO_KW_LIST_APPEND",
|
||||
"PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST",
|
||||
"PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS",
|
||||
"PRECALL_NO_KW_METHOD_DESCRIPTOR_O",
|
||||
"PRECALL_NO_KW_STR_1",
|
||||
"PRECALL_NO_KW_TUPLE_1",
|
||||
"PRECALL_NO_KW_TYPE_1",
|
||||
"PRECALL_PYFUNC",
|
||||
],
|
||||
"RESUME": [
|
||||
"RESUME_QUICK",
|
||||
],
|
||||
|
@ -394,9 +389,6 @@ _cache_format = {
|
|||
"func_version": 2,
|
||||
"min_args": 1,
|
||||
},
|
||||
"PRECALL": {
|
||||
"counter": 1,
|
||||
},
|
||||
"STORE_SUBSCR": {
|
||||
"counter": 1,
|
||||
},
|
||||
|
|
|
@ -839,7 +839,7 @@ if 1:
|
|||
instructions = [opcode.opname for opcode in opcodes]
|
||||
self.assertNotIn('LOAD_METHOD', instructions)
|
||||
self.assertIn('LOAD_ATTR', instructions)
|
||||
self.assertIn('PRECALL', instructions)
|
||||
self.assertIn('CALL', instructions)
|
||||
|
||||
def test_lineno_procedure_call(self):
|
||||
def call():
|
||||
|
|
|
@ -107,7 +107,6 @@ dis_f = """\
|
|||
|
||||
%3d LOAD_GLOBAL 1 (NULL + print)
|
||||
LOAD_FAST 0 (a)
|
||||
PRECALL 1
|
||||
CALL 1
|
||||
POP_TOP
|
||||
|
||||
|
@ -122,7 +121,6 @@ dis_f_co_code = """\
|
|||
RESUME 0
|
||||
LOAD_GLOBAL 1
|
||||
LOAD_FAST 0
|
||||
PRECALL 1
|
||||
CALL 1
|
||||
POP_TOP
|
||||
LOAD_CONST 1
|
||||
|
@ -143,13 +141,12 @@ dis_bug708901 = """\
|
|||
|
||||
%3d LOAD_CONST 2 (10)
|
||||
|
||||
%3d PRECALL 2
|
||||
CALL 2
|
||||
%3d CALL 2
|
||||
GET_ITER
|
||||
>> FOR_ITER 2 (to 40)
|
||||
>> FOR_ITER 2 (to 36)
|
||||
STORE_FAST 0 (res)
|
||||
|
||||
%3d JUMP_BACKWARD 3 (to 34)
|
||||
%3d JUMP_BACKWARD 3 (to 30)
|
||||
|
||||
%3d >> LOAD_CONST 0 (None)
|
||||
RETURN_VALUE
|
||||
|
@ -174,13 +171,11 @@ dis_bug1333982 = """\
|
|||
MAKE_FUNCTION 0
|
||||
LOAD_FAST 0 (x)
|
||||
GET_ITER
|
||||
PRECALL 0
|
||||
CALL 0
|
||||
|
||||
%3d LOAD_CONST 3 (1)
|
||||
|
||||
%3d BINARY_OP 0 (+)
|
||||
PRECALL 0
|
||||
CALL 0
|
||||
RAISE_VARARGS 1
|
||||
""" % (bug1333982.__code__.co_firstlineno,
|
||||
|
@ -315,7 +310,6 @@ dis_annot_stmt_str = """\
|
|||
3 PUSH_NULL
|
||||
LOAD_NAME 3 (fun)
|
||||
LOAD_CONST 0 (1)
|
||||
PRECALL 1
|
||||
CALL 1
|
||||
LOAD_NAME 2 (__annotations__)
|
||||
LOAD_CONST 2 ('y')
|
||||
|
@ -326,7 +320,6 @@ dis_annot_stmt_str = """\
|
|||
PUSH_NULL
|
||||
LOAD_NAME 3 (fun)
|
||||
LOAD_CONST 3 (0)
|
||||
PRECALL 1
|
||||
CALL 1
|
||||
STORE_SUBSCR
|
||||
LOAD_NAME 1 (int)
|
||||
|
@ -449,14 +442,12 @@ dis_tryfinally = """\
|
|||
|
||||
%3d PUSH_NULL
|
||||
LOAD_FAST 1 (b)
|
||||
PRECALL 0
|
||||
CALL 0
|
||||
POP_TOP
|
||||
RETURN_VALUE
|
||||
>> PUSH_EXC_INFO
|
||||
PUSH_NULL
|
||||
LOAD_FAST 1 (b)
|
||||
PRECALL 0
|
||||
CALL 0
|
||||
POP_TOP
|
||||
RERAISE 0
|
||||
|
@ -479,7 +470,6 @@ dis_tryfinallyconst = """\
|
|||
|
||||
%3d PUSH_NULL
|
||||
LOAD_FAST 0 (b)
|
||||
PRECALL 0
|
||||
CALL 0
|
||||
POP_TOP
|
||||
LOAD_CONST 1 (1)
|
||||
|
@ -487,7 +477,6 @@ dis_tryfinallyconst = """\
|
|||
PUSH_EXC_INFO
|
||||
PUSH_NULL
|
||||
LOAD_FAST 0 (b)
|
||||
PRECALL 0
|
||||
CALL 0
|
||||
POP_TOP
|
||||
RERAISE 0
|
||||
|
@ -550,7 +539,6 @@ Disassembly of <code object foo at 0x..., file "%s", line %d>:
|
|||
MAKE_FUNCTION 8 (closure)
|
||||
LOAD_DEREF 1 (y)
|
||||
GET_ITER
|
||||
PRECALL 0
|
||||
CALL 0
|
||||
RETURN_VALUE
|
||||
""" % (dis_nested_0,
|
||||
|
@ -608,26 +596,25 @@ def loop_test():
|
|||
load_test(i)
|
||||
|
||||
dis_loop_test_quickened_code = """\
|
||||
%3d 0 RESUME_QUICK 0
|
||||
%3d RESUME_QUICK 0
|
||||
|
||||
%3d 2 BUILD_LIST 0
|
||||
4 LOAD_CONST 1 ((1, 2, 3))
|
||||
6 LIST_EXTEND 1
|
||||
8 LOAD_CONST 2 (3)
|
||||
10 BINARY_OP_ADAPTIVE 5 (*)
|
||||
14 GET_ITER
|
||||
16 FOR_ITER 17 (to 52)
|
||||
18 STORE_FAST 0 (i)
|
||||
%3d BUILD_LIST 0
|
||||
LOAD_CONST 1 ((1, 2, 3))
|
||||
LIST_EXTEND 1
|
||||
LOAD_CONST 2 (3)
|
||||
BINARY_OP_ADAPTIVE 5 (*)
|
||||
GET_ITER
|
||||
FOR_ITER 15 (to 48)
|
||||
STORE_FAST 0 (i)
|
||||
|
||||
%3d 20 LOAD_GLOBAL_MODULE 1 (NULL + load_test)
|
||||
32 LOAD_FAST 0 (i)
|
||||
34 PRECALL_PYFUNC 1
|
||||
38 CALL_PY_WITH_DEFAULTS 1
|
||||
48 POP_TOP
|
||||
50 JUMP_BACKWARD_QUICK 18 (to 16)
|
||||
%3d LOAD_GLOBAL_MODULE 1 (NULL + load_test)
|
||||
LOAD_FAST 0 (i)
|
||||
CALL_PY_WITH_DEFAULTS 1
|
||||
POP_TOP
|
||||
JUMP_BACKWARD_QUICK 16 (to 16)
|
||||
|
||||
%3d >> 52 LOAD_CONST 0 (None)
|
||||
54 RETURN_VALUE
|
||||
%3d >> LOAD_CONST 0 (None)
|
||||
RETURN_VALUE
|
||||
""" % (loop_test.__code__.co_firstlineno,
|
||||
loop_test.__code__.co_firstlineno + 1,
|
||||
loop_test.__code__.co_firstlineno + 2,
|
||||
|
@ -990,26 +977,25 @@ class DisTests(DisTestBase):
|
|||
@cpython_only
|
||||
def test_call_specialize(self):
|
||||
call_quicken = """\
|
||||
0 RESUME_QUICK 0
|
||||
RESUME_QUICK 0
|
||||
|
||||
1 2 PUSH_NULL
|
||||
4 LOAD_NAME 0 (str)
|
||||
6 LOAD_CONST 0 (1)
|
||||
8 PRECALL_NO_KW_STR_1 1
|
||||
12 CALL_ADAPTIVE 1
|
||||
22 RETURN_VALUE
|
||||
1 PUSH_NULL
|
||||
LOAD_NAME 0 (str)
|
||||
LOAD_CONST 0 (1)
|
||||
CALL_NO_KW_STR_1 1
|
||||
RETURN_VALUE
|
||||
"""
|
||||
co = compile("str(1)", "", "eval")
|
||||
self.code_quicken(lambda: exec(co, {}, {}))
|
||||
got = self.get_disassembly(co, adaptive=True)
|
||||
self.do_disassembly_compare(got, call_quicken, True)
|
||||
self.do_disassembly_compare(got, call_quicken)
|
||||
|
||||
@cpython_only
|
||||
def test_loop_quicken(self):
|
||||
# Loop can trigger a quicken where the loop is located
|
||||
self.code_quicken(loop_test, 1)
|
||||
got = self.get_disassembly(loop_test, adaptive=True)
|
||||
self.do_disassembly_compare(got, dis_loop_test_quickened_code, True)
|
||||
self.do_disassembly_compare(got, dis_loop_test_quickened_code)
|
||||
|
||||
def get_cached_values(self, quickened, adaptive):
|
||||
def f():
|
||||
|
@ -1040,7 +1026,7 @@ class DisTests(DisTestBase):
|
|||
for cache in caches:
|
||||
self.assertRegex(cache, pattern)
|
||||
self.assertEqual(caches.count(""), 8)
|
||||
self.assertEqual(len(caches), 25)
|
||||
self.assertEqual(len(caches), 23)
|
||||
|
||||
|
||||
class DisWithFileTests(DisTests):
|
||||
|
@ -1319,6 +1305,7 @@ def _prepare_test_cases():
|
|||
#_prepare_test_cases()
|
||||
|
||||
Instruction = dis.Instruction
|
||||
|
||||
expected_opinfo_outer = [
|
||||
Instruction(opname='MAKE_CELL', opcode=135, arg=0, argval='a', argrepr='a', offset=0, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='MAKE_CELL', opcode=135, arg=1, argval='b', argrepr='b', offset=2, starts_line=None, is_jump_target=False, positions=None),
|
||||
|
@ -1338,11 +1325,10 @@ expected_opinfo_outer = [
|
|||
Instruction(opname='BUILD_LIST', opcode=103, arg=0, argval=0, argrepr='', offset=40, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='BUILD_MAP', opcode=105, arg=0, argval=0, argrepr='', offset=42, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Hello world!', argrepr="'Hello world!'", offset=44, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=7, argval=7, argrepr='', offset=46, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=7, argval=7, argrepr='', offset=50, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=60, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='f', argrepr='f', offset=62, starts_line=8, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=64, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=7, argval=7, argrepr='', offset=46, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=56, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='f', argrepr='f', offset=58, starts_line=8, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=60, starts_line=None, is_jump_target=False, positions=None),
|
||||
]
|
||||
|
||||
expected_opinfo_f = [
|
||||
|
@ -1364,11 +1350,10 @@ expected_opinfo_f = [
|
|||
Instruction(opname='LOAD_DEREF', opcode=137, arg=4, argval='b', argrepr='b', offset=40, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_DEREF', opcode=137, arg=0, argval='c', argrepr='c', offset=42, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_DEREF', opcode=137, arg=1, argval='d', argrepr='d', offset=44, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=4, argval=4, argrepr='', offset=46, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=4, argval=4, argrepr='', offset=50, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=60, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='inner', argrepr='inner', offset=62, starts_line=6, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=64, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=4, argval=4, argrepr='', offset=46, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=56, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='inner', argrepr='inner', offset=58, starts_line=6, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=60, starts_line=None, is_jump_target=False, positions=None),
|
||||
]
|
||||
|
||||
expected_opinfo_inner = [
|
||||
|
@ -1381,137 +1366,126 @@ expected_opinfo_inner = [
|
|||
Instruction(opname='LOAD_DEREF', opcode=137, arg=5, argval='d', argrepr='d', offset=22, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='e', argrepr='e', offset=24, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=1, argval='f', argrepr='f', offset=26, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=6, argval=6, argrepr='', offset=28, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=6, argval=6, argrepr='', offset=32, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=42, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=44, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=46, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=6, argval=6, argrepr='', offset=28, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=38, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=40, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=42, starts_line=None, is_jump_target=False, positions=None),
|
||||
]
|
||||
|
||||
expected_opinfo_jumpy = [
|
||||
Instruction(opname='RESUME', opcode=151, arg=0, argval=0, argrepr='', offset=0, starts_line=1, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='range', argrepr='NULL + range', offset=2, starts_line=3, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=10, argrepr='10', offset=14, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=1, argval=1, argrepr='', offset=16, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=20, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', offset=30, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='FOR_ITER', opcode=93, arg=32, argval=98, argrepr='to 98', offset=32, starts_line=None, is_jump_target=True, positions=None),
|
||||
Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=34, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=36, starts_line=4, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=48, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=1, argval=1, argrepr='', offset=50, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=54, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=64, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=66, starts_line=5, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=68, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', offset=70, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=1, argval=80, argrepr='to 80', offset=76, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_BACKWARD', opcode=140, arg=24, argval=32, argrepr='to 32', offset=78, starts_line=6, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=80, starts_line=7, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=82, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', offset=84, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=2, argval=96, argrepr='to 96', offset=90, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=92, starts_line=8, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_FORWARD', opcode=110, arg=16, argval=128, argrepr='to 128', offset=94, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_BACKWARD', opcode=140, arg=33, argval=32, argrepr='to 32', offset=96, starts_line=7, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=98, starts_line=10, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=110, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=1, argval=1, argrepr='', offset=112, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=116, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=126, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=128, starts_line=11, is_jump_target=True, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=36, argval=204, argrepr='to 204', offset=130, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=132, starts_line=12, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=144, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=1, argval=1, argrepr='', offset=146, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=150, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=160, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=162, starts_line=13, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=164, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='BINARY_OP', opcode=122, arg=23, argval=23, argrepr='-=', offset=166, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=170, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=172, starts_line=14, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=174, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', offset=176, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=1, argval=186, argrepr='to 186', offset=182, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_BACKWARD', opcode=140, arg=29, argval=128, argrepr='to 128', offset=184, starts_line=15, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=186, starts_line=16, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=188, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', offset=190, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=1, argval=200, argrepr='to 200', offset=196, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_FORWARD', opcode=110, arg=17, argval=234, argrepr='to 234', offset=198, starts_line=17, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=200, starts_line=11, is_jump_target=True, positions=None),
|
||||
Instruction(opname='POP_JUMP_BACKWARD_IF_TRUE', opcode=176, arg=36, argval=132, argrepr='to 132', offset=202, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=204, starts_line=19, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=216, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=1, argval=1, argrepr='', offset=218, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=222, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=232, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=234, starts_line=20, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=236, starts_line=21, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=238, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='BINARY_OP', opcode=122, arg=11, argval=11, argrepr='/', offset=240, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=244, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=246, starts_line=25, is_jump_target=False, positions=None),
|
||||
Instruction(opname='BEFORE_WITH', opcode=53, arg=None, argval=None, argrepr='', offset=248, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=250, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=252, starts_line=26, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=264, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=1, argval=1, argrepr='', offset=266, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=270, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=280, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=282, starts_line=25, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=284, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=286, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=2, argval=2, argrepr='', offset=288, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=292, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=302, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_FORWARD', opcode=110, arg=11, argval=328, argrepr='to 328', offset=304, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=306, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=308, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_TRUE', opcode=115, arg=4, argval=320, argrepr='to 320', offset=310, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=2, argval=2, argrepr='', offset=312, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=314, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=316, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=318, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=320, starts_line=None, is_jump_target=True, positions=None),
|
||||
Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=322, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=324, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=326, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_FORWARD', opcode=110, arg=31, argval=392, argrepr='to 392', offset=328, starts_line=None, is_jump_target=True, positions=None),
|
||||
Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=330, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=332, starts_line=22, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CHECK_EXC_MATCH', opcode=36, arg=None, argval=None, argrepr='', offset=344, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=18, argval=384, argrepr='to 384', offset=346, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=348, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=350, starts_line=23, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=362, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=1, argval=1, argrepr='', offset=364, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=368, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=378, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=380, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_FORWARD', opcode=110, arg=4, argval=392, argrepr='to 392', offset=382, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=384, starts_line=22, is_jump_target=True, positions=None),
|
||||
Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=386, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=388, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=390, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=392, starts_line=28, is_jump_target=True, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=16, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', offset=26, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='FOR_ITER', opcode=93, arg=30, argval=90, argrepr='to 90', offset=28, starts_line=None, is_jump_target=True, positions=None),
|
||||
Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=30, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=32, starts_line=4, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=44, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=46, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=56, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=58, starts_line=5, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=60, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', offset=62, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=1, argval=72, argrepr='to 72', offset=68, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_BACKWARD', opcode=140, arg=22, argval=28, argrepr='to 28', offset=70, starts_line=6, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=72, starts_line=7, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=74, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', offset=76, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=2, argval=88, argrepr='to 88', offset=82, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=84, starts_line=8, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_FORWARD', opcode=110, arg=14, argval=116, argrepr='to 116', offset=86, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_BACKWARD', opcode=140, arg=31, argval=28, argrepr='to 28', offset=88, starts_line=7, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=90, starts_line=10, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=102, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=104, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=114, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=116, starts_line=11, is_jump_target=True, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=34, argval=188, argrepr='to 188', offset=118, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=120, starts_line=12, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=132, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=134, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=144, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=146, starts_line=13, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=148, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='BINARY_OP', opcode=122, arg=23, argval=23, argrepr='-=', offset=150, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='STORE_FAST', opcode=125, arg=0, argval='i', argrepr='i', offset=154, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=156, starts_line=14, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=6, argrepr='6', offset=158, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', offset=160, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=1, argval=170, argrepr='to 170', offset=166, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_BACKWARD', opcode=140, arg=27, argval=116, argrepr='to 116', offset=168, starts_line=15, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=170, starts_line=16, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=172, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COMPARE_OP', opcode=107, arg=0, argval='<', argrepr='<', offset=174, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=1, argval=184, argrepr='to 184', offset=180, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_FORWARD', opcode=110, arg=15, argval=214, argrepr='to 214', offset=182, starts_line=17, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=184, starts_line=11, is_jump_target=True, positions=None),
|
||||
Instruction(opname='POP_JUMP_BACKWARD_IF_TRUE', opcode=176, arg=34, argval=120, argrepr='to 120', offset=186, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=188, starts_line=19, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='Who let lolcatz into this test suite?', argrepr="'Who let lolcatz into this test suite?'", offset=200, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=202, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=212, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=214, starts_line=20, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=1, argrepr='1', offset=216, starts_line=21, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=0, argrepr='0', offset=218, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='BINARY_OP', opcode=122, arg=11, argval=11, argrepr='/', offset=220, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=224, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=226, starts_line=25, is_jump_target=False, positions=None),
|
||||
Instruction(opname='BEFORE_WITH', opcode=53, arg=None, argval=None, argrepr='', offset=228, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='STORE_FAST', opcode=125, arg=1, argval='dodgy', argrepr='dodgy', offset=230, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=232, starts_line=26, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Never reach this', argrepr="'Never reach this'", offset=244, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=246, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=256, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=258, starts_line=25, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=260, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=262, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=264, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=274, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_FORWARD', opcode=110, arg=11, argval=300, argrepr='to 300', offset=276, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=278, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=280, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_TRUE', opcode=115, arg=4, argval=292, argrepr='to 292', offset=282, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=2, argval=2, argrepr='', offset=284, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=286, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=288, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=290, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=292, starts_line=None, is_jump_target=True, positions=None),
|
||||
Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=294, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=296, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=298, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_FORWARD', opcode=110, arg=29, argval=360, argrepr='to 360', offset=300, starts_line=None, is_jump_target=True, positions=None),
|
||||
Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=302, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=4, argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=304, starts_line=22, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CHECK_EXC_MATCH', opcode=36, arg=None, argval=None, argrepr='', offset=316, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_JUMP_FORWARD_IF_FALSE', opcode=114, arg=16, argval=352, argrepr='to 352', offset=318, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=320, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=322, starts_line=23, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval='Here we go, here we go, here we go...', argrepr="'Here we go, here we go, here we go...'", offset=334, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=336, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=346, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=348, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='JUMP_FORWARD', opcode=110, arg=4, argval=360, argrepr='to 360', offset=350, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=352, starts_line=22, is_jump_target=True, positions=None),
|
||||
Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=354, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=356, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=358, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=360, starts_line=28, is_jump_target=True, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=372, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=374, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=384, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=386, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=388, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=390, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=392, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=404, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=1, argval=1, argrepr='', offset=406, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=410, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=420, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=422, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=424, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=426, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='print', argrepr='NULL + print', offset=428, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=440, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='PRECALL', opcode=166, arg=1, argval=1, argrepr='', offset=442, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=446, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=456, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=458, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=460, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=462, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=464, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='CALL', opcode=171, arg=1, argval=1, argrepr='', offset=406, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=416, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=418, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='COPY', opcode=120, arg=3, argval=3, argrepr='', offset=420, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=422, starts_line=None, is_jump_target=False, positions=None),
|
||||
Instruction(opname='RERAISE', opcode=119, arg=1, argval=1, argrepr='', offset=424, starts_line=None, is_jump_target=False, positions=None),
|
||||
]
|
||||
|
||||
# One last piece of inspect fodder to check the default line number handling
|
||||
|
@ -1581,7 +1555,6 @@ class InstructionTests(InstructionTestCase):
|
|||
(1, 3, 0, 1),
|
||||
(1, 3, 0, 1),
|
||||
(1, 3, 0, 1),
|
||||
(1, 3, 0, 1),
|
||||
(1, 3, 0, 1)
|
||||
]
|
||||
self.assertEqual(positions, expected)
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
The PRECALL instruction has been removed. It offered only a small advantage
|
||||
for specialization and is not needed in the vast majority of cases.
|
|
@ -1,18 +1,17 @@
|
|||
// Auto-generated by Programs/freeze_test_frozenmain.py
|
||||
unsigned char M_test_frozenmain[] = {
|
||||
227,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,
|
||||
0,0,0,0,0,115,176,0,0,0,151,0,100,0,100,1,
|
||||
0,0,0,0,0,115,160,0,0,0,151,0,100,0,100,1,
|
||||
108,0,90,0,100,0,100,1,108,1,90,1,2,0,101,2,
|
||||
100,2,166,1,0,0,171,1,0,0,0,0,0,0,0,0,
|
||||
1,0,2,0,101,2,100,3,101,0,106,3,0,0,0,0,
|
||||
0,0,0,0,166,2,0,0,171,2,0,0,0,0,0,0,
|
||||
0,0,1,0,2,0,101,1,106,4,0,0,0,0,0,0,
|
||||
0,0,166,0,0,0,171,0,0,0,0,0,0,0,0,0,
|
||||
100,4,25,0,0,0,0,0,0,0,0,0,90,5,100,5,
|
||||
68,0,93,25,90,6,2,0,101,2,100,6,101,6,155,0,
|
||||
100,7,101,5,101,6,25,0,0,0,0,0,0,0,0,0,
|
||||
155,0,157,4,166,1,0,0,171,1,0,0,0,0,0,0,
|
||||
0,0,1,0,140,26,100,1,83,0,41,8,233,0,0,0,
|
||||
100,2,171,1,0,0,0,0,0,0,0,0,1,0,2,0,
|
||||
101,2,100,3,101,0,106,3,0,0,0,0,0,0,0,0,
|
||||
171,2,0,0,0,0,0,0,0,0,1,0,2,0,101,1,
|
||||
106,4,0,0,0,0,0,0,0,0,171,0,0,0,0,0,
|
||||
0,0,0,0,100,4,25,0,0,0,0,0,0,0,0,0,
|
||||
90,5,100,5,68,0,93,23,90,6,2,0,101,2,100,6,
|
||||
101,6,155,0,100,7,101,5,101,6,25,0,0,0,0,0,
|
||||
0,0,0,0,155,0,157,4,171,1,0,0,0,0,0,0,
|
||||
0,0,1,0,140,24,100,1,83,0,41,8,233,0,0,0,
|
||||
0,78,122,18,70,114,111,122,101,110,32,72,101,108,108,111,
|
||||
32,87,111,114,108,100,122,8,115,121,115,46,97,114,103,118,
|
||||
218,6,99,111,110,102,105,103,41,5,218,12,112,114,111,103,
|
||||
|
@ -28,15 +27,14 @@ unsigned char M_test_frozenmain[] = {
|
|||
107,101,121,169,0,243,0,0,0,0,250,18,116,101,115,116,
|
||||
95,102,114,111,122,101,110,109,97,105,110,46,112,121,250,8,
|
||||
60,109,111,100,117,108,101,62,114,17,0,0,0,1,0,0,
|
||||
0,115,152,0,0,0,248,240,6,0,1,11,128,10,128,10,
|
||||
0,115,140,0,0,0,248,240,6,0,1,11,128,10,128,10,
|
||||
128,10,216,0,24,208,0,24,208,0,24,208,0,24,224,0,
|
||||
5,128,5,208,6,26,209,0,27,212,0,27,208,0,27,216,
|
||||
0,5,128,5,128,106,144,35,148,40,209,0,27,212,0,27,
|
||||
208,0,27,216,9,38,208,9,26,212,9,38,209,9,40,212,
|
||||
9,40,168,24,212,9,50,128,6,240,2,6,12,2,240,0,
|
||||
7,1,42,240,0,7,1,42,128,67,240,14,0,5,10,128,
|
||||
69,208,10,40,144,67,208,10,40,208,10,40,152,54,160,35,
|
||||
156,59,208,10,40,208,10,40,209,4,41,212,4,41,208,4,
|
||||
41,208,4,41,240,15,7,1,42,240,0,7,1,42,114,15,
|
||||
0,0,0,
|
||||
5,128,5,208,6,26,212,0,27,208,0,27,216,0,5,128,
|
||||
5,128,106,144,35,148,40,212,0,27,208,0,27,216,9,38,
|
||||
208,9,26,212,9,38,212,9,40,168,24,212,9,50,128,6,
|
||||
240,2,6,12,2,240,0,7,1,42,240,0,7,1,42,128,
|
||||
67,240,14,0,5,10,128,69,208,10,40,144,67,208,10,40,
|
||||
208,10,40,152,54,160,35,156,59,208,10,40,208,10,40,212,
|
||||
4,41,208,4,41,208,4,41,240,15,7,1,42,240,0,7,
|
||||
1,42,114,15,0,0,0,
|
||||
};
|
||||
|
|
271
Python/ceval.c
271
Python/ceval.c
|
@ -1439,10 +1439,6 @@ eval_frame_handle_pending(PyThreadState *tstate)
|
|||
#define JUMPTO(x) (next_instr = first_instr + (x))
|
||||
#define JUMPBY(x) (next_instr += (x))
|
||||
|
||||
// Skip from a PRECALL over a CALL to the next instruction:
|
||||
#define SKIP_CALL() \
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_PRECALL + 1 + INLINE_CACHE_ENTRIES_CALL)
|
||||
|
||||
/* Get opcode and oparg from original instructions, not quickened form. */
|
||||
#define TRACING_NEXTOPARG() do { \
|
||||
NEXTOPARG(); \
|
||||
|
@ -1687,7 +1683,7 @@ pop_frame(PyThreadState *tstate, _PyInterpreterFrame *frame)
|
|||
return prev_frame;
|
||||
}
|
||||
|
||||
/* It is only between the PRECALL instruction and the following CALL,
|
||||
/* It is only between the KW_NAMES instruction and the following CALL,
|
||||
* that this has any meaning.
|
||||
*/
|
||||
typedef struct {
|
||||
|
@ -4541,7 +4537,7 @@ handle_eval_breaker:
|
|||
|
||||
TARGET(LOAD_METHOD) {
|
||||
PREDICTED(LOAD_METHOD);
|
||||
/* Designed to work in tandem with PRECALL. */
|
||||
/* Designed to work in tandem with CALL. */
|
||||
PyObject *name = GETITEM(names, oparg);
|
||||
PyObject *obj = TOP();
|
||||
PyObject *meth = NULL;
|
||||
|
@ -4566,7 +4562,7 @@ handle_eval_breaker:
|
|||
/* meth is not an unbound method (but a regular attr, or
|
||||
something was returned by a descriptor protocol). Set
|
||||
the second element of the stack to NULL, to signal
|
||||
PRECALL that it's not a method call.
|
||||
CALL that it's not a method call.
|
||||
|
||||
NULL | meth | arg1 | ... | argN
|
||||
*/
|
||||
|
@ -4710,57 +4706,11 @@ handle_eval_breaker:
|
|||
NOTRACE_DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL) {
|
||||
PREDICTED(PRECALL);
|
||||
/* Designed to work in tamdem with LOAD_METHOD. */
|
||||
/* `meth` is NULL when LOAD_METHOD thinks that it's not
|
||||
a method call.
|
||||
|
||||
Stack layout:
|
||||
|
||||
... | NULL | callable | arg1 | ... | argN
|
||||
^- TOP()
|
||||
^- (-oparg)
|
||||
^- (-oparg-1)
|
||||
^- (-oparg-2)
|
||||
|
||||
`callable` will be POPed by call_function.
|
||||
NULL will will be POPed manually later.
|
||||
If `meth` isn't NULL, it's a method call. Stack layout:
|
||||
|
||||
... | method | self | arg1 | ... | argN
|
||||
^- TOP()
|
||||
^- (-oparg)
|
||||
^- (-oparg-1)
|
||||
^- (-oparg-2)
|
||||
|
||||
`self` and `method` will be POPed by call_function.
|
||||
We'll be passing `oparg + 1` to call_function, to
|
||||
make it accept the `self` as a first argument.
|
||||
*/
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int nargs = oparg + is_meth;
|
||||
/* Move ownership of reference from stack to call_shape
|
||||
* and make sure that NULL is cleared from stack */
|
||||
PyObject *function = PEEK(nargs + 1);
|
||||
if (!is_meth && Py_TYPE(function) == &PyMethod_Type) {
|
||||
PyObject *meth = ((PyMethodObject *)function)->im_func;
|
||||
PyObject *self = ((PyMethodObject *)function)->im_self;
|
||||
Py_INCREF(meth);
|
||||
Py_INCREF(self);
|
||||
PEEK(oparg+1) = self;
|
||||
PEEK(oparg+2) = meth;
|
||||
Py_DECREF(function);
|
||||
}
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_PRECALL);
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_BOUND_METHOD) {
|
||||
DEOPT_IF(is_method(stack_pointer, oparg), PRECALL);
|
||||
TARGET(CALL_BOUND_METHOD_EXACT_ARGS) {
|
||||
DEOPT_IF(is_method(stack_pointer, oparg), CALL);
|
||||
PyObject *function = PEEK(oparg + 1);
|
||||
DEOPT_IF(Py_TYPE(function) != &PyMethod_Type, PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
DEOPT_IF(Py_TYPE(function) != &PyMethod_Type, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
PyObject *meth = ((PyMethodObject *)function)->im_func;
|
||||
PyObject *self = ((PyMethodObject *)function)->im_self;
|
||||
Py_INCREF(meth);
|
||||
|
@ -4768,17 +4718,7 @@ handle_eval_breaker:
|
|||
PEEK(oparg + 1) = self;
|
||||
PEEK(oparg + 2) = meth;
|
||||
Py_DECREF(function);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_PRECALL);
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_PYFUNC) {
|
||||
int nargs = oparg + is_method(stack_pointer, oparg);
|
||||
PyObject *function = PEEK(nargs + 1);
|
||||
DEOPT_IF(Py_TYPE(function) != &PyFunction_Type, PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_PRECALL);
|
||||
DISPATCH();
|
||||
goto call_exact_args;
|
||||
}
|
||||
|
||||
TARGET(KW_NAMES) {
|
||||
|
@ -4789,11 +4729,22 @@ handle_eval_breaker:
|
|||
}
|
||||
|
||||
TARGET(CALL) {
|
||||
int is_meth;
|
||||
int total_args, is_meth;
|
||||
call_function:
|
||||
is_meth = is_method(stack_pointer, oparg);
|
||||
int total_args = oparg + is_meth;
|
||||
PyObject *function = PEEK(total_args + 1);
|
||||
PyObject *function = PEEK(oparg + 1);
|
||||
if (!is_meth && Py_TYPE(function) == &PyMethod_Type) {
|
||||
PyObject *meth = ((PyMethodObject *)function)->im_func;
|
||||
PyObject *self = ((PyMethodObject *)function)->im_self;
|
||||
Py_INCREF(meth);
|
||||
Py_INCREF(self);
|
||||
PEEK(oparg+1) = self;
|
||||
PEEK(oparg+2) = meth;
|
||||
Py_DECREF(function);
|
||||
is_meth = 1;
|
||||
}
|
||||
total_args = oparg + is_meth;
|
||||
function = PEEK(total_args + 1);
|
||||
int positional_args = total_args - KWNAMES_LEN();
|
||||
// Check if the call can be inlined or not
|
||||
if (Py_TYPE(function) == &PyFunction_Type && tstate->interp->eval_frame == NULL) {
|
||||
|
@ -4850,27 +4801,6 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_ADAPTIVE) {
|
||||
_PyPrecallCache *cache = (_PyPrecallCache *)next_instr;
|
||||
if (cache->counter == 0) {
|
||||
next_instr--;
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int nargs = oparg + is_meth;
|
||||
PyObject *callable = PEEK(nargs + 1);
|
||||
int err = _Py_Specialize_Precall(callable, next_instr, nargs,
|
||||
call_shape.kwnames, oparg);
|
||||
if (err < 0) {
|
||||
goto error;
|
||||
}
|
||||
NOTRACE_DISPATCH_SAME_OPARG();
|
||||
}
|
||||
else {
|
||||
STAT_INC(PRECALL, deferred);
|
||||
cache->counter--;
|
||||
JUMP_TO_INSTRUCTION(PRECALL);
|
||||
}
|
||||
}
|
||||
|
||||
TARGET(CALL_ADAPTIVE) {
|
||||
_PyCallCache *cache = (_PyCallCache *)next_instr;
|
||||
if (cache->counter == 0) {
|
||||
|
@ -4893,6 +4823,7 @@ handle_eval_breaker:
|
|||
}
|
||||
|
||||
TARGET(CALL_PY_EXACT_ARGS) {
|
||||
call_exact_args:
|
||||
assert(call_shape.kwnames == NULL);
|
||||
DEOPT_IF(tstate->interp->eval_frame, CALL);
|
||||
_PyCallCache *cache = (_PyCallCache *)next_instr;
|
||||
|
@ -4968,16 +4899,16 @@ handle_eval_breaker:
|
|||
goto start_frame;
|
||||
}
|
||||
|
||||
TARGET(PRECALL_NO_KW_TYPE_1) {
|
||||
TARGET(CALL_NO_KW_TYPE_1) {
|
||||
assert(call_shape.kwnames == NULL);
|
||||
assert(cframe.use_tracing == 0);
|
||||
assert(oparg == 1);
|
||||
DEOPT_IF(is_method(stack_pointer, 1), PRECALL);
|
||||
DEOPT_IF(is_method(stack_pointer, 1), CALL);
|
||||
PyObject *obj = TOP();
|
||||
PyObject *callable = SECOND();
|
||||
DEOPT_IF(callable != (PyObject *)&PyType_Type, PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
DEOPT_IF(callable != (PyObject *)&PyType_Type, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
PyObject *res = Py_NewRef(Py_TYPE(obj));
|
||||
Py_DECREF(callable);
|
||||
Py_DECREF(obj);
|
||||
|
@ -4986,15 +4917,15 @@ handle_eval_breaker:
|
|||
NOTRACE_DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_NO_KW_STR_1) {
|
||||
TARGET(CALL_NO_KW_STR_1) {
|
||||
assert(call_shape.kwnames == NULL);
|
||||
assert(cframe.use_tracing == 0);
|
||||
assert(oparg == 1);
|
||||
DEOPT_IF(is_method(stack_pointer, 1), PRECALL);
|
||||
DEOPT_IF(is_method(stack_pointer, 1), CALL);
|
||||
PyObject *callable = PEEK(2);
|
||||
DEOPT_IF(callable != (PyObject *)&PyUnicode_Type, PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
DEOPT_IF(callable != (PyObject *)&PyUnicode_Type, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
PyObject *arg = TOP();
|
||||
PyObject *res = PyObject_Str(arg);
|
||||
Py_DECREF(arg);
|
||||
|
@ -5008,14 +4939,14 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_NO_KW_TUPLE_1) {
|
||||
TARGET(CALL_NO_KW_TUPLE_1) {
|
||||
assert(call_shape.kwnames == NULL);
|
||||
assert(oparg == 1);
|
||||
DEOPT_IF(is_method(stack_pointer, 1), PRECALL);
|
||||
DEOPT_IF(is_method(stack_pointer, 1), CALL);
|
||||
PyObject *callable = PEEK(2);
|
||||
DEOPT_IF(callable != (PyObject *)&PyTuple_Type, PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
DEOPT_IF(callable != (PyObject *)&PyTuple_Type, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
PyObject *arg = TOP();
|
||||
PyObject *res = PySequence_Tuple(arg);
|
||||
Py_DECREF(arg);
|
||||
|
@ -5029,16 +4960,16 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_BUILTIN_CLASS) {
|
||||
TARGET(CALL_BUILTIN_CLASS) {
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int total_args = oparg + is_meth;
|
||||
int kwnames_len = KWNAMES_LEN();
|
||||
PyObject *callable = PEEK(total_args + 1);
|
||||
DEOPT_IF(!PyType_Check(callable), PRECALL);
|
||||
DEOPT_IF(!PyType_Check(callable), CALL);
|
||||
PyTypeObject *tp = (PyTypeObject *)callable;
|
||||
DEOPT_IF(tp->tp_vectorcall == NULL, PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
DEOPT_IF(tp->tp_vectorcall == NULL, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
STACK_SHRINK(total_args);
|
||||
PyObject *res = tp->tp_vectorcall((PyObject *)tp, stack_pointer,
|
||||
total_args-kwnames_len, call_shape.kwnames);
|
||||
|
@ -5057,18 +4988,18 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_NO_KW_BUILTIN_O) {
|
||||
TARGET(CALL_NO_KW_BUILTIN_O) {
|
||||
assert(cframe.use_tracing == 0);
|
||||
/* Builtin METH_O functions */
|
||||
assert(call_shape.kwnames == NULL);
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int total_args = oparg + is_meth;
|
||||
DEOPT_IF(total_args != 1, PRECALL);
|
||||
DEOPT_IF(total_args != 1, CALL);
|
||||
PyObject *callable = PEEK(total_args + 1);
|
||||
DEOPT_IF(!PyCFunction_CheckExact(callable), PRECALL);
|
||||
DEOPT_IF(PyCFunction_GET_FLAGS(callable) != METH_O, PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
DEOPT_IF(!PyCFunction_CheckExact(callable), CALL);
|
||||
DEOPT_IF(PyCFunction_GET_FLAGS(callable) != METH_O, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
PyCFunction cfunc = PyCFunction_GET_FUNCTION(callable);
|
||||
// This is slower but CPython promises to check all non-vectorcall
|
||||
// function calls.
|
||||
|
@ -5091,18 +5022,18 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_NO_KW_BUILTIN_FAST) {
|
||||
TARGET(CALL_NO_KW_BUILTIN_FAST) {
|
||||
assert(cframe.use_tracing == 0);
|
||||
/* Builtin METH_FASTCALL functions, without keywords */
|
||||
assert(call_shape.kwnames == NULL);
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int total_args = oparg + is_meth;
|
||||
PyObject *callable = PEEK(total_args + 1);
|
||||
DEOPT_IF(!PyCFunction_CheckExact(callable), PRECALL);
|
||||
DEOPT_IF(!PyCFunction_CheckExact(callable), CALL);
|
||||
DEOPT_IF(PyCFunction_GET_FLAGS(callable) != METH_FASTCALL,
|
||||
PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
PyCFunction cfunc = PyCFunction_GET_FUNCTION(callable);
|
||||
STACK_SHRINK(total_args);
|
||||
/* res = func(self, args, nargs) */
|
||||
|
@ -5131,17 +5062,17 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_BUILTIN_FAST_WITH_KEYWORDS) {
|
||||
TARGET(CALL_BUILTIN_FAST_WITH_KEYWORDS) {
|
||||
assert(cframe.use_tracing == 0);
|
||||
/* Builtin METH_FASTCALL | METH_KEYWORDS functions */
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int total_args = oparg + is_meth;
|
||||
PyObject *callable = PEEK(total_args + 1);
|
||||
DEOPT_IF(!PyCFunction_CheckExact(callable), PRECALL);
|
||||
DEOPT_IF(!PyCFunction_CheckExact(callable), CALL);
|
||||
DEOPT_IF(PyCFunction_GET_FLAGS(callable) !=
|
||||
(METH_FASTCALL | METH_KEYWORDS), PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
(METH_FASTCALL | METH_KEYWORDS), CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
STACK_SHRINK(total_args);
|
||||
/* res = func(self, args, nargs, kwnames) */
|
||||
_PyCFunctionFastWithKeywords cfunc =
|
||||
|
@ -5170,18 +5101,18 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_NO_KW_LEN) {
|
||||
TARGET(CALL_NO_KW_LEN) {
|
||||
assert(cframe.use_tracing == 0);
|
||||
assert(call_shape.kwnames == NULL);
|
||||
/* len(o) */
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int total_args = oparg + is_meth;
|
||||
DEOPT_IF(total_args != 1, PRECALL);
|
||||
DEOPT_IF(total_args != 1, CALL);
|
||||
PyObject *callable = PEEK(total_args + 1);
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
DEOPT_IF(callable != interp->callable_cache.len, PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
DEOPT_IF(callable != interp->callable_cache.len, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
PyObject *arg = TOP();
|
||||
Py_ssize_t len_i = PyObject_Length(arg);
|
||||
if (len_i < 0) {
|
||||
|
@ -5200,18 +5131,18 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_NO_KW_ISINSTANCE) {
|
||||
TARGET(CALL_NO_KW_ISINSTANCE) {
|
||||
assert(cframe.use_tracing == 0);
|
||||
assert(call_shape.kwnames == NULL);
|
||||
/* isinstance(o, o2) */
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int total_args = oparg + is_meth;
|
||||
PyObject *callable = PEEK(total_args + 1);
|
||||
DEOPT_IF(total_args != 2, PRECALL);
|
||||
DEOPT_IF(total_args != 2, CALL);
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
DEOPT_IF(callable != interp->callable_cache.isinstance, PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
DEOPT_IF(callable != interp->callable_cache.isinstance, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
PyObject *cls = POP();
|
||||
PyObject *inst = TOP();
|
||||
int retval = PyObject_IsInstance(inst, cls);
|
||||
|
@ -5233,18 +5164,18 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_NO_KW_LIST_APPEND) {
|
||||
TARGET(CALL_NO_KW_LIST_APPEND) {
|
||||
assert(cframe.use_tracing == 0);
|
||||
assert(call_shape.kwnames == NULL);
|
||||
assert(oparg == 1);
|
||||
PyObject *callable = PEEK(3);
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
DEOPT_IF(callable != interp->callable_cache.list_append, PRECALL);
|
||||
DEOPT_IF(callable != interp->callable_cache.list_append, CALL);
|
||||
PyObject *list = SECOND();
|
||||
DEOPT_IF(!PyList_Check(list), PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
// PRECALL + CALL + POP_TOP
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_PRECALL + 1 + INLINE_CACHE_ENTRIES_CALL + 1);
|
||||
DEOPT_IF(!PyList_Check(list), CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
// CALL + POP_TOP
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1);
|
||||
assert(_Py_OPCODE(next_instr[-1]) == POP_TOP);
|
||||
PyObject *arg = POP();
|
||||
if (_PyList_AppendTakeRef((PyListObject *)list, arg) < 0) {
|
||||
|
@ -5256,21 +5187,21 @@ handle_eval_breaker:
|
|||
NOTRACE_DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_NO_KW_METHOD_DESCRIPTOR_O) {
|
||||
TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) {
|
||||
assert(call_shape.kwnames == NULL);
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int total_args = oparg + is_meth;
|
||||
PyMethodDescrObject *callable =
|
||||
(PyMethodDescrObject *)PEEK(total_args + 1);
|
||||
DEOPT_IF(total_args != 2, PRECALL);
|
||||
DEOPT_IF(!Py_IS_TYPE(callable, &PyMethodDescr_Type), PRECALL);
|
||||
DEOPT_IF(total_args != 2, CALL);
|
||||
DEOPT_IF(!Py_IS_TYPE(callable, &PyMethodDescr_Type), CALL);
|
||||
PyMethodDef *meth = callable->d_method;
|
||||
DEOPT_IF(meth->ml_flags != METH_O, PRECALL);
|
||||
DEOPT_IF(meth->ml_flags != METH_O, CALL);
|
||||
PyObject *arg = TOP();
|
||||
PyObject *self = SECOND();
|
||||
DEOPT_IF(!Py_IS_TYPE(self, callable->d_common.d_type), PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
DEOPT_IF(!Py_IS_TYPE(self, callable->d_common.d_type), CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
PyCFunction cfunc = meth->ml_meth;
|
||||
// This is slower but CPython promises to check all non-vectorcall
|
||||
// function calls.
|
||||
|
@ -5292,19 +5223,19 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS) {
|
||||
TARGET(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS) {
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int total_args = oparg + is_meth;
|
||||
PyMethodDescrObject *callable =
|
||||
(PyMethodDescrObject *)PEEK(total_args + 1);
|
||||
DEOPT_IF(!Py_IS_TYPE(callable, &PyMethodDescr_Type), PRECALL);
|
||||
DEOPT_IF(!Py_IS_TYPE(callable, &PyMethodDescr_Type), CALL);
|
||||
PyMethodDef *meth = callable->d_method;
|
||||
DEOPT_IF(meth->ml_flags != (METH_FASTCALL|METH_KEYWORDS), PRECALL);
|
||||
DEOPT_IF(meth->ml_flags != (METH_FASTCALL|METH_KEYWORDS), CALL);
|
||||
PyTypeObject *d_type = callable->d_common.d_type;
|
||||
PyObject *self = PEEK(total_args);
|
||||
DEOPT_IF(!Py_IS_TYPE(self, d_type), PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
DEOPT_IF(!Py_IS_TYPE(self, d_type), CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
int nargs = total_args-1;
|
||||
STACK_SHRINK(nargs);
|
||||
_PyCFunctionFastWithKeywords cfunc =
|
||||
|
@ -5329,20 +5260,20 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS) {
|
||||
TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS) {
|
||||
assert(call_shape.kwnames == NULL);
|
||||
assert(oparg == 0 || oparg == 1);
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int total_args = oparg + is_meth;
|
||||
DEOPT_IF(total_args != 1, PRECALL);
|
||||
DEOPT_IF(total_args != 1, CALL);
|
||||
PyMethodDescrObject *callable = (PyMethodDescrObject *)SECOND();
|
||||
DEOPT_IF(!Py_IS_TYPE(callable, &PyMethodDescr_Type), PRECALL);
|
||||
DEOPT_IF(!Py_IS_TYPE(callable, &PyMethodDescr_Type), CALL);
|
||||
PyMethodDef *meth = callable->d_method;
|
||||
PyObject *self = TOP();
|
||||
DEOPT_IF(!Py_IS_TYPE(self, callable->d_common.d_type), PRECALL);
|
||||
DEOPT_IF(meth->ml_flags != METH_NOARGS, PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
DEOPT_IF(!Py_IS_TYPE(self, callable->d_common.d_type), CALL);
|
||||
DEOPT_IF(meth->ml_flags != METH_NOARGS, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
PyCFunction cfunc = meth->ml_meth;
|
||||
// This is slower but CPython promises to check all non-vectorcall
|
||||
// function calls.
|
||||
|
@ -5363,20 +5294,20 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST) {
|
||||
TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_FAST) {
|
||||
assert(call_shape.kwnames == NULL);
|
||||
int is_meth = is_method(stack_pointer, oparg);
|
||||
int total_args = oparg + is_meth;
|
||||
PyMethodDescrObject *callable =
|
||||
(PyMethodDescrObject *)PEEK(total_args + 1);
|
||||
/* Builtin METH_FASTCALL methods, without keywords */
|
||||
DEOPT_IF(!Py_IS_TYPE(callable, &PyMethodDescr_Type), PRECALL);
|
||||
DEOPT_IF(!Py_IS_TYPE(callable, &PyMethodDescr_Type), CALL);
|
||||
PyMethodDef *meth = callable->d_method;
|
||||
DEOPT_IF(meth->ml_flags != METH_FASTCALL, PRECALL);
|
||||
DEOPT_IF(meth->ml_flags != METH_FASTCALL, CALL);
|
||||
PyObject *self = PEEK(total_args);
|
||||
DEOPT_IF(!Py_IS_TYPE(self, callable->d_common.d_type), PRECALL);
|
||||
STAT_INC(PRECALL, hit);
|
||||
SKIP_CALL();
|
||||
DEOPT_IF(!Py_IS_TYPE(self, callable->d_common.d_type), CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
_PyCFunctionFast cfunc =
|
||||
(_PyCFunctionFast)(void(*)(void))meth->ml_meth;
|
||||
int nargs = total_args-1;
|
||||
|
|
|
@ -1116,12 +1116,10 @@ stack_effect(int opcode, int oparg, int jump)
|
|||
return -oparg;
|
||||
|
||||
/* Functions and calls */
|
||||
case PRECALL:
|
||||
return -oparg;
|
||||
case KW_NAMES:
|
||||
return 0;
|
||||
case CALL:
|
||||
return -1;
|
||||
return -1-oparg;
|
||||
|
||||
case CALL_FUNCTION_EX:
|
||||
return -2 - ((oparg & 0x01) != 0);
|
||||
|
@ -1947,7 +1945,6 @@ compiler_call_exit_with_nones(struct compiler *c) {
|
|||
ADDOP_LOAD_CONST(c, Py_None);
|
||||
ADDOP_LOAD_CONST(c, Py_None);
|
||||
ADDOP_LOAD_CONST(c, Py_None);
|
||||
ADDOP_I(c, PRECALL, 2);
|
||||
ADDOP_I(c, CALL, 2);
|
||||
return 1;
|
||||
}
|
||||
|
@ -2325,7 +2322,6 @@ compiler_apply_decorators(struct compiler *c, asdl_expr_seq* decos)
|
|||
int old_end_col_offset = c->u->u_end_col_offset;
|
||||
for (Py_ssize_t i = asdl_seq_LEN(decos) - 1; i > -1; i--) {
|
||||
SET_LOC(c, (expr_ty)asdl_seq_GET(decos, i));
|
||||
ADDOP_I(c, PRECALL, 0);
|
||||
ADDOP_I(c, CALL, 0);
|
||||
}
|
||||
c->u->u_lineno = old_lineno;
|
||||
|
@ -4002,7 +3998,6 @@ compiler_assert(struct compiler *c, stmt_ty s)
|
|||
ADDOP(c, LOAD_ASSERTION_ERROR);
|
||||
if (s->v.Assert.msg) {
|
||||
VISIT(c, expr, s->v.Assert.msg);
|
||||
ADDOP_I(c, PRECALL, 0);
|
||||
ADDOP_I(c, CALL, 0);
|
||||
}
|
||||
ADDOP_I(c, RAISE_VARARGS, 1);
|
||||
|
@ -4831,7 +4826,6 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e)
|
|||
return 0;
|
||||
};
|
||||
}
|
||||
ADDOP_I(c, PRECALL, argsl + kwdsl);
|
||||
ADDOP_I(c, CALL, argsl + kwdsl);
|
||||
c->u->u_lineno = old_lineno;
|
||||
return 1;
|
||||
|
@ -4897,7 +4891,6 @@ compiler_joined_str(struct compiler *c, expr_ty e)
|
|||
VISIT(c, expr, asdl_seq_GET(e->v.JoinedStr.values, i));
|
||||
ADDOP_I(c, LIST_APPEND, 1);
|
||||
}
|
||||
ADDOP_I(c, PRECALL, 1);
|
||||
ADDOP_I(c, CALL, 1);
|
||||
}
|
||||
else {
|
||||
|
@ -5071,7 +5064,6 @@ compiler_call_helper(struct compiler *c,
|
|||
return 0;
|
||||
};
|
||||
}
|
||||
ADDOP_I(c, PRECALL, n + nelts + nkwelts);
|
||||
ADDOP_I(c, CALL, n + nelts + nkwelts);
|
||||
return 1;
|
||||
|
||||
|
@ -5462,7 +5454,6 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type,
|
|||
ADDOP(c, GET_ITER);
|
||||
}
|
||||
|
||||
ADDOP_I(c, PRECALL, 0);
|
||||
ADDOP_I(c, CALL, 0);
|
||||
|
||||
if (is_async_generator && type != COMP_GENEXP) {
|
||||
|
|
|
@ -25,62 +25,62 @@ static void *opcode_targets[256] = {
|
|||
&&TARGET_CALL_PY_EXACT_ARGS,
|
||||
&&TARGET_CALL_PY_WITH_DEFAULTS,
|
||||
&&TARGET_BINARY_SUBSCR,
|
||||
&&TARGET_COMPARE_OP_ADAPTIVE,
|
||||
&&TARGET_COMPARE_OP_FLOAT_JUMP,
|
||||
&&TARGET_COMPARE_OP_INT_JUMP,
|
||||
&&TARGET_COMPARE_OP_STR_JUMP,
|
||||
&&TARGET_CALL_BOUND_METHOD_EXACT_ARGS,
|
||||
&&TARGET_CALL_BUILTIN_CLASS,
|
||||
&&TARGET_CALL_BUILTIN_FAST_WITH_KEYWORDS,
|
||||
&&TARGET_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS,
|
||||
&&TARGET_GET_LEN,
|
||||
&&TARGET_MATCH_MAPPING,
|
||||
&&TARGET_MATCH_SEQUENCE,
|
||||
&&TARGET_MATCH_KEYS,
|
||||
&&TARGET_EXTENDED_ARG_QUICK,
|
||||
&&TARGET_CALL_NO_KW_BUILTIN_FAST,
|
||||
&&TARGET_PUSH_EXC_INFO,
|
||||
&&TARGET_CHECK_EXC_MATCH,
|
||||
&&TARGET_CHECK_EG_MATCH,
|
||||
&&TARGET_JUMP_BACKWARD_QUICK,
|
||||
&&TARGET_LOAD_ATTR_ADAPTIVE,
|
||||
&&TARGET_LOAD_ATTR_INSTANCE_VALUE,
|
||||
&&TARGET_LOAD_ATTR_MODULE,
|
||||
&&TARGET_LOAD_ATTR_SLOT,
|
||||
&&TARGET_LOAD_ATTR_WITH_HINT,
|
||||
&&TARGET_LOAD_CONST__LOAD_FAST,
|
||||
&&TARGET_LOAD_FAST__LOAD_CONST,
|
||||
&&TARGET_LOAD_FAST__LOAD_FAST,
|
||||
&&TARGET_LOAD_GLOBAL_ADAPTIVE,
|
||||
&&TARGET_LOAD_GLOBAL_BUILTIN,
|
||||
&&TARGET_CALL_NO_KW_BUILTIN_O,
|
||||
&&TARGET_CALL_NO_KW_ISINSTANCE,
|
||||
&&TARGET_CALL_NO_KW_LEN,
|
||||
&&TARGET_CALL_NO_KW_LIST_APPEND,
|
||||
&&TARGET_CALL_NO_KW_METHOD_DESCRIPTOR_FAST,
|
||||
&&TARGET_CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS,
|
||||
&&TARGET_CALL_NO_KW_METHOD_DESCRIPTOR_O,
|
||||
&&TARGET_CALL_NO_KW_STR_1,
|
||||
&&TARGET_CALL_NO_KW_TUPLE_1,
|
||||
&&TARGET_CALL_NO_KW_TYPE_1,
|
||||
&&TARGET_COMPARE_OP_ADAPTIVE,
|
||||
&&TARGET_WITH_EXCEPT_START,
|
||||
&&TARGET_GET_AITER,
|
||||
&&TARGET_GET_ANEXT,
|
||||
&&TARGET_BEFORE_ASYNC_WITH,
|
||||
&&TARGET_BEFORE_WITH,
|
||||
&&TARGET_END_ASYNC_FOR,
|
||||
&&TARGET_LOAD_GLOBAL_MODULE,
|
||||
&&TARGET_LOAD_METHOD_ADAPTIVE,
|
||||
&&TARGET_LOAD_METHOD_CLASS,
|
||||
&&TARGET_LOAD_METHOD_MODULE,
|
||||
&&TARGET_LOAD_METHOD_NO_DICT,
|
||||
&&TARGET_COMPARE_OP_FLOAT_JUMP,
|
||||
&&TARGET_COMPARE_OP_INT_JUMP,
|
||||
&&TARGET_COMPARE_OP_STR_JUMP,
|
||||
&&TARGET_EXTENDED_ARG_QUICK,
|
||||
&&TARGET_JUMP_BACKWARD_QUICK,
|
||||
&&TARGET_STORE_SUBSCR,
|
||||
&&TARGET_DELETE_SUBSCR,
|
||||
&&TARGET_LOAD_METHOD_WITH_DICT,
|
||||
&&TARGET_LOAD_METHOD_WITH_VALUES,
|
||||
&&TARGET_PRECALL_ADAPTIVE,
|
||||
&&TARGET_PRECALL_BOUND_METHOD,
|
||||
&&TARGET_PRECALL_BUILTIN_CLASS,
|
||||
&&TARGET_PRECALL_BUILTIN_FAST_WITH_KEYWORDS,
|
||||
&&TARGET_LOAD_ATTR_ADAPTIVE,
|
||||
&&TARGET_LOAD_ATTR_INSTANCE_VALUE,
|
||||
&&TARGET_LOAD_ATTR_MODULE,
|
||||
&&TARGET_LOAD_ATTR_SLOT,
|
||||
&&TARGET_LOAD_ATTR_WITH_HINT,
|
||||
&&TARGET_LOAD_CONST__LOAD_FAST,
|
||||
&&TARGET_GET_ITER,
|
||||
&&TARGET_GET_YIELD_FROM_ITER,
|
||||
&&TARGET_PRINT_EXPR,
|
||||
&&TARGET_LOAD_BUILD_CLASS,
|
||||
&&TARGET_PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS,
|
||||
&&TARGET_PRECALL_NO_KW_BUILTIN_FAST,
|
||||
&&TARGET_LOAD_FAST__LOAD_CONST,
|
||||
&&TARGET_LOAD_FAST__LOAD_FAST,
|
||||
&&TARGET_LOAD_ASSERTION_ERROR,
|
||||
&&TARGET_RETURN_GENERATOR,
|
||||
&&TARGET_PRECALL_NO_KW_BUILTIN_O,
|
||||
&&TARGET_PRECALL_NO_KW_ISINSTANCE,
|
||||
&&TARGET_PRECALL_NO_KW_LEN,
|
||||
&&TARGET_PRECALL_NO_KW_LIST_APPEND,
|
||||
&&TARGET_PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST,
|
||||
&&TARGET_PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS,
|
||||
&&TARGET_LOAD_GLOBAL_ADAPTIVE,
|
||||
&&TARGET_LOAD_GLOBAL_BUILTIN,
|
||||
&&TARGET_LOAD_GLOBAL_MODULE,
|
||||
&&TARGET_LOAD_METHOD_ADAPTIVE,
|
||||
&&TARGET_LOAD_METHOD_CLASS,
|
||||
&&TARGET_LOAD_METHOD_MODULE,
|
||||
&&TARGET_LIST_TO_TUPLE,
|
||||
&&TARGET_RETURN_VALUE,
|
||||
&&TARGET_IMPORT_STAR,
|
||||
|
@ -112,7 +112,7 @@ static void *opcode_targets[256] = {
|
|||
&&TARGET_JUMP_FORWARD,
|
||||
&&TARGET_JUMP_IF_FALSE_OR_POP,
|
||||
&&TARGET_JUMP_IF_TRUE_OR_POP,
|
||||
&&TARGET_PRECALL_NO_KW_METHOD_DESCRIPTOR_O,
|
||||
&&TARGET_LOAD_METHOD_NO_DICT,
|
||||
&&TARGET_POP_JUMP_FORWARD_IF_FALSE,
|
||||
&&TARGET_POP_JUMP_FORWARD_IF_TRUE,
|
||||
&&TARGET_LOAD_GLOBAL,
|
||||
|
@ -120,13 +120,13 @@ static void *opcode_targets[256] = {
|
|||
&&TARGET_CONTAINS_OP,
|
||||
&&TARGET_RERAISE,
|
||||
&&TARGET_COPY,
|
||||
&&TARGET_PRECALL_NO_KW_STR_1,
|
||||
&&TARGET_LOAD_METHOD_WITH_DICT,
|
||||
&&TARGET_BINARY_OP,
|
||||
&&TARGET_SEND,
|
||||
&&TARGET_LOAD_FAST,
|
||||
&&TARGET_STORE_FAST,
|
||||
&&TARGET_DELETE_FAST,
|
||||
&&TARGET_PRECALL_NO_KW_TUPLE_1,
|
||||
&&TARGET_LOAD_METHOD_WITH_VALUES,
|
||||
&&TARGET_POP_JUMP_FORWARD_IF_NOT_NONE,
|
||||
&&TARGET_POP_JUMP_FORWARD_IF_NONE,
|
||||
&&TARGET_RAISE_VARARGS,
|
||||
|
@ -140,45 +140,42 @@ static void *opcode_targets[256] = {
|
|||
&&TARGET_STORE_DEREF,
|
||||
&&TARGET_DELETE_DEREF,
|
||||
&&TARGET_JUMP_BACKWARD,
|
||||
&&TARGET_PRECALL_NO_KW_TYPE_1,
|
||||
&&TARGET_RESUME_QUICK,
|
||||
&&TARGET_CALL_FUNCTION_EX,
|
||||
&&TARGET_PRECALL_PYFUNC,
|
||||
&&TARGET_STORE_ATTR_ADAPTIVE,
|
||||
&&TARGET_EXTENDED_ARG,
|
||||
&&TARGET_LIST_APPEND,
|
||||
&&TARGET_SET_ADD,
|
||||
&&TARGET_MAP_ADD,
|
||||
&&TARGET_LOAD_CLASSDEREF,
|
||||
&&TARGET_COPY_FREE_VARS,
|
||||
&&TARGET_RESUME_QUICK,
|
||||
&&TARGET_STORE_ATTR_INSTANCE_VALUE,
|
||||
&&TARGET_RESUME,
|
||||
&&TARGET_MATCH_CLASS,
|
||||
&&TARGET_STORE_ATTR_ADAPTIVE,
|
||||
&&TARGET_STORE_ATTR_INSTANCE_VALUE,
|
||||
&&TARGET_STORE_ATTR_SLOT,
|
||||
&&TARGET_STORE_ATTR_WITH_HINT,
|
||||
&&TARGET_FORMAT_VALUE,
|
||||
&&TARGET_BUILD_CONST_KEY_MAP,
|
||||
&&TARGET_BUILD_STRING,
|
||||
&&TARGET_STORE_ATTR_SLOT,
|
||||
&&TARGET_STORE_ATTR_WITH_HINT,
|
||||
&&TARGET_LOAD_METHOD,
|
||||
&&TARGET_STORE_FAST__LOAD_FAST,
|
||||
&&TARGET_STORE_FAST__STORE_FAST,
|
||||
&&TARGET_LOAD_METHOD,
|
||||
&&TARGET_STORE_SUBSCR_ADAPTIVE,
|
||||
&&TARGET_LIST_EXTEND,
|
||||
&&TARGET_SET_UPDATE,
|
||||
&&TARGET_DICT_MERGE,
|
||||
&&TARGET_DICT_UPDATE,
|
||||
&&TARGET_PRECALL,
|
||||
&&TARGET_STORE_FAST__STORE_FAST,
|
||||
&&TARGET_STORE_SUBSCR_ADAPTIVE,
|
||||
&&TARGET_STORE_SUBSCR_DICT,
|
||||
&&TARGET_STORE_SUBSCR_LIST_INT,
|
||||
&&TARGET_UNPACK_SEQUENCE_ADAPTIVE,
|
||||
&&TARGET_UNPACK_SEQUENCE_LIST,
|
||||
&&TARGET_UNPACK_SEQUENCE_TUPLE,
|
||||
&&TARGET_CALL,
|
||||
&&TARGET_KW_NAMES,
|
||||
&&TARGET_POP_JUMP_BACKWARD_IF_NOT_NONE,
|
||||
&&TARGET_POP_JUMP_BACKWARD_IF_NONE,
|
||||
&&TARGET_POP_JUMP_BACKWARD_IF_FALSE,
|
||||
&&TARGET_POP_JUMP_BACKWARD_IF_TRUE,
|
||||
&&TARGET_UNPACK_SEQUENCE_ADAPTIVE,
|
||||
&&TARGET_UNPACK_SEQUENCE_LIST,
|
||||
&&TARGET_UNPACK_SEQUENCE_TUPLE,
|
||||
&&TARGET_UNPACK_SEQUENCE_TWO_TUPLE,
|
||||
&&_unknown_opcode,
|
||||
&&_unknown_opcode,
|
||||
|
@ -254,5 +251,8 @@ static void *opcode_targets[256] = {
|
|||
&&_unknown_opcode,
|
||||
&&_unknown_opcode,
|
||||
&&_unknown_opcode,
|
||||
&&_unknown_opcode,
|
||||
&&_unknown_opcode,
|
||||
&&_unknown_opcode,
|
||||
&&TARGET_DO_TRACING
|
||||
};
|
||||
|
|
|
@ -24,7 +24,6 @@ uint8_t _PyOpcode_Adaptive[256] = {
|
|||
[BINARY_SUBSCR] = BINARY_SUBSCR_ADAPTIVE,
|
||||
[STORE_SUBSCR] = STORE_SUBSCR_ADAPTIVE,
|
||||
[CALL] = CALL_ADAPTIVE,
|
||||
[PRECALL] = PRECALL_ADAPTIVE,
|
||||
[STORE_ATTR] = STORE_ATTR_ADAPTIVE,
|
||||
[BINARY_OP] = BINARY_OP_ADAPTIVE,
|
||||
[COMPARE_OP] = COMPARE_OP_ADAPTIVE,
|
||||
|
@ -121,7 +120,6 @@ _Py_GetSpecializationStats(void) {
|
|||
err += add_stat_dict(stats, BINARY_OP, "binary_op");
|
||||
err += add_stat_dict(stats, COMPARE_OP, "compare_op");
|
||||
err += add_stat_dict(stats, UNPACK_SEQUENCE, "unpack_sequence");
|
||||
err += add_stat_dict(stats, PRECALL, "precall");
|
||||
if (err < 0) {
|
||||
Py_DECREF(stats);
|
||||
return NULL;
|
||||
|
@ -1358,38 +1356,39 @@ success:
|
|||
|
||||
static int
|
||||
specialize_class_call(PyObject *callable, _Py_CODEUNIT *instr, int nargs,
|
||||
PyObject *kwnames, int oparg)
|
||||
PyObject *kwnames)
|
||||
{
|
||||
assert(_Py_OPCODE(*instr) == PRECALL_ADAPTIVE);
|
||||
assert(_Py_OPCODE(*instr) == CALL_ADAPTIVE);
|
||||
PyTypeObject *tp = _PyType_CAST(callable);
|
||||
if (tp->tp_new == PyBaseObject_Type.tp_new) {
|
||||
SPECIALIZATION_FAIL(PRECALL, SPEC_FAIL_CALL_PYTHON_CLASS);
|
||||
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_PYTHON_CLASS);
|
||||
return -1;
|
||||
}
|
||||
if (tp->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) {
|
||||
int oparg = _Py_OPARG(*instr);
|
||||
if (nargs == 1 && kwnames == NULL && oparg == 1) {
|
||||
if (tp == &PyUnicode_Type) {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_STR_1);
|
||||
_Py_SET_OPCODE(*instr, CALL_NO_KW_STR_1);
|
||||
return 0;
|
||||
}
|
||||
else if (tp == &PyType_Type) {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_TYPE_1);
|
||||
_Py_SET_OPCODE(*instr, CALL_NO_KW_TYPE_1);
|
||||
return 0;
|
||||
}
|
||||
else if (tp == &PyTuple_Type) {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_TUPLE_1);
|
||||
_Py_SET_OPCODE(*instr, CALL_NO_KW_TUPLE_1);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (tp->tp_vectorcall != NULL) {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_BUILTIN_CLASS);
|
||||
_Py_SET_OPCODE(*instr, CALL_BUILTIN_CLASS);
|
||||
return 0;
|
||||
}
|
||||
SPECIALIZATION_FAIL(PRECALL, tp == &PyUnicode_Type ?
|
||||
SPECIALIZATION_FAIL(CALL, tp == &PyUnicode_Type ?
|
||||
SPEC_FAIL_CALL_STR : SPEC_FAIL_CALL_CLASS_NO_VECTORCALL);
|
||||
return -1;
|
||||
}
|
||||
SPECIALIZATION_FAIL(PRECALL, SPEC_FAIL_CALL_CLASS_MUTABLE);
|
||||
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_CLASS_MUTABLE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1419,11 +1418,11 @@ builtin_call_fail_kind(int ml_flags)
|
|||
|
||||
static int
|
||||
specialize_method_descriptor(PyMethodDescrObject *descr, _Py_CODEUNIT *instr,
|
||||
int nargs, PyObject *kwnames, int oparg)
|
||||
int nargs, PyObject *kwnames)
|
||||
{
|
||||
assert(_Py_OPCODE(*instr) == PRECALL_ADAPTIVE);
|
||||
assert(_Py_OPCODE(*instr) == CALL_ADAPTIVE);
|
||||
if (kwnames) {
|
||||
SPECIALIZATION_FAIL(PRECALL, SPEC_FAIL_CALL_KWNAMES);
|
||||
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_KWNAMES);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1432,45 +1431,45 @@ specialize_method_descriptor(PyMethodDescrObject *descr, _Py_CODEUNIT *instr,
|
|||
METH_KEYWORDS | METH_METHOD)) {
|
||||
case METH_NOARGS: {
|
||||
if (nargs != 1) {
|
||||
SPECIALIZATION_FAIL(PRECALL, SPEC_FAIL_WRONG_NUMBER_ARGUMENTS);
|
||||
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_WRONG_NUMBER_ARGUMENTS);
|
||||
return -1;
|
||||
}
|
||||
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS);
|
||||
_Py_SET_OPCODE(*instr, CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS);
|
||||
return 0;
|
||||
}
|
||||
case METH_O: {
|
||||
if (nargs != 2) {
|
||||
SPECIALIZATION_FAIL(PRECALL, SPEC_FAIL_WRONG_NUMBER_ARGUMENTS);
|
||||
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_WRONG_NUMBER_ARGUMENTS);
|
||||
return -1;
|
||||
}
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
PyObject *list_append = interp->callable_cache.list_append;
|
||||
_Py_CODEUNIT next = instr[INLINE_CACHE_ENTRIES_PRECALL + 1
|
||||
+ INLINE_CACHE_ENTRIES_CALL + 1];
|
||||
_Py_CODEUNIT next = instr[INLINE_CACHE_ENTRIES_CALL + 1];
|
||||
bool pop = (_Py_OPCODE(next) == POP_TOP);
|
||||
int oparg = _Py_OPARG(*instr);
|
||||
if ((PyObject *)descr == list_append && oparg == 1 && pop) {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_LIST_APPEND);
|
||||
_Py_SET_OPCODE(*instr, CALL_NO_KW_LIST_APPEND);
|
||||
return 0;
|
||||
}
|
||||
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_METHOD_DESCRIPTOR_O);
|
||||
_Py_SET_OPCODE(*instr, CALL_NO_KW_METHOD_DESCRIPTOR_O);
|
||||
return 0;
|
||||
}
|
||||
case METH_FASTCALL: {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST);
|
||||
_Py_SET_OPCODE(*instr, CALL_NO_KW_METHOD_DESCRIPTOR_FAST);
|
||||
return 0;
|
||||
}
|
||||
case METH_FASTCALL|METH_KEYWORDS: {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS);
|
||||
_Py_SET_OPCODE(*instr, CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
SPECIALIZATION_FAIL(PRECALL, builtin_call_fail_kind(descr->d_method->ml_flags));
|
||||
SPECIALIZATION_FAIL(CALL, builtin_call_fail_kind(descr->d_method->ml_flags));
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
|
||||
PyObject *kwnames)
|
||||
PyObject *kwnames, bool bound_method)
|
||||
{
|
||||
_PyCallCache *cache = (_PyCallCache *)(instr + 1);
|
||||
assert(_Py_OPCODE(*instr) == CALL_ADAPTIVE);
|
||||
|
@ -1512,7 +1511,11 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
|
|||
write_u32(cache->func_version, version);
|
||||
cache->min_args = min_args;
|
||||
if (argcount == nargs) {
|
||||
_Py_SET_OPCODE(*instr, CALL_PY_EXACT_ARGS);
|
||||
_Py_SET_OPCODE(*instr, bound_method ? CALL_BOUND_METHOD_EXACT_ARGS : CALL_PY_EXACT_ARGS);
|
||||
}
|
||||
else if (bound_method) {
|
||||
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_BOUND_METHOD);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
_Py_SET_OPCODE(*instr, CALL_PY_WITH_DEFAULTS);
|
||||
|
@ -1524,7 +1527,7 @@ static int
|
|||
specialize_c_call(PyObject *callable, _Py_CODEUNIT *instr, int nargs,
|
||||
PyObject *kwnames)
|
||||
{
|
||||
assert(_Py_OPCODE(*instr) == PRECALL_ADAPTIVE);
|
||||
assert(_Py_OPCODE(*instr) == CALL_ADAPTIVE);
|
||||
if (PyCFunction_GET_FUNCTION(callable) == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -1533,44 +1536,44 @@ specialize_c_call(PyObject *callable, _Py_CODEUNIT *instr, int nargs,
|
|||
METH_KEYWORDS | METH_METHOD)) {
|
||||
case METH_O: {
|
||||
if (kwnames) {
|
||||
SPECIALIZATION_FAIL(PRECALL, SPEC_FAIL_CALL_KWNAMES);
|
||||
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_KWNAMES);
|
||||
return -1;
|
||||
}
|
||||
if (nargs != 1) {
|
||||
SPECIALIZATION_FAIL(PRECALL, SPEC_FAIL_WRONG_NUMBER_ARGUMENTS);
|
||||
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_WRONG_NUMBER_ARGUMENTS);
|
||||
return 1;
|
||||
}
|
||||
/* len(o) */
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
if (callable == interp->callable_cache.len) {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_LEN);
|
||||
_Py_SET_OPCODE(*instr, CALL_NO_KW_LEN);
|
||||
return 0;
|
||||
}
|
||||
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_BUILTIN_O);
|
||||
_Py_SET_OPCODE(*instr, CALL_NO_KW_BUILTIN_O);
|
||||
return 0;
|
||||
}
|
||||
case METH_FASTCALL: {
|
||||
if (kwnames) {
|
||||
SPECIALIZATION_FAIL(PRECALL, SPEC_FAIL_CALL_KWNAMES);
|
||||
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_KWNAMES);
|
||||
return -1;
|
||||
}
|
||||
if (nargs == 2) {
|
||||
/* isinstance(o1, o2) */
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
if (callable == interp->callable_cache.isinstance) {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_ISINSTANCE);
|
||||
_Py_SET_OPCODE(*instr, CALL_NO_KW_ISINSTANCE);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
_Py_SET_OPCODE(*instr, PRECALL_NO_KW_BUILTIN_FAST);
|
||||
_Py_SET_OPCODE(*instr, CALL_NO_KW_BUILTIN_FAST);
|
||||
return 0;
|
||||
}
|
||||
case METH_FASTCALL | METH_KEYWORDS: {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_BUILTIN_FAST_WITH_KEYWORDS);
|
||||
_Py_SET_OPCODE(*instr, CALL_BUILTIN_FAST_WITH_KEYWORDS);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
SPECIALIZATION_FAIL(PRECALL,
|
||||
SPECIALIZATION_FAIL(CALL,
|
||||
builtin_call_fail_kind(PyCFunction_GET_FLAGS(callable)));
|
||||
return 1;
|
||||
}
|
||||
|
@ -1618,49 +1621,6 @@ call_fail_kind(PyObject *callable)
|
|||
#endif
|
||||
|
||||
|
||||
int
|
||||
_Py_Specialize_Precall(PyObject *callable, _Py_CODEUNIT *instr, int nargs,
|
||||
PyObject *kwnames, int oparg)
|
||||
{
|
||||
assert(_PyOpcode_Caches[PRECALL] == INLINE_CACHE_ENTRIES_PRECALL);
|
||||
_PyPrecallCache *cache = (_PyPrecallCache *)(instr + 1);
|
||||
int fail;
|
||||
if (PyCFunction_CheckExact(callable)) {
|
||||
fail = specialize_c_call(callable, instr, nargs, kwnames);
|
||||
}
|
||||
else if (PyFunction_Check(callable)) {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_PYFUNC);
|
||||
fail = 0;
|
||||
}
|
||||
else if (PyType_Check(callable)) {
|
||||
fail = specialize_class_call(callable, instr, nargs, kwnames, oparg);
|
||||
}
|
||||
else if (Py_IS_TYPE(callable, &PyMethodDescr_Type)) {
|
||||
fail = specialize_method_descriptor((PyMethodDescrObject *)callable,
|
||||
instr, nargs, kwnames, oparg);
|
||||
}
|
||||
else if (Py_TYPE(callable) == &PyMethod_Type) {
|
||||
_Py_SET_OPCODE(*instr, PRECALL_BOUND_METHOD);
|
||||
fail = 0;
|
||||
}
|
||||
else {
|
||||
SPECIALIZATION_FAIL(PRECALL, call_fail_kind(callable));
|
||||
fail = -1;
|
||||
}
|
||||
if (fail) {
|
||||
STAT_INC(PRECALL, failure);
|
||||
assert(!PyErr_Occurred());
|
||||
cache->counter = ADAPTIVE_CACHE_BACKOFF;
|
||||
}
|
||||
else {
|
||||
STAT_INC(PRECALL, success);
|
||||
assert(!PyErr_Occurred());
|
||||
cache->counter = initial_counter_value();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* TODO:
|
||||
- Specialize calling classes.
|
||||
*/
|
||||
|
@ -1671,9 +1631,29 @@ _Py_Specialize_Call(PyObject *callable, _Py_CODEUNIT *instr, int nargs,
|
|||
assert(_PyOpcode_Caches[CALL] == INLINE_CACHE_ENTRIES_CALL);
|
||||
_PyCallCache *cache = (_PyCallCache *)(instr + 1);
|
||||
int fail;
|
||||
if (PyFunction_Check(callable)) {
|
||||
if (PyCFunction_CheckExact(callable)) {
|
||||
fail = specialize_c_call(callable, instr, nargs, kwnames);
|
||||
}
|
||||
else if (PyFunction_Check(callable)) {
|
||||
fail = specialize_py_call((PyFunctionObject *)callable, instr, nargs,
|
||||
kwnames);
|
||||
kwnames, false);
|
||||
}
|
||||
else if (PyType_Check(callable)) {
|
||||
fail = specialize_class_call(callable, instr, nargs, kwnames);
|
||||
}
|
||||
else if (Py_IS_TYPE(callable, &PyMethodDescr_Type)) {
|
||||
fail = specialize_method_descriptor((PyMethodDescrObject *)callable,
|
||||
instr, nargs, kwnames);
|
||||
}
|
||||
else if (Py_TYPE(callable) == &PyMethod_Type) {
|
||||
PyObject *func = ((PyMethodObject *)callable)->im_func;
|
||||
if (PyFunction_Check(func)) {
|
||||
fail = specialize_py_call((PyFunctionObject *)func,
|
||||
instr, nargs+1, kwnames, true);
|
||||
} else {
|
||||
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_BOUND_METHOD);
|
||||
fail = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
SPECIALIZATION_FAIL(CALL, call_fail_kind(callable));
|
||||
|
|
Loading…
Reference in New Issue