mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
GH-120507: Lower the BEFORE_WITH and BEFORE_ASYNC_WITH instructions. (#120640)
* Remove BEFORE_WITH and BEFORE_ASYNC_WITH instructions. * Add LOAD_SPECIAL instruction * Reimplement `with` and `async with` statements using LOAD_SPECIAL
This commit is contained in:
parent
73dc1c678e
commit
9cefcc0ee7
22 changed files with 663 additions and 651 deletions
233
Include/opcode_ids.h
generated
233
Include/opcode_ids.h
generated
|
|
@ -11,124 +11,123 @@ extern "C" {
|
|||
|
||||
/* Instruction opcodes for compiled code */
|
||||
#define CACHE 0
|
||||
#define BEFORE_ASYNC_WITH 1
|
||||
#define BEFORE_WITH 2
|
||||
#define BINARY_SLICE 1
|
||||
#define BINARY_SUBSCR 2
|
||||
#define BINARY_OP_INPLACE_ADD_UNICODE 3
|
||||
#define BINARY_SLICE 4
|
||||
#define BINARY_SUBSCR 5
|
||||
#define CHECK_EG_MATCH 6
|
||||
#define CHECK_EXC_MATCH 7
|
||||
#define CLEANUP_THROW 8
|
||||
#define DELETE_SUBSCR 9
|
||||
#define END_ASYNC_FOR 10
|
||||
#define END_FOR 11
|
||||
#define END_SEND 12
|
||||
#define EXIT_INIT_CHECK 13
|
||||
#define FORMAT_SIMPLE 14
|
||||
#define FORMAT_WITH_SPEC 15
|
||||
#define GET_AITER 16
|
||||
#define CHECK_EG_MATCH 4
|
||||
#define CHECK_EXC_MATCH 5
|
||||
#define CLEANUP_THROW 6
|
||||
#define DELETE_SUBSCR 7
|
||||
#define END_ASYNC_FOR 8
|
||||
#define END_FOR 9
|
||||
#define END_SEND 10
|
||||
#define EXIT_INIT_CHECK 11
|
||||
#define FORMAT_SIMPLE 12
|
||||
#define FORMAT_WITH_SPEC 13
|
||||
#define GET_AITER 14
|
||||
#define GET_ANEXT 15
|
||||
#define GET_ITER 16
|
||||
#define RESERVED 17
|
||||
#define GET_ANEXT 18
|
||||
#define GET_ITER 19
|
||||
#define GET_LEN 20
|
||||
#define GET_YIELD_FROM_ITER 21
|
||||
#define INTERPRETER_EXIT 22
|
||||
#define LOAD_BUILD_CLASS 23
|
||||
#define LOAD_LOCALS 24
|
||||
#define MAKE_FUNCTION 25
|
||||
#define MATCH_KEYS 26
|
||||
#define MATCH_MAPPING 27
|
||||
#define MATCH_SEQUENCE 28
|
||||
#define NOP 29
|
||||
#define POP_EXCEPT 30
|
||||
#define POP_TOP 31
|
||||
#define PUSH_EXC_INFO 32
|
||||
#define PUSH_NULL 33
|
||||
#define RETURN_GENERATOR 34
|
||||
#define RETURN_VALUE 35
|
||||
#define SETUP_ANNOTATIONS 36
|
||||
#define STORE_SLICE 37
|
||||
#define STORE_SUBSCR 38
|
||||
#define TO_BOOL 39
|
||||
#define UNARY_INVERT 40
|
||||
#define UNARY_NEGATIVE 41
|
||||
#define UNARY_NOT 42
|
||||
#define WITH_EXCEPT_START 43
|
||||
#define BINARY_OP 44
|
||||
#define BUILD_CONST_KEY_MAP 45
|
||||
#define BUILD_LIST 46
|
||||
#define BUILD_MAP 47
|
||||
#define BUILD_SET 48
|
||||
#define BUILD_SLICE 49
|
||||
#define BUILD_STRING 50
|
||||
#define BUILD_TUPLE 51
|
||||
#define CALL 52
|
||||
#define CALL_FUNCTION_EX 53
|
||||
#define CALL_INTRINSIC_1 54
|
||||
#define CALL_INTRINSIC_2 55
|
||||
#define CALL_KW 56
|
||||
#define COMPARE_OP 57
|
||||
#define CONTAINS_OP 58
|
||||
#define CONVERT_VALUE 59
|
||||
#define COPY 60
|
||||
#define COPY_FREE_VARS 61
|
||||
#define DELETE_ATTR 62
|
||||
#define DELETE_DEREF 63
|
||||
#define DELETE_FAST 64
|
||||
#define DELETE_GLOBAL 65
|
||||
#define DELETE_NAME 66
|
||||
#define DICT_MERGE 67
|
||||
#define DICT_UPDATE 68
|
||||
#define ENTER_EXECUTOR 69
|
||||
#define EXTENDED_ARG 70
|
||||
#define FOR_ITER 71
|
||||
#define GET_AWAITABLE 72
|
||||
#define IMPORT_FROM 73
|
||||
#define IMPORT_NAME 74
|
||||
#define IS_OP 75
|
||||
#define JUMP_BACKWARD 76
|
||||
#define JUMP_BACKWARD_NO_INTERRUPT 77
|
||||
#define JUMP_FORWARD 78
|
||||
#define LIST_APPEND 79
|
||||
#define LIST_EXTEND 80
|
||||
#define LOAD_ATTR 81
|
||||
#define LOAD_COMMON_CONSTANT 82
|
||||
#define LOAD_CONST 83
|
||||
#define LOAD_DEREF 84
|
||||
#define LOAD_FAST 85
|
||||
#define LOAD_FAST_AND_CLEAR 86
|
||||
#define LOAD_FAST_CHECK 87
|
||||
#define LOAD_FAST_LOAD_FAST 88
|
||||
#define LOAD_FROM_DICT_OR_DEREF 89
|
||||
#define LOAD_FROM_DICT_OR_GLOBALS 90
|
||||
#define LOAD_GLOBAL 91
|
||||
#define LOAD_NAME 92
|
||||
#define LOAD_SUPER_ATTR 93
|
||||
#define MAKE_CELL 94
|
||||
#define MAP_ADD 95
|
||||
#define MATCH_CLASS 96
|
||||
#define POP_JUMP_IF_FALSE 97
|
||||
#define POP_JUMP_IF_NONE 98
|
||||
#define POP_JUMP_IF_NOT_NONE 99
|
||||
#define POP_JUMP_IF_TRUE 100
|
||||
#define RAISE_VARARGS 101
|
||||
#define RERAISE 102
|
||||
#define RETURN_CONST 103
|
||||
#define SEND 104
|
||||
#define SET_ADD 105
|
||||
#define SET_FUNCTION_ATTRIBUTE 106
|
||||
#define SET_UPDATE 107
|
||||
#define STORE_ATTR 108
|
||||
#define STORE_DEREF 109
|
||||
#define STORE_FAST 110
|
||||
#define STORE_FAST_LOAD_FAST 111
|
||||
#define STORE_FAST_STORE_FAST 112
|
||||
#define STORE_GLOBAL 113
|
||||
#define STORE_NAME 114
|
||||
#define SWAP 115
|
||||
#define UNPACK_EX 116
|
||||
#define UNPACK_SEQUENCE 117
|
||||
#define YIELD_VALUE 118
|
||||
#define GET_LEN 18
|
||||
#define GET_YIELD_FROM_ITER 19
|
||||
#define INTERPRETER_EXIT 20
|
||||
#define LOAD_BUILD_CLASS 21
|
||||
#define LOAD_LOCALS 22
|
||||
#define MAKE_FUNCTION 23
|
||||
#define MATCH_KEYS 24
|
||||
#define MATCH_MAPPING 25
|
||||
#define MATCH_SEQUENCE 26
|
||||
#define NOP 27
|
||||
#define POP_EXCEPT 28
|
||||
#define POP_TOP 29
|
||||
#define PUSH_EXC_INFO 30
|
||||
#define PUSH_NULL 31
|
||||
#define RETURN_GENERATOR 32
|
||||
#define RETURN_VALUE 33
|
||||
#define SETUP_ANNOTATIONS 34
|
||||
#define STORE_SLICE 35
|
||||
#define STORE_SUBSCR 36
|
||||
#define TO_BOOL 37
|
||||
#define UNARY_INVERT 38
|
||||
#define UNARY_NEGATIVE 39
|
||||
#define UNARY_NOT 40
|
||||
#define WITH_EXCEPT_START 41
|
||||
#define BINARY_OP 42
|
||||
#define BUILD_CONST_KEY_MAP 43
|
||||
#define BUILD_LIST 44
|
||||
#define BUILD_MAP 45
|
||||
#define BUILD_SET 46
|
||||
#define BUILD_SLICE 47
|
||||
#define BUILD_STRING 48
|
||||
#define BUILD_TUPLE 49
|
||||
#define CALL 50
|
||||
#define CALL_FUNCTION_EX 51
|
||||
#define CALL_INTRINSIC_1 52
|
||||
#define CALL_INTRINSIC_2 53
|
||||
#define CALL_KW 54
|
||||
#define COMPARE_OP 55
|
||||
#define CONTAINS_OP 56
|
||||
#define CONVERT_VALUE 57
|
||||
#define COPY 58
|
||||
#define COPY_FREE_VARS 59
|
||||
#define DELETE_ATTR 60
|
||||
#define DELETE_DEREF 61
|
||||
#define DELETE_FAST 62
|
||||
#define DELETE_GLOBAL 63
|
||||
#define DELETE_NAME 64
|
||||
#define DICT_MERGE 65
|
||||
#define DICT_UPDATE 66
|
||||
#define ENTER_EXECUTOR 67
|
||||
#define EXTENDED_ARG 68
|
||||
#define FOR_ITER 69
|
||||
#define GET_AWAITABLE 70
|
||||
#define IMPORT_FROM 71
|
||||
#define IMPORT_NAME 72
|
||||
#define IS_OP 73
|
||||
#define JUMP_BACKWARD 74
|
||||
#define JUMP_BACKWARD_NO_INTERRUPT 75
|
||||
#define JUMP_FORWARD 76
|
||||
#define LIST_APPEND 77
|
||||
#define LIST_EXTEND 78
|
||||
#define LOAD_ATTR 79
|
||||
#define LOAD_COMMON_CONSTANT 80
|
||||
#define LOAD_CONST 81
|
||||
#define LOAD_DEREF 82
|
||||
#define LOAD_FAST 83
|
||||
#define LOAD_FAST_AND_CLEAR 84
|
||||
#define LOAD_FAST_CHECK 85
|
||||
#define LOAD_FAST_LOAD_FAST 86
|
||||
#define LOAD_FROM_DICT_OR_DEREF 87
|
||||
#define LOAD_FROM_DICT_OR_GLOBALS 88
|
||||
#define LOAD_GLOBAL 89
|
||||
#define LOAD_NAME 90
|
||||
#define LOAD_SPECIAL 91
|
||||
#define LOAD_SUPER_ATTR 92
|
||||
#define MAKE_CELL 93
|
||||
#define MAP_ADD 94
|
||||
#define MATCH_CLASS 95
|
||||
#define POP_JUMP_IF_FALSE 96
|
||||
#define POP_JUMP_IF_NONE 97
|
||||
#define POP_JUMP_IF_NOT_NONE 98
|
||||
#define POP_JUMP_IF_TRUE 99
|
||||
#define RAISE_VARARGS 100
|
||||
#define RERAISE 101
|
||||
#define RETURN_CONST 102
|
||||
#define SEND 103
|
||||
#define SET_ADD 104
|
||||
#define SET_FUNCTION_ATTRIBUTE 105
|
||||
#define SET_UPDATE 106
|
||||
#define STORE_ATTR 107
|
||||
#define STORE_DEREF 108
|
||||
#define STORE_FAST 109
|
||||
#define STORE_FAST_LOAD_FAST 110
|
||||
#define STORE_FAST_STORE_FAST 111
|
||||
#define STORE_GLOBAL 112
|
||||
#define STORE_NAME 113
|
||||
#define SWAP 114
|
||||
#define UNPACK_EX 115
|
||||
#define UNPACK_SEQUENCE 116
|
||||
#define YIELD_VALUE 117
|
||||
#define RESUME 149
|
||||
#define BINARY_OP_ADD_FLOAT 150
|
||||
#define BINARY_OP_ADD_INT 151
|
||||
|
|
@ -231,7 +230,7 @@ extern "C" {
|
|||
#define SETUP_WITH 262
|
||||
#define STORE_FAST_MAYBE_NULL 263
|
||||
|
||||
#define HAVE_ARGUMENT 43
|
||||
#define HAVE_ARGUMENT 41
|
||||
#define MIN_INSTRUMENTED_OPCODE 236
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue