From 2a2bce6c37f299a34ba99e1eb0f9b5976b28f1cf Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Tue, 3 Feb 2026 11:58:37 +0000 Subject: [PATCH] Use recorded values to make optimizer more robust * Add three new symbol kinds * Do not smuggle code object in _PUSH_FRAME operand * Fix small bug in predicate analysis --- Include/internal/pycore_opcode_metadata.h | 22 +- Include/internal/pycore_optimizer.h | 14 + Include/internal/pycore_optimizer_types.h | 24 + Include/internal/pycore_uop_ids.h | 837 +++++++++++----------- Include/internal/pycore_uop_metadata.h | 25 +- Lib/test/test_capi/test_opt.py | 44 -- Modules/_testinternalcapi/test_cases.c.h | 139 ++-- Python/bytecodes.c | 52 +- Python/executor_cases.c.h | 40 +- Python/generated_cases.c.h | 139 ++-- Python/optimizer.c | 27 +- Python/optimizer_analysis.c | 31 +- Python/optimizer_bytecodes.c | 173 ++--- Python/optimizer_cases.c.h | 170 ++--- Python/optimizer_symbols.c | 398 +++++++++- Python/record_functions.c.h | 47 +- 16 files changed, 1266 insertions(+), 916 deletions(-) diff --git a/Include/internal/pycore_opcode_metadata.h b/Include/internal/pycore_opcode_metadata.h index db28839a860008..98d9c2b51a7834 100644 --- a/Include/internal/pycore_opcode_metadata.h +++ b/Include/internal/pycore_opcode_metadata.h @@ -1179,7 +1179,7 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[267] = { [FORMAT_SIMPLE] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ESCAPES_FLAG }, [FORMAT_WITH_SPEC] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ESCAPES_FLAG }, [FOR_ITER] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_ERROR_FLAG | HAS_ERROR_NO_POP_FLAG | HAS_ESCAPES_FLAG | HAS_UNPREDICTABLE_JUMP_FLAG }, - [FOR_ITER_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_SYNC_SP_FLAG | HAS_NEEDS_GUARD_IP_FLAG | HAS_RECORDS_VALUE_FLAG }, + [FOR_ITER_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_ESCAPES_FLAG | HAS_SYNC_SP_FLAG | HAS_NEEDS_GUARD_IP_FLAG | HAS_RECORDS_VALUE_FLAG }, [FOR_ITER_LIST] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_DEOPT_FLAG | HAS_EXIT_FLAG | HAS_ESCAPES_FLAG | HAS_UNPREDICTABLE_JUMP_FLAG }, [FOR_ITER_RANGE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_EXIT_FLAG | HAS_ERROR_FLAG | HAS_UNPREDICTABLE_JUMP_FLAG }, [FOR_ITER_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_EXIT_FLAG | HAS_UNPREDICTABLE_JUMP_FLAG }, @@ -1280,10 +1280,10 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[267] = { [RESERVED] = { true, INSTR_FMT_IX, 0 }, [RESUME] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG | HAS_ERROR_FLAG | HAS_ERROR_NO_POP_FLAG | HAS_ESCAPES_FLAG }, [RESUME_CHECK] = { true, INSTR_FMT_IX, HAS_DEOPT_FLAG }, - [RETURN_GENERATOR] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ESCAPES_FLAG | HAS_NEEDS_GUARD_IP_FLAG | HAS_RECORDS_VALUE_FLAG }, - [RETURN_VALUE] = { true, INSTR_FMT_IX, HAS_ESCAPES_FLAG | HAS_NEEDS_GUARD_IP_FLAG | HAS_RECORDS_VALUE_FLAG }, + [RETURN_GENERATOR] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ESCAPES_FLAG | HAS_NEEDS_GUARD_IP_FLAG }, + [RETURN_VALUE] = { true, INSTR_FMT_IX, HAS_ESCAPES_FLAG | HAS_NEEDS_GUARD_IP_FLAG }, [SEND] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_ERROR_FLAG | HAS_ESCAPES_FLAG | HAS_SYNC_SP_FLAG | HAS_UNPREDICTABLE_JUMP_FLAG | HAS_NEEDS_GUARD_IP_FLAG }, - [SEND_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_SYNC_SP_FLAG | HAS_NEEDS_GUARD_IP_FLAG }, + [SEND_GEN] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_ESCAPES_FLAG | HAS_SYNC_SP_FLAG | HAS_NEEDS_GUARD_IP_FLAG | HAS_RECORDS_VALUE_FLAG }, [SETUP_ANNOTATIONS] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ESCAPES_FLAG }, [SET_ADD] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_ERROR_FLAG | HAS_ESCAPES_FLAG }, [SET_FUNCTION_ATTRIBUTE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG }, @@ -1320,7 +1320,7 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[267] = { [UNPACK_SEQUENCE_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_EXIT_FLAG | HAS_ESCAPES_FLAG }, [UNPACK_SEQUENCE_TWO_TUPLE] = { true, INSTR_FMT_IBC, HAS_ARG_FLAG | HAS_DEOPT_FLAG | HAS_EXIT_FLAG | HAS_ESCAPES_FLAG }, [WITH_EXCEPT_START] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ESCAPES_FLAG }, - [YIELD_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NEEDS_GUARD_IP_FLAG | HAS_RECORDS_VALUE_FLAG }, + [YIELD_VALUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_NEEDS_GUARD_IP_FLAG }, [ANNOTATIONS_PLACEHOLDER] = { true, -1, HAS_PURE_FLAG }, [JUMP] = { true, -1, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_EVAL_BREAK_FLAG | HAS_ERROR_FLAG | HAS_ESCAPES_FLAG }, [JUMP_IF_FALSE] = { true, -1, HAS_ARG_FLAG | HAS_JUMP_FLAG | HAS_ERROR_FLAG | HAS_ESCAPES_FLAG }, @@ -1354,7 +1354,7 @@ _PyOpcode_macro_expansion[256] = { [BINARY_OP_MULTIPLY_FLOAT] = { .nuops = 5, .uops = { { _GUARD_TOS_FLOAT, OPARG_SIMPLE, 0 }, { _GUARD_NOS_FLOAT, OPARG_SIMPLE, 0 }, { _BINARY_OP_MULTIPLY_FLOAT, OPARG_SIMPLE, 5 }, { _POP_TOP_FLOAT, OPARG_SIMPLE, 5 }, { _POP_TOP_FLOAT, OPARG_SIMPLE, 5 } } }, [BINARY_OP_MULTIPLY_INT] = { .nuops = 5, .uops = { { _GUARD_TOS_INT, OPARG_SIMPLE, 0 }, { _GUARD_NOS_INT, OPARG_SIMPLE, 0 }, { _BINARY_OP_MULTIPLY_INT, OPARG_SIMPLE, 5 }, { _POP_TOP_INT, OPARG_SIMPLE, 5 }, { _POP_TOP_INT, OPARG_SIMPLE, 5 } } }, [BINARY_OP_SUBSCR_DICT] = { .nuops = 4, .uops = { { _GUARD_NOS_DICT, OPARG_SIMPLE, 0 }, { _BINARY_OP_SUBSCR_DICT, OPARG_SIMPLE, 5 }, { _POP_TOP, OPARG_SIMPLE, 5 }, { _POP_TOP, OPARG_SIMPLE, 5 } } }, - [BINARY_OP_SUBSCR_GETITEM] = { .nuops = 5, .uops = { { _RECORD_TOS, OPARG_SIMPLE, 0 }, { _CHECK_PEP_523, OPARG_SIMPLE, 5 }, { _BINARY_OP_SUBSCR_CHECK_FUNC, OPARG_SIMPLE, 5 }, { _BINARY_OP_SUBSCR_INIT_CALL, OPARG_SIMPLE, 5 }, { _PUSH_FRAME, OPARG_SIMPLE, 5 } } }, + [BINARY_OP_SUBSCR_GETITEM] = { .nuops = 5, .uops = { { _RECORD_NOS, OPARG_SIMPLE, 0 }, { _CHECK_PEP_523, OPARG_SIMPLE, 5 }, { _BINARY_OP_SUBSCR_CHECK_FUNC, OPARG_SIMPLE, 5 }, { _BINARY_OP_SUBSCR_INIT_CALL, OPARG_SIMPLE, 5 }, { _PUSH_FRAME, OPARG_SIMPLE, 5 } } }, [BINARY_OP_SUBSCR_LIST_INT] = { .nuops = 5, .uops = { { _GUARD_TOS_INT, OPARG_SIMPLE, 0 }, { _GUARD_NOS_LIST, OPARG_SIMPLE, 0 }, { _BINARY_OP_SUBSCR_LIST_INT, OPARG_SIMPLE, 5 }, { _POP_TOP_INT, OPARG_SIMPLE, 5 }, { _POP_TOP, OPARG_SIMPLE, 5 } } }, [BINARY_OP_SUBSCR_LIST_SLICE] = { .nuops = 3, .uops = { { _GUARD_TOS_SLICE, OPARG_SIMPLE, 0 }, { _GUARD_NOS_LIST, OPARG_SIMPLE, 0 }, { _BINARY_OP_SUBSCR_LIST_SLICE, OPARG_SIMPLE, 5 } } }, [BINARY_OP_SUBSCR_STR_INT] = { .nuops = 5, .uops = { { _GUARD_TOS_INT, OPARG_SIMPLE, 0 }, { _GUARD_NOS_COMPACT_ASCII, OPARG_SIMPLE, 0 }, { _BINARY_OP_SUBSCR_STR_INT, OPARG_SIMPLE, 5 }, { _POP_TOP_INT, OPARG_SIMPLE, 5 }, { _POP_TOP_UNICODE, OPARG_SIMPLE, 5 } } }, @@ -1424,7 +1424,7 @@ _PyOpcode_macro_expansion[256] = { [FORMAT_SIMPLE] = { .nuops = 1, .uops = { { _FORMAT_SIMPLE, OPARG_SIMPLE, 0 } } }, [FORMAT_WITH_SPEC] = { .nuops = 1, .uops = { { _FORMAT_WITH_SPEC, OPARG_SIMPLE, 0 } } }, [FOR_ITER] = { .nuops = 1, .uops = { { _FOR_ITER, OPARG_REPLACED, 0 } } }, - [FOR_ITER_GEN] = { .nuops = 4, .uops = { { _RECORD_NOS, OPARG_SIMPLE, 0 }, { _CHECK_PEP_523, OPARG_SIMPLE, 1 }, { _FOR_ITER_GEN_FRAME, OPARG_SIMPLE, 1 }, { _PUSH_FRAME, OPARG_SIMPLE, 1 } } }, + [FOR_ITER_GEN] = { .nuops = 4, .uops = { { _RECORD_NOS_GEN_FUNC, OPARG_SIMPLE, 0 }, { _CHECK_PEP_523, OPARG_SIMPLE, 1 }, { _FOR_ITER_GEN_FRAME, OPARG_SIMPLE, 1 }, { _PUSH_FRAME, OPARG_SIMPLE, 1 } } }, [FOR_ITER_LIST] = { .nuops = 3, .uops = { { _ITER_CHECK_LIST, OPARG_SIMPLE, 1 }, { _ITER_JUMP_LIST, OPARG_REPLACED, 1 }, { _ITER_NEXT_LIST, OPARG_REPLACED, 1 } } }, [FOR_ITER_RANGE] = { .nuops = 3, .uops = { { _ITER_CHECK_RANGE, OPARG_SIMPLE, 1 }, { _ITER_JUMP_RANGE, OPARG_REPLACED, 1 }, { _ITER_NEXT_RANGE, OPARG_SIMPLE, 1 } } }, [FOR_ITER_TUPLE] = { .nuops = 3, .uops = { { _ITER_CHECK_TUPLE, OPARG_SIMPLE, 1 }, { _ITER_JUMP_TUPLE, OPARG_REPLACED, 1 }, { _ITER_NEXT_TUPLE, OPARG_SIMPLE, 1 } } }, @@ -1494,9 +1494,9 @@ _PyOpcode_macro_expansion[256] = { [PUSH_EXC_INFO] = { .nuops = 1, .uops = { { _PUSH_EXC_INFO, OPARG_SIMPLE, 0 } } }, [PUSH_NULL] = { .nuops = 1, .uops = { { _PUSH_NULL, OPARG_SIMPLE, 0 } } }, [RESUME_CHECK] = { .nuops = 1, .uops = { { _RESUME_CHECK, OPARG_SIMPLE, 0 } } }, - [RETURN_GENERATOR] = { .nuops = 2, .uops = { { _RECORD_CALLER_CODE, OPARG_SIMPLE, 0 }, { _RETURN_GENERATOR, OPARG_SIMPLE, 0 } } }, - [RETURN_VALUE] = { .nuops = 2, .uops = { { _RECORD_CALLER_CODE, OPARG_SIMPLE, 0 }, { _RETURN_VALUE, OPARG_SIMPLE, 0 } } }, - [SEND_GEN] = { .nuops = 3, .uops = { { _CHECK_PEP_523, OPARG_SIMPLE, 1 }, { _SEND_GEN_FRAME, OPARG_SIMPLE, 1 }, { _PUSH_FRAME, OPARG_SIMPLE, 1 } } }, + [RETURN_GENERATOR] = { .nuops = 1, .uops = { { _RETURN_GENERATOR, OPARG_SIMPLE, 0 } } }, + [RETURN_VALUE] = { .nuops = 1, .uops = { { _RETURN_VALUE, OPARG_SIMPLE, 0 } } }, + [SEND_GEN] = { .nuops = 4, .uops = { { _RECORD_NOS_GEN_FUNC, OPARG_SIMPLE, 1 }, { _CHECK_PEP_523, OPARG_SIMPLE, 1 }, { _SEND_GEN_FRAME, OPARG_SIMPLE, 1 }, { _PUSH_FRAME, OPARG_SIMPLE, 1 } } }, [SETUP_ANNOTATIONS] = { .nuops = 1, .uops = { { _SETUP_ANNOTATIONS, OPARG_SIMPLE, 0 } } }, [SET_ADD] = { .nuops = 1, .uops = { { _SET_ADD, OPARG_SIMPLE, 0 } } }, [SET_FUNCTION_ATTRIBUTE] = { .nuops = 1, .uops = { { _SET_FUNCTION_ATTRIBUTE, OPARG_SIMPLE, 0 } } }, @@ -1532,7 +1532,7 @@ _PyOpcode_macro_expansion[256] = { [UNPACK_SEQUENCE_TUPLE] = { .nuops = 2, .uops = { { _GUARD_TOS_TUPLE, OPARG_SIMPLE, 0 }, { _UNPACK_SEQUENCE_TUPLE, OPARG_SIMPLE, 1 } } }, [UNPACK_SEQUENCE_TWO_TUPLE] = { .nuops = 2, .uops = { { _GUARD_TOS_TUPLE, OPARG_SIMPLE, 0 }, { _UNPACK_SEQUENCE_TWO_TUPLE, OPARG_SIMPLE, 1 } } }, [WITH_EXCEPT_START] = { .nuops = 1, .uops = { { _WITH_EXCEPT_START, OPARG_SIMPLE, 0 } } }, - [YIELD_VALUE] = { .nuops = 2, .uops = { { _RECORD_CALLER_CODE, OPARG_SIMPLE, 0 }, { _YIELD_VALUE, OPARG_SIMPLE, 0 } } }, + [YIELD_VALUE] = { .nuops = 1, .uops = { { _YIELD_VALUE, OPARG_SIMPLE, 0 } } }, }; #endif // NEED_OPCODE_METADATA diff --git a/Include/internal/pycore_optimizer.h b/Include/internal/pycore_optimizer.h index bb2028c59356b2..79a2d60eb788ea 100644 --- a/Include/internal/pycore_optimizer.h +++ b/Include/internal/pycore_optimizer.h @@ -298,6 +298,11 @@ extern JitOptRef _Py_uop_sym_new_compact_int(JitOptContext *ctx); extern void _Py_uop_sym_set_compact_int(JitOptContext *ctx, JitOptRef sym); extern JitOptRef _Py_uop_sym_new_predicate(JitOptContext *ctx, JitOptRef lhs_ref, JitOptRef rhs_ref, JitOptPredicateKind kind); extern void _Py_uop_sym_apply_predicate_narrowing(JitOptContext *ctx, JitOptRef sym, bool branch_is_true); +extern void _Py_uop_sym_set_recorded_value(JitOptContext *ctx, JitOptRef sym, PyObject *value); +extern void _Py_uop_sym_set_recorded_type(JitOptContext *ctx, JitOptRef sym, PyTypeObject *type); +extern void _Py_uop_sym_set_recorded_gen_func(JitOptContext *ctx, JitOptRef ref, PyFunctionObject *value); +extern PyCodeObject *_Py_uop_sym_get_probable_func_code(JitOptRef sym); +extern PyObject *_Py_uop_sym_get_probable_value(JitOptRef sym); extern void _Py_uop_abstractcontext_init(JitOptContext *ctx); extern void _Py_uop_abstractcontext_fini(JitOptContext *ctx); @@ -308,6 +313,14 @@ extern _Py_UOpsAbstractFrame *_Py_uop_frame_new( int curr_stackentries, JitOptRef *args, int arg_len); + +extern _Py_UOpsAbstractFrame *_Py_uop_frame_new_from_symbol( + JitOptContext *ctx, + JitOptRef callable, + int curr_stackentries, + JitOptRef *args, + int arg_len); + extern int _Py_uop_frame_pop(JitOptContext *ctx, PyCodeObject *co, int curr_stackentries); PyAPI_FUNC(PyObject *) _Py_uop_symbols_test(PyObject *self, PyObject *ignored); @@ -341,6 +354,7 @@ _PyJit_TryInitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame, int oparg, _PyExecutorObject *current_executor); PyAPI_FUNC(void) _PyJit_FinalizeTracing(PyThreadState *tstate, int err); +void _PyPrintExecutor(_PyExecutorObject *executor, const _PyUOpInstruction *marker); void _PyJit_TracerFree(_PyThreadStateImpl *_tstate); void _PyJit_Tracer_InvalidateDependency(PyThreadState *old_tstate, void *obj); diff --git a/Include/internal/pycore_optimizer_types.h b/Include/internal/pycore_optimizer_types.h index b4b93e8353812a..57c0c828c2aabd 100644 --- a/Include/internal/pycore_optimizer_types.h +++ b/Include/internal/pycore_optimizer_types.h @@ -41,6 +41,9 @@ typedef enum _JitSymType { JIT_SYM_TRUTHINESS_TAG = 9, JIT_SYM_COMPACT_INT = 10, JIT_SYM_PREDICATE_TAG = 11, + JIT_SYM_RECORDED_VALUE_TAG = 12, + JIT_SYM_RECORDED_TYPE_TAG = 13, + JIT_SYM_RECORDED_GEN_FUNC_TAG = 14, } JitSymType; typedef struct _jit_opt_known_class { @@ -87,6 +90,24 @@ typedef struct { uint16_t rhs; } JitOptPredicate; +typedef struct _jit_opt_recorded_value { + uint8_t tag; + bool known_type; + PyObject *value; +} JitOptRecordedValue; + +typedef struct _jit_opt_recorded_type { + uint8_t tag; + PyTypeObject *type; +} JitOptRecordedType; + +/* Represents a generator, but we record the + * function as the generator is emphemeral */ +typedef struct _jit_opt_recorded_gen_func { + uint8_t tag; + PyFunctionObject *func; +} JitOptRecordedGenFunc; + typedef struct { uint8_t tag; } JitOptCompactInt; @@ -100,6 +121,9 @@ typedef union _jit_opt_symbol { JitOptTruthiness truthiness; JitOptCompactInt compact; JitOptPredicate predicate; + JitOptRecordedValue recorded_value; + JitOptRecordedType recorded_type; + JitOptRecordedGenFunc recorded_gen_func; } JitOptSymbol; // This mimics the _PyStackRef API diff --git a/Include/internal/pycore_uop_ids.h b/Include/internal/pycore_uop_ids.h index 850ae446dc7aca..5738f82a52aa54 100644 --- a/Include/internal/pycore_uop_ids.h +++ b/Include/internal/pycore_uop_ids.h @@ -147,57 +147,58 @@ extern "C" { #define _GUARD_CALLABLE_STR_1 402 #define _GUARD_CALLABLE_TUPLE_1 403 #define _GUARD_CALLABLE_TYPE_1 404 -#define _GUARD_DORV_NO_DICT 405 -#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT 406 -#define _GUARD_GLOBALS_VERSION 407 -#define _GUARD_IP_RETURN_GENERATOR 408 -#define _GUARD_IP_RETURN_VALUE 409 -#define _GUARD_IP_YIELD_VALUE 410 -#define _GUARD_IP__PUSH_FRAME 411 -#define _GUARD_IS_FALSE_POP 412 -#define _GUARD_IS_NONE_POP 413 -#define _GUARD_IS_NOT_NONE_POP 414 -#define _GUARD_IS_TRUE_POP 415 -#define _GUARD_KEYS_VERSION 416 -#define _GUARD_NOS_COMPACT_ASCII 417 -#define _GUARD_NOS_DICT 418 -#define _GUARD_NOS_FLOAT 419 -#define _GUARD_NOS_INT 420 -#define _GUARD_NOS_LIST 421 -#define _GUARD_NOS_NOT_NULL 422 -#define _GUARD_NOS_NULL 423 -#define _GUARD_NOS_OVERFLOWED 424 -#define _GUARD_NOS_TUPLE 425 -#define _GUARD_NOS_UNICODE 426 -#define _GUARD_NOT_EXHAUSTED_LIST 427 -#define _GUARD_NOT_EXHAUSTED_RANGE 428 -#define _GUARD_NOT_EXHAUSTED_TUPLE 429 -#define _GUARD_THIRD_NULL 430 -#define _GUARD_TOS_ANY_SET 431 -#define _GUARD_TOS_DICT 432 -#define _GUARD_TOS_FLOAT 433 -#define _GUARD_TOS_INT 434 -#define _GUARD_TOS_LIST 435 -#define _GUARD_TOS_OVERFLOWED 436 -#define _GUARD_TOS_SLICE 437 -#define _GUARD_TOS_TUPLE 438 -#define _GUARD_TOS_UNICODE 439 -#define _GUARD_TYPE_VERSION 440 -#define _GUARD_TYPE_VERSION_AND_LOCK 441 -#define _HANDLE_PENDING_AND_DEOPT 442 +#define _GUARD_CODE 405 +#define _GUARD_DORV_NO_DICT 406 +#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT 407 +#define _GUARD_GLOBALS_VERSION 408 +#define _GUARD_IP_RETURN_GENERATOR 409 +#define _GUARD_IP_RETURN_VALUE 410 +#define _GUARD_IP_YIELD_VALUE 411 +#define _GUARD_IP__PUSH_FRAME 412 +#define _GUARD_IS_FALSE_POP 413 +#define _GUARD_IS_NONE_POP 414 +#define _GUARD_IS_NOT_NONE_POP 415 +#define _GUARD_IS_TRUE_POP 416 +#define _GUARD_KEYS_VERSION 417 +#define _GUARD_NOS_COMPACT_ASCII 418 +#define _GUARD_NOS_DICT 419 +#define _GUARD_NOS_FLOAT 420 +#define _GUARD_NOS_INT 421 +#define _GUARD_NOS_LIST 422 +#define _GUARD_NOS_NOT_NULL 423 +#define _GUARD_NOS_NULL 424 +#define _GUARD_NOS_OVERFLOWED 425 +#define _GUARD_NOS_TUPLE 426 +#define _GUARD_NOS_UNICODE 427 +#define _GUARD_NOT_EXHAUSTED_LIST 428 +#define _GUARD_NOT_EXHAUSTED_RANGE 429 +#define _GUARD_NOT_EXHAUSTED_TUPLE 430 +#define _GUARD_THIRD_NULL 431 +#define _GUARD_TOS_ANY_SET 432 +#define _GUARD_TOS_DICT 433 +#define _GUARD_TOS_FLOAT 434 +#define _GUARD_TOS_INT 435 +#define _GUARD_TOS_LIST 436 +#define _GUARD_TOS_OVERFLOWED 437 +#define _GUARD_TOS_SLICE 438 +#define _GUARD_TOS_TUPLE 439 +#define _GUARD_TOS_UNICODE 440 +#define _GUARD_TYPE_VERSION 441 +#define _GUARD_TYPE_VERSION_AND_LOCK 442 +#define _HANDLE_PENDING_AND_DEOPT 443 #define _IMPORT_FROM IMPORT_FROM #define _IMPORT_NAME IMPORT_NAME -#define _INIT_CALL_BOUND_METHOD_EXACT_ARGS 443 -#define _INIT_CALL_PY_EXACT_ARGS 444 -#define _INIT_CALL_PY_EXACT_ARGS_0 445 -#define _INIT_CALL_PY_EXACT_ARGS_1 446 -#define _INIT_CALL_PY_EXACT_ARGS_2 447 -#define _INIT_CALL_PY_EXACT_ARGS_3 448 -#define _INIT_CALL_PY_EXACT_ARGS_4 449 -#define _INSERT_1_LOAD_CONST_INLINE 450 -#define _INSERT_1_LOAD_CONST_INLINE_BORROW 451 -#define _INSERT_2_LOAD_CONST_INLINE_BORROW 452 -#define _INSERT_NULL 453 +#define _INIT_CALL_BOUND_METHOD_EXACT_ARGS 444 +#define _INIT_CALL_PY_EXACT_ARGS 445 +#define _INIT_CALL_PY_EXACT_ARGS_0 446 +#define _INIT_CALL_PY_EXACT_ARGS_1 447 +#define _INIT_CALL_PY_EXACT_ARGS_2 448 +#define _INIT_CALL_PY_EXACT_ARGS_3 449 +#define _INIT_CALL_PY_EXACT_ARGS_4 450 +#define _INSERT_1_LOAD_CONST_INLINE 451 +#define _INSERT_1_LOAD_CONST_INLINE_BORROW 452 +#define _INSERT_2_LOAD_CONST_INLINE_BORROW 453 +#define _INSERT_NULL 454 #define _INSTRUMENTED_FOR_ITER INSTRUMENTED_FOR_ITER #define _INSTRUMENTED_INSTRUCTION INSTRUMENTED_INSTRUCTION #define _INSTRUMENTED_JUMP_FORWARD INSTRUMENTED_JUMP_FORWARD @@ -207,133 +208,134 @@ extern "C" { #define _INSTRUMENTED_POP_JUMP_IF_NONE INSTRUMENTED_POP_JUMP_IF_NONE #define _INSTRUMENTED_POP_JUMP_IF_NOT_NONE INSTRUMENTED_POP_JUMP_IF_NOT_NONE #define _INSTRUMENTED_POP_JUMP_IF_TRUE INSTRUMENTED_POP_JUMP_IF_TRUE -#define _IS_NONE 454 -#define _IS_OP 455 -#define _ITER_CHECK_LIST 456 -#define _ITER_CHECK_RANGE 457 -#define _ITER_CHECK_TUPLE 458 -#define _ITER_JUMP_LIST 459 -#define _ITER_JUMP_RANGE 460 -#define _ITER_JUMP_TUPLE 461 -#define _ITER_NEXT_LIST 462 -#define _ITER_NEXT_LIST_TIER_TWO 463 -#define _ITER_NEXT_RANGE 464 -#define _ITER_NEXT_TUPLE 465 +#define _IS_NONE 455 +#define _IS_OP 456 +#define _ITER_CHECK_LIST 457 +#define _ITER_CHECK_RANGE 458 +#define _ITER_CHECK_TUPLE 459 +#define _ITER_JUMP_LIST 460 +#define _ITER_JUMP_RANGE 461 +#define _ITER_JUMP_TUPLE 462 +#define _ITER_NEXT_LIST 463 +#define _ITER_NEXT_LIST_TIER_TWO 464 +#define _ITER_NEXT_RANGE 465 +#define _ITER_NEXT_TUPLE 466 #define _JUMP_BACKWARD_NO_INTERRUPT JUMP_BACKWARD_NO_INTERRUPT -#define _JUMP_TO_TOP 466 +#define _JUMP_TO_TOP 467 #define _LIST_APPEND LIST_APPEND #define _LIST_EXTEND LIST_EXTEND -#define _LOAD_ATTR 467 -#define _LOAD_ATTR_CLASS 468 +#define _LOAD_ATTR 468 +#define _LOAD_ATTR_CLASS 469 #define _LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN -#define _LOAD_ATTR_INSTANCE_VALUE 469 -#define _LOAD_ATTR_METHOD_LAZY_DICT 470 -#define _LOAD_ATTR_METHOD_NO_DICT 471 -#define _LOAD_ATTR_METHOD_WITH_VALUES 472 -#define _LOAD_ATTR_MODULE 473 -#define _LOAD_ATTR_NONDESCRIPTOR_NO_DICT 474 -#define _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES 475 -#define _LOAD_ATTR_PROPERTY_FRAME 476 -#define _LOAD_ATTR_SLOT 477 -#define _LOAD_ATTR_WITH_HINT 478 +#define _LOAD_ATTR_INSTANCE_VALUE 470 +#define _LOAD_ATTR_METHOD_LAZY_DICT 471 +#define _LOAD_ATTR_METHOD_NO_DICT 472 +#define _LOAD_ATTR_METHOD_WITH_VALUES 473 +#define _LOAD_ATTR_MODULE 474 +#define _LOAD_ATTR_NONDESCRIPTOR_NO_DICT 475 +#define _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES 476 +#define _LOAD_ATTR_PROPERTY_FRAME 477 +#define _LOAD_ATTR_SLOT 478 +#define _LOAD_ATTR_WITH_HINT 479 #define _LOAD_BUILD_CLASS LOAD_BUILD_CLASS -#define _LOAD_BYTECODE 479 +#define _LOAD_BYTECODE 480 #define _LOAD_COMMON_CONSTANT LOAD_COMMON_CONSTANT #define _LOAD_CONST LOAD_CONST -#define _LOAD_CONST_INLINE 480 -#define _LOAD_CONST_INLINE_BORROW 481 -#define _LOAD_CONST_UNDER_INLINE 482 -#define _LOAD_CONST_UNDER_INLINE_BORROW 483 +#define _LOAD_CONST_INLINE 481 +#define _LOAD_CONST_INLINE_BORROW 482 +#define _LOAD_CONST_UNDER_INLINE 483 +#define _LOAD_CONST_UNDER_INLINE_BORROW 484 #define _LOAD_DEREF LOAD_DEREF -#define _LOAD_FAST 484 -#define _LOAD_FAST_0 485 -#define _LOAD_FAST_1 486 -#define _LOAD_FAST_2 487 -#define _LOAD_FAST_3 488 -#define _LOAD_FAST_4 489 -#define _LOAD_FAST_5 490 -#define _LOAD_FAST_6 491 -#define _LOAD_FAST_7 492 +#define _LOAD_FAST 485 +#define _LOAD_FAST_0 486 +#define _LOAD_FAST_1 487 +#define _LOAD_FAST_2 488 +#define _LOAD_FAST_3 489 +#define _LOAD_FAST_4 490 +#define _LOAD_FAST_5 491 +#define _LOAD_FAST_6 492 +#define _LOAD_FAST_7 493 #define _LOAD_FAST_AND_CLEAR LOAD_FAST_AND_CLEAR -#define _LOAD_FAST_BORROW 493 -#define _LOAD_FAST_BORROW_0 494 -#define _LOAD_FAST_BORROW_1 495 -#define _LOAD_FAST_BORROW_2 496 -#define _LOAD_FAST_BORROW_3 497 -#define _LOAD_FAST_BORROW_4 498 -#define _LOAD_FAST_BORROW_5 499 -#define _LOAD_FAST_BORROW_6 500 -#define _LOAD_FAST_BORROW_7 501 +#define _LOAD_FAST_BORROW 494 +#define _LOAD_FAST_BORROW_0 495 +#define _LOAD_FAST_BORROW_1 496 +#define _LOAD_FAST_BORROW_2 497 +#define _LOAD_FAST_BORROW_3 498 +#define _LOAD_FAST_BORROW_4 499 +#define _LOAD_FAST_BORROW_5 500 +#define _LOAD_FAST_BORROW_6 501 +#define _LOAD_FAST_BORROW_7 502 #define _LOAD_FAST_CHECK LOAD_FAST_CHECK #define _LOAD_FROM_DICT_OR_DEREF LOAD_FROM_DICT_OR_DEREF #define _LOAD_FROM_DICT_OR_GLOBALS LOAD_FROM_DICT_OR_GLOBALS -#define _LOAD_GLOBAL 502 -#define _LOAD_GLOBAL_BUILTINS 503 -#define _LOAD_GLOBAL_MODULE 504 +#define _LOAD_GLOBAL 503 +#define _LOAD_GLOBAL_BUILTINS 504 +#define _LOAD_GLOBAL_MODULE 505 #define _LOAD_LOCALS LOAD_LOCALS #define _LOAD_NAME LOAD_NAME -#define _LOAD_SMALL_INT 505 -#define _LOAD_SMALL_INT_0 506 -#define _LOAD_SMALL_INT_1 507 -#define _LOAD_SMALL_INT_2 508 -#define _LOAD_SMALL_INT_3 509 -#define _LOAD_SPECIAL 510 +#define _LOAD_SMALL_INT 506 +#define _LOAD_SMALL_INT_0 507 +#define _LOAD_SMALL_INT_1 508 +#define _LOAD_SMALL_INT_2 509 +#define _LOAD_SMALL_INT_3 510 +#define _LOAD_SPECIAL 511 #define _LOAD_SUPER_ATTR_ATTR LOAD_SUPER_ATTR_ATTR #define _LOAD_SUPER_ATTR_METHOD LOAD_SUPER_ATTR_METHOD -#define _MAKE_CALLARGS_A_TUPLE 511 +#define _MAKE_CALLARGS_A_TUPLE 512 #define _MAKE_CELL MAKE_CELL #define _MAKE_FUNCTION MAKE_FUNCTION -#define _MAKE_WARM 512 +#define _MAKE_WARM 513 #define _MAP_ADD MAP_ADD #define _MATCH_CLASS MATCH_CLASS #define _MATCH_KEYS MATCH_KEYS #define _MATCH_MAPPING MATCH_MAPPING #define _MATCH_SEQUENCE MATCH_SEQUENCE -#define _MAYBE_EXPAND_METHOD 513 -#define _MAYBE_EXPAND_METHOD_KW 514 -#define _MONITOR_CALL 515 -#define _MONITOR_CALL_KW 516 -#define _MONITOR_JUMP_BACKWARD 517 -#define _MONITOR_RESUME 518 +#define _MAYBE_EXPAND_METHOD 514 +#define _MAYBE_EXPAND_METHOD_KW 515 +#define _MONITOR_CALL 516 +#define _MONITOR_CALL_KW 517 +#define _MONITOR_JUMP_BACKWARD 518 +#define _MONITOR_RESUME 519 #define _NOP NOP -#define _POP_CALL 519 -#define _POP_CALL_LOAD_CONST_INLINE_BORROW 520 -#define _POP_CALL_ONE 521 -#define _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW 522 -#define _POP_CALL_TWO 523 -#define _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW 524 +#define _POP_CALL 520 +#define _POP_CALL_LOAD_CONST_INLINE_BORROW 521 +#define _POP_CALL_ONE 522 +#define _POP_CALL_ONE_LOAD_CONST_INLINE_BORROW 523 +#define _POP_CALL_TWO 524 +#define _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW 525 #define _POP_EXCEPT POP_EXCEPT #define _POP_ITER POP_ITER -#define _POP_JUMP_IF_FALSE 525 -#define _POP_JUMP_IF_TRUE 526 +#define _POP_JUMP_IF_FALSE 526 +#define _POP_JUMP_IF_TRUE 527 #define _POP_TOP POP_TOP -#define _POP_TOP_FLOAT 527 -#define _POP_TOP_INT 528 -#define _POP_TOP_LOAD_CONST_INLINE 529 -#define _POP_TOP_LOAD_CONST_INLINE_BORROW 530 -#define _POP_TOP_NOP 531 -#define _POP_TOP_UNICODE 532 -#define _POP_TWO 533 -#define _POP_TWO_LOAD_CONST_INLINE_BORROW 534 +#define _POP_TOP_FLOAT 528 +#define _POP_TOP_INT 529 +#define _POP_TOP_LOAD_CONST_INLINE 530 +#define _POP_TOP_LOAD_CONST_INLINE_BORROW 531 +#define _POP_TOP_NOP 532 +#define _POP_TOP_UNICODE 533 +#define _POP_TWO 534 +#define _POP_TWO_LOAD_CONST_INLINE_BORROW 535 #define _PUSH_EXC_INFO PUSH_EXC_INFO -#define _PUSH_FRAME 535 +#define _PUSH_FRAME 536 #define _PUSH_NULL PUSH_NULL -#define _PUSH_NULL_CONDITIONAL 536 -#define _PY_FRAME_EX 537 -#define _PY_FRAME_GENERAL 538 -#define _PY_FRAME_KW 539 -#define _QUICKEN_RESUME 540 -#define _RECORD_4OS 541 -#define _RECORD_BOUND_METHOD 542 -#define _RECORD_CALLABLE 543 -#define _RECORD_CALLER_CODE 544 -#define _RECORD_NOS 545 -#define _RECORD_TOS 546 -#define _RECORD_TOS_TYPE 547 -#define _REPLACE_WITH_TRUE 548 +#define _PUSH_NULL_CONDITIONAL 537 +#define _PY_FRAME_EX 538 +#define _PY_FRAME_GENERAL 539 +#define _PY_FRAME_KW 540 +#define _QUICKEN_RESUME 541 +#define _RECORD_4OS 542 +#define _RECORD_BOUND_METHOD 543 +#define _RECORD_CALLABLE 544 +#define _RECORD_CODE 545 +#define _RECORD_NOS 546 +#define _RECORD_NOS_GEN_FUNC 547 +#define _RECORD_TOS 548 +#define _RECORD_TOS_TYPE 549 +#define _REPLACE_WITH_TRUE 550 #define _RESUME_CHECK RESUME_CHECK -#define _RETURN_GENERATOR 549 -#define _RETURN_VALUE 550 +#define _RETURN_GENERATOR RETURN_GENERATOR +#define _RETURN_VALUE RETURN_VALUE #define _SAVE_RETURN_OFFSET 551 #define _SEND 552 #define _SEND_GEN_FRAME 553 @@ -385,277 +387,278 @@ extern "C" { #define _UNPACK_SEQUENCE_TUPLE 587 #define _UNPACK_SEQUENCE_TWO_TUPLE 588 #define _WITH_EXCEPT_START WITH_EXCEPT_START -#define _YIELD_VALUE 589 -#define MAX_UOP_ID 589 -#define _BINARY_OP_r23 590 -#define _BINARY_OP_ADD_FLOAT_r03 591 -#define _BINARY_OP_ADD_FLOAT_r13 592 -#define _BINARY_OP_ADD_FLOAT_r23 593 -#define _BINARY_OP_ADD_INT_r03 594 -#define _BINARY_OP_ADD_INT_r13 595 -#define _BINARY_OP_ADD_INT_r23 596 -#define _BINARY_OP_ADD_UNICODE_r03 597 -#define _BINARY_OP_ADD_UNICODE_r13 598 -#define _BINARY_OP_ADD_UNICODE_r23 599 -#define _BINARY_OP_EXTEND_r23 600 -#define _BINARY_OP_INPLACE_ADD_UNICODE_r21 601 -#define _BINARY_OP_MULTIPLY_FLOAT_r03 602 -#define _BINARY_OP_MULTIPLY_FLOAT_r13 603 -#define _BINARY_OP_MULTIPLY_FLOAT_r23 604 -#define _BINARY_OP_MULTIPLY_INT_r03 605 -#define _BINARY_OP_MULTIPLY_INT_r13 606 -#define _BINARY_OP_MULTIPLY_INT_r23 607 -#define _BINARY_OP_SUBSCR_CHECK_FUNC_r23 608 -#define _BINARY_OP_SUBSCR_DICT_r23 609 -#define _BINARY_OP_SUBSCR_INIT_CALL_r01 610 -#define _BINARY_OP_SUBSCR_INIT_CALL_r11 611 -#define _BINARY_OP_SUBSCR_INIT_CALL_r21 612 -#define _BINARY_OP_SUBSCR_INIT_CALL_r31 613 -#define _BINARY_OP_SUBSCR_LIST_INT_r23 614 -#define _BINARY_OP_SUBSCR_LIST_SLICE_r21 615 -#define _BINARY_OP_SUBSCR_STR_INT_r23 616 -#define _BINARY_OP_SUBSCR_TUPLE_INT_r03 617 -#define _BINARY_OP_SUBSCR_TUPLE_INT_r13 618 -#define _BINARY_OP_SUBSCR_TUPLE_INT_r23 619 -#define _BINARY_OP_SUBSCR_USTR_INT_r23 620 -#define _BINARY_OP_SUBTRACT_FLOAT_r03 621 -#define _BINARY_OP_SUBTRACT_FLOAT_r13 622 -#define _BINARY_OP_SUBTRACT_FLOAT_r23 623 -#define _BINARY_OP_SUBTRACT_INT_r03 624 -#define _BINARY_OP_SUBTRACT_INT_r13 625 -#define _BINARY_OP_SUBTRACT_INT_r23 626 -#define _BINARY_SLICE_r31 627 -#define _BUILD_INTERPOLATION_r01 628 -#define _BUILD_LIST_r01 629 -#define _BUILD_MAP_r01 630 -#define _BUILD_SET_r01 631 -#define _BUILD_SLICE_r01 632 -#define _BUILD_STRING_r01 633 -#define _BUILD_TEMPLATE_r21 634 -#define _BUILD_TUPLE_r01 635 -#define _CALL_BUILTIN_CLASS_r01 636 -#define _CALL_BUILTIN_FAST_r01 637 -#define _CALL_BUILTIN_FAST_WITH_KEYWORDS_r01 638 -#define _CALL_BUILTIN_O_r03 639 -#define _CALL_FUNCTION_EX_NON_PY_GENERAL_r31 640 -#define _CALL_INTRINSIC_1_r11 641 -#define _CALL_INTRINSIC_2_r21 642 -#define _CALL_ISINSTANCE_r31 643 -#define _CALL_KW_NON_PY_r11 644 -#define _CALL_LEN_r33 645 -#define _CALL_LIST_APPEND_r03 646 -#define _CALL_LIST_APPEND_r13 647 -#define _CALL_LIST_APPEND_r23 648 -#define _CALL_LIST_APPEND_r33 649 -#define _CALL_METHOD_DESCRIPTOR_FAST_r01 650 -#define _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_r01 651 -#define _CALL_METHOD_DESCRIPTOR_NOARGS_r01 652 -#define _CALL_METHOD_DESCRIPTOR_O_r03 653 -#define _CALL_NON_PY_GENERAL_r01 654 -#define _CALL_STR_1_r32 655 -#define _CALL_TUPLE_1_r32 656 -#define _CALL_TYPE_1_r02 657 -#define _CALL_TYPE_1_r12 658 -#define _CALL_TYPE_1_r22 659 -#define _CALL_TYPE_1_r32 660 -#define _CHECK_AND_ALLOCATE_OBJECT_r00 661 -#define _CHECK_ATTR_CLASS_r01 662 -#define _CHECK_ATTR_CLASS_r11 663 -#define _CHECK_ATTR_CLASS_r22 664 -#define _CHECK_ATTR_CLASS_r33 665 -#define _CHECK_ATTR_METHOD_LAZY_DICT_r01 666 -#define _CHECK_ATTR_METHOD_LAZY_DICT_r11 667 -#define _CHECK_ATTR_METHOD_LAZY_DICT_r22 668 -#define _CHECK_ATTR_METHOD_LAZY_DICT_r33 669 -#define _CHECK_CALL_BOUND_METHOD_EXACT_ARGS_r00 670 -#define _CHECK_EG_MATCH_r22 671 -#define _CHECK_EXC_MATCH_r22 672 -#define _CHECK_FUNCTION_EXACT_ARGS_r00 673 -#define _CHECK_FUNCTION_VERSION_r00 674 -#define _CHECK_FUNCTION_VERSION_INLINE_r00 675 -#define _CHECK_FUNCTION_VERSION_INLINE_r11 676 -#define _CHECK_FUNCTION_VERSION_INLINE_r22 677 -#define _CHECK_FUNCTION_VERSION_INLINE_r33 678 -#define _CHECK_FUNCTION_VERSION_KW_r11 679 -#define _CHECK_IS_NOT_PY_CALLABLE_r00 680 -#define _CHECK_IS_NOT_PY_CALLABLE_EX_r03 681 -#define _CHECK_IS_NOT_PY_CALLABLE_EX_r13 682 -#define _CHECK_IS_NOT_PY_CALLABLE_EX_r23 683 -#define _CHECK_IS_NOT_PY_CALLABLE_EX_r33 684 -#define _CHECK_IS_NOT_PY_CALLABLE_KW_r11 685 -#define _CHECK_IS_PY_CALLABLE_EX_r03 686 -#define _CHECK_IS_PY_CALLABLE_EX_r13 687 -#define _CHECK_IS_PY_CALLABLE_EX_r23 688 -#define _CHECK_IS_PY_CALLABLE_EX_r33 689 -#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r01 690 -#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r11 691 -#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r22 692 -#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r33 693 -#define _CHECK_METHOD_VERSION_r00 694 -#define _CHECK_METHOD_VERSION_KW_r11 695 -#define _CHECK_PEP_523_r00 696 -#define _CHECK_PEP_523_r11 697 -#define _CHECK_PEP_523_r22 698 -#define _CHECK_PEP_523_r33 699 -#define _CHECK_PERIODIC_r00 700 -#define _CHECK_PERIODIC_AT_END_r00 701 -#define _CHECK_PERIODIC_IF_NOT_YIELD_FROM_r00 702 -#define _CHECK_RECURSION_REMAINING_r00 703 -#define _CHECK_RECURSION_REMAINING_r11 704 -#define _CHECK_RECURSION_REMAINING_r22 705 -#define _CHECK_RECURSION_REMAINING_r33 706 -#define _CHECK_STACK_SPACE_r00 707 -#define _CHECK_STACK_SPACE_OPERAND_r00 708 -#define _CHECK_STACK_SPACE_OPERAND_r11 709 -#define _CHECK_STACK_SPACE_OPERAND_r22 710 -#define _CHECK_STACK_SPACE_OPERAND_r33 711 -#define _CHECK_VALIDITY_r00 712 -#define _CHECK_VALIDITY_r11 713 -#define _CHECK_VALIDITY_r22 714 -#define _CHECK_VALIDITY_r33 715 -#define _COLD_DYNAMIC_EXIT_r00 716 -#define _COLD_EXIT_r00 717 -#define _COMPARE_OP_r21 718 -#define _COMPARE_OP_FLOAT_r03 719 -#define _COMPARE_OP_FLOAT_r13 720 -#define _COMPARE_OP_FLOAT_r23 721 -#define _COMPARE_OP_INT_r23 722 -#define _COMPARE_OP_STR_r23 723 -#define _CONTAINS_OP_r23 724 -#define _CONTAINS_OP_DICT_r23 725 -#define _CONTAINS_OP_SET_r23 726 -#define _CONVERT_VALUE_r11 727 -#define _COPY_r01 728 -#define _COPY_1_r02 729 -#define _COPY_1_r12 730 -#define _COPY_1_r23 731 -#define _COPY_2_r03 732 -#define _COPY_2_r13 733 -#define _COPY_2_r23 734 -#define _COPY_3_r03 735 -#define _COPY_3_r13 736 -#define _COPY_3_r23 737 -#define _COPY_3_r33 738 -#define _COPY_FREE_VARS_r00 739 -#define _COPY_FREE_VARS_r11 740 -#define _COPY_FREE_VARS_r22 741 -#define _COPY_FREE_VARS_r33 742 -#define _CREATE_INIT_FRAME_r01 743 -#define _DELETE_ATTR_r10 744 -#define _DELETE_DEREF_r00 745 -#define _DELETE_FAST_r00 746 -#define _DELETE_GLOBAL_r00 747 -#define _DELETE_NAME_r00 748 -#define _DELETE_SUBSCR_r20 749 -#define _DEOPT_r00 750 -#define _DEOPT_r10 751 -#define _DEOPT_r20 752 -#define _DEOPT_r30 753 -#define _DICT_MERGE_r10 754 -#define _DICT_UPDATE_r10 755 -#define _DO_CALL_r01 756 -#define _DO_CALL_FUNCTION_EX_r31 757 -#define _DO_CALL_KW_r11 758 -#define _DYNAMIC_EXIT_r00 759 -#define _DYNAMIC_EXIT_r10 760 -#define _DYNAMIC_EXIT_r20 761 -#define _DYNAMIC_EXIT_r30 762 -#define _END_FOR_r10 763 -#define _END_SEND_r21 764 -#define _ERROR_POP_N_r00 765 -#define _EXIT_INIT_CHECK_r10 766 -#define _EXIT_TRACE_r00 767 -#define _EXIT_TRACE_r10 768 -#define _EXIT_TRACE_r20 769 -#define _EXIT_TRACE_r30 770 -#define _EXPAND_METHOD_r00 771 -#define _EXPAND_METHOD_KW_r11 772 -#define _FATAL_ERROR_r00 773 -#define _FATAL_ERROR_r11 774 -#define _FATAL_ERROR_r22 775 -#define _FATAL_ERROR_r33 776 -#define _FORMAT_SIMPLE_r11 777 -#define _FORMAT_WITH_SPEC_r21 778 -#define _FOR_ITER_r23 779 -#define _FOR_ITER_GEN_FRAME_r03 780 -#define _FOR_ITER_GEN_FRAME_r13 781 -#define _FOR_ITER_GEN_FRAME_r23 782 -#define _FOR_ITER_TIER_TWO_r23 783 -#define _GET_AITER_r11 784 -#define _GET_ANEXT_r12 785 -#define _GET_AWAITABLE_r11 786 -#define _GET_ITER_r12 787 -#define _GET_LEN_r12 788 -#define _GET_YIELD_FROM_ITER_r11 789 -#define _GUARD_BINARY_OP_EXTEND_r22 790 -#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r02 791 -#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r12 792 -#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r22 793 -#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r33 794 -#define _GUARD_BIT_IS_SET_POP_r00 795 -#define _GUARD_BIT_IS_SET_POP_r10 796 -#define _GUARD_BIT_IS_SET_POP_r21 797 -#define _GUARD_BIT_IS_SET_POP_r32 798 -#define _GUARD_BIT_IS_SET_POP_4_r00 799 -#define _GUARD_BIT_IS_SET_POP_4_r10 800 -#define _GUARD_BIT_IS_SET_POP_4_r21 801 -#define _GUARD_BIT_IS_SET_POP_4_r32 802 -#define _GUARD_BIT_IS_SET_POP_5_r00 803 -#define _GUARD_BIT_IS_SET_POP_5_r10 804 -#define _GUARD_BIT_IS_SET_POP_5_r21 805 -#define _GUARD_BIT_IS_SET_POP_5_r32 806 -#define _GUARD_BIT_IS_SET_POP_6_r00 807 -#define _GUARD_BIT_IS_SET_POP_6_r10 808 -#define _GUARD_BIT_IS_SET_POP_6_r21 809 -#define _GUARD_BIT_IS_SET_POP_6_r32 810 -#define _GUARD_BIT_IS_SET_POP_7_r00 811 -#define _GUARD_BIT_IS_SET_POP_7_r10 812 -#define _GUARD_BIT_IS_SET_POP_7_r21 813 -#define _GUARD_BIT_IS_SET_POP_7_r32 814 -#define _GUARD_BIT_IS_UNSET_POP_r00 815 -#define _GUARD_BIT_IS_UNSET_POP_r10 816 -#define _GUARD_BIT_IS_UNSET_POP_r21 817 -#define _GUARD_BIT_IS_UNSET_POP_r32 818 -#define _GUARD_BIT_IS_UNSET_POP_4_r00 819 -#define _GUARD_BIT_IS_UNSET_POP_4_r10 820 -#define _GUARD_BIT_IS_UNSET_POP_4_r21 821 -#define _GUARD_BIT_IS_UNSET_POP_4_r32 822 -#define _GUARD_BIT_IS_UNSET_POP_5_r00 823 -#define _GUARD_BIT_IS_UNSET_POP_5_r10 824 -#define _GUARD_BIT_IS_UNSET_POP_5_r21 825 -#define _GUARD_BIT_IS_UNSET_POP_5_r32 826 -#define _GUARD_BIT_IS_UNSET_POP_6_r00 827 -#define _GUARD_BIT_IS_UNSET_POP_6_r10 828 -#define _GUARD_BIT_IS_UNSET_POP_6_r21 829 -#define _GUARD_BIT_IS_UNSET_POP_6_r32 830 -#define _GUARD_BIT_IS_UNSET_POP_7_r00 831 -#define _GUARD_BIT_IS_UNSET_POP_7_r10 832 -#define _GUARD_BIT_IS_UNSET_POP_7_r21 833 -#define _GUARD_BIT_IS_UNSET_POP_7_r32 834 -#define _GUARD_CALLABLE_ISINSTANCE_r03 835 -#define _GUARD_CALLABLE_ISINSTANCE_r13 836 -#define _GUARD_CALLABLE_ISINSTANCE_r23 837 -#define _GUARD_CALLABLE_ISINSTANCE_r33 838 -#define _GUARD_CALLABLE_LEN_r03 839 -#define _GUARD_CALLABLE_LEN_r13 840 -#define _GUARD_CALLABLE_LEN_r23 841 -#define _GUARD_CALLABLE_LEN_r33 842 -#define _GUARD_CALLABLE_LIST_APPEND_r03 843 -#define _GUARD_CALLABLE_LIST_APPEND_r13 844 -#define _GUARD_CALLABLE_LIST_APPEND_r23 845 -#define _GUARD_CALLABLE_LIST_APPEND_r33 846 -#define _GUARD_CALLABLE_STR_1_r03 847 -#define _GUARD_CALLABLE_STR_1_r13 848 -#define _GUARD_CALLABLE_STR_1_r23 849 -#define _GUARD_CALLABLE_STR_1_r33 850 -#define _GUARD_CALLABLE_TUPLE_1_r03 851 -#define _GUARD_CALLABLE_TUPLE_1_r13 852 -#define _GUARD_CALLABLE_TUPLE_1_r23 853 -#define _GUARD_CALLABLE_TUPLE_1_r33 854 -#define _GUARD_CALLABLE_TYPE_1_r03 855 -#define _GUARD_CALLABLE_TYPE_1_r13 856 -#define _GUARD_CALLABLE_TYPE_1_r23 857 -#define _GUARD_CALLABLE_TYPE_1_r33 858 +#define _YIELD_VALUE YIELD_VALUE +#define MAX_UOP_ID 588 +#define _BINARY_OP_r23 589 +#define _BINARY_OP_ADD_FLOAT_r03 590 +#define _BINARY_OP_ADD_FLOAT_r13 591 +#define _BINARY_OP_ADD_FLOAT_r23 592 +#define _BINARY_OP_ADD_INT_r03 593 +#define _BINARY_OP_ADD_INT_r13 594 +#define _BINARY_OP_ADD_INT_r23 595 +#define _BINARY_OP_ADD_UNICODE_r03 596 +#define _BINARY_OP_ADD_UNICODE_r13 597 +#define _BINARY_OP_ADD_UNICODE_r23 598 +#define _BINARY_OP_EXTEND_r23 599 +#define _BINARY_OP_INPLACE_ADD_UNICODE_r21 600 +#define _BINARY_OP_MULTIPLY_FLOAT_r03 601 +#define _BINARY_OP_MULTIPLY_FLOAT_r13 602 +#define _BINARY_OP_MULTIPLY_FLOAT_r23 603 +#define _BINARY_OP_MULTIPLY_INT_r03 604 +#define _BINARY_OP_MULTIPLY_INT_r13 605 +#define _BINARY_OP_MULTIPLY_INT_r23 606 +#define _BINARY_OP_SUBSCR_CHECK_FUNC_r23 607 +#define _BINARY_OP_SUBSCR_DICT_r23 608 +#define _BINARY_OP_SUBSCR_INIT_CALL_r01 609 +#define _BINARY_OP_SUBSCR_INIT_CALL_r11 610 +#define _BINARY_OP_SUBSCR_INIT_CALL_r21 611 +#define _BINARY_OP_SUBSCR_INIT_CALL_r31 612 +#define _BINARY_OP_SUBSCR_LIST_INT_r23 613 +#define _BINARY_OP_SUBSCR_LIST_SLICE_r21 614 +#define _BINARY_OP_SUBSCR_STR_INT_r23 615 +#define _BINARY_OP_SUBSCR_TUPLE_INT_r03 616 +#define _BINARY_OP_SUBSCR_TUPLE_INT_r13 617 +#define _BINARY_OP_SUBSCR_TUPLE_INT_r23 618 +#define _BINARY_OP_SUBSCR_USTR_INT_r23 619 +#define _BINARY_OP_SUBTRACT_FLOAT_r03 620 +#define _BINARY_OP_SUBTRACT_FLOAT_r13 621 +#define _BINARY_OP_SUBTRACT_FLOAT_r23 622 +#define _BINARY_OP_SUBTRACT_INT_r03 623 +#define _BINARY_OP_SUBTRACT_INT_r13 624 +#define _BINARY_OP_SUBTRACT_INT_r23 625 +#define _BINARY_SLICE_r31 626 +#define _BUILD_INTERPOLATION_r01 627 +#define _BUILD_LIST_r01 628 +#define _BUILD_MAP_r01 629 +#define _BUILD_SET_r01 630 +#define _BUILD_SLICE_r01 631 +#define _BUILD_STRING_r01 632 +#define _BUILD_TEMPLATE_r21 633 +#define _BUILD_TUPLE_r01 634 +#define _CALL_BUILTIN_CLASS_r01 635 +#define _CALL_BUILTIN_FAST_r01 636 +#define _CALL_BUILTIN_FAST_WITH_KEYWORDS_r01 637 +#define _CALL_BUILTIN_O_r03 638 +#define _CALL_FUNCTION_EX_NON_PY_GENERAL_r31 639 +#define _CALL_INTRINSIC_1_r11 640 +#define _CALL_INTRINSIC_2_r21 641 +#define _CALL_ISINSTANCE_r31 642 +#define _CALL_KW_NON_PY_r11 643 +#define _CALL_LEN_r33 644 +#define _CALL_LIST_APPEND_r03 645 +#define _CALL_LIST_APPEND_r13 646 +#define _CALL_LIST_APPEND_r23 647 +#define _CALL_LIST_APPEND_r33 648 +#define _CALL_METHOD_DESCRIPTOR_FAST_r01 649 +#define _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_r01 650 +#define _CALL_METHOD_DESCRIPTOR_NOARGS_r01 651 +#define _CALL_METHOD_DESCRIPTOR_O_r03 652 +#define _CALL_NON_PY_GENERAL_r01 653 +#define _CALL_STR_1_r32 654 +#define _CALL_TUPLE_1_r32 655 +#define _CALL_TYPE_1_r02 656 +#define _CALL_TYPE_1_r12 657 +#define _CALL_TYPE_1_r22 658 +#define _CALL_TYPE_1_r32 659 +#define _CHECK_AND_ALLOCATE_OBJECT_r00 660 +#define _CHECK_ATTR_CLASS_r01 661 +#define _CHECK_ATTR_CLASS_r11 662 +#define _CHECK_ATTR_CLASS_r22 663 +#define _CHECK_ATTR_CLASS_r33 664 +#define _CHECK_ATTR_METHOD_LAZY_DICT_r01 665 +#define _CHECK_ATTR_METHOD_LAZY_DICT_r11 666 +#define _CHECK_ATTR_METHOD_LAZY_DICT_r22 667 +#define _CHECK_ATTR_METHOD_LAZY_DICT_r33 668 +#define _CHECK_CALL_BOUND_METHOD_EXACT_ARGS_r00 669 +#define _CHECK_EG_MATCH_r22 670 +#define _CHECK_EXC_MATCH_r22 671 +#define _CHECK_FUNCTION_EXACT_ARGS_r00 672 +#define _CHECK_FUNCTION_VERSION_r00 673 +#define _CHECK_FUNCTION_VERSION_INLINE_r00 674 +#define _CHECK_FUNCTION_VERSION_INLINE_r11 675 +#define _CHECK_FUNCTION_VERSION_INLINE_r22 676 +#define _CHECK_FUNCTION_VERSION_INLINE_r33 677 +#define _CHECK_FUNCTION_VERSION_KW_r11 678 +#define _CHECK_IS_NOT_PY_CALLABLE_r00 679 +#define _CHECK_IS_NOT_PY_CALLABLE_EX_r03 680 +#define _CHECK_IS_NOT_PY_CALLABLE_EX_r13 681 +#define _CHECK_IS_NOT_PY_CALLABLE_EX_r23 682 +#define _CHECK_IS_NOT_PY_CALLABLE_EX_r33 683 +#define _CHECK_IS_NOT_PY_CALLABLE_KW_r11 684 +#define _CHECK_IS_PY_CALLABLE_EX_r03 685 +#define _CHECK_IS_PY_CALLABLE_EX_r13 686 +#define _CHECK_IS_PY_CALLABLE_EX_r23 687 +#define _CHECK_IS_PY_CALLABLE_EX_r33 688 +#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r01 689 +#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r11 690 +#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r22 691 +#define _CHECK_MANAGED_OBJECT_HAS_VALUES_r33 692 +#define _CHECK_METHOD_VERSION_r00 693 +#define _CHECK_METHOD_VERSION_KW_r11 694 +#define _CHECK_PEP_523_r00 695 +#define _CHECK_PEP_523_r11 696 +#define _CHECK_PEP_523_r22 697 +#define _CHECK_PEP_523_r33 698 +#define _CHECK_PERIODIC_r00 699 +#define _CHECK_PERIODIC_AT_END_r00 700 +#define _CHECK_PERIODIC_IF_NOT_YIELD_FROM_r00 701 +#define _CHECK_RECURSION_REMAINING_r00 702 +#define _CHECK_RECURSION_REMAINING_r11 703 +#define _CHECK_RECURSION_REMAINING_r22 704 +#define _CHECK_RECURSION_REMAINING_r33 705 +#define _CHECK_STACK_SPACE_r00 706 +#define _CHECK_STACK_SPACE_OPERAND_r00 707 +#define _CHECK_STACK_SPACE_OPERAND_r11 708 +#define _CHECK_STACK_SPACE_OPERAND_r22 709 +#define _CHECK_STACK_SPACE_OPERAND_r33 710 +#define _CHECK_VALIDITY_r00 711 +#define _CHECK_VALIDITY_r11 712 +#define _CHECK_VALIDITY_r22 713 +#define _CHECK_VALIDITY_r33 714 +#define _COLD_DYNAMIC_EXIT_r00 715 +#define _COLD_EXIT_r00 716 +#define _COMPARE_OP_r21 717 +#define _COMPARE_OP_FLOAT_r03 718 +#define _COMPARE_OP_FLOAT_r13 719 +#define _COMPARE_OP_FLOAT_r23 720 +#define _COMPARE_OP_INT_r23 721 +#define _COMPARE_OP_STR_r23 722 +#define _CONTAINS_OP_r23 723 +#define _CONTAINS_OP_DICT_r23 724 +#define _CONTAINS_OP_SET_r23 725 +#define _CONVERT_VALUE_r11 726 +#define _COPY_r01 727 +#define _COPY_1_r02 728 +#define _COPY_1_r12 729 +#define _COPY_1_r23 730 +#define _COPY_2_r03 731 +#define _COPY_2_r13 732 +#define _COPY_2_r23 733 +#define _COPY_3_r03 734 +#define _COPY_3_r13 735 +#define _COPY_3_r23 736 +#define _COPY_3_r33 737 +#define _COPY_FREE_VARS_r00 738 +#define _COPY_FREE_VARS_r11 739 +#define _COPY_FREE_VARS_r22 740 +#define _COPY_FREE_VARS_r33 741 +#define _CREATE_INIT_FRAME_r01 742 +#define _DELETE_ATTR_r10 743 +#define _DELETE_DEREF_r00 744 +#define _DELETE_FAST_r00 745 +#define _DELETE_GLOBAL_r00 746 +#define _DELETE_NAME_r00 747 +#define _DELETE_SUBSCR_r20 748 +#define _DEOPT_r00 749 +#define _DEOPT_r10 750 +#define _DEOPT_r20 751 +#define _DEOPT_r30 752 +#define _DICT_MERGE_r10 753 +#define _DICT_UPDATE_r10 754 +#define _DO_CALL_r01 755 +#define _DO_CALL_FUNCTION_EX_r31 756 +#define _DO_CALL_KW_r11 757 +#define _DYNAMIC_EXIT_r00 758 +#define _DYNAMIC_EXIT_r10 759 +#define _DYNAMIC_EXIT_r20 760 +#define _DYNAMIC_EXIT_r30 761 +#define _END_FOR_r10 762 +#define _END_SEND_r21 763 +#define _ERROR_POP_N_r00 764 +#define _EXIT_INIT_CHECK_r10 765 +#define _EXIT_TRACE_r00 766 +#define _EXIT_TRACE_r10 767 +#define _EXIT_TRACE_r20 768 +#define _EXIT_TRACE_r30 769 +#define _EXPAND_METHOD_r00 770 +#define _EXPAND_METHOD_KW_r11 771 +#define _FATAL_ERROR_r00 772 +#define _FATAL_ERROR_r11 773 +#define _FATAL_ERROR_r22 774 +#define _FATAL_ERROR_r33 775 +#define _FORMAT_SIMPLE_r11 776 +#define _FORMAT_WITH_SPEC_r21 777 +#define _FOR_ITER_r23 778 +#define _FOR_ITER_GEN_FRAME_r03 779 +#define _FOR_ITER_GEN_FRAME_r13 780 +#define _FOR_ITER_GEN_FRAME_r23 781 +#define _FOR_ITER_TIER_TWO_r23 782 +#define _GET_AITER_r11 783 +#define _GET_ANEXT_r12 784 +#define _GET_AWAITABLE_r11 785 +#define _GET_ITER_r12 786 +#define _GET_LEN_r12 787 +#define _GET_YIELD_FROM_ITER_r11 788 +#define _GUARD_BINARY_OP_EXTEND_r22 789 +#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r02 790 +#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r12 791 +#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r22 792 +#define _GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS_r33 793 +#define _GUARD_BIT_IS_SET_POP_r00 794 +#define _GUARD_BIT_IS_SET_POP_r10 795 +#define _GUARD_BIT_IS_SET_POP_r21 796 +#define _GUARD_BIT_IS_SET_POP_r32 797 +#define _GUARD_BIT_IS_SET_POP_4_r00 798 +#define _GUARD_BIT_IS_SET_POP_4_r10 799 +#define _GUARD_BIT_IS_SET_POP_4_r21 800 +#define _GUARD_BIT_IS_SET_POP_4_r32 801 +#define _GUARD_BIT_IS_SET_POP_5_r00 802 +#define _GUARD_BIT_IS_SET_POP_5_r10 803 +#define _GUARD_BIT_IS_SET_POP_5_r21 804 +#define _GUARD_BIT_IS_SET_POP_5_r32 805 +#define _GUARD_BIT_IS_SET_POP_6_r00 806 +#define _GUARD_BIT_IS_SET_POP_6_r10 807 +#define _GUARD_BIT_IS_SET_POP_6_r21 808 +#define _GUARD_BIT_IS_SET_POP_6_r32 809 +#define _GUARD_BIT_IS_SET_POP_7_r00 810 +#define _GUARD_BIT_IS_SET_POP_7_r10 811 +#define _GUARD_BIT_IS_SET_POP_7_r21 812 +#define _GUARD_BIT_IS_SET_POP_7_r32 813 +#define _GUARD_BIT_IS_UNSET_POP_r00 814 +#define _GUARD_BIT_IS_UNSET_POP_r10 815 +#define _GUARD_BIT_IS_UNSET_POP_r21 816 +#define _GUARD_BIT_IS_UNSET_POP_r32 817 +#define _GUARD_BIT_IS_UNSET_POP_4_r00 818 +#define _GUARD_BIT_IS_UNSET_POP_4_r10 819 +#define _GUARD_BIT_IS_UNSET_POP_4_r21 820 +#define _GUARD_BIT_IS_UNSET_POP_4_r32 821 +#define _GUARD_BIT_IS_UNSET_POP_5_r00 822 +#define _GUARD_BIT_IS_UNSET_POP_5_r10 823 +#define _GUARD_BIT_IS_UNSET_POP_5_r21 824 +#define _GUARD_BIT_IS_UNSET_POP_5_r32 825 +#define _GUARD_BIT_IS_UNSET_POP_6_r00 826 +#define _GUARD_BIT_IS_UNSET_POP_6_r10 827 +#define _GUARD_BIT_IS_UNSET_POP_6_r21 828 +#define _GUARD_BIT_IS_UNSET_POP_6_r32 829 +#define _GUARD_BIT_IS_UNSET_POP_7_r00 830 +#define _GUARD_BIT_IS_UNSET_POP_7_r10 831 +#define _GUARD_BIT_IS_UNSET_POP_7_r21 832 +#define _GUARD_BIT_IS_UNSET_POP_7_r32 833 +#define _GUARD_CALLABLE_ISINSTANCE_r03 834 +#define _GUARD_CALLABLE_ISINSTANCE_r13 835 +#define _GUARD_CALLABLE_ISINSTANCE_r23 836 +#define _GUARD_CALLABLE_ISINSTANCE_r33 837 +#define _GUARD_CALLABLE_LEN_r03 838 +#define _GUARD_CALLABLE_LEN_r13 839 +#define _GUARD_CALLABLE_LEN_r23 840 +#define _GUARD_CALLABLE_LEN_r33 841 +#define _GUARD_CALLABLE_LIST_APPEND_r03 842 +#define _GUARD_CALLABLE_LIST_APPEND_r13 843 +#define _GUARD_CALLABLE_LIST_APPEND_r23 844 +#define _GUARD_CALLABLE_LIST_APPEND_r33 845 +#define _GUARD_CALLABLE_STR_1_r03 846 +#define _GUARD_CALLABLE_STR_1_r13 847 +#define _GUARD_CALLABLE_STR_1_r23 848 +#define _GUARD_CALLABLE_STR_1_r33 849 +#define _GUARD_CALLABLE_TUPLE_1_r03 850 +#define _GUARD_CALLABLE_TUPLE_1_r13 851 +#define _GUARD_CALLABLE_TUPLE_1_r23 852 +#define _GUARD_CALLABLE_TUPLE_1_r33 853 +#define _GUARD_CALLABLE_TYPE_1_r03 854 +#define _GUARD_CALLABLE_TYPE_1_r13 855 +#define _GUARD_CALLABLE_TYPE_1_r23 856 +#define _GUARD_CALLABLE_TYPE_1_r33 857 +#define _GUARD_CODE_r00 858 #define _GUARD_DORV_NO_DICT_r01 859 #define _GUARD_DORV_NO_DICT_r11 860 #define _GUARD_DORV_NO_DICT_r22 861 diff --git a/Include/internal/pycore_uop_metadata.h b/Include/internal/pycore_uop_metadata.h index 85f2948ece4b4d..a6fb977d6046f0 100644 --- a/Include/internal/pycore_uop_metadata.h +++ b/Include/internal/pycore_uop_metadata.h @@ -370,6 +370,7 @@ const uint32_t _PyUop_Flags[MAX_UOP_ID+1] = { [_TIER2_RESUME_CHECK] = HAS_PERIODIC_FLAG, [_COLD_EXIT] = HAS_SYNC_SP_FLAG, [_COLD_DYNAMIC_EXIT] = HAS_SYNC_SP_FLAG, + [_GUARD_CODE] = HAS_EXIT_FLAG | HAS_ESCAPES_FLAG, [_GUARD_IP__PUSH_FRAME] = HAS_EXIT_FLAG, [_GUARD_IP_YIELD_VALUE] = HAS_EXIT_FLAG, [_GUARD_IP_RETURN_VALUE] = HAS_EXIT_FLAG, @@ -377,10 +378,11 @@ const uint32_t _PyUop_Flags[MAX_UOP_ID+1] = { [_RECORD_TOS] = HAS_RECORDS_VALUE_FLAG, [_RECORD_TOS_TYPE] = HAS_RECORDS_VALUE_FLAG, [_RECORD_NOS] = HAS_RECORDS_VALUE_FLAG, + [_RECORD_NOS_GEN_FUNC] = HAS_ESCAPES_FLAG | HAS_RECORDS_VALUE_FLAG, [_RECORD_4OS] = HAS_RECORDS_VALUE_FLAG, [_RECORD_CALLABLE] = HAS_ARG_FLAG | HAS_RECORDS_VALUE_FLAG, [_RECORD_BOUND_METHOD] = HAS_ARG_FLAG | HAS_RECORDS_VALUE_FLAG, - [_RECORD_CALLER_CODE] = HAS_RECORDS_VALUE_FLAG, + [_RECORD_CODE] = HAS_RECORDS_VALUE_FLAG, }; const ReplicationRange _PyUop_Replication[MAX_UOP_ID+1] = { @@ -3402,6 +3404,15 @@ const _PyUopCachingInfo _PyUop_Caching[MAX_UOP_ID+1] = { { -1, -1, -1 }, }, }, + [_GUARD_CODE] = { + .best = { 0, 0, 0, 0 }, + .entries = { + { 0, 0, _GUARD_CODE_r00 }, + { -1, -1, -1 }, + { -1, -1, -1 }, + { -1, -1, -1 }, + }, + }, [_GUARD_IP__PUSH_FRAME] = { .best = { 0, 1, 2, 3 }, .entries = { @@ -4210,6 +4221,7 @@ const uint16_t _PyUop_Uncached[MAX_UOP_REGS_ID+1] = { [_TIER2_RESUME_CHECK_r33] = _TIER2_RESUME_CHECK, [_COLD_EXIT_r00] = _COLD_EXIT, [_COLD_DYNAMIC_EXIT_r00] = _COLD_DYNAMIC_EXIT, + [_GUARD_CODE_r00] = _GUARD_CODE, [_GUARD_IP__PUSH_FRAME_r00] = _GUARD_IP__PUSH_FRAME, [_GUARD_IP__PUSH_FRAME_r11] = _GUARD_IP__PUSH_FRAME, [_GUARD_IP__PUSH_FRAME_r22] = _GUARD_IP__PUSH_FRAME, @@ -4640,6 +4652,8 @@ const char *const _PyOpcode_uop_name[MAX_UOP_REGS_ID+1] = { [_GUARD_CALLABLE_TYPE_1_r13] = "_GUARD_CALLABLE_TYPE_1_r13", [_GUARD_CALLABLE_TYPE_1_r23] = "_GUARD_CALLABLE_TYPE_1_r23", [_GUARD_CALLABLE_TYPE_1_r33] = "_GUARD_CALLABLE_TYPE_1_r33", + [_GUARD_CODE] = "_GUARD_CODE", + [_GUARD_CODE_r00] = "_GUARD_CODE_r00", [_GUARD_DORV_NO_DICT] = "_GUARD_DORV_NO_DICT", [_GUARD_DORV_NO_DICT_r01] = "_GUARD_DORV_NO_DICT_r01", [_GUARD_DORV_NO_DICT_r11] = "_GUARD_DORV_NO_DICT_r11", @@ -5179,8 +5193,9 @@ const char *const _PyOpcode_uop_name[MAX_UOP_REGS_ID+1] = { [_RECORD_4OS] = "_RECORD_4OS", [_RECORD_BOUND_METHOD] = "_RECORD_BOUND_METHOD", [_RECORD_CALLABLE] = "_RECORD_CALLABLE", - [_RECORD_CALLER_CODE] = "_RECORD_CALLER_CODE", + [_RECORD_CODE] = "_RECORD_CODE", [_RECORD_NOS] = "_RECORD_NOS", + [_RECORD_NOS_GEN_FUNC] = "_RECORD_NOS_GEN_FUNC", [_RECORD_TOS] = "_RECORD_TOS", [_RECORD_TOS_TYPE] = "_RECORD_TOS_TYPE", [_REPLACE_WITH_TRUE] = "_REPLACE_WITH_TRUE", @@ -6049,6 +6064,8 @@ int _PyUop_num_popped(int opcode, int oparg) return 0; case _COLD_DYNAMIC_EXIT: return 0; + case _GUARD_CODE: + return 0; case _GUARD_IP__PUSH_FRAME: return 0; case _GUARD_IP_YIELD_VALUE: @@ -6063,13 +6080,15 @@ int _PyUop_num_popped(int opcode, int oparg) return 0; case _RECORD_NOS: return 0; + case _RECORD_NOS_GEN_FUNC: + return 0; case _RECORD_4OS: return 0; case _RECORD_CALLABLE: return 0; case _RECORD_BOUND_METHOD: return 0; - case _RECORD_CALLER_CODE: + case _RECORD_CODE: return 0; default: return -1; diff --git a/Lib/test/test_capi/test_opt.py b/Lib/test/test_capi/test_opt.py index 437cc340fc90e3..43b268b0206a46 100644 --- a/Lib/test/test_capi/test_opt.py +++ b/Lib/test/test_capi/test_opt.py @@ -978,50 +978,6 @@ def return_tenth(): # Constant narrowing allows constant folding for second comparison self.assertLessEqual(count_ops(ex, "_COMPARE_OP_FLOAT"), 1) - def test_compare_str_eq_narrows_to_constant(self): - def f(n): - def return_hello(): - return "hello" - - hits = 0 - v = return_hello() - for _ in range(n): - if v == "hello": - if v == "hello": - hits += 1 - return hits - - res, ex = self._run_with_optimizer(f, TIER2_THRESHOLD) - self.assertEqual(res, TIER2_THRESHOLD) - self.assertIsNotNone(ex) - uops = get_opnames(ex) - - # Constant narrowing allows constant folding for second comparison - self.assertLessEqual(count_ops(ex, "_COMPARE_OP_STR"), 1) - - def test_compare_str_ne_narrows_to_constant(self): - def f(n): - def return_hello(): - return "hello" - - hits = 0 - v = return_hello() - for _ in range(n): - if v != "hello": - hits += 1000 - else: - if v == "hello": - hits += 1 - return hits - - res, ex = self._run_with_optimizer(f, TIER2_THRESHOLD) - self.assertEqual(res, TIER2_THRESHOLD) - self.assertIsNotNone(ex) - uops = get_opnames(ex) - - # Constant narrowing allows constant folding for second comparison - self.assertLessEqual(count_ops(ex, "_COMPARE_OP_STR"), 1) - def test_combine_stack_space_checks_sequential(self): def dummy12(x): return x - 1 diff --git a/Modules/_testinternalcapi/test_cases.c.h b/Modules/_testinternalcapi/test_cases.c.h index 64c9ffeb4dc411..c89c790988c52d 100644 --- a/Modules/_testinternalcapi/test_cases.c.h +++ b/Modules/_testinternalcapi/test_cases.c.h @@ -749,11 +749,11 @@ JUMP_TO_PREDICTED(BINARY_OP); } getitem = PyStackRef_FromPyObjectNew(getitem_o); - STAT_INC(BINARY_OP, hit); } // _BINARY_OP_SUBSCR_INIT_CALL { sub = stack_pointer[-1]; + STAT_INC(BINARY_OP, hit); _PyInterpreterFrame* pushed_frame = _PyFrame_PushUnchecked(tstate, getitem, 2, frame); pushed_frame->localsplus[0] = container; pushed_frame->localsplus[1] = sub; @@ -10449,33 +10449,30 @@ next_instr += 1; INSTRUCTION_STATS(RETURN_GENERATOR); _PyStackRef res; - // _RETURN_GENERATOR - { - assert(PyStackRef_FunctionCheck(frame->f_funcobj)); - PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj); - _PyFrame_SetStackPointer(frame, stack_pointer); - PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); - stack_pointer = _PyFrame_GetStackPointer(frame); - if (gen == NULL) { - JUMP_TO_LABEL(error); - } - assert(STACK_LEVEL() <= 2); - _PyFrame_SetStackPointer(frame, stack_pointer); - _PyInterpreterFrame *gen_frame = &gen->gi_iframe; - frame->instr_ptr++; - _PyFrame_Copy(frame, gen_frame); - assert(frame->frame_obj == NULL); - gen->gi_frame_state = FRAME_CREATED; - gen_frame->owner = FRAME_OWNED_BY_GENERATOR; - _Py_LeaveRecursiveCallPy(tstate); - _PyInterpreterFrame *prev = frame->previous; - _PyThreadState_PopFrame(tstate, frame); - frame = tstate->current_frame = prev; - LOAD_IP(frame->return_offset); - stack_pointer = _PyFrame_GetStackPointer(frame); - res = PyStackRef_FromPyObjectStealMortal((PyObject *)gen); - LLTRACE_RESUME_FRAME(); + assert(PyStackRef_FunctionCheck(frame->f_funcobj)); + PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj); + _PyFrame_SetStackPointer(frame, stack_pointer); + PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); + stack_pointer = _PyFrame_GetStackPointer(frame); + if (gen == NULL) { + JUMP_TO_LABEL(error); } + assert(STACK_LEVEL() <= 2); + _PyFrame_SetStackPointer(frame, stack_pointer); + _PyInterpreterFrame *gen_frame = &gen->gi_iframe; + frame->instr_ptr++; + _PyFrame_Copy(frame, gen_frame); + assert(frame->frame_obj == NULL); + gen->gi_frame_state = FRAME_CREATED; + gen_frame->owner = FRAME_OWNED_BY_GENERATOR; + _Py_LeaveRecursiveCallPy(tstate); + _PyInterpreterFrame *prev = frame->previous; + _PyThreadState_PopFrame(tstate, frame); + frame = tstate->current_frame = prev; + LOAD_IP(frame->return_offset); + stack_pointer = _PyFrame_GetStackPointer(frame); + res = PyStackRef_FromPyObjectStealMortal((PyObject *)gen); + LLTRACE_RESUME_FRAME(); stack_pointer[0] = res; stack_pointer += 1; ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); @@ -10492,24 +10489,21 @@ INSTRUCTION_STATS(RETURN_VALUE); _PyStackRef retval; _PyStackRef res; - // _RETURN_VALUE - { - retval = stack_pointer[-1]; - assert(frame->owner != FRAME_OWNED_BY_INTERPRETER); - _PyStackRef temp = PyStackRef_MakeHeapSafe(retval); - stack_pointer += -1; - ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); - _PyFrame_SetStackPointer(frame, stack_pointer); - assert(STACK_LEVEL() == 0); - _Py_LeaveRecursiveCallPy(tstate); - _PyInterpreterFrame *dying = frame; - frame = tstate->current_frame = dying->previous; - _PyEval_FrameClearAndPop(tstate, dying); - stack_pointer = _PyFrame_GetStackPointer(frame); - LOAD_IP(frame->return_offset); - res = temp; - LLTRACE_RESUME_FRAME(); - } + retval = stack_pointer[-1]; + assert(frame->owner != FRAME_OWNED_BY_INTERPRETER); + _PyStackRef temp = PyStackRef_MakeHeapSafe(retval); + stack_pointer += -1; + ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); + _PyFrame_SetStackPointer(frame, stack_pointer); + assert(STACK_LEVEL() == 0); + _Py_LeaveRecursiveCallPy(tstate); + _PyInterpreterFrame *dying = frame; + frame = tstate->current_frame = dying->previous; + _PyEval_FrameClearAndPop(tstate, dying); + stack_pointer = _PyFrame_GetStackPointer(frame); + LOAD_IP(frame->return_offset); + res = temp; + LLTRACE_RESUME_FRAME(); stack_pointer[0] = res; stack_pointer += 1; ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); @@ -12326,40 +12320,37 @@ INSTRUCTION_STATS(YIELD_VALUE); _PyStackRef retval; _PyStackRef value; - // _YIELD_VALUE - { - retval = stack_pointer[-1]; - assert(frame->owner != FRAME_OWNED_BY_INTERPRETER); - frame->instr_ptr++; - PyGenObject *gen = _PyGen_GetGeneratorFromFrame(frame); - assert(FRAME_SUSPENDED_YIELD_FROM == FRAME_SUSPENDED + 1); - assert(oparg == 0 || oparg == 1); - _PyStackRef temp = retval; - stack_pointer += -1; - ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); - _PyFrame_SetStackPointer(frame, stack_pointer); - tstate->exc_info = gen->gi_exc_state.previous_item; - gen->gi_exc_state.previous_item = NULL; - _Py_LeaveRecursiveCallPy(tstate); - _PyInterpreterFrame *gen_frame = frame; - frame = tstate->current_frame = frame->previous; - gen_frame->previous = NULL; - ((_PyThreadStateImpl *)tstate)->generator_return_kind = GENERATOR_YIELD; - FT_ATOMIC_STORE_INT8_RELEASE(gen->gi_frame_state, FRAME_SUSPENDED + oparg); - assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER); - #if TIER_ONE - assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE || + retval = stack_pointer[-1]; + assert(frame->owner != FRAME_OWNED_BY_INTERPRETER); + frame->instr_ptr++; + PyGenObject *gen = _PyGen_GetGeneratorFromFrame(frame); + assert(FRAME_SUSPENDED_YIELD_FROM == FRAME_SUSPENDED + 1); + assert(oparg == 0 || oparg == 1); + _PyStackRef temp = retval; + stack_pointer += -1; + ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); + _PyFrame_SetStackPointer(frame, stack_pointer); + tstate->exc_info = gen->gi_exc_state.previous_item; + gen->gi_exc_state.previous_item = NULL; + _Py_LeaveRecursiveCallPy(tstate); + _PyInterpreterFrame *gen_frame = frame; + frame = tstate->current_frame = frame->previous; + gen_frame->previous = NULL; + ((_PyThreadStateImpl *)tstate)->generator_return_kind = GENERATOR_YIELD; + FT_ATOMIC_STORE_INT8_RELEASE(gen->gi_frame_state, FRAME_SUSPENDED + oparg); + assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER); + #if TIER_ONE + assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE || frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION || _PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND || _PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER || _PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT || _PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR); - #endif - stack_pointer = _PyFrame_GetStackPointer(frame); - LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND); - value = PyStackRef_MakeHeapSafe(temp); - LLTRACE_RESUME_FRAME(); - } + #endif + stack_pointer = _PyFrame_GetStackPointer(frame); + LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND); + value = PyStackRef_MakeHeapSafe(temp); + LLTRACE_RESUME_FRAME(); stack_pointer[0] = value; stack_pointer += 1; ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); diff --git a/Python/bytecodes.c b/Python/bytecodes.c index a990ab28577c73..a014f56deb202e 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1095,10 +1095,10 @@ dummy_func( assert(code->co_argcount == 2); DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize)); getitem = PyStackRef_FromPyObjectNew(getitem_o); - STAT_INC(BINARY_OP, hit); } op(_BINARY_OP_SUBSCR_INIT_CALL, (container, sub, getitem -- new_frame)) { + STAT_INC(BINARY_OP, hit); _PyInterpreterFrame* pushed_frame = _PyFrame_PushUnchecked(tstate, getitem, 2, frame); pushed_frame->localsplus[0] = container; pushed_frame->localsplus[1] = sub; @@ -1108,7 +1108,7 @@ dummy_func( } macro(BINARY_OP_SUBSCR_GETITEM) = - _RECORD_TOS + + _RECORD_NOS + unused/5 + // Skip over the counter and cache _CHECK_PEP_523 + _BINARY_OP_SUBSCR_CHECK_FUNC + @@ -1269,7 +1269,7 @@ dummy_func( // The stack effect here is a bit misleading. // retval is popped from the stack, but res // is pushed to a different frame, the callers' frame. - op(_RETURN_VALUE, (retval -- res)) { + inst(RETURN_VALUE, (retval -- res)) { assert(frame->owner != FRAME_OWNED_BY_INTERPRETER); _PyStackRef temp = PyStackRef_MakeHeapSafe(retval); DEAD(retval); @@ -1293,13 +1293,9 @@ dummy_func( ERROR_IF(err); } - macro(RETURN_VALUE) = - _RECORD_CALLER_CODE + - _RETURN_VALUE; - macro(INSTRUMENTED_RETURN_VALUE) = _RETURN_VALUE_EVENT + - _RETURN_VALUE; + RETURN_VALUE; inst(GET_AITER, (obj -- iter)) { unaryfunc getter = NULL; @@ -1436,11 +1432,12 @@ dummy_func( macro(SEND_GEN) = unused/1 + + _RECORD_NOS_GEN_FUNC + _CHECK_PEP_523 + _SEND_GEN_FRAME + _PUSH_FRAME; - op(_YIELD_VALUE, (retval -- value)) { + inst(YIELD_VALUE, (retval -- value)) { // NOTE: It's important that YIELD_VALUE never raises an exception! // The compiler treats any exception raised here as a failed close() // or throw() call. @@ -1476,10 +1473,6 @@ dummy_func( LLTRACE_RESUME_FRAME(); } - macro(YIELD_VALUE) = - _RECORD_CALLER_CODE + - _YIELD_VALUE; - tier1 op(_YIELD_VALUE_EVENT, (val -- val)) { int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_YIELD, @@ -1495,7 +1488,7 @@ dummy_func( macro(INSTRUMENTED_YIELD_VALUE) = _YIELD_VALUE_EVENT + - _YIELD_VALUE; + YIELD_VALUE; inst(POP_EXCEPT, (exc_value -- )) { _PyErr_StackItem *exc_info = tstate->exc_info; @@ -3523,7 +3516,7 @@ dummy_func( } macro(FOR_ITER_GEN) = - _RECORD_NOS + + _RECORD_NOS_GEN_FUNC + unused/1 + _CHECK_PEP_523 + _FOR_ITER_GEN_FRAME + @@ -5074,7 +5067,7 @@ dummy_func( *ptr = attr; } - op(_RETURN_GENERATOR, (-- res)) { + inst(RETURN_GENERATOR, (-- res)) { assert(PyStackRef_FunctionCheck(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj); PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -5097,10 +5090,6 @@ dummy_func( LLTRACE_RESUME_FRAME(); } - macro(RETURN_GENERATOR) = - _RECORD_CALLER_CODE + - _RETURN_GENERATOR; - inst(BUILD_SLICE, (args[oparg] -- slice)) { PyObject *start_o = PyStackRef_AsPyObjectBorrow(args[0]); PyObject *stop_o = PyStackRef_AsPyObjectBorrow(args[1]); @@ -5646,6 +5635,12 @@ dummy_func( Py_UNREACHABLE(); } + tier2 op(_GUARD_CODE, (version/2 -- )) { + PyObject *code = PyStackRef_AsPyObjectBorrow(frame->f_executable); + EXIT_IF(code == Py_None); + EXIT_IF(((PyCodeObject *)code)->co_version != version); + } + tier2 op(_GUARD_IP__PUSH_FRAME, (ip/4 --)) { _Py_CODEUNIT *target = frame->instr_ptr; if (target != (_Py_CODEUNIT *)ip) { @@ -5694,6 +5689,14 @@ dummy_func( RECORD_VALUE(PyStackRef_AsPyObjectBorrow(nos)); } + tier2 op(_RECORD_NOS_GEN_FUNC, (nos, tos -- nos, tos)) { + PyObject *obj = PyStackRef_AsPyObjectBorrow(nos); + if (PyGen_Check(obj)) { + PyObject *func = (PyObject *)_PyFrame_GetFunction(&((PyGenObject *)obj)->gi_iframe); + RECORD_VALUE(func); + } + } + tier2 op(_RECORD_4OS, (value, _3os, nos, tos -- value, _3os, nos, tos)) { RECORD_VALUE(PyStackRef_AsPyObjectBorrow(value)); } @@ -5710,12 +5713,9 @@ dummy_func( } } - tier2 op(_RECORD_CALLER_CODE, ( -- )) { - _PyInterpreterFrame *caller_frame = frame->previous; - if (caller_frame->owner < FRAME_OWNED_BY_INTERPRETER) { - PyCodeObject *code = _PyFrame_GetCode(frame->previous); - RECORD_VALUE(code); - } + /* Inserted by the JIT tracer. Never executed. */ + tier2 op(_RECORD_CODE, ( -- )) { + RECORD_VALUE(NULL); } label(pop_2_error) { diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 9c82f1acdef493..5fa564153bdc7f 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -6184,7 +6184,6 @@ JUMP_TO_JUMP_TARGET(); } getitem = PyStackRef_FromPyObjectNew(getitem_o); - STAT_INC(BINARY_OP, hit); _tos_cache2 = getitem; _tos_cache1 = _stack_item_1; _tos_cache0 = container; @@ -6203,6 +6202,7 @@ getitem = stack_pointer[-1]; sub = stack_pointer[-2]; container = stack_pointer[-3]; + STAT_INC(BINARY_OP, hit); _PyInterpreterFrame* pushed_frame = _PyFrame_PushUnchecked(tstate, getitem, 2, frame); pushed_frame->localsplus[0] = container; pushed_frame->localsplus[1] = sub; @@ -6227,6 +6227,7 @@ getitem = _stack_item_0; sub = stack_pointer[-1]; container = stack_pointer[-2]; + STAT_INC(BINARY_OP, hit); _PyInterpreterFrame* pushed_frame = _PyFrame_PushUnchecked(tstate, getitem, 2, frame); pushed_frame->localsplus[0] = container; pushed_frame->localsplus[1] = sub; @@ -6252,6 +6253,7 @@ getitem = _stack_item_1; sub = _stack_item_0; container = stack_pointer[-1]; + STAT_INC(BINARY_OP, hit); _PyInterpreterFrame* pushed_frame = _PyFrame_PushUnchecked(tstate, getitem, 2, frame); pushed_frame->localsplus[0] = container; pushed_frame->localsplus[1] = sub; @@ -6278,6 +6280,7 @@ getitem = _stack_item_2; sub = _stack_item_1; container = _stack_item_0; + STAT_INC(BINARY_OP, hit); _PyInterpreterFrame* pushed_frame = _PyFrame_PushUnchecked(tstate, getitem, 2, frame); pushed_frame->localsplus[0] = container; pushed_frame->localsplus[1] = sub; @@ -20142,6 +20145,41 @@ GOTO_TIER_ONE(target); } + case _GUARD_CODE_r00: { + CHECK_CURRENT_CACHED_VALUES(0); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + uint32_t version = (uint32_t)CURRENT_OPERAND0_32(); + PyObject *code = PyStackRef_AsPyObjectBorrow(frame->f_executable); + if (code == Py_None) { + _PyFrame_SetStackPointer(frame, stack_pointer); + printf("Guard Code failed: code is None\n"); + fflush(stdout); + stack_pointer = _PyFrame_GetStackPointer(frame); + } + if (((PyCodeObject *)code)->co_version != version) { + _PyFrame_SetStackPointer(frame, stack_pointer); + printf("Guard Code failed: expected version %ud, actual version %ud\n", version, ((PyCodeObject *)code)->co_version); + fflush(stdout); + stack_pointer = _PyFrame_GetStackPointer(frame); + } + if (code == Py_None) { + UOP_STAT_INC(uopcode, miss); + SET_CURRENT_CACHED_VALUES(0); + JUMP_TO_JUMP_TARGET(); + } + if (((PyCodeObject *)code)->co_version != version) { + UOP_STAT_INC(uopcode, miss); + SET_CURRENT_CACHED_VALUES(0); + JUMP_TO_JUMP_TARGET(); + } + _tos_cache0 = PyStackRef_ZERO_BITS; + _tos_cache1 = PyStackRef_ZERO_BITS; + _tos_cache2 = PyStackRef_ZERO_BITS; + SET_CURRENT_CACHED_VALUES(0); + assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); + break; + } + case _GUARD_IP__PUSH_FRAME_r00: { CHECK_CURRENT_CACHED_VALUES(0); assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE()); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index d3c5f526efd6a8..be5dbfcc747935 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -749,11 +749,11 @@ JUMP_TO_PREDICTED(BINARY_OP); } getitem = PyStackRef_FromPyObjectNew(getitem_o); - STAT_INC(BINARY_OP, hit); } // _BINARY_OP_SUBSCR_INIT_CALL { sub = stack_pointer[-1]; + STAT_INC(BINARY_OP, hit); _PyInterpreterFrame* pushed_frame = _PyFrame_PushUnchecked(tstate, getitem, 2, frame); pushed_frame->localsplus[0] = container; pushed_frame->localsplus[1] = sub; @@ -10446,33 +10446,30 @@ next_instr += 1; INSTRUCTION_STATS(RETURN_GENERATOR); _PyStackRef res; - // _RETURN_GENERATOR - { - assert(PyStackRef_FunctionCheck(frame->f_funcobj)); - PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj); - _PyFrame_SetStackPointer(frame, stack_pointer); - PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); - stack_pointer = _PyFrame_GetStackPointer(frame); - if (gen == NULL) { - JUMP_TO_LABEL(error); - } - assert(STACK_LEVEL() <= 2); - _PyFrame_SetStackPointer(frame, stack_pointer); - _PyInterpreterFrame *gen_frame = &gen->gi_iframe; - frame->instr_ptr++; - _PyFrame_Copy(frame, gen_frame); - assert(frame->frame_obj == NULL); - gen->gi_frame_state = FRAME_CREATED; - gen_frame->owner = FRAME_OWNED_BY_GENERATOR; - _Py_LeaveRecursiveCallPy(tstate); - _PyInterpreterFrame *prev = frame->previous; - _PyThreadState_PopFrame(tstate, frame); - frame = tstate->current_frame = prev; - LOAD_IP(frame->return_offset); - stack_pointer = _PyFrame_GetStackPointer(frame); - res = PyStackRef_FromPyObjectStealMortal((PyObject *)gen); - LLTRACE_RESUME_FRAME(); + assert(PyStackRef_FunctionCheck(frame->f_funcobj)); + PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj); + _PyFrame_SetStackPointer(frame, stack_pointer); + PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); + stack_pointer = _PyFrame_GetStackPointer(frame); + if (gen == NULL) { + JUMP_TO_LABEL(error); } + assert(STACK_LEVEL() <= 2); + _PyFrame_SetStackPointer(frame, stack_pointer); + _PyInterpreterFrame *gen_frame = &gen->gi_iframe; + frame->instr_ptr++; + _PyFrame_Copy(frame, gen_frame); + assert(frame->frame_obj == NULL); + gen->gi_frame_state = FRAME_CREATED; + gen_frame->owner = FRAME_OWNED_BY_GENERATOR; + _Py_LeaveRecursiveCallPy(tstate); + _PyInterpreterFrame *prev = frame->previous; + _PyThreadState_PopFrame(tstate, frame); + frame = tstate->current_frame = prev; + LOAD_IP(frame->return_offset); + stack_pointer = _PyFrame_GetStackPointer(frame); + res = PyStackRef_FromPyObjectStealMortal((PyObject *)gen); + LLTRACE_RESUME_FRAME(); stack_pointer[0] = res; stack_pointer += 1; ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); @@ -10489,24 +10486,21 @@ INSTRUCTION_STATS(RETURN_VALUE); _PyStackRef retval; _PyStackRef res; - // _RETURN_VALUE - { - retval = stack_pointer[-1]; - assert(frame->owner != FRAME_OWNED_BY_INTERPRETER); - _PyStackRef temp = PyStackRef_MakeHeapSafe(retval); - stack_pointer += -1; - ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); - _PyFrame_SetStackPointer(frame, stack_pointer); - assert(STACK_LEVEL() == 0); - _Py_LeaveRecursiveCallPy(tstate); - _PyInterpreterFrame *dying = frame; - frame = tstate->current_frame = dying->previous; - _PyEval_FrameClearAndPop(tstate, dying); - stack_pointer = _PyFrame_GetStackPointer(frame); - LOAD_IP(frame->return_offset); - res = temp; - LLTRACE_RESUME_FRAME(); - } + retval = stack_pointer[-1]; + assert(frame->owner != FRAME_OWNED_BY_INTERPRETER); + _PyStackRef temp = PyStackRef_MakeHeapSafe(retval); + stack_pointer += -1; + ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); + _PyFrame_SetStackPointer(frame, stack_pointer); + assert(STACK_LEVEL() == 0); + _Py_LeaveRecursiveCallPy(tstate); + _PyInterpreterFrame *dying = frame; + frame = tstate->current_frame = dying->previous; + _PyEval_FrameClearAndPop(tstate, dying); + stack_pointer = _PyFrame_GetStackPointer(frame); + LOAD_IP(frame->return_offset); + res = temp; + LLTRACE_RESUME_FRAME(); stack_pointer[0] = res; stack_pointer += 1; ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); @@ -12323,40 +12317,37 @@ INSTRUCTION_STATS(YIELD_VALUE); _PyStackRef retval; _PyStackRef value; - // _YIELD_VALUE - { - retval = stack_pointer[-1]; - assert(frame->owner != FRAME_OWNED_BY_INTERPRETER); - frame->instr_ptr++; - PyGenObject *gen = _PyGen_GetGeneratorFromFrame(frame); - assert(FRAME_SUSPENDED_YIELD_FROM == FRAME_SUSPENDED + 1); - assert(oparg == 0 || oparg == 1); - _PyStackRef temp = retval; - stack_pointer += -1; - ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); - _PyFrame_SetStackPointer(frame, stack_pointer); - tstate->exc_info = gen->gi_exc_state.previous_item; - gen->gi_exc_state.previous_item = NULL; - _Py_LeaveRecursiveCallPy(tstate); - _PyInterpreterFrame *gen_frame = frame; - frame = tstate->current_frame = frame->previous; - gen_frame->previous = NULL; - ((_PyThreadStateImpl *)tstate)->generator_return_kind = GENERATOR_YIELD; - FT_ATOMIC_STORE_INT8_RELEASE(gen->gi_frame_state, FRAME_SUSPENDED + oparg); - assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER); - #if TIER_ONE - assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE || + retval = stack_pointer[-1]; + assert(frame->owner != FRAME_OWNED_BY_INTERPRETER); + frame->instr_ptr++; + PyGenObject *gen = _PyGen_GetGeneratorFromFrame(frame); + assert(FRAME_SUSPENDED_YIELD_FROM == FRAME_SUSPENDED + 1); + assert(oparg == 0 || oparg == 1); + _PyStackRef temp = retval; + stack_pointer += -1; + ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); + _PyFrame_SetStackPointer(frame, stack_pointer); + tstate->exc_info = gen->gi_exc_state.previous_item; + gen->gi_exc_state.previous_item = NULL; + _Py_LeaveRecursiveCallPy(tstate); + _PyInterpreterFrame *gen_frame = frame; + frame = tstate->current_frame = frame->previous; + gen_frame->previous = NULL; + ((_PyThreadStateImpl *)tstate)->generator_return_kind = GENERATOR_YIELD; + FT_ATOMIC_STORE_INT8_RELEASE(gen->gi_frame_state, FRAME_SUSPENDED + oparg); + assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER); + #if TIER_ONE + assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE || frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION || _PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND || _PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER || _PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT || _PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR); - #endif - stack_pointer = _PyFrame_GetStackPointer(frame); - LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND); - value = PyStackRef_MakeHeapSafe(temp); - LLTRACE_RESUME_FRAME(); - } + #endif + stack_pointer = _PyFrame_GetStackPointer(frame); + LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND); + value = PyStackRef_MakeHeapSafe(temp); + LLTRACE_RESUME_FRAME(); stack_pointer[0] = value; stack_pointer += 1; ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); diff --git a/Python/optimizer.c b/Python/optimizer.c index e4e18f14bdc9b1..bf5d8a28264635 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -928,22 +928,8 @@ _PyJit_translate_single_bytecode_to_trace( } if (uop == _PUSH_FRAME || uop == _RETURN_VALUE || uop == _RETURN_GENERATOR || uop == _YIELD_VALUE) { PyCodeObject *new_code = (PyCodeObject *)PyStackRef_AsPyObjectBorrow(frame->f_executable); - PyFunctionObject *new_func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj); - - operand = 0; - if (frame->owner < FRAME_OWNED_BY_INTERPRETER) { - // Don't add nested code objects to the dependency. - // It causes endless re-traces. - if (new_func != NULL && !Py_IsNone((PyObject*)new_func) && !(new_code->co_flags & CO_NESTED)) { - operand = (uintptr_t)new_func; - DPRINTF(2, "Adding %p func to op\n", (void *)operand); - _Py_BloomFilter_Add(dependencies, new_func); - } - else if (new_code != NULL && !Py_IsNone((PyObject*)new_code)) { - operand = (uintptr_t)new_code | 1; - DPRINTF(2, "Adding %p code to op\n", (void *)operand); - _Py_BloomFilter_Add(dependencies, new_code); - } + if (new_code != NULL && !Py_IsNone((PyObject*)new_code)) { + _Py_BloomFilter_Add(dependencies, new_code); } ADD_TO_TRACE(uop, oparg, operand, target); uop_buffer_last(trace)->operand1 = PyStackRef_IsNone(frame->f_executable) ? 2 : ((int)(frame->stackpointer - _PyFrame_Stackbase(frame))); @@ -974,7 +960,13 @@ _PyJit_translate_single_bytecode_to_trace( DPRINTF(1, "Unknown uop needing guard ip %s\n", _PyOpcode_uop_name[uop_buffer_last(trace)->opcode]); Py_UNREACHABLE(); } + PyObject *code = PyStackRef_AsPyObjectBorrow(frame->f_executable); + Py_INCREF(code); + ADD_TO_TRACE(_RECORD_CODE, 0, (uintptr_t)code, 0); ADD_TO_TRACE(guard_ip, 0, (uintptr_t)next_instr, 0); + if (PyCode_Check(code)) { + ADD_TO_TRACE(_GUARD_CODE, 0, ((PyCodeObject *)code)->co_version, 0); + } } // Loop back to the start int is_first_instr = tracer->initial_state.close_loop_instr == next_instr || @@ -1224,7 +1216,8 @@ prepare_for_execution(_PyUOpInstruction *buffer, int length) base_opcode == _GUARD_IP__PUSH_FRAME || base_opcode == _GUARD_IP_RETURN_VALUE || base_opcode == _GUARD_IP_YIELD_VALUE || - base_opcode == _GUARD_IP_RETURN_GENERATOR + base_opcode == _GUARD_IP_RETURN_GENERATOR || + base_opcode == _GUARD_CODE ) { base_exit_op = _DYNAMIC_EXIT; } diff --git a/Python/optimizer_analysis.c b/Python/optimizer_analysis.c index 039aacf23ae3a3..381b2500158ef0 100644 --- a/Python/optimizer_analysis.c +++ b/Python/optimizer_analysis.c @@ -226,6 +226,7 @@ add_op(JitOptContext *ctx, _PyUOpInstruction *this_instr, uint16_t opcode, uint16_t oparg, uintptr_t operand0) { _PyUOpInstruction *out = ctx->out_buffer.next; + assert(out < ctx->out_buffer.end); out->opcode = (opcode); out->format = this_instr->format; out->oparg = (oparg); @@ -261,6 +262,7 @@ add_op(JitOptContext *ctx, _PyUOpInstruction *this_instr, #define sym_is_bottom _Py_uop_sym_is_bottom #define sym_truthiness _Py_uop_sym_truthiness #define frame_new _Py_uop_frame_new +#define frame_new_from_symbol _Py_uop_frame_new_from_symbol #define frame_pop _Py_uop_frame_pop #define sym_new_tuple _Py_uop_sym_new_tuple #define sym_tuple_getitem _Py_uop_sym_tuple_getitem @@ -271,6 +273,11 @@ add_op(JitOptContext *ctx, _PyUOpInstruction *this_instr, #define sym_new_truthiness _Py_uop_sym_new_truthiness #define sym_new_predicate _Py_uop_sym_new_predicate #define sym_apply_predicate_narrowing _Py_uop_sym_apply_predicate_narrowing +#define sym_set_recorded_type(SYM, TYPE) _Py_uop_sym_set_recorded_type(ctx, SYM, TYPE) +#define sym_set_recorded_value(SYM, VAL) _Py_uop_sym_set_recorded_value(ctx, SYM, VAL) +#define sym_set_recorded_gen_func(SYM, VAL) _Py_uop_sym_set_recorded_gen_func(ctx, SYM, VAL) +#define sym_get_probable_func_code _Py_uop_sym_get_probable_func_code +#define sym_get_probable_value _Py_uop_sym_get_probable_value /* Comparison oparg masks */ #define COMPARE_LT_MASK 2 @@ -355,30 +362,6 @@ lookup_attr(JitOptContext *ctx, _PyBloomFilter *dependencies, _PyUOpInstruction return sym_new_not_null(ctx); } -static PyCodeObject * -get_code_with_logging(_PyUOpInstruction *op) -{ - PyCodeObject *co = NULL; - uint64_t push_operand = op->operand0; - if (push_operand & 1) { - co = (PyCodeObject *)(push_operand & ~1); - DPRINTF(3, " code=%p\n", co); - assert(PyCode_Check(co)); - } - else { - PyFunctionObject *func = (PyFunctionObject *)push_operand; - DPRINTF(3, " func=%p ", func); - if (func == NULL) { - DPRINTF(3, "\n"); - DPRINTF(1, "Missing function\n"); - return NULL; - } - co = (PyCodeObject *)func->func_code; - DPRINTF(3, "code=%p\n", co); - } - return co; -} - static PyCodeObject * get_current_code_object(JitOptContext *ctx) diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c index 89c6707160326c..0863d5dd8f8df7 100644 --- a/Python/optimizer_bytecodes.c +++ b/Python/optimizer_bytecodes.c @@ -30,6 +30,7 @@ typedef struct _Py_UOpsAbstractFrame _Py_UOpsAbstractFrame; #define sym_set_compact_int(SYM) _Py_uop_sym_set_compact_int(ctx, SYM) #define sym_is_bottom _Py_uop_sym_is_bottom #define frame_new _Py_uop_frame_new +#define frame_new_from_symbol _Py_uop_frame_new_from_symbol #define frame_pop _Py_uop_frame_pop #define sym_new_tuple _Py_uop_sym_new_tuple #define sym_tuple_getitem _Py_uop_sym_tuple_getitem @@ -40,6 +41,11 @@ typedef struct _Py_UOpsAbstractFrame _Py_UOpsAbstractFrame; #define sym_new_truthiness _Py_uop_sym_new_truthiness #define sym_new_predicate _Py_uop_sym_new_predicate #define sym_apply_predicate_narrowing _Py_uop_sym_apply_predicate_narrowing +#define sym_set_recorded_type(SYM, TYPE) _Py_uop_sym_set_recorded_type(ctx, SYM, TYPE) +#define sym_set_recorded_value(SYM, VAL) _Py_uop_sym_set_recorded_value(ctx, SYM, VAL) +#define sym_set_recorded_gen_func(SYM, VAL) _Py_uop_sym_set_recorded_gen_func(ctx, SYM, VAL) +#define sym_get_probable_func_code _Py_uop_sym_get_probable_func_code +#define sym_get_probable_value _Py_uop_sym_get_probable_value extern int optimize_to_bool( @@ -337,14 +343,23 @@ dummy_func(void) { GETLOCAL(this_instr->operand0) = sym_new_null(ctx); } - op(_BINARY_OP_SUBSCR_INIT_CALL, (container, sub, getitem -- new_frame)) { - assert((this_instr + 1)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging(this_instr + 1); - if (co == NULL) { - ctx->done = true; - break; + op(_BINARY_OP_SUBSCR_CHECK_FUNC, (container, unused -- container, unused, getitem)) { + getitem = sym_new_not_null(ctx); + PyTypeObject *tp = sym_get_type(container); + if (tp == NULL) { + PyObject *c = sym_get_probable_value(container); + if (c != NULL) { + tp = Py_TYPE(c); + } } - _Py_UOpsAbstractFrame *f = frame_new(ctx, co, 0, NULL, 0); + if (tp != NULL) { + PyObject *getitem_o = ((PyHeapTypeObject *)tp)->_spec_cache.getitem; + sym_set_recorded_value(getitem, getitem_o); + } + } + + op(_BINARY_OP_SUBSCR_INIT_CALL, (container, sub, getitem -- new_frame)) { + _Py_UOpsAbstractFrame *f = frame_new_from_symbol(ctx, getitem, 0, NULL, 0); if (f == NULL) { break; } @@ -556,17 +571,10 @@ dummy_func(void) { } op(_COMPARE_OP_STR, (left, right -- res, l, r)) { - int cmp_mask = oparg & (COMPARE_LT_MASK | COMPARE_GT_MASK | COMPARE_EQ_MASK); - - if (cmp_mask == COMPARE_EQ_MASK) { - res = sym_new_predicate(ctx, left, right, JIT_PRED_EQ); - } - else if (cmp_mask == (COMPARE_LT_MASK | COMPARE_GT_MASK)) { - res = sym_new_predicate(ctx, left, right, JIT_PRED_NE); - } - else { - res = sym_new_type(ctx, &PyBool_Type); - } + /* Cannot use predicate optimization here, as `a == b` + * does not imply that `a` is equivalent to `b`. `a` may be + * mortal, while `b` is immortal */ + res = sym_new_type(ctx, &PyBool_Type); l = left; r = right; REPLACE_OPCODE_IF_EVALUATES_PURE(left, right, res); @@ -814,12 +822,8 @@ dummy_func(void) { op(_LOAD_ATTR_PROPERTY_FRAME, (fget/4, owner -- new_frame)) { // + 1 for _SAVE_RETURN_OFFSET - assert((this_instr + 2)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging(this_instr + 2); - if (co == NULL) { - ctx->done = true; - break; - } + // FIX ME -- This needs a version check and function watcher + PyCodeObject *co = (PyCodeObject *)((PyFunctionObject *)fget)->func_code; _Py_UOpsAbstractFrame *f = frame_new(ctx, co, 0, NULL, 0); if (f == NULL) { break; @@ -872,14 +876,6 @@ dummy_func(void) { op(_INIT_CALL_PY_EXACT_ARGS, (callable, self_or_null, args[oparg] -- new_frame)) { int argcount = oparg; - - assert((this_instr + 2)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 2)); - if (co == NULL) { - ctx->done = true; - break; - } - assert(!PyJitRef_IsNull(self_or_null)); assert(args != NULL); if (sym_is_not_null(self_or_null)) { @@ -889,9 +885,9 @@ dummy_func(void) { } if (sym_is_null(self_or_null) || sym_is_not_null(self_or_null)) { - new_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, args, argcount)); + new_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, callable, 0, args, argcount)); } else { - new_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, NULL, 0)); + new_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, callable, 0, NULL, 0)); } } @@ -902,36 +898,15 @@ dummy_func(void) { } op(_PY_FRAME_GENERAL, (callable, self_or_null, args[oparg] -- new_frame)) { - assert((this_instr + 2)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 2)); - if (co == NULL) { - ctx->done = true; - break; - } - - new_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, NULL, 0)); + new_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, callable, 0, NULL, 0)); } op(_PY_FRAME_KW, (callable, self_or_null, args[oparg], kwnames -- new_frame)) { - assert((this_instr + 2)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 2)); - if (co == NULL) { - ctx->done = true; - break; - } - - new_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, NULL, 0)); + new_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, callable, 0, NULL, 0)); } op(_PY_FRAME_EX, (func_st, null, callargs_st, kwargs_st -- ex_frame)) { - assert((this_instr + 2)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 2)); - if (co == NULL) { - ctx->done = true; - break; - } - - ex_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, NULL, 0)); + ex_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, func_st, 0, NULL, 0)); } op(_CHECK_AND_ALLOCATE_OBJECT, (type_version/2, callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) { @@ -954,8 +929,7 @@ dummy_func(void) { ctx->frame = shim; ctx->curr_frame_depth++; assert((this_instr + 1)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 1)); - init_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, args-1, oparg+1)); + init_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, init, 0, args-1, oparg+1)); } op(_RETURN_VALUE, (retval -- res)) { @@ -964,7 +938,9 @@ dummy_func(void) { DEAD(retval); SAVE_STACK(); ctx->frame->stack_pointer = stack_pointer; - PyCodeObject *returning_code = get_code_with_logging(this_instr); + assert(this_instr[1].opcode == _RECORD_CODE); + PyCodeObject *returning_code = (PyCodeObject *)this_instr[1].operand0; + assert(PyCode_Check(returning_code)); if (returning_code == NULL) { ctx->done = true; break; @@ -973,8 +949,8 @@ dummy_func(void) { if (ctx->curr_frame_depth >= 2) { PyCodeObject *expected_code = ctx->frames[ctx->curr_frame_depth - 2].code; if (expected_code == returning_code) { - assert((this_instr + 1)->opcode == _GUARD_IP_RETURN_VALUE); - REPLACE_OP((this_instr + 1), _NOP, 0, 0); + assert(this_instr[2].opcode == _GUARD_IP_RETURN_VALUE); + REPLACE_OP((this_instr + 2), _NOP, 0, 0); } } if (frame_pop(ctx, returning_code, returning_stacklevel)) { @@ -989,7 +965,9 @@ dummy_func(void) { op(_RETURN_GENERATOR, ( -- res)) { SYNC_SP(); ctx->frame->stack_pointer = stack_pointer; - PyCodeObject *returning_code = get_code_with_logging(this_instr); + assert(this_instr[1].opcode == _RECORD_CODE); + PyCodeObject *returning_code = (PyCodeObject *)this_instr[1].operand0; + assert(PyCode_Check(returning_code)); if (returning_code == NULL) { ctx->done = true; break; @@ -1009,7 +987,9 @@ dummy_func(void) { DEAD(retval); SAVE_STACK(); ctx->frame->stack_pointer = stack_pointer; - PyCodeObject *returning_code = get_code_with_logging(this_instr); + assert(this_instr[1].opcode == _RECORD_CODE); + PyCodeObject *returning_code = (PyCodeObject *)this_instr[1].operand0; + assert(PyCode_Check(returning_code)); if (returning_code == NULL) { ctx->done = true; break; @@ -1035,14 +1015,8 @@ dummy_func(void) { } } - op(_FOR_ITER_GEN_FRAME, (unused, unused -- unused, unused, gen_frame)) { - assert((this_instr + 1)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 1)); - if (co == NULL) { - ctx->done = true; - break; - } - _Py_UOpsAbstractFrame *new_frame = frame_new(ctx, co, 1, NULL, 0); + op(_FOR_ITER_GEN_FRAME, (iter, unused -- iter, unused, gen_frame)) { + _Py_UOpsAbstractFrame *new_frame = frame_new_from_symbol(ctx, iter, 1, NULL, 0); if (new_frame == NULL) { ctx->done = true; break; @@ -1051,14 +1025,8 @@ dummy_func(void) { gen_frame = PyJitRef_WrapInvalid(new_frame); } - op(_SEND_GEN_FRAME, (unused, v -- unused, gen_frame)) { - assert((this_instr + 1)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 1)); - if (co == NULL) { - ctx->done = true; - break; - } - _Py_UOpsAbstractFrame *new_frame = frame_new(ctx, co, 1, NULL, 0); + op(_SEND_GEN_FRAME, (receiver, v -- receiver, gen_frame)) { + _Py_UOpsAbstractFrame *new_frame = frame_new_from_symbol(ctx, receiver, 1, NULL, 0); if (new_frame == NULL) { ctx->done = true; break; @@ -1067,9 +1035,8 @@ dummy_func(void) { gen_frame = PyJitRef_WrapInvalid(new_frame); } - op(_CHECK_STACK_SPACE, (unused, unused, unused[oparg] -- unused, unused, unused[oparg])) { - assert((this_instr + 4)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 4)); + op(_CHECK_STACK_SPACE, (callable, unused, unused[oparg] -- callable, unused, unused[oparg])) { + PyCodeObject *co = sym_get_probable_func_code(callable); if (co == NULL) { ctx->done = true; break; @@ -1089,22 +1056,12 @@ dummy_func(void) { ctx->frame = (_Py_UOpsAbstractFrame *)PyJitRef_Unwrap(new_frame); ctx->curr_frame_depth++; stack_pointer = ctx->frame->stack_pointer; - uint64_t operand = this_instr->operand0; - if (operand == 0) { - ctx->done = true; - break; - } - if (!(operand & 1)) { - PyFunctionObject *func = (PyFunctionObject *)operand; - // No need to re-add to dependencies here. Already - // handled by the tracer. - ctx->frame->func = func; - } // Fixed calls don't need IP guards. if ((this_instr-1)->opcode == _CREATE_INIT_FRAME) { assert((this_instr+1)->opcode == _GUARD_IP__PUSH_FRAME); REPLACE_OP(this_instr+1, _NOP, 0, 0); } + assert(ctx->frame->locals != NULL); } op(_UNPACK_SEQUENCE, (seq -- values[oparg], top[0])) { @@ -1653,6 +1610,32 @@ dummy_func(void) { ss = sub_st; } + op(_RECORD_TOS, (tos -- tos)) { + sym_set_recorded_value(tos, (PyObject *)this_instr->operand0); + } + + op(_RECORD_TOS_TYPE, (tos -- tos)) { + PyTypeObject *tp = (PyTypeObject *)this_instr->operand0; + sym_set_recorded_type(tos, tp); + } + + op(_RECORD_NOS, (nos, tos -- nos, tos)) { + sym_set_recorded_value(nos, (PyObject *)this_instr->operand0); + } + + op(_RECORD_4OS, (value, _3os, nos, tos -- value, _3os, nos, tos)) { + sym_set_recorded_value(value, (PyObject *)this_instr->operand0); + } + + op(_RECORD_CALLABLE, (func, self, args[oparg] -- func, self, args[oparg])) { + sym_set_recorded_value(func, (PyObject *)this_instr->operand0); + } + + op(_RECORD_NOS_GEN_FUNC, (nos, tos -- nos, tos)) { + PyFunctionObject *func = (PyFunctionObject *)this_instr->operand0; + assert(func == NULL || PyFunction_Check(func)); + sym_set_recorded_gen_func(nos, func); + } // END BYTECODES // diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h index 61a30314c21789..9a51d2fa366661 100644 --- a/Python/optimizer_cases.c.h +++ b/Python/optimizer_cases.c.h @@ -1115,8 +1115,21 @@ } case _BINARY_OP_SUBSCR_CHECK_FUNC: { + JitOptRef container; JitOptRef getitem; + container = stack_pointer[-2]; getitem = sym_new_not_null(ctx); + PyTypeObject *tp = sym_get_type(container); + if (tp == NULL) { + PyObject *c = sym_get_probable_value(container); + if (c != NULL) { + tp = Py_TYPE(c); + } + } + if (tp != NULL) { + PyObject *getitem_o = ((PyHeapTypeObject *)tp)->_spec_cache.getitem; + sym_set_recorded_value(getitem, getitem_o); + } CHECK_STACK_BOUNDS(1); stack_pointer[0] = getitem; stack_pointer += 1; @@ -1125,18 +1138,14 @@ } case _BINARY_OP_SUBSCR_INIT_CALL: { + JitOptRef getitem; JitOptRef sub; JitOptRef container; JitOptRef new_frame; + getitem = stack_pointer[-1]; sub = stack_pointer[-2]; container = stack_pointer[-3]; - assert((this_instr + 1)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging(this_instr + 1); - if (co == NULL) { - ctx->done = true; - break; - } - _Py_UOpsAbstractFrame *f = frame_new(ctx, co, 0, NULL, 0); + _Py_UOpsAbstractFrame *f = frame_new_from_symbol(ctx, getitem, 0, NULL, 0); if (f == NULL) { break; } @@ -1239,7 +1248,9 @@ stack_pointer += -1; ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); ctx->frame->stack_pointer = stack_pointer; - PyCodeObject *returning_code = get_code_with_logging(this_instr); + assert(this_instr[1].opcode == _RECORD_CODE); + PyCodeObject *returning_code = (PyCodeObject *)this_instr[1].operand0; + assert(PyCode_Check(returning_code)); if (returning_code == NULL) { ctx->done = true; break; @@ -1248,8 +1259,8 @@ if (ctx->curr_frame_depth >= 2) { PyCodeObject *expected_code = ctx->frames[ctx->curr_frame_depth - 2].code; if (expected_code == returning_code) { - assert((this_instr + 1)->opcode == _GUARD_IP_RETURN_VALUE); - REPLACE_OP((this_instr + 1), _NOP, 0, 0); + assert(this_instr[2].opcode == _GUARD_IP_RETURN_VALUE); + REPLACE_OP((this_instr + 2), _NOP, 0, 0); } } if (frame_pop(ctx, returning_code, returning_stacklevel)) { @@ -1292,15 +1303,11 @@ case _SEND_GEN_FRAME: { JitOptRef v; + JitOptRef receiver; JitOptRef gen_frame; v = stack_pointer[-1]; - assert((this_instr + 1)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 1)); - if (co == NULL) { - ctx->done = true; - break; - } - _Py_UOpsAbstractFrame *new_frame = frame_new(ctx, co, 1, NULL, 0); + receiver = stack_pointer[-2]; + _Py_UOpsAbstractFrame *new_frame = frame_new_from_symbol(ctx, receiver, 1, NULL, 0); if (new_frame == NULL) { ctx->done = true; break; @@ -1320,7 +1327,9 @@ stack_pointer += -1; ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__); ctx->frame->stack_pointer = stack_pointer; - PyCodeObject *returning_code = get_code_with_logging(this_instr); + assert(this_instr[1].opcode == _RECORD_CODE); + PyCodeObject *returning_code = (PyCodeObject *)this_instr[1].operand0; + assert(PyCode_Check(returning_code)); if (returning_code == NULL) { ctx->done = true; break; @@ -1984,12 +1993,7 @@ JitOptRef new_frame; owner = stack_pointer[-1]; PyObject *fget = (PyObject *)this_instr->operand0; - assert((this_instr + 2)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging(this_instr + 2); - if (co == NULL) { - ctx->done = true; - break; - } + PyCodeObject *co = (PyCodeObject *)((PyFunctionObject *)fget)->func_code; _Py_UOpsAbstractFrame *f = frame_new(ctx, co, 0, NULL, 0); if (f == NULL) { break; @@ -2267,16 +2271,7 @@ JitOptRef r; right = stack_pointer[-1]; left = stack_pointer[-2]; - int cmp_mask = oparg & (COMPARE_LT_MASK | COMPARE_GT_MASK | COMPARE_EQ_MASK); - if (cmp_mask == COMPARE_EQ_MASK) { - res = sym_new_predicate(ctx, left, right, JIT_PRED_EQ); - } - else if (cmp_mask == (COMPARE_LT_MASK | COMPARE_GT_MASK)) { - res = sym_new_predicate(ctx, left, right, JIT_PRED_NE); - } - else { - res = sym_new_type(ctx, &PyBool_Type); - } + res = sym_new_type(ctx, &PyBool_Type); l = left; r = right; if ( @@ -2694,14 +2689,10 @@ } case _FOR_ITER_GEN_FRAME: { + JitOptRef iter; JitOptRef gen_frame; - assert((this_instr + 1)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 1)); - if (co == NULL) { - ctx->done = true; - break; - } - _Py_UOpsAbstractFrame *new_frame = frame_new(ctx, co, 1, NULL, 0); + iter = stack_pointer[-2]; + _Py_UOpsAbstractFrame *new_frame = frame_new_from_symbol(ctx, iter, 1, NULL, 0); if (new_frame == NULL) { ctx->done = true; break; @@ -2884,14 +2875,10 @@ /* _MONITOR_CALL is not a viable micro-op for tier 2 */ case _PY_FRAME_GENERAL: { + JitOptRef callable; JitOptRef new_frame; - assert((this_instr + 2)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 2)); - if (co == NULL) { - ctx->done = true; - break; - } - new_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, NULL, 0)); + callable = stack_pointer[-2 - oparg]; + new_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, callable, 0, NULL, 0)); CHECK_STACK_BOUNDS(-1 - oparg); stack_pointer[-2 - oparg] = new_frame; stack_pointer += -1 - oparg; @@ -2996,8 +2983,9 @@ } case _CHECK_STACK_SPACE: { - assert((this_instr + 4)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 4)); + JitOptRef callable; + callable = stack_pointer[-2 - oparg]; + PyCodeObject *co = sym_get_probable_func_code(callable); if (co == NULL) { ctx->done = true; break; @@ -3013,16 +3001,12 @@ case _INIT_CALL_PY_EXACT_ARGS: { JitOptRef *args; JitOptRef self_or_null; + JitOptRef callable; JitOptRef new_frame; args = &stack_pointer[-oparg]; self_or_null = stack_pointer[-1 - oparg]; + callable = stack_pointer[-2 - oparg]; int argcount = oparg; - assert((this_instr + 2)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 2)); - if (co == NULL) { - ctx->done = true; - break; - } assert(!PyJitRef_IsNull(self_or_null)); assert(args != NULL); if (sym_is_not_null(self_or_null)) { @@ -3030,9 +3014,9 @@ argcount++; } if (sym_is_null(self_or_null) || sym_is_not_null(self_or_null)) { - new_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, args, argcount)); + new_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, callable, 0, args, argcount)); } else { - new_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, NULL, 0)); + new_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, callable, 0, NULL, 0)); } CHECK_STACK_BOUNDS(-1 - oparg); stack_pointer[-2 - oparg] = new_frame; @@ -3053,19 +3037,11 @@ ctx->frame = (_Py_UOpsAbstractFrame *)PyJitRef_Unwrap(new_frame); ctx->curr_frame_depth++; stack_pointer = ctx->frame->stack_pointer; - uint64_t operand = this_instr->operand0; - if (operand == 0) { - ctx->done = true; - break; - } - if (!(operand & 1)) { - PyFunctionObject *func = (PyFunctionObject *)operand; - ctx->frame->func = func; - } if ((this_instr-1)->opcode == _CREATE_INIT_FRAME) { assert((this_instr+1)->opcode == _GUARD_IP__PUSH_FRAME); REPLACE_OP(this_instr+1, _NOP, 0, 0); } + assert(ctx->frame->locals != NULL); break; } @@ -3212,9 +3188,11 @@ case _CREATE_INIT_FRAME: { JitOptRef *args; JitOptRef self; + JitOptRef init; JitOptRef init_frame; args = &stack_pointer[-oparg]; self = stack_pointer[-1 - oparg]; + init = stack_pointer[-2 - oparg]; ctx->frame->stack_pointer = stack_pointer - oparg - 2; _Py_UOpsAbstractFrame *shim = frame_new(ctx, (PyCodeObject *)&_Py_InitCleanup, 0, NULL, 0); if (shim == NULL) { @@ -3226,8 +3204,7 @@ ctx->frame = shim; ctx->curr_frame_depth++; assert((this_instr + 1)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 1)); - init_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, args-1, oparg+1)); + init_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, init, 0, args-1, oparg+1)); CHECK_STACK_BOUNDS(-1 - oparg); stack_pointer[-2 - oparg] = init_frame; stack_pointer += -1 - oparg; @@ -3501,14 +3478,10 @@ /* _DO_CALL_KW is not a viable micro-op for tier 2 */ case _PY_FRAME_KW: { + JitOptRef callable; JitOptRef new_frame; - assert((this_instr + 2)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 2)); - if (co == NULL) { - ctx->done = true; - break; - } - new_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, NULL, 0)); + callable = stack_pointer[-3 - oparg]; + new_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, callable, 0, NULL, 0)); CHECK_STACK_BOUNDS(-2 - oparg); stack_pointer[-3 - oparg] = new_frame; stack_pointer += -2 - oparg; @@ -3553,14 +3526,10 @@ } case _PY_FRAME_EX: { + JitOptRef func_st; JitOptRef ex_frame; - assert((this_instr + 2)->opcode == _PUSH_FRAME); - PyCodeObject *co = get_code_with_logging((this_instr + 2)); - if (co == NULL) { - ctx->done = true; - break; - } - ex_frame = PyJitRef_WrapInvalid(frame_new(ctx, co, 0, NULL, 0)); + func_st = stack_pointer[-4]; + ex_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, func_st, 0, NULL, 0)); CHECK_STACK_BOUNDS(-3); stack_pointer[-4] = ex_frame; stack_pointer += -3; @@ -3602,7 +3571,9 @@ case _RETURN_GENERATOR: { JitOptRef res; ctx->frame->stack_pointer = stack_pointer; - PyCodeObject *returning_code = get_code_with_logging(this_instr); + assert(this_instr[1].opcode == _RECORD_CODE); + PyCodeObject *returning_code = (PyCodeObject *)this_instr[1].operand0; + assert(PyCode_Check(returning_code)); if (returning_code == NULL) { ctx->done = true; break; @@ -4167,6 +4138,10 @@ break; } + case _GUARD_CODE: { + break; + } + case _GUARD_IP__PUSH_FRAME: { break; } @@ -4184,22 +4159,47 @@ } case _RECORD_TOS: { + JitOptRef tos; + tos = stack_pointer[-1]; + sym_set_recorded_value(tos, (PyObject *)this_instr->operand0); break; } case _RECORD_TOS_TYPE: { + JitOptRef tos; + tos = stack_pointer[-1]; + PyTypeObject *tp = (PyTypeObject *)this_instr->operand0; + sym_set_recorded_type(tos, tp); break; } case _RECORD_NOS: { + JitOptRef nos; + nos = stack_pointer[-2]; + sym_set_recorded_value(nos, (PyObject *)this_instr->operand0); + break; + } + + case _RECORD_NOS_GEN_FUNC: { + JitOptRef nos; + nos = stack_pointer[-2]; + PyFunctionObject *func = (PyFunctionObject *)this_instr->operand0; + assert(func == NULL || PyFunction_Check(func)); + sym_set_recorded_gen_func(nos, func); break; } case _RECORD_4OS: { + JitOptRef value; + value = stack_pointer[-4]; + sym_set_recorded_value(value, (PyObject *)this_instr->operand0); break; } case _RECORD_CALLABLE: { + JitOptRef func; + func = stack_pointer[-2 - oparg]; + sym_set_recorded_value(func, (PyObject *)this_instr->operand0); break; } @@ -4207,7 +4207,7 @@ break; } - case _RECORD_CALLER_CODE: { + case _RECORD_CODE: { break; } diff --git a/Python/optimizer_symbols.c b/Python/optimizer_symbols.c index bdf1b860d4e789..e1b389e6a45727 100644 --- a/Python/optimizer_symbols.c +++ b/Python/optimizer_symbols.c @@ -4,6 +4,7 @@ #include "pycore_code.h" #include "pycore_frame.h" +#include "pycore_interpframe.h" #include "pycore_long.h" #include "pycore_optimizer.h" #include "pycore_stats.h" @@ -25,26 +26,26 @@ state represents no information, and the BOTTOM state represents contradictory information. Though symbols logically progress through all intermediate nodes, we often skip in-between states for convenience: - UNKNOWN-------------------+ - | | | -NULL | | -| | | <- Anything below this level is an object. -| NON_NULL-+ | -| | | | <- Anything below this level has a known type version. -| TYPE_VERSION | | -| | | | <- Anything below this level has a known type. -| KNOWN_CLASS | | -| | | | | | PREDICATE -| | | INT* | | | -| | | | | | | <- Anything below this level has a known truthiness. -| | | | | TRUTHINESS | -| | | | | | | -| TUPLE | | | | | -| | | | | | | <- Anything below this level is a known constant. -| KNOWN_VALUE--+----------+ -| | <- Anything below this level is unreachable. + UNKNOWN-------------------+------+ + | | | | +NULL | | RECORDED_VALUE* +| | | | <- Anything below this level is an object. +| NON_NULL-+ | | +| | | | | <- Anything below this level has a known type version. +| TYPE_VERSION | | | +| | | | | <- Anything below this level has a known type. +| KNOWN_CLASS | | | +| | | | | | PREDICATE RECORDED_VALUE(known type) +| | | INT* | | | | +| | | | | | | | <- Anything below this level has a known truthiness. +| TUPLE | | | TRUTHINESS | | +| | | | | | | | <- Anything below this level is a known constant. +| KNOWN_VALUE--+----------+------+ +| | <- Anything below this level is unreachable. BOTTOM + + For example, after guarding that the type of an UNKNOWN local is int, we can narrow the symbol to KNOWN_CLASS (logically progressing though NON_NULL and TYPE_VERSION to get there). Later, we may learn that it is falsey based on the @@ -54,6 +55,7 @@ the same symbol, that would be a contradiction, and the symbol would be set to BOTTOM (indicating that the code is unreachable). INT* is a limited range int, currently a "compact" int. +RECORDED_VALUE* includes RECORDED_TYPE and RECORDED_GEN_FUNC */ @@ -81,7 +83,8 @@ _PyUOpSymPrint(JitOptRef ref) return; } JitOptSymbol *sym = PyJitRef_Unwrap(ref); - switch (sym->tag) { + JitSymType tag = sym->tag; + switch (tag) { case JIT_SYM_UNKNOWN_TAG: printf("", (void *)sym); break; @@ -116,8 +119,17 @@ _PyUOpSymPrint(JitOptRef ref) case JIT_SYM_PREDICATE_TAG: printf("", (void *)sym); break; + case JIT_SYM_RECORDED_VALUE_TAG: + printf("", sym->recorded_value.value); + break; + case JIT_SYM_RECORDED_TYPE_TAG: + printf("", sym->recorded_type.type->tp_name); + break; + case JIT_SYM_RECORDED_GEN_FUNC_TAG: + printf("", (void *)sym); + break; default: - printf("", sym->tag, (void *)sym); + printf("", tag, (void *)sym); break; } } @@ -304,8 +316,26 @@ _Py_uop_sym_set_type(JitOptContext *ctx, JitOptRef ref, PyTypeObject *typ) sym_set_bottom(ctx, sym); } return; + case JIT_SYM_RECORDED_GEN_FUNC_TAG: + if (typ != &PyGen_Type) { + sym_set_bottom(ctx, sym); + } + return; case JIT_SYM_BOTTOM_TAG: return; + case JIT_SYM_RECORDED_VALUE_TAG: + if (Py_TYPE(sym->recorded_value.value) == typ) { + sym->recorded_value.known_type = true; + return; + } + sym->tag = JIT_SYM_KNOWN_CLASS_TAG; + sym->cls.version = 0; + sym->cls.type = typ; + return; + case JIT_SYM_RECORDED_TYPE_TAG: + /* The given value might contradict the recorded one, + * in which case we could return bottom. + * Just discard the recorded value for now */ case JIT_SYM_NON_NULL_TAG: case JIT_SYM_UNKNOWN_TAG: sym->tag = JIT_SYM_KNOWN_CLASS_TAG; @@ -361,6 +391,12 @@ _Py_uop_sym_set_type_version(JitOptContext *ctx, JitOptRef ref, unsigned int ver return false; }; return true; + case JIT_SYM_RECORDED_GEN_FUNC_TAG: + if (PyGen_Type.tp_version_tag != version) { + sym_set_bottom(ctx, sym); + return false; + } + return true; case JIT_SYM_TYPE_VERSION_TAG: if (sym->version.version != version) { sym_set_bottom(ctx, sym); @@ -387,6 +423,29 @@ _Py_uop_sym_set_type_version(JitOptContext *ctx, JitOptRef ref, unsigned int ver return false; } return true; + case JIT_SYM_RECORDED_VALUE_TAG: + if (Py_TYPE(sym->recorded_value.value)->tp_version_tag == version) { + sym->recorded_value.known_type = true; + sym->tag = JIT_SYM_KNOWN_CLASS_TAG; + sym->cls.type = Py_TYPE(sym->recorded_value.value); + sym->cls.version = version; + } + else { + sym->tag = JIT_SYM_TYPE_VERSION_TAG; + sym->version.version = version; + } + return true; + case JIT_SYM_RECORDED_TYPE_TAG: + if (sym->recorded_type.type->tp_version_tag == version) { + sym->tag = JIT_SYM_KNOWN_CLASS_TAG; + sym->cls.type = sym->recorded_type.type; + sym->cls.version = version; + } + else { + sym->tag = JIT_SYM_TYPE_VERSION_TAG; + sym->version.version = version; + } + return true; } Py_UNREACHABLE(); } @@ -398,6 +457,7 @@ _Py_uop_sym_set_const(JitOptContext *ctx, JitOptRef ref, PyObject *const_val) JitSymType tag = sym->tag; switch(tag) { case JIT_SYM_NULL_TAG: + case JIT_SYM_RECORDED_GEN_FUNC_TAG: sym_set_bottom(ctx, sym); return; case JIT_SYM_KNOWN_CLASS_TAG: @@ -437,6 +497,11 @@ _Py_uop_sym_set_const(JitOptContext *ctx, JitOptRef ref, PyObject *const_val) return; case JIT_SYM_BOTTOM_TAG: return; + case JIT_SYM_RECORDED_VALUE_TAG: + case JIT_SYM_RECORDED_TYPE_TAG: + /* The given value might contradict the recorded one, + * in which case we could return bottom. + * Just discard the recorded value for now */ case JIT_SYM_NON_NULL_TAG: case JIT_SYM_UNKNOWN_TAG: make_const(sym, const_val); @@ -592,6 +657,13 @@ _Py_uop_sym_get_type(JitOptRef ref) case JIT_SYM_BOTTOM_TAG: case JIT_SYM_NON_NULL_TAG: case JIT_SYM_UNKNOWN_TAG: + case JIT_SYM_RECORDED_TYPE_TAG: + case JIT_SYM_RECORDED_GEN_FUNC_TAG: + return NULL; + case JIT_SYM_RECORDED_VALUE_TAG: + if (sym->recorded_value.known_type) { + return Py_TYPE(sym->recorded_value.value); + } return NULL; case JIT_SYM_KNOWN_CLASS_TAG: return sym->cls.type; @@ -606,7 +678,6 @@ _Py_uop_sym_get_type(JitOptRef ref) return &PyBool_Type; case JIT_SYM_COMPACT_INT: return &PyLong_Type; - } Py_UNREACHABLE(); } @@ -621,6 +692,8 @@ _Py_uop_sym_get_type_version(JitOptRef ref) case JIT_SYM_BOTTOM_TAG: case JIT_SYM_NON_NULL_TAG: case JIT_SYM_UNKNOWN_TAG: + case JIT_SYM_RECORDED_VALUE_TAG: + case JIT_SYM_RECORDED_TYPE_TAG: return 0; case JIT_SYM_TYPE_VERSION_TAG: return sym->version.version; @@ -635,6 +708,8 @@ _Py_uop_sym_get_type_version(JitOptRef ref) return PyBool_Type.tp_version_tag; case JIT_SYM_COMPACT_INT: return PyLong_Type.tp_version_tag; + case JIT_SYM_RECORDED_GEN_FUNC_TAG: + return PyGen_Type.tp_version_tag; } Py_UNREACHABLE(); } @@ -658,11 +733,69 @@ _Py_uop_sym_matches_type_version(JitOptRef sym, unsigned int version) return _Py_uop_sym_get_type_version(sym) == version; } +PyObject * +_Py_uop_sym_get_probable_value(JitOptRef ref) +{ + JitOptSymbol *sym = PyJitRef_Unwrap(ref); + JitSymType tag = sym->tag; + switch(tag) { + case JIT_SYM_NULL_TAG: + case JIT_SYM_BOTTOM_TAG: + case JIT_SYM_NON_NULL_TAG: + case JIT_SYM_UNKNOWN_TAG: + case JIT_SYM_RECORDED_TYPE_TAG: + case JIT_SYM_TYPE_VERSION_TAG: + case JIT_SYM_TUPLE_TAG: + case JIT_SYM_PREDICATE_TAG: + case JIT_SYM_TRUTHINESS_TAG: + case JIT_SYM_COMPACT_INT: + case JIT_SYM_KNOWN_CLASS_TAG: + case JIT_SYM_RECORDED_GEN_FUNC_TAG: + return NULL; + case JIT_SYM_RECORDED_VALUE_TAG: + return sym->recorded_value.value; + case JIT_SYM_KNOWN_VALUE_TAG: + return sym->value.value; + } + Py_UNREACHABLE(); +} + +PyCodeObject * +_Py_uop_sym_get_probable_func_code(JitOptRef ref) +{ + JitOptSymbol *sym = PyJitRef_Unwrap(ref); + if (sym->tag == JIT_SYM_RECORDED_GEN_FUNC_TAG) { + return (PyCodeObject *)PyFunction_GET_CODE(sym->recorded_gen_func.func); + } + PyObject *obj = _Py_uop_sym_get_probable_value(ref); + if (obj != NULL) { + if (PyFunction_Check(obj)) { + return (PyCodeObject *)PyFunction_GET_CODE(obj); + } + } + return NULL; +} + +PyFunctionObject * +_Py_uop_sym_get_probable_function(JitOptRef ref) +{ + JitOptSymbol *sym = PyJitRef_Unwrap(ref); + if (sym->tag == JIT_SYM_RECORDED_GEN_FUNC_TAG) { + return sym->recorded_gen_func.func; + } + PyObject *obj = _Py_uop_sym_get_probable_value(ref); + if (obj != NULL && PyFunction_Check(obj)) { + return (PyFunctionObject *)obj; + } + return NULL; +} + int _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptRef ref) { JitOptSymbol *sym = PyJitRef_Unwrap(ref); - switch(sym->tag) { + JitSymType tag = sym->tag; + switch (tag) { case JIT_SYM_NULL_TAG: case JIT_SYM_TYPE_VERSION_TAG: case JIT_SYM_BOTTOM_TAG: @@ -670,6 +803,9 @@ _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptRef ref) case JIT_SYM_UNKNOWN_TAG: case JIT_SYM_COMPACT_INT: case JIT_SYM_PREDICATE_TAG: + case JIT_SYM_RECORDED_VALUE_TAG: + case JIT_SYM_RECORDED_TYPE_TAG: + case JIT_SYM_RECORDED_GEN_FUNC_TAG: return -1; case JIT_SYM_KNOWN_CLASS_TAG: /* TODO : @@ -681,7 +817,7 @@ _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptRef ref) case JIT_SYM_TUPLE_TAG: return sym->tuple.length != 0; case JIT_SYM_TRUTHINESS_TAG: - ; + { JitOptSymbol *value = allocation_base(ctx) + sym->truthiness.value; int truthiness = _Py_uop_sym_truthiness(ctx, PyJitRef_Wrap(value)); @@ -691,6 +827,7 @@ _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptRef ref) truthiness ^= sym->truthiness.invert; make_const(sym, truthiness ? Py_True : Py_False); return truthiness; + } } PyObject *value = sym->value.value; /* Only handle a few known safe types */ @@ -801,6 +938,7 @@ _Py_uop_sym_set_compact_int(JitOptContext *ctx, JitOptRef ref) JitSymType tag = sym->tag; switch(tag) { case JIT_SYM_NULL_TAG: + case JIT_SYM_RECORDED_GEN_FUNC_TAG: sym_set_bottom(ctx, sym); return; case JIT_SYM_KNOWN_CLASS_TAG: @@ -832,6 +970,11 @@ _Py_uop_sym_set_compact_int(JitOptContext *ctx, JitOptRef ref) case JIT_SYM_BOTTOM_TAG: case JIT_SYM_COMPACT_INT: return; + case JIT_SYM_RECORDED_VALUE_TAG: + case JIT_SYM_RECORDED_TYPE_TAG: + /* The given value might contradict the recorded one, + * in which case we could return bottom. + * Just discard the recorded value for now */ case JIT_SYM_NON_NULL_TAG: case JIT_SYM_UNKNOWN_TAG: sym->tag = JIT_SYM_COMPACT_INT; @@ -941,6 +1084,210 @@ _Py_uop_sym_new_compact_int(JitOptContext *ctx) return PyJitRef_Wrap(sym); } +void +_Py_uop_sym_set_recorded_value(JitOptContext *ctx, JitOptRef ref, PyObject *value) +{ + // It is possible for value to be NULL due to respecialization + // during execution of the traced instruction. + if (value == NULL) { + return; + } + JitOptSymbol *sym = PyJitRef_Unwrap(ref); + JitSymType tag = sym->tag; + switch(tag) { + case JIT_SYM_NULL_TAG: + sym_set_bottom(ctx, sym); + return; + case JIT_SYM_BOTTOM_TAG: + return; + case JIT_SYM_NON_NULL_TAG: + case JIT_SYM_UNKNOWN_TAG: + sym->tag = JIT_SYM_RECORDED_VALUE_TAG; + sym->recorded_value.known_type = false; + sym->recorded_value.value = value; + return; + case JIT_SYM_RECORDED_VALUE_TAG: + if (sym->recorded_value.value != value) { + sym_set_bottom(ctx, sym); + } + return; + case JIT_SYM_RECORDED_TYPE_TAG: + if (sym->recorded_type.type == Py_TYPE(value)) { + sym->tag = JIT_SYM_RECORDED_VALUE_TAG; + sym->recorded_value.known_type = false; + sym->recorded_value.value = value; + } + else { + sym_set_bottom(ctx, sym); + } + return; + case JIT_SYM_KNOWN_CLASS_TAG: + if (sym->cls.type == Py_TYPE(value)) { + sym->tag = JIT_SYM_RECORDED_VALUE_TAG; + sym->recorded_value.known_type = true; + sym->recorded_value.value = value; + } + return; + case JIT_SYM_KNOWN_VALUE_TAG: + return; + case JIT_SYM_TYPE_VERSION_TAG: + if (sym->version.version == Py_TYPE(value)->tp_version_tag) { + sym->tag = JIT_SYM_RECORDED_VALUE_TAG; + sym->recorded_value.known_type = true; + sym->recorded_value.value = value; + } + return; + // In these cases the original information is more valuable + case JIT_SYM_RECORDED_GEN_FUNC_TAG: + case JIT_SYM_TUPLE_TAG: + case JIT_SYM_PREDICATE_TAG: + case JIT_SYM_TRUTHINESS_TAG: + case JIT_SYM_COMPACT_INT: + return; + } + Py_UNREACHABLE(); +} +void +_Py_uop_sym_set_recorded_gen_func(JitOptContext *ctx, JitOptRef ref, PyFunctionObject *value) +{ + // It is possible for value to be NULL due to respecialization + // during execution of the traced instruction. + if (value == NULL) { + return; + } + assert(!PyJitRef_IsNull(ref)); + JitOptSymbol *sym = PyJitRef_Unwrap(ref); + JitSymType tag = sym->tag; + switch(tag) { + case JIT_SYM_NULL_TAG: + case JIT_SYM_RECORDED_VALUE_TAG: + case JIT_SYM_KNOWN_VALUE_TAG: + case JIT_SYM_TUPLE_TAG: + case JIT_SYM_PREDICATE_TAG: + case JIT_SYM_TRUTHINESS_TAG: + case JIT_SYM_COMPACT_INT: + sym_set_bottom(ctx, sym); + return; + case JIT_SYM_BOTTOM_TAG: + return; + case JIT_SYM_NON_NULL_TAG: + case JIT_SYM_UNKNOWN_TAG: + sym->tag = JIT_SYM_RECORDED_GEN_FUNC_TAG; + sym->recorded_gen_func.func = value; + return; + case JIT_SYM_RECORDED_TYPE_TAG: + if (sym->recorded_type.type == &PyGen_Type) { + sym->tag = JIT_SYM_RECORDED_GEN_FUNC_TAG; + sym->recorded_gen_func.func = value; + } + else { + sym_set_bottom(ctx, sym); + } + return; + case JIT_SYM_KNOWN_CLASS_TAG: + if (sym->cls.type == &PyGen_Type) { + sym->tag = JIT_SYM_RECORDED_GEN_FUNC_TAG; + sym->recorded_gen_func.func = value; + } + return; + case JIT_SYM_TYPE_VERSION_TAG: + if (sym->version.version == PyGen_Type.tp_version_tag) { + sym->tag = JIT_SYM_RECORDED_GEN_FUNC_TAG; + sym->recorded_gen_func.func = value; + } + else { + sym_set_bottom(ctx, sym); + } + return; + case JIT_SYM_RECORDED_GEN_FUNC_TAG: + if (sym->recorded_gen_func.func != value) { + sym_set_bottom(ctx, sym); + } + return; + } + Py_UNREACHABLE(); +} + +void +_Py_uop_sym_set_recorded_type(JitOptContext *ctx, JitOptRef ref, PyTypeObject *type) +{ + // It is possible for type to be NULL due to respecialization + // during execution of the traced instruction. + if (type == NULL) { + return; + } + assert(PyType_Check((PyObject *)type)); + JitOptSymbol *sym = PyJitRef_Unwrap(ref); + JitSymType tag = sym->tag; + switch(tag) { + case JIT_SYM_NULL_TAG: + sym_set_bottom(ctx, sym); + return; + case JIT_SYM_BOTTOM_TAG: + return; + case JIT_SYM_NON_NULL_TAG: + case JIT_SYM_UNKNOWN_TAG: + sym->tag = JIT_SYM_RECORDED_TYPE_TAG; + sym->recorded_type.type = type; + return; + case JIT_SYM_RECORDED_VALUE_TAG: + if (Py_TYPE(sym->recorded_value.value) != type) { + sym_set_bottom(ctx, sym); + } + return; + case JIT_SYM_RECORDED_TYPE_TAG: + if (sym->recorded_type.type != type) { + sym_set_bottom(ctx, sym); + } + return; + case JIT_SYM_KNOWN_CLASS_TAG: + return; + case JIT_SYM_KNOWN_VALUE_TAG: + return; + case JIT_SYM_TYPE_VERSION_TAG: + if (sym->version.version == type->tp_version_tag) { + sym->tag = JIT_SYM_KNOWN_CLASS_TAG; + sym->cls.type = type; + } + return; + // In these cases the original information is more valuable + case JIT_SYM_TUPLE_TAG: + case JIT_SYM_PREDICATE_TAG: + case JIT_SYM_TRUTHINESS_TAG: + case JIT_SYM_COMPACT_INT: + case JIT_SYM_RECORDED_GEN_FUNC_TAG: + return; + } + Py_UNREACHABLE(); +} + +// 0 on success, -1 on error. +_Py_UOpsAbstractFrame * +_Py_uop_frame_new_from_symbol( + JitOptContext *ctx, + JitOptRef callable, + int curr_stackentries, + JitOptRef *args, + int arg_len) +{ + PyCodeObject *co = _Py_uop_sym_get_probable_func_code(callable); + if (co == NULL) { + ctx->done = true; + return NULL; + } + _Py_UOpsAbstractFrame *frame = _Py_uop_frame_new(ctx, co, curr_stackentries, args, arg_len); + if (frame == NULL) { + return NULL; + } + PyFunctionObject *func = _Py_uop_sym_get_probable_function(callable); + if (func != NULL) { + assert(PyFunction_Check(func)); + frame->func = func; + } + assert(frame->stack_pointer != NULL); + return frame; +} + // 0 on success, -1 on error. _Py_UOpsAbstractFrame * _Py_uop_frame_new( @@ -950,6 +1297,7 @@ _Py_uop_frame_new( JitOptRef *args, int arg_len) { + assert(co != NULL); if (ctx->curr_frame_depth >= MAX_ABSTRACT_FRAME_DEPTH) { ctx->done = true; ctx->out_of_space = true; @@ -988,13 +1336,13 @@ _Py_uop_frame_new( frame->locals[i] = local; } - // Initialize the stack as well for (int i = 0; i < curr_stackentries; i++) { JitOptRef stackvar = _Py_uop_sym_new_unknown(ctx); frame->stack[i] = stackvar; } + assert(frame->locals != NULL); return frame; } @@ -1052,6 +1400,7 @@ _Py_uop_frame_pop(JitOptContext *ctx, PyCodeObject *co, int curr_stackentries) if (ctx->curr_frame_depth >= 1) { ctx->frame = &ctx->frames[ctx->curr_frame_depth - 1]; + assert(ctx->frame->locals != NULL); // We returned to the correct code. Nothing to do here. if (co == ctx->frame->code) { @@ -1079,6 +1428,7 @@ _Py_uop_frame_pop(JitOptContext *ctx, PyCodeObject *co, int curr_stackentries) ctx->curr_frame_depth++; ctx->frame = new_frame; + assert(ctx->frame->locals != NULL); return 0; } diff --git a/Python/record_functions.c.h b/Python/record_functions.c.h index ba85ed752d2c96..c6709f9a9d6bec 100644 --- a/Python/record_functions.c.h +++ b/Python/record_functions.c.h @@ -27,6 +27,19 @@ void _PyOpcode_RecordFunction_NOS(_PyInterpreterFrame *frame, _PyStackRef *stack Py_INCREF(*recorded_value); } +void _PyOpcode_RecordFunction_NOS_GEN_FUNC(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) { + _PyStackRef nos; + nos = stack_pointer[-2]; + PyObject *obj = PyStackRef_AsPyObjectBorrow(nos); + if (PyGen_Check(obj)) { + _PyFrame_SetStackPointer(frame, stack_pointer); + PyObject *func = (PyObject *)_PyFrame_GetFunction(&((PyGenObject *)obj)->gi_iframe); + stack_pointer = _PyFrame_GetStackPointer(frame); + *recorded_value = (PyObject *)func; + Py_INCREF(*recorded_value); + } +} + void _PyOpcode_RecordFunction_4OS(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) { _PyStackRef value; value = stack_pointer[-4]; @@ -52,27 +65,21 @@ void _PyOpcode_RecordFunction_BOUND_METHOD(_PyInterpreterFrame *frame, _PyStackR } } -void _PyOpcode_RecordFunction_CALLER_CODE(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) { - _PyInterpreterFrame *caller_frame = frame->previous; - if (caller_frame->owner < FRAME_OWNED_BY_INTERPRETER) { - PyCodeObject *code = _PyFrame_GetCode(frame->previous); - *recorded_value = (PyObject *)code; - Py_INCREF(*recorded_value); - } +void _PyOpcode_RecordFunction_CODE(_PyInterpreterFrame *frame, _PyStackRef *stack_pointer, int oparg, PyObject **recorded_value) { + *recorded_value = (PyObject *)NULL; + Py_INCREF(*recorded_value); } #define _RECORD_TOS_TYPE_INDEX 1 -#define _RECORD_TOS_INDEX 2 -#define _RECORD_CALLER_CODE_INDEX 3 -#define _RECORD_NOS_INDEX 4 -#define _RECORD_CALLABLE_INDEX 5 -#define _RECORD_BOUND_METHOD_INDEX 6 -#define _RECORD_4OS_INDEX 7 +#define _RECORD_NOS_INDEX 2 +#define _RECORD_NOS_GEN_FUNC_INDEX 3 +#define _RECORD_CALLABLE_INDEX 4 +#define _RECORD_BOUND_METHOD_INDEX 5 +#define _RECORD_4OS_INDEX 6 const uint8_t _PyOpcode_RecordFunctionIndices[256] = { [TO_BOOL_ALWAYS_TRUE] = _RECORD_TOS_TYPE_INDEX, - [BINARY_OP_SUBSCR_GETITEM] = _RECORD_TOS_INDEX, - [RETURN_VALUE] = _RECORD_CALLER_CODE_INDEX, - [YIELD_VALUE] = _RECORD_CALLER_CODE_INDEX, + [BINARY_OP_SUBSCR_GETITEM] = _RECORD_NOS_INDEX, + [SEND_GEN] = _RECORD_NOS_GEN_FUNC_INDEX, [LOAD_ATTR_INSTANCE_VALUE] = _RECORD_TOS_TYPE_INDEX, [LOAD_ATTR_WITH_HINT] = _RECORD_TOS_TYPE_INDEX, [LOAD_ATTR_SLOT] = _RECORD_TOS_TYPE_INDEX, @@ -80,7 +87,7 @@ const uint8_t _PyOpcode_RecordFunctionIndices[256] = { [LOAD_ATTR_PROPERTY] = _RECORD_TOS_TYPE_INDEX, [STORE_ATTR_WITH_HINT] = _RECORD_TOS_TYPE_INDEX, [STORE_ATTR_SLOT] = _RECORD_TOS_TYPE_INDEX, - [FOR_ITER_GEN] = _RECORD_NOS_INDEX, + [FOR_ITER_GEN] = _RECORD_NOS_GEN_FUNC_INDEX, [LOAD_ATTR_METHOD_WITH_VALUES] = _RECORD_TOS_TYPE_INDEX, [LOAD_ATTR_METHOD_NO_DICT] = _RECORD_TOS_TYPE_INDEX, [LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES] = _RECORD_TOS_TYPE_INDEX, @@ -100,15 +107,13 @@ const uint8_t _PyOpcode_RecordFunctionIndices[256] = { [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = _RECORD_CALLABLE_INDEX, [CALL_METHOD_DESCRIPTOR_NOARGS] = _RECORD_CALLABLE_INDEX, [CALL_EX_PY] = _RECORD_4OS_INDEX, - [RETURN_GENERATOR] = _RECORD_CALLER_CODE_INDEX, }; -const _Py_RecordFuncPtr _PyOpcode_RecordFunctions[8] = { +const _Py_RecordFuncPtr _PyOpcode_RecordFunctions[7] = { [0] = NULL, [_RECORD_TOS_TYPE_INDEX] = _PyOpcode_RecordFunction_TOS_TYPE, - [_RECORD_TOS_INDEX] = _PyOpcode_RecordFunction_TOS, - [_RECORD_CALLER_CODE_INDEX] = _PyOpcode_RecordFunction_CALLER_CODE, [_RECORD_NOS_INDEX] = _PyOpcode_RecordFunction_NOS, + [_RECORD_NOS_GEN_FUNC_INDEX] = _PyOpcode_RecordFunction_NOS_GEN_FUNC, [_RECORD_CALLABLE_INDEX] = _PyOpcode_RecordFunction_CALLABLE, [_RECORD_BOUND_METHOD_INDEX] = _PyOpcode_RecordFunction_BOUND_METHOD, [_RECORD_4OS_INDEX] = _PyOpcode_RecordFunction_4OS,