- Notifications
You must be signed in to change notification settings - Fork 31.7k
/
Copy pathopcode.h
171 lines (141 loc) · 4.7 KB
/
opcode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#ifndefPy_OPCODE_H
#definePy_OPCODE_H
#ifdef__cplusplus
extern"C" {
#endif
/* Instruction opcodes for compiled code */
#defineSTOP_CODE 0
#definePOP_TOP 1
#defineROT_TWO 2
#defineROT_THREE 3
#defineDUP_TOP 4
#defineROT_FOUR 5
#defineNOP 9
#defineUNARY_POSITIVE 10
#defineUNARY_NEGATIVE 11
#defineUNARY_NOT 12
#defineUNARY_CONVERT 13
#defineUNARY_INVERT 15
#defineBINARY_POWER 19
#defineBINARY_MULTIPLY 20
#defineBINARY_DIVIDE 21
#defineBINARY_MODULO 22
#defineBINARY_ADD 23
#defineBINARY_SUBTRACT 24
#defineBINARY_SUBSCR 25
#defineBINARY_FLOOR_DIVIDE 26
#defineBINARY_TRUE_DIVIDE 27
#defineINPLACE_FLOOR_DIVIDE 28
#defineINPLACE_TRUE_DIVIDE 29
#defineSLICE 30
/* Also uses 31-33 */
#defineSLICE_1 31
#defineSLICE_2 32
#defineSLICE_3 33
#defineSTORE_SLICE 40
/* Also uses 41-43 */
#defineSTORE_SLICE_1 41
#defineSTORE_SLICE_2 42
#defineSTORE_SLICE_3 43
#defineDELETE_SLICE 50
/* Also uses 51-53 */
#defineDELETE_SLICE_1 51
#defineDELETE_SLICE_2 52
#defineDELETE_SLICE_3 53
#defineSTORE_MAP 54
#defineINPLACE_ADD 55
#defineINPLACE_SUBTRACT 56
#defineINPLACE_MULTIPLY 57
#defineINPLACE_DIVIDE 58
#defineINPLACE_MODULO 59
#defineSTORE_SUBSCR 60
#defineDELETE_SUBSCR 61
#defineBINARY_LSHIFT 62
#defineBINARY_RSHIFT 63
#defineBINARY_AND 64
#defineBINARY_XOR 65
#defineBINARY_OR 66
#defineINPLACE_POWER 67
#defineGET_ITER 68
#definePRINT_EXPR 70
#definePRINT_ITEM 71
#definePRINT_NEWLINE 72
#definePRINT_ITEM_TO 73
#definePRINT_NEWLINE_TO 74
#defineINPLACE_LSHIFT 75
#defineINPLACE_RSHIFT 76
#defineINPLACE_AND 77
#defineINPLACE_XOR 78
#defineINPLACE_OR 79
#defineBREAK_LOOP 80
#defineWITH_CLEANUP 81
#defineLOAD_LOCALS 82
#defineRETURN_VALUE 83
#defineIMPORT_STAR 84
#defineEXEC_STMT 85
#defineYIELD_VALUE 86
#definePOP_BLOCK 87
#defineEND_FINALLY 88
#defineBUILD_CLASS 89
#defineHAVE_ARGUMENT 90 /* Opcodes from here have an argument: */
#defineSTORE_NAME 90 /* Index in name list */
#defineDELETE_NAME 91 /* "" */
#defineUNPACK_SEQUENCE 92 /* Number of sequence items */
#defineFOR_ITER 93
#defineLIST_APPEND 94
#defineSTORE_ATTR 95 /* Index in name list */
#defineDELETE_ATTR 96 /* "" */
#defineSTORE_GLOBAL 97 /* "" */
#defineDELETE_GLOBAL 98 /* "" */
#defineDUP_TOPX 99 /* number of items to duplicate */
#defineLOAD_CONST 100 /* Index in const list */
#defineLOAD_NAME 101 /* Index in name list */
#defineBUILD_TUPLE 102 /* Number of tuple items */
#defineBUILD_LIST 103 /* Number of list items */
#defineBUILD_SET 104 /* Number of set items */
#defineBUILD_MAP 105 /* Always zero for now */
#defineLOAD_ATTR 106 /* Index in name list */
#defineCOMPARE_OP 107 /* Comparison operator */
#defineIMPORT_NAME 108 /* Index in name list */
#defineIMPORT_FROM 109 /* Index in name list */
#defineJUMP_FORWARD 110 /* Number of bytes to skip */
#defineJUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning
of code */
#defineJUMP_IF_TRUE_OR_POP 112 /* "" */
#defineJUMP_ABSOLUTE 113 /* "" */
#definePOP_JUMP_IF_FALSE 114 /* "" */
#definePOP_JUMP_IF_TRUE 115 /* "" */
#defineLOAD_GLOBAL 116 /* Index in name list */
#defineCONTINUE_LOOP 119 /* Start of loop (absolute) */
#defineSETUP_LOOP 120 /* Target address (relative) */
#defineSETUP_EXCEPT 121 /* "" */
#defineSETUP_FINALLY 122 /* "" */
#defineLOAD_FAST 124 /* Local variable number */
#defineSTORE_FAST 125 /* Local variable number */
#defineDELETE_FAST 126 /* Local variable number */
#defineRAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */
/* CALL_FUNCTION_XXX opcodes defined below depend on this definition */
#defineCALL_FUNCTION 131 /* #args + (#kwargs<<8) */
#defineMAKE_FUNCTION 132 /* #defaults */
#defineBUILD_SLICE 133 /* Number of items */
#defineMAKE_CLOSURE 134 /* #free vars */
#defineLOAD_CLOSURE 135 /* Load free variable from closure */
#defineLOAD_DEREF 136 /* Load and dereference from closure cell */
#defineSTORE_DEREF 137 /* Store into cell */
/* The next 3 opcodes must be contiguous and satisfy
(CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */
#defineCALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */
#defineCALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */
#defineCALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */
#defineSETUP_WITH 143
/* Support for opargs more than 16 bits long */
#defineEXTENDED_ARG 145
#defineSET_ADD 146
#defineMAP_ADD 147
enumcmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE,
PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD};
#defineHAS_ARG(op) ((op) >= HAVE_ARGUMENT)
#ifdef__cplusplus
}
#endif
#endif/* !Py_OPCODE_H */