summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorDennis Sweeney <36520290+sweeneyde@users.noreply.github.com>2022-05-03 14:59:12 (GMT)
committerGitHub <noreply@github.com>2022-05-03 14:59:12 (GMT)
commitb156578bd63a94fe3d80a4c6a8dbc067feba5d06 (patch)
treeef52569184e48c4f282032e3f67b519c432c372f /Include
parent04dc4b06a3afc79a658cacca87ee1d93a34653bd (diff)
downloadcpython-b156578bd63a94fe3d80a4c6a8dbc067feba5d06.zip
cpython-b156578bd63a94fe3d80a4c6a8dbc067feba5d06.tar.gz
cpython-b156578bd63a94fe3d80a4c6a8dbc067feba5d06.tar.bz2
gh-92031: Deoptimize Static Code at Finalization (GH-92039)
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_opcode.h186
1 files changed, 186 insertions, 0 deletions
diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h
index eadcba1..09f6501 100644
--- a/Include/internal/pycore_opcode.h
+++ b/Include/internal/pycore_opcode.h
@@ -16,6 +16,8 @@ extern const uint8_t _PyOpcode_Caches[256];
extern const uint8_t _PyOpcode_Deopt[256];
+extern const uint8_t _PyOpcode_Original[256];
+
#ifdef NEED_OPCODE_TABLES
static const uint32_t _PyOpcode_RelativeJump[8] = {
0U,
@@ -235,6 +237,190 @@ const uint8_t _PyOpcode_Deopt[256] = {
[WITH_EXCEPT_START] = WITH_EXCEPT_START,
[YIELD_VALUE] = YIELD_VALUE,
};
+
+const uint8_t _PyOpcode_Original[256] = {
+ [ASYNC_GEN_WRAP] = ASYNC_GEN_WRAP,
+ [BEFORE_ASYNC_WITH] = BEFORE_ASYNC_WITH,
+ [BEFORE_WITH] = BEFORE_WITH,
+ [BINARY_OP] = BINARY_OP,
+ [BINARY_OP_ADAPTIVE] = BINARY_OP,
+ [BINARY_OP_ADD_FLOAT] = BINARY_OP,
+ [BINARY_OP_ADD_INT] = BINARY_OP,
+ [BINARY_OP_ADD_UNICODE] = BINARY_OP,
+ [BINARY_OP_INPLACE_ADD_UNICODE] = BINARY_OP,
+ [BINARY_OP_MULTIPLY_FLOAT] = BINARY_OP,
+ [BINARY_OP_MULTIPLY_INT] = BINARY_OP,
+ [BINARY_OP_SUBTRACT_FLOAT] = BINARY_OP,
+ [BINARY_OP_SUBTRACT_INT] = BINARY_OP,
+ [BINARY_SUBSCR] = BINARY_SUBSCR,
+ [BINARY_SUBSCR_ADAPTIVE] = BINARY_SUBSCR,
+ [BINARY_SUBSCR_DICT] = BINARY_SUBSCR,
+ [BINARY_SUBSCR_GETITEM] = BINARY_SUBSCR,
+ [BINARY_SUBSCR_LIST_INT] = BINARY_SUBSCR,
+ [BINARY_SUBSCR_TUPLE_INT] = BINARY_SUBSCR,
+ [BUILD_CONST_KEY_MAP] = BUILD_CONST_KEY_MAP,
+ [BUILD_LIST] = BUILD_LIST,
+ [BUILD_MAP] = BUILD_MAP,
+ [BUILD_SET] = BUILD_SET,
+ [BUILD_SLICE] = BUILD_SLICE,
+ [BUILD_STRING] = BUILD_STRING,
+ [BUILD_TUPLE] = BUILD_TUPLE,
+ [CACHE] = CACHE,
+ [CALL] = CALL,
+ [CALL_ADAPTIVE] = CALL,
+ [CALL_FUNCTION_EX] = CALL_FUNCTION_EX,
+ [CALL_PY_EXACT_ARGS] = CALL,
+ [CALL_PY_WITH_DEFAULTS] = CALL,
+ [CHECK_EG_MATCH] = CHECK_EG_MATCH,
+ [CHECK_EXC_MATCH] = CHECK_EXC_MATCH,
+ [COMPARE_OP] = COMPARE_OP,
+ [COMPARE_OP_ADAPTIVE] = COMPARE_OP,
+ [COMPARE_OP_FLOAT_JUMP] = COMPARE_OP,
+ [COMPARE_OP_INT_JUMP] = COMPARE_OP,
+ [COMPARE_OP_STR_JUMP] = COMPARE_OP,
+ [CONTAINS_OP] = CONTAINS_OP,
+ [COPY] = COPY,
+ [COPY_FREE_VARS] = COPY_FREE_VARS,
+ [DELETE_ATTR] = DELETE_ATTR,
+ [DELETE_DEREF] = DELETE_DEREF,
+ [DELETE_FAST] = DELETE_FAST,
+ [DELETE_GLOBAL] = DELETE_GLOBAL,
+ [DELETE_NAME] = DELETE_NAME,
+ [DELETE_SUBSCR] = DELETE_SUBSCR,
+ [DICT_MERGE] = DICT_MERGE,
+ [DICT_UPDATE] = DICT_UPDATE,
+ [END_ASYNC_FOR] = END_ASYNC_FOR,
+ [EXTENDED_ARG] = EXTENDED_ARG_QUICK,
+ [EXTENDED_ARG_QUICK] = EXTENDED_ARG_QUICK,
+ [FORMAT_VALUE] = FORMAT_VALUE,
+ [FOR_ITER] = FOR_ITER,
+ [GET_AITER] = GET_AITER,
+ [GET_ANEXT] = GET_ANEXT,
+ [GET_AWAITABLE] = GET_AWAITABLE,
+ [GET_ITER] = GET_ITER,
+ [GET_LEN] = GET_LEN,
+ [GET_YIELD_FROM_ITER] = GET_YIELD_FROM_ITER,
+ [IMPORT_FROM] = IMPORT_FROM,
+ [IMPORT_NAME] = IMPORT_NAME,
+ [IMPORT_STAR] = IMPORT_STAR,
+ [IS_OP] = IS_OP,
+ [JUMP_BACKWARD] = JUMP_BACKWARD,
+ [JUMP_BACKWARD_NO_INTERRUPT] = JUMP_BACKWARD_NO_INTERRUPT,
+ [JUMP_BACKWARD_QUICK] = JUMP_BACKWARD,
+ [JUMP_FORWARD] = JUMP_FORWARD,
+ [JUMP_IF_FALSE_OR_POP] = JUMP_IF_FALSE_OR_POP,
+ [JUMP_IF_TRUE_OR_POP] = JUMP_IF_TRUE_OR_POP,
+ [KW_NAMES] = KW_NAMES,
+ [LIST_APPEND] = LIST_APPEND,
+ [LIST_EXTEND] = LIST_EXTEND,
+ [LIST_TO_TUPLE] = LIST_TO_TUPLE,
+ [LOAD_ASSERTION_ERROR] = LOAD_ASSERTION_ERROR,
+ [LOAD_ATTR] = LOAD_ATTR,
+ [LOAD_ATTR_ADAPTIVE] = LOAD_ATTR,
+ [LOAD_ATTR_INSTANCE_VALUE] = LOAD_ATTR,
+ [LOAD_ATTR_MODULE] = LOAD_ATTR,
+ [LOAD_ATTR_SLOT] = LOAD_ATTR,
+ [LOAD_ATTR_WITH_HINT] = LOAD_ATTR,
+ [LOAD_BUILD_CLASS] = LOAD_BUILD_CLASS,
+ [LOAD_CLASSDEREF] = LOAD_CLASSDEREF,
+ [LOAD_CLOSURE] = LOAD_CLOSURE,
+ [LOAD_CONST] = LOAD_CONST,
+ [LOAD_CONST__LOAD_FAST] = LOAD_CONST,
+ [LOAD_DEREF] = LOAD_DEREF,
+ [LOAD_FAST] = LOAD_FAST,
+ [LOAD_FAST__LOAD_CONST] = LOAD_FAST,
+ [LOAD_FAST__LOAD_FAST] = LOAD_FAST,
+ [LOAD_GLOBAL] = LOAD_GLOBAL,
+ [LOAD_GLOBAL_ADAPTIVE] = LOAD_GLOBAL,
+ [LOAD_GLOBAL_BUILTIN] = LOAD_GLOBAL,
+ [LOAD_GLOBAL_MODULE] = LOAD_GLOBAL,
+ [LOAD_METHOD] = LOAD_METHOD,
+ [LOAD_METHOD_ADAPTIVE] = LOAD_METHOD,
+ [LOAD_METHOD_CLASS] = LOAD_METHOD,
+ [LOAD_METHOD_MODULE] = LOAD_METHOD,
+ [LOAD_METHOD_NO_DICT] = LOAD_METHOD,
+ [LOAD_METHOD_WITH_DICT] = LOAD_METHOD,
+ [LOAD_METHOD_WITH_VALUES] = LOAD_METHOD,
+ [LOAD_NAME] = LOAD_NAME,
+ [MAKE_CELL] = MAKE_CELL,
+ [MAKE_FUNCTION] = MAKE_FUNCTION,
+ [MAP_ADD] = MAP_ADD,
+ [MATCH_CLASS] = MATCH_CLASS,
+ [MATCH_KEYS] = MATCH_KEYS,
+ [MATCH_MAPPING] = MATCH_MAPPING,
+ [MATCH_SEQUENCE] = MATCH_SEQUENCE,
+ [NOP] = NOP,
+ [POP_EXCEPT] = POP_EXCEPT,
+ [POP_JUMP_BACKWARD_IF_FALSE] = POP_JUMP_BACKWARD_IF_FALSE,
+ [POP_JUMP_BACKWARD_IF_NONE] = POP_JUMP_BACKWARD_IF_NONE,
+ [POP_JUMP_BACKWARD_IF_NOT_NONE] = POP_JUMP_BACKWARD_IF_NOT_NONE,
+ [POP_JUMP_BACKWARD_IF_TRUE] = POP_JUMP_BACKWARD_IF_TRUE,
+ [POP_JUMP_FORWARD_IF_FALSE] = POP_JUMP_FORWARD_IF_FALSE,
+ [POP_JUMP_FORWARD_IF_NONE] = POP_JUMP_FORWARD_IF_NONE,
+ [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,
+ [PUSH_NULL] = PUSH_NULL,
+ [RAISE_VARARGS] = RAISE_VARARGS,
+ [RERAISE] = RERAISE,
+ [RESUME] = RESUME,
+ [RESUME_QUICK] = RESUME,
+ [RETURN_GENERATOR] = RETURN_GENERATOR,
+ [RETURN_VALUE] = RETURN_VALUE,
+ [SEND] = SEND,
+ [SETUP_ANNOTATIONS] = SETUP_ANNOTATIONS,
+ [SET_ADD] = SET_ADD,
+ [SET_UPDATE] = SET_UPDATE,
+ [STORE_ATTR] = STORE_ATTR,
+ [STORE_ATTR_ADAPTIVE] = STORE_ATTR,
+ [STORE_ATTR_INSTANCE_VALUE] = STORE_ATTR,
+ [STORE_ATTR_SLOT] = STORE_ATTR,
+ [STORE_ATTR_WITH_HINT] = STORE_ATTR,
+ [STORE_DEREF] = STORE_DEREF,
+ [STORE_FAST] = STORE_FAST,
+ [STORE_FAST__LOAD_FAST] = STORE_FAST,
+ [STORE_FAST__STORE_FAST] = STORE_FAST,
+ [STORE_GLOBAL] = STORE_GLOBAL,
+ [STORE_NAME] = STORE_NAME,
+ [STORE_SUBSCR] = STORE_SUBSCR,
+ [STORE_SUBSCR_ADAPTIVE] = STORE_SUBSCR,
+ [STORE_SUBSCR_DICT] = STORE_SUBSCR,
+ [STORE_SUBSCR_LIST_INT] = STORE_SUBSCR,
+ [SWAP] = SWAP,
+ [UNARY_INVERT] = UNARY_INVERT,
+ [UNARY_NEGATIVE] = UNARY_NEGATIVE,
+ [UNARY_NOT] = UNARY_NOT,
+ [UNARY_POSITIVE] = UNARY_POSITIVE,
+ [UNPACK_EX] = UNPACK_EX,
+ [UNPACK_SEQUENCE] = UNPACK_SEQUENCE,
+ [UNPACK_SEQUENCE_ADAPTIVE] = UNPACK_SEQUENCE,
+ [UNPACK_SEQUENCE_LIST] = UNPACK_SEQUENCE,
+ [UNPACK_SEQUENCE_TUPLE] = UNPACK_SEQUENCE,
+ [UNPACK_SEQUENCE_TWO_TUPLE] = UNPACK_SEQUENCE,
+ [WITH_EXCEPT_START] = WITH_EXCEPT_START,
+ [YIELD_VALUE] = YIELD_VALUE,
+};
#endif // NEED_OPCODE_TABLES
#ifdef Py_DEBUG