summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Include/internal/pycore_opcode_metadata.h450
-rw-r--r--Python/optimizer.c140
-rw-r--r--Tools/cases_generator/analysis.py2
-rw-r--r--Tools/cases_generator/flags.py26
-rw-r--r--Tools/cases_generator/generate_cases.py5
5 files changed, 392 insertions, 231 deletions
diff --git a/Include/internal/pycore_opcode_metadata.h b/Include/internal/pycore_opcode_metadata.h
index 4908972..aaf3541 100644
--- a/Include/internal/pycore_opcode_metadata.h
+++ b/Include/internal/pycore_opcode_metadata.h
@@ -37,38 +37,42 @@
#define _BINARY_OP_SUBTRACT_FLOAT 309
#define _GUARD_BOTH_UNICODE 310
#define _BINARY_OP_ADD_UNICODE 311
-#define _POP_FRAME 312
-#define _LOAD_LOCALS 313
-#define _LOAD_FROM_DICT_OR_GLOBALS 314
-#define _GUARD_GLOBALS_VERSION 315
-#define _GUARD_BUILTINS_VERSION 316
-#define _LOAD_GLOBAL_MODULE 317
-#define _LOAD_GLOBAL_BUILTINS 318
-#define _GUARD_TYPE_VERSION 319
-#define _CHECK_MANAGED_OBJECT_HAS_VALUES 320
-#define _LOAD_ATTR_INSTANCE_VALUE 321
-#define IS_NONE 322
-#define _ITER_CHECK_LIST 323
-#define _IS_ITER_EXHAUSTED_LIST 324
-#define _ITER_NEXT_LIST 325
-#define _ITER_CHECK_TUPLE 326
-#define _IS_ITER_EXHAUSTED_TUPLE 327
-#define _ITER_NEXT_TUPLE 328
-#define _ITER_CHECK_RANGE 329
-#define _IS_ITER_EXHAUSTED_RANGE 330
-#define _ITER_NEXT_RANGE 331
-#define _CHECK_CALL_BOUND_METHOD_EXACT_ARGS 332
-#define _INIT_CALL_BOUND_METHOD_EXACT_ARGS 333
-#define _CHECK_PEP_523 334
-#define _CHECK_FUNCTION_EXACT_ARGS 335
-#define _CHECK_STACK_SPACE 336
-#define _INIT_CALL_PY_EXACT_ARGS 337
-#define _PUSH_FRAME 338
-#define _POP_JUMP_IF_FALSE 339
-#define _POP_JUMP_IF_TRUE 340
-#define JUMP_TO_TOP 341
-#define SAVE_CURRENT_IP 342
-#define INSERT 343
+#define _BINARY_OP_INPLACE_ADD_UNICODE 312
+#define _POP_FRAME 313
+#define _LOAD_LOCALS 314
+#define _LOAD_FROM_DICT_OR_GLOBALS 315
+#define _GUARD_GLOBALS_VERSION 316
+#define _GUARD_BUILTINS_VERSION 317
+#define _LOAD_GLOBAL_MODULE 318
+#define _LOAD_GLOBAL_BUILTINS 319
+#define _GUARD_TYPE_VERSION 320
+#define _CHECK_MANAGED_OBJECT_HAS_VALUES 321
+#define _LOAD_ATTR_INSTANCE_VALUE 322
+#define IS_NONE 323
+#define _ITER_CHECK_LIST 324
+#define _ITER_JUMP_LIST 325
+#define _IS_ITER_EXHAUSTED_LIST 326
+#define _ITER_NEXT_LIST 327
+#define _ITER_CHECK_TUPLE 328
+#define _ITER_JUMP_TUPLE 329
+#define _IS_ITER_EXHAUSTED_TUPLE 330
+#define _ITER_NEXT_TUPLE 331
+#define _ITER_CHECK_RANGE 332
+#define _ITER_JUMP_RANGE 333
+#define _IS_ITER_EXHAUSTED_RANGE 334
+#define _ITER_NEXT_RANGE 335
+#define _CHECK_CALL_BOUND_METHOD_EXACT_ARGS 336
+#define _INIT_CALL_BOUND_METHOD_EXACT_ARGS 337
+#define _CHECK_PEP_523 338
+#define _CHECK_FUNCTION_EXACT_ARGS 339
+#define _CHECK_STACK_SPACE 340
+#define _INIT_CALL_PY_EXACT_ARGS 341
+#define _PUSH_FRAME 342
+#define _POP_JUMP_IF_FALSE 343
+#define _POP_JUMP_IF_TRUE 344
+#define JUMP_TO_TOP 345
+#define SAVE_CURRENT_IP 346
+#define INSERT 347
extern int _PyOpcode_num_popped(int opcode, int oparg, bool jump);
#ifdef NEED_OPCODE_METADATA
@@ -1159,6 +1163,8 @@ enum InstructionFormat {
#define HAS_FREE_FLAG (16)
#define HAS_LOCAL_FLAG (32)
#define HAS_EVAL_BREAK_FLAG (64)
+#define HAS_DEOPT_FLAG (128)
+#define HAS_ERROR_FLAG (256)
#define OPCODE_HAS_ARG(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_ARG_FLAG))
#define OPCODE_HAS_CONST(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_CONST_FLAG))
#define OPCODE_HAS_NAME(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_NAME_FLAG))
@@ -1166,6 +1172,8 @@ enum InstructionFormat {
#define OPCODE_HAS_FREE(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_FREE_FLAG))
#define OPCODE_HAS_LOCAL(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_LOCAL_FLAG))
#define OPCODE_HAS_EVAL_BREAK(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_EVAL_BREAK_FLAG))
+#define OPCODE_HAS_DEOPT(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_DEOPT_FLAG))
+#define OPCODE_HAS_ERROR(OP) (_PyOpcode_opcode_metadata[OP].flags & (HAS_ERROR_FLAG))
struct opcode_metadata {
bool valid_entry;
@@ -1198,10 +1206,10 @@ extern const struct opcode_metadata _PyOpcode_opcode_metadata[OPCODE_METADATA_SI
#ifdef NEED_OPCODE_METADATA
const struct opcode_metadata _PyOpcode_opcode_metadata[OPCODE_METADATA_SIZE] = {
[NOP] = { true, INSTR_FMT_IX, 0 },
- [RESUME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [INSTRUMENTED_RESUME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
+ [RESUME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_ERROR_FLAG },
+ [INSTRUMENTED_RESUME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_ERROR_FLAG },
[LOAD_CLOSURE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_LOCAL_FLAG },
- [LOAD_FAST_CHECK] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_LOCAL_FLAG },
+ [LOAD_FAST_CHECK] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_LOCAL_FLAG | HAS_ERROR_FLAG },
[LOAD_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_LOCAL_FLAG },
[LOAD_FAST_AND_CLEAR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_LOCAL_FLAG },
[LOAD_FAST_LOAD_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_LOCAL_FLAG },
@@ -1213,198 +1221,239 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[OPCODE_METADATA_SIZE] = {
[POP_TOP] = { true, INSTR_FMT_IX, 0 },
[PUSH_NULL] = { true, INSTR_FMT_IX, 0 },
[END_FOR] = { true, INSTR_FMT_IX, 0 },
- [INSTRUMENTED_END_FOR] = { true, INSTR_FMT_IX, 0 },
+ [INSTRUMENTED_END_FOR] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
[END_SEND] = { true, INSTR_FMT_IX, 0 },
- [INSTRUMENTED_END_SEND] = { true, INSTR_FMT_IX, 0 },
- [UNARY_NEGATIVE] = { true, INSTR_FMT_IX, 0 },
+ [INSTRUMENTED_END_SEND] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [UNARY_NEGATIVE] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
[UNARY_NOT] = { true, INSTR_FMT_IX, 0 },
- [TO_BOOL] = { true, INSTR_FMT_IXC00, 0 },
- [TO_BOOL_BOOL] = { true, INSTR_FMT_IXC00, 0 },
- [TO_BOOL_INT] = { true, INSTR_FMT_IXC00, 0 },
- [TO_BOOL_LIST] = { true, INSTR_FMT_IXC00, 0 },
- [TO_BOOL_NONE] = { true, INSTR_FMT_IXC00, 0 },
- [TO_BOOL_STR] = { true, INSTR_FMT_IXC00, 0 },
- [TO_BOOL_ALWAYS_TRUE] = { true, INSTR_FMT_IXC00, 0 },
- [UNARY_INVERT] = { true, INSTR_FMT_IX, 0 },
- [BINARY_OP_MULTIPLY_INT] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_OP_ADD_INT] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_OP_SUBTRACT_INT] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_OP_MULTIPLY_FLOAT] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_OP_ADD_FLOAT] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_OP_SUBTRACT_FLOAT] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_OP_ADD_UNICODE] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_OP_INPLACE_ADD_UNICODE] = { true, INSTR_FMT_IX, HAS_LOCAL_FLAG },
- [BINARY_SUBSCR] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_SLICE] = { true, INSTR_FMT_IX, 0 },
- [STORE_SLICE] = { true, INSTR_FMT_IX, 0 },
- [BINARY_SUBSCR_LIST_INT] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_SUBSCR_STR_INT] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_SUBSCR_TUPLE_INT] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_SUBSCR_DICT] = { true, INSTR_FMT_IXC, 0 },
- [BINARY_SUBSCR_GETITEM] = { true, INSTR_FMT_IXC, 0 },
- [LIST_APPEND] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [SET_ADD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [STORE_SUBSCR] = { true, INSTR_FMT_IXC, 0 },
- [STORE_SUBSCR_LIST_INT] = { true, INSTR_FMT_IXC, 0 },
- [STORE_SUBSCR_DICT] = { true, INSTR_FMT_IXC, 0 },
- [DELETE_SUBSCR] = { true, INSTR_FMT_IX, 0 },
- [CALL_INTRINSIC_1] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [CALL_INTRINSIC_2] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [RAISE_VARARGS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
+ [TO_BOOL] = { true, INSTR_FMT_IXC00, HAS_ERROR_FLAG },
+ [TO_BOOL_BOOL] = { true, INSTR_FMT_IXC00, HAS_DEOPT_FLAG },
+ [TO_BOOL_INT] = { true, INSTR_FMT_IXC00, HAS_DEOPT_FLAG },
+ [TO_BOOL_LIST] = { true, INSTR_FMT_IXC00, HAS_DEOPT_FLAG },
+ [TO_BOOL_NONE] = { true, INSTR_FMT_IXC00, HAS_DEOPT_FLAG },
+ [TO_BOOL_STR] = { true, INSTR_FMT_IXC00, HAS_DEOPT_FLAG },
+ [TO_BOOL_ALWAYS_TRUE] = { true, INSTR_FMT_IXC00, HAS_DEOPT_FLAG },
+ [UNARY_INVERT] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [_GUARD_BOTH_INT] = { true, INSTR_FMT_IX, HAS_DEOPT_FLAG },
+ [_BINARY_OP_MULTIPLY_INT] = { true, INSTR_FMT_IXC, HAS_ERROR_FLAG },
+ [_BINARY_OP_ADD_INT] = { true, INSTR_FMT_IXC, HAS_ERROR_FLAG },
+ [_BINARY_OP_SUBTRACT_INT] = { true, INSTR_FMT_IXC, HAS_ERROR_FLAG },
+ [BINARY_OP_MULTIPLY_INT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [BINARY_OP_ADD_INT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [BINARY_OP_SUBTRACT_INT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [_GUARD_BOTH_FLOAT] = { true, INSTR_FMT_IX, HAS_DEOPT_FLAG },
+ [_BINARY_OP_MULTIPLY_FLOAT] = { true, INSTR_FMT_IXC, 0 },
+ [_BINARY_OP_ADD_FLOAT] = { true, INSTR_FMT_IXC, 0 },
+ [_BINARY_OP_SUBTRACT_FLOAT] = { true, INSTR_FMT_IXC, 0 },
+ [BINARY_OP_MULTIPLY_FLOAT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG },
+ [BINARY_OP_ADD_FLOAT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG },
+ [BINARY_OP_SUBTRACT_FLOAT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG },
+ [_GUARD_BOTH_UNICODE] = { true, INSTR_FMT_IX, HAS_DEOPT_FLAG },
+ [_BINARY_OP_ADD_UNICODE] = { true, INSTR_FMT_IXC, HAS_ERROR_FLAG },
+ [BINARY_OP_ADD_UNICODE] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [_BINARY_OP_INPLACE_ADD_UNICODE] = { true, INSTR_FMT_IX, HAS_LOCAL_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [BINARY_OP_INPLACE_ADD_UNICODE] = { true, INSTR_FMT_IX, HAS_LOCAL_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [BINARY_SUBSCR] = { true, INSTR_FMT_IXC, HAS_ERROR_FLAG },
+ [BINARY_SLICE] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [STORE_SLICE] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [BINARY_SUBSCR_LIST_INT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG },
+ [BINARY_SUBSCR_STR_INT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG },
+ [BINARY_SUBSCR_TUPLE_INT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG },
+ [BINARY_SUBSCR_DICT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [BINARY_SUBSCR_GETITEM] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG },
+ [LIST_APPEND] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [SET_ADD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [STORE_SUBSCR] = { true, INSTR_FMT_IXC, HAS_ERROR_FLAG },
+ [STORE_SUBSCR_LIST_INT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG },
+ [STORE_SUBSCR_DICT] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [DELETE_SUBSCR] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [CALL_INTRINSIC_1] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [CALL_INTRINSIC_2] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [RAISE_VARARGS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
[INTERPRETER_EXIT] = { true, INSTR_FMT_IX, 0 },
+ [_POP_FRAME] = { true, INSTR_FMT_IX, 0 },
[RETURN_VALUE] = { true, INSTR_FMT_IX, 0 },
- [INSTRUMENTED_RETURN_VALUE] = { true, INSTR_FMT_IX, 0 },
+ [INSTRUMENTED_RETURN_VALUE] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
[RETURN_CONST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_CONST_FLAG },
- [INSTRUMENTED_RETURN_CONST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_CONST_FLAG },
- [GET_AITER] = { true, INSTR_FMT_IX, 0 },
- [GET_ANEXT] = { true, INSTR_FMT_IX, 0 },
- [GET_AWAITABLE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [SEND] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG },
- [SEND_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG },
- [INSTRUMENTED_YIELD_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
+ [INSTRUMENTED_RETURN_CONST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_CONST_FLAG | HAS_ERROR_FLAG },
+ [GET_AITER] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [GET_ANEXT] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [GET_AWAITABLE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [SEND] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_ERROR_FLAG },
+ [SEND_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [INSTRUMENTED_YIELD_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
[YIELD_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
[POP_EXCEPT] = { true, INSTR_FMT_IX, 0 },
- [RERAISE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [END_ASYNC_FOR] = { true, INSTR_FMT_IX, 0 },
- [CLEANUP_THROW] = { true, INSTR_FMT_IX, 0 },
+ [RERAISE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [END_ASYNC_FOR] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [CLEANUP_THROW] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
[LOAD_ASSERTION_ERROR] = { true, INSTR_FMT_IX, 0 },
- [LOAD_BUILD_CLASS] = { true, INSTR_FMT_IX, 0 },
- [STORE_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [DELETE_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [UNPACK_SEQUENCE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG },
- [UNPACK_SEQUENCE_TWO_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG },
- [UNPACK_SEQUENCE_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG },
- [UNPACK_SEQUENCE_LIST] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG },
- [UNPACK_EX] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [STORE_ATTR] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [DELETE_ATTR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [STORE_GLOBAL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [DELETE_GLOBAL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_LOCALS] = { true, INSTR_FMT_IX, 0 },
- [LOAD_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_FROM_DICT_OR_GLOBALS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_GLOBAL] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_GLOBAL_MODULE] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG },
- [LOAD_GLOBAL_BUILTIN] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG },
- [DELETE_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_LOCAL_FLAG },
- [MAKE_CELL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_FREE_FLAG },
- [DELETE_DEREF] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_FREE_FLAG },
- [LOAD_FROM_DICT_OR_DEREF] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_FREE_FLAG },
- [LOAD_DEREF] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_FREE_FLAG },
+ [LOAD_BUILD_CLASS] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [STORE_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [DELETE_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [UNPACK_SEQUENCE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [UNPACK_SEQUENCE_TWO_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [UNPACK_SEQUENCE_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [UNPACK_SEQUENCE_LIST] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [UNPACK_EX] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [STORE_ATTR] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [DELETE_ATTR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [STORE_GLOBAL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [DELETE_GLOBAL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [_LOAD_LOCALS] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [LOAD_LOCALS] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [_LOAD_FROM_DICT_OR_GLOBALS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [LOAD_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [LOAD_FROM_DICT_OR_GLOBALS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [LOAD_GLOBAL] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [_GUARD_GLOBALS_VERSION] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG },
+ [_GUARD_BUILTINS_VERSION] = { true, INSTR_FMT_IXC, HAS_DEOPT_FLAG },
+ [_LOAD_GLOBAL_MODULE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [_LOAD_GLOBAL_BUILTINS] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_GLOBAL_MODULE] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_GLOBAL_BUILTIN] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [DELETE_FAST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_LOCAL_FLAG | HAS_ERROR_FLAG },
+ [MAKE_CELL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_FREE_FLAG | HAS_ERROR_FLAG },
+ [DELETE_DEREF] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_FREE_FLAG | HAS_ERROR_FLAG },
+ [LOAD_FROM_DICT_OR_DEREF] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_FREE_FLAG | HAS_ERROR_FLAG },
+ [LOAD_DEREF] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_FREE_FLAG | HAS_ERROR_FLAG },
[STORE_DEREF] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_FREE_FLAG },
[COPY_FREE_VARS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [BUILD_STRING] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [BUILD_TUPLE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [BUILD_LIST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [LIST_EXTEND] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [SET_UPDATE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [BUILD_SET] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [BUILD_MAP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [SETUP_ANNOTATIONS] = { true, INSTR_FMT_IX, 0 },
- [BUILD_CONST_KEY_MAP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [DICT_UPDATE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [DICT_MERGE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [MAP_ADD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
+ [BUILD_STRING] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [BUILD_TUPLE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [BUILD_LIST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [LIST_EXTEND] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [SET_UPDATE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [BUILD_SET] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [BUILD_MAP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [SETUP_ANNOTATIONS] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [BUILD_CONST_KEY_MAP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [DICT_UPDATE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [DICT_MERGE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [MAP_ADD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
[INSTRUMENTED_LOAD_SUPER_ATTR] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
- [LOAD_SUPER_ATTR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_SUPER_METHOD] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_ZERO_SUPER_METHOD] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_ZERO_SUPER_ATTR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_SUPER_ATTR_ATTR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_SUPER_ATTR_METHOD] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_ATTR] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_METHOD] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
- [LOAD_ATTR_MODULE] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
- [LOAD_ATTR_WITH_HINT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [LOAD_ATTR_SLOT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
- [LOAD_ATTR_CLASS] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
- [LOAD_ATTR_PROPERTY] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
- [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [STORE_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IXC000, 0 },
- [STORE_ATTR_WITH_HINT] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [STORE_ATTR_SLOT] = { true, INSTR_FMT_IXC000, 0 },
- [COMPARE_OP] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG },
- [COMPARE_OP_FLOAT] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG },
- [COMPARE_OP_INT] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG },
- [COMPARE_OP_STR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG },
+ [LOAD_SUPER_ATTR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [LOAD_SUPER_METHOD] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [LOAD_ZERO_SUPER_METHOD] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [LOAD_ZERO_SUPER_ATTR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [LOAD_SUPER_ATTR_ATTR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [LOAD_SUPER_ATTR_METHOD] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [LOAD_ATTR] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [LOAD_METHOD] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [_GUARD_TYPE_VERSION] = { true, INSTR_FMT_IXC0, HAS_DEOPT_FLAG },
+ [_CHECK_MANAGED_OBJECT_HAS_VALUES] = { true, INSTR_FMT_IX, HAS_DEOPT_FLAG },
+ [_LOAD_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_ATTR_MODULE] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_ATTR_WITH_HINT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_ATTR_SLOT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_ATTR_CLASS] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_ATTR_PROPERTY] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_DEOPT_FLAG },
+ [STORE_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IXC000, HAS_DEOPT_FLAG },
+ [STORE_ATTR_WITH_HINT] = { true, INSTR_FMT_IBC000, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_DEOPT_FLAG },
+ [STORE_ATTR_SLOT] = { true, INSTR_FMT_IXC000, HAS_DEOPT_FLAG },
+ [COMPARE_OP] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [COMPARE_OP_FLOAT] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [COMPARE_OP_INT] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [COMPARE_OP_STR] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
[IS_OP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [CONTAINS_OP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [CHECK_EG_MATCH] = { true, INSTR_FMT_IX, 0 },
- [CHECK_EXC_MATCH] = { true, INSTR_FMT_IX, 0 },
- [IMPORT_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG },
- [IMPORT_FROM] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG },
+ [CONTAINS_OP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [CHECK_EG_MATCH] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [CHECK_EXC_MATCH] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [IMPORT_NAME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
+ [IMPORT_FROM] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NAME_FLAG | HAS_ERROR_FLAG },
[JUMP_FORWARD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
- [JUMP_BACKWARD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_EVAL_BREAK_FLAG },
+ [JUMP_BACKWARD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_EVAL_BREAK_FLAG | HAS_ERROR_FLAG },
[JUMP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[JUMP_NO_INTERRUPT] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
- [ENTER_EXECUTOR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_EVAL_BREAK_FLAG },
+ [ENTER_EXECUTOR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_EVAL_BREAK_FLAG | HAS_ERROR_FLAG },
[POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
+ [IS_NONE] = { true, INSTR_FMT_IX, 0 },
[POP_JUMP_IF_NONE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[JUMP_BACKWARD_NO_INTERRUPT] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
- [GET_LEN] = { true, INSTR_FMT_IX, 0 },
- [MATCH_CLASS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
+ [GET_LEN] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [MATCH_CLASS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
[MATCH_MAPPING] = { true, INSTR_FMT_IX, 0 },
[MATCH_SEQUENCE] = { true, INSTR_FMT_IX, 0 },
- [MATCH_KEYS] = { true, INSTR_FMT_IX, 0 },
- [GET_ITER] = { true, INSTR_FMT_IX, 0 },
- [GET_YIELD_FROM_ITER] = { true, INSTR_FMT_IX, 0 },
- [FOR_ITER] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG },
- [INSTRUMENTED_FOR_ITER] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [FOR_ITER_LIST] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG },
- [FOR_ITER_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG },
- [FOR_ITER_RANGE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG },
- [FOR_ITER_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG },
- [BEFORE_ASYNC_WITH] = { true, INSTR_FMT_IX, 0 },
- [BEFORE_WITH] = { true, INSTR_FMT_IX, 0 },
- [WITH_EXCEPT_START] = { true, INSTR_FMT_IX, 0 },
+ [MATCH_KEYS] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [GET_ITER] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [GET_YIELD_FROM_ITER] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [FOR_ITER] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_ERROR_FLAG },
+ [INSTRUMENTED_FOR_ITER] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [_ITER_CHECK_LIST] = { true, INSTR_FMT_IX, HAS_DEOPT_FLAG },
+ [_ITER_JUMP_LIST] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
+ [_IS_ITER_EXHAUSTED_LIST] = { true, INSTR_FMT_IX, 0 },
+ [_ITER_NEXT_LIST] = { true, INSTR_FMT_IX, 0 },
+ [FOR_ITER_LIST] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_DEOPT_FLAG },
+ [_ITER_CHECK_TUPLE] = { true, INSTR_FMT_IX, HAS_DEOPT_FLAG },
+ [_ITER_JUMP_TUPLE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
+ [_IS_ITER_EXHAUSTED_TUPLE] = { true, INSTR_FMT_IX, 0 },
+ [_ITER_NEXT_TUPLE] = { true, INSTR_FMT_IX, 0 },
+ [FOR_ITER_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_DEOPT_FLAG },
+ [_ITER_CHECK_RANGE] = { true, INSTR_FMT_IX, HAS_DEOPT_FLAG },
+ [_ITER_JUMP_RANGE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
+ [_IS_ITER_EXHAUSTED_RANGE] = { true, INSTR_FMT_IX, 0 },
+ [_ITER_NEXT_RANGE] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [FOR_ITER_RANGE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [FOR_ITER_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [BEFORE_ASYNC_WITH] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [BEFORE_WITH] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [WITH_EXCEPT_START] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
[SETUP_FINALLY] = { true, INSTR_FMT_IX, 0 },
[SETUP_CLEANUP] = { true, INSTR_FMT_IX, 0 },
[SETUP_WITH] = { true, INSTR_FMT_IX, 0 },
[POP_BLOCK] = { true, INSTR_FMT_IX, 0 },
[PUSH_EXC_INFO] = { true, INSTR_FMT_IX, 0 },
- [LOAD_ATTR_METHOD_WITH_VALUES] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
- [LOAD_ATTR_METHOD_NO_DICT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
- [LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
- [LOAD_ATTR_NONDESCRIPTOR_NO_DICT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
- [LOAD_ATTR_METHOD_LAZY_DICT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
+ [LOAD_ATTR_METHOD_WITH_VALUES] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_ATTR_METHOD_NO_DICT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_ATTR_NONDESCRIPTOR_NO_DICT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [LOAD_ATTR_METHOD_LAZY_DICT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
[KW_NAMES] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_CONST_FLAG },
- [INSTRUMENTED_CALL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [CALL] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [CALL_BOUND_METHOD_EXACT_ARGS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG },
- [CALL_PY_EXACT_ARGS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG },
- [CALL_PY_WITH_DEFAULTS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG },
- [CALL_NO_KW_TYPE_1] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG },
- [CALL_NO_KW_STR_1] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [CALL_NO_KW_TUPLE_1] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [CALL_NO_KW_ALLOC_AND_ENTER_INIT] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG },
- [EXIT_INIT_CHECK] = { true, INSTR_FMT_IX, 0 },
- [CALL_BUILTIN_CLASS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [CALL_NO_KW_BUILTIN_O] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [CALL_NO_KW_BUILTIN_FAST] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [CALL_BUILTIN_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [CALL_NO_KW_LEN] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG },
- [CALL_NO_KW_ISINSTANCE] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG },
- [CALL_NO_KW_LIST_APPEND] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG },
- [CALL_NO_KW_METHOD_DESCRIPTOR_O] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
+ [INSTRUMENTED_CALL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [CALL] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_ERROR_FLAG },
+ [_CHECK_CALL_BOUND_METHOD_EXACT_ARGS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [_INIT_CALL_BOUND_METHOD_EXACT_ARGS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
+ [_CHECK_PEP_523] = { true, INSTR_FMT_IX, HAS_DEOPT_FLAG },
+ [_CHECK_FUNCTION_EXACT_ARGS] = { true, INSTR_FMT_IBC0, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [_CHECK_STACK_SPACE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [_INIT_CALL_PY_EXACT_ARGS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
+ [_PUSH_FRAME] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [CALL_BOUND_METHOD_EXACT_ARGS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_PY_EXACT_ARGS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_PY_WITH_DEFAULTS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [CALL_NO_KW_TYPE_1] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_DEOPT_FLAG },
+ [CALL_NO_KW_STR_1] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_NO_KW_TUPLE_1] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_NO_KW_ALLOC_AND_ENTER_INIT] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [EXIT_INIT_CHECK] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [CALL_BUILTIN_CLASS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_NO_KW_BUILTIN_O] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_NO_KW_BUILTIN_FAST] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_BUILTIN_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_NO_KW_LEN] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_NO_KW_ISINSTANCE] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_NO_KW_LIST_APPEND] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_NO_KW_METHOD_DESCRIPTOR_O] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
+ [CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = { true, INSTR_FMT_IBC00, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_DEOPT_FLAG | HAS_ERROR_FLAG },
[INSTRUMENTED_CALL_FUNCTION_EX] = { true, INSTR_FMT_IX, 0 },
- [CALL_FUNCTION_EX] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
- [MAKE_FUNCTION] = { true, INSTR_FMT_IX, 0 },
+ [CALL_FUNCTION_EX] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_ERROR_FLAG },
+ [MAKE_FUNCTION] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
[SET_FUNCTION_ATTRIBUTE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [RETURN_GENERATOR] = { true, INSTR_FMT_IX, 0 },
- [BUILD_SLICE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [CONVERT_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [FORMAT_SIMPLE] = { true, INSTR_FMT_IX, 0 },
- [FORMAT_WITH_SPEC] = { true, INSTR_FMT_IX, 0 },
+ [RETURN_GENERATOR] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [BUILD_SLICE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [CONVERT_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG },
+ [FORMAT_SIMPLE] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
+ [FORMAT_WITH_SPEC] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
[COPY] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [BINARY_OP] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG },
+ [BINARY_OP] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_ERROR_FLAG },
[SWAP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
- [INSTRUMENTED_INSTRUCTION] = { true, INSTR_FMT_IX, 0 },
+ [INSTRUMENTED_INSTRUCTION] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG },
[INSTRUMENTED_JUMP_FORWARD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
[INSTRUMENTED_JUMP_BACKWARD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
[INSTRUMENTED_POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
@@ -1414,6 +1463,13 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[OPCODE_METADATA_SIZE] = {
[EXTENDED_ARG] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
[CACHE] = { true, INSTR_FMT_IX, 0 },
[RESERVED] = { true, INSTR_FMT_IX, 0 },
+ [_POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
+ [_POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
+ [JUMP_TO_TOP] = { true, INSTR_FMT_IX, HAS_EVAL_BREAK_FLAG },
+ [SAVE_IP] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
+ [SAVE_CURRENT_IP] = { true, INSTR_FMT_IX, 0 },
+ [EXIT_TRACE] = { true, INSTR_FMT_IX, 0 },
+ [INSERT] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
};
#endif // NEED_OPCODE_METADATA
@@ -1570,6 +1626,7 @@ const char * const _PyOpcode_uop_name[OPCODE_UOP_NAME_SIZE] = {
[_BINARY_OP_SUBTRACT_FLOAT] = "_BINARY_OP_SUBTRACT_FLOAT",
[_GUARD_BOTH_UNICODE] = "_GUARD_BOTH_UNICODE",
[_BINARY_OP_ADD_UNICODE] = "_BINARY_OP_ADD_UNICODE",
+ [_BINARY_OP_INPLACE_ADD_UNICODE] = "_BINARY_OP_INPLACE_ADD_UNICODE",
[_POP_FRAME] = "_POP_FRAME",
[_LOAD_LOCALS] = "_LOAD_LOCALS",
[_LOAD_FROM_DICT_OR_GLOBALS] = "_LOAD_FROM_DICT_OR_GLOBALS",
@@ -1582,12 +1639,15 @@ const char * const _PyOpcode_uop_name[OPCODE_UOP_NAME_SIZE] = {
[_LOAD_ATTR_INSTANCE_VALUE] = "_LOAD_ATTR_INSTANCE_VALUE",
[IS_NONE] = "IS_NONE",
[_ITER_CHECK_LIST] = "_ITER_CHECK_LIST",
+ [_ITER_JUMP_LIST] = "_ITER_JUMP_LIST",
[_IS_ITER_EXHAUSTED_LIST] = "_IS_ITER_EXHAUSTED_LIST",
[_ITER_NEXT_LIST] = "_ITER_NEXT_LIST",
[_ITER_CHECK_TUPLE] = "_ITER_CHECK_TUPLE",
+ [_ITER_JUMP_TUPLE] = "_ITER_JUMP_TUPLE",
[_IS_ITER_EXHAUSTED_TUPLE] = "_IS_ITER_EXHAUSTED_TUPLE",
[_ITER_NEXT_TUPLE] = "_ITER_NEXT_TUPLE",
[_ITER_CHECK_RANGE] = "_ITER_CHECK_RANGE",
+ [_ITER_JUMP_RANGE] = "_ITER_JUMP_RANGE",
[_IS_ITER_EXHAUSTED_RANGE] = "_IS_ITER_EXHAUSTED_RANGE",
[_ITER_NEXT_RANGE] = "_ITER_NEXT_RANGE",
[_CHECK_CALL_BOUND_METHOD_EXACT_ARGS] = "_CHECK_CALL_BOUND_METHOD_EXACT_ARGS",
diff --git a/Python/optimizer.c b/Python/optimizer.c
index bbc1259..c311a03 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -372,6 +372,32 @@ static PyTypeObject UOpExecutor_Type = {
.tp_as_sequence = &uop_as_sequence,
};
+static int
+move_stubs(
+ _PyUOpInstruction *trace,
+ int trace_length,
+ int stubs_start,
+ int stubs_end
+)
+{
+ memmove(trace + trace_length,
+ trace + stubs_start,
+ (stubs_end - stubs_start) * sizeof(_PyUOpInstruction));
+ // Patch up the jump targets
+ for (int i = 0; i < trace_length; i++) {
+ if (trace[i].opcode == _POP_JUMP_IF_FALSE ||
+ trace[i].opcode == _POP_JUMP_IF_TRUE)
+ {
+ int target = trace[i].oparg;
+ if (target >= stubs_start) {
+ target += trace_length - stubs_start;
+ trace[i].oparg = target;
+ }
+ }
+ }
+ return trace_length + stubs_end - stubs_start;
+}
+
#define TRACE_STACK_SIZE 5
static int
@@ -730,36 +756,31 @@ done:
if (trace_length > 3) {
ADD_TO_TRACE(EXIT_TRACE, 0, 0);
DPRINTF(1,
- "Created a trace for %s (%s:%d) at byte offset %d -- length %d\n",
+ "Created a trace for %s (%s:%d) at byte offset %d -- length %d+%d\n",
PyUnicode_AsUTF8(code->co_qualname),
PyUnicode_AsUTF8(code->co_filename),
code->co_firstlineno,
2 * INSTR_IP(initial_instr, code),
- trace_length);
- if (max_length < buffer_size && trace_length < max_length) {
- // Move the stubs back to be immediately after the main trace
- // (which ends at trace_length)
- DPRINTF(2,
- "Moving %d stub uops back by %d\n",
- buffer_size - max_length,
- max_length - trace_length);
- memmove(trace + trace_length,
- trace + max_length,
- (buffer_size - max_length) * sizeof(_PyUOpInstruction));
- // Patch up the jump targets
- for (int i = 0; i < trace_length; i++) {
- if (trace[i].opcode == _POP_JUMP_IF_FALSE ||
- trace[i].opcode == _POP_JUMP_IF_TRUE)
- {
- int target = trace[i].oparg;
- if (target >= max_length) {
- target += trace_length - max_length;
- trace[i].oparg = target;
- }
- }
+ trace_length,
+ buffer_size - max_length);
+ if (max_length < buffer_size) {
+ // There are stubs
+ if (trace_length < max_length) {
+ // There's a gap before the stubs
+ // Move the stubs back to be immediately after the main trace
+ // (which ends at trace_length)
+ DPRINTF(2,
+ "Moving %d stub uops back by %d\n",
+ buffer_size - max_length,
+ max_length - trace_length);
+ trace_length = move_stubs(trace, trace_length, max_length, buffer_size);
+ }
+ else {
+ assert(trace_length == max_length);
+ // There's no gap
+ trace_length = buffer_size;
}
}
- trace_length += buffer_size - max_length;
return trace_length;
}
else {
@@ -780,6 +801,76 @@ done:
}
static int
+remove_unneeded_uops(_PyUOpInstruction *trace, int trace_length)
+{
+ // Stage 1: Replace unneeded SAVE_IP uops with NOP.
+ // Note that we don't enter stubs, those SAVE_IPs are needed.
+ int last_save_ip = -1;
+ int last_instr = 0;
+ bool need_ip = true;
+ for (int pc = 0; pc < trace_length; pc++) {
+ int opcode = trace[pc].opcode;
+ if (opcode == SAVE_CURRENT_IP) {
+ // Special case: never remove preceding SAVE_IP
+ last_save_ip = -1;
+ }
+ else if (opcode == SAVE_IP) {
+ if (!need_ip && last_save_ip >= 0) {
+ trace[last_save_ip].opcode = NOP;
+ }
+ need_ip = false;
+ last_save_ip = pc;
+ }
+ else if (opcode == JUMP_TO_TOP || opcode == EXIT_TRACE) {
+ last_instr = pc + 1;
+ break;
+ }
+ else {
+ // If opcode has ERROR or DEOPT, set need_up to true
+ if (_PyOpcode_opcode_metadata[opcode].flags & (HAS_ERROR_FLAG | HAS_DEOPT_FLAG)) {
+ need_ip = true;
+ }
+ }
+ }
+ // Stage 2: Squash NOP opcodes (pre-existing or set above).
+ int dest = 0;
+ for (int pc = 0; pc < last_instr; pc++) {
+ int opcode = trace[pc].opcode;
+ if (opcode != NOP) {
+ if (pc != dest) {
+ trace[dest] = trace[pc];
+ }
+ dest++;
+ }
+ }
+ // Stage 3: Move the stubs back.
+ if (dest < last_instr) {
+ int new_trace_length = move_stubs(trace, dest, last_instr, trace_length);
+#ifdef Py_DEBUG
+ char *uop_debug = Py_GETENV("PYTHONUOPSDEBUG");
+ int lltrace = 0;
+ if (uop_debug != NULL && *uop_debug >= '0') {
+ lltrace = *uop_debug - '0'; // TODO: Parse an int and all that
+ }
+ if (lltrace >= 2) {
+ printf("Optimized trace (length %d+%d = %d, saved %d):\n",
+ dest, trace_length - last_instr, new_trace_length,
+ trace_length - new_trace_length);
+ for (int pc = 0; pc < new_trace_length; pc++) {
+ printf("%4d: (%s, %d, %" PRIu64 ")\n",
+ pc,
+ uop_name(trace[pc].opcode),
+ (trace[pc].oparg),
+ (uint64_t)(trace[pc].operand));
+ }
+ }
+#endif
+ trace_length = new_trace_length;
+ }
+ return trace_length;
+}
+
+static int
uop_optimize(
_PyOptimizerObject *self,
PyCodeObject *code,
@@ -798,6 +889,7 @@ uop_optimize(
if (uop_optimize != NULL && *uop_optimize > '0') {
trace_length = _Py_uop_analyze_and_optimize(code, trace, trace_length, curr_stackentries);
}
+ trace_length = remove_unneeded_uops(trace, trace_length);
_PyUOpExecutorObject *executor = PyObject_NewVar(_PyUOpExecutorObject, &UOpExecutor_Type, trace_length);
if (executor == NULL) {
return -1;
diff --git a/Tools/cases_generator/analysis.py b/Tools/cases_generator/analysis.py
index b3c3df1..7c7c908 100644
--- a/Tools/cases_generator/analysis.py
+++ b/Tools/cases_generator/analysis.py
@@ -381,7 +381,7 @@ class Analyzer:
# Make sure the targets have the same fmt
fmts = list(set([t.instr_fmt for t in targets]))
assert len(fmts) == 1
- ignored_flags = {'HAS_EVAL_BREAK_FLAG'}
+ ignored_flags = {"HAS_EVAL_BREAK_FLAG", "HAS_DEOPT_FLAG", "HAS_ERROR_FLAG"}
assert len({t.instr_flags.bitmap(ignore=ignored_flags) for t in targets}) == 1
return PseudoInstruction(pseudo.name, targets, fmts[0], targets[0].instr_flags)
diff --git a/Tools/cases_generator/flags.py b/Tools/cases_generator/flags.py
index 193e7ff..5241331 100644
--- a/Tools/cases_generator/flags.py
+++ b/Tools/cases_generator/flags.py
@@ -10,13 +10,15 @@ from typing import AbstractSet
class InstructionFlags:
"""Construct and manipulate instruction flags"""
- HAS_ARG_FLAG: bool
- HAS_CONST_FLAG: bool
- HAS_NAME_FLAG: bool
- HAS_JUMP_FLAG: bool
- HAS_FREE_FLAG: bool
- HAS_LOCAL_FLAG: bool
- HAS_EVAL_BREAK_FLAG: bool
+ HAS_ARG_FLAG: bool = False
+ HAS_CONST_FLAG: bool = False
+ HAS_NAME_FLAG: bool = False
+ HAS_JUMP_FLAG: bool = False
+ HAS_FREE_FLAG: bool = False
+ HAS_LOCAL_FLAG: bool = False
+ HAS_EVAL_BREAK_FLAG: bool = False
+ HAS_DEOPT_FLAG: bool = False
+ HAS_ERROR_FLAG: bool = False
def __post_init__(self) -> None:
self.bitmask = {name: (1 << i) for i, name in enumerate(self.names())}
@@ -40,11 +42,19 @@ class InstructionFlags:
)
and not has_free,
HAS_EVAL_BREAK_FLAG=variable_used(instr, "CHECK_EVAL_BREAKER"),
+ HAS_DEOPT_FLAG=variable_used(instr, "DEOPT_IF"),
+ HAS_ERROR_FLAG=(
+ variable_used(instr, "ERROR_IF")
+ or variable_used(instr, "error")
+ or variable_used(instr, "pop_1_error")
+ or variable_used(instr, "exception_unwind")
+ or variable_used(instr, "resume_with_error")
+ ),
)
@staticmethod
def newEmpty() -> "InstructionFlags":
- return InstructionFlags(False, False, False, False, False, False, False)
+ return InstructionFlags()
def add(self, other: "InstructionFlags") -> None:
for name, value in dataclasses.asdict(other).items():
diff --git a/Tools/cases_generator/generate_cases.py b/Tools/cases_generator/generate_cases.py
index f89572f..1335c0c 100644
--- a/Tools/cases_generator/generate_cases.py
+++ b/Tools/cases_generator/generate_cases.py
@@ -484,8 +484,7 @@ class Generator(Analyzer):
case OverriddenInstructionPlaceHolder():
continue
case parsing.InstDef():
- if thing.kind != "op":
- self.write_metadata_for_inst(self.instrs[thing.name])
+ self.write_metadata_for_inst(self.instrs[thing.name])
case parsing.Macro():
self.write_metadata_for_macro(self.macro_instrs[thing.name])
case parsing.Pseudo():
@@ -653,7 +652,7 @@ class Generator(Analyzer):
add("SAVE_IP")
for instr in self.instrs.values():
- if instr.kind == "op" and instr.is_viable_uop():
+ if instr.kind == "op":
add(instr.name)
def write_macro_expansions(