xref: /aosp_15_r20/prebuilts/build-tools/common/py3-stdlib/opcode.py (revision cda5da8d549138a6648c5ee6d7a49cf8f4a657be)
1*cda5da8dSAndroid Build Coastguard Worker
2*cda5da8dSAndroid Build Coastguard Worker"""
3*cda5da8dSAndroid Build Coastguard Workeropcode module - potentially shared between dis and other modules which
4*cda5da8dSAndroid Build Coastguard Workeroperate on bytecodes (e.g. peephole optimizers).
5*cda5da8dSAndroid Build Coastguard Worker"""
6*cda5da8dSAndroid Build Coastguard Worker
7*cda5da8dSAndroid Build Coastguard Worker__all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs",
8*cda5da8dSAndroid Build Coastguard Worker           "haslocal", "hascompare", "hasfree", "opname", "opmap",
9*cda5da8dSAndroid Build Coastguard Worker           "HAVE_ARGUMENT", "EXTENDED_ARG", "hasnargs"]
10*cda5da8dSAndroid Build Coastguard Worker
11*cda5da8dSAndroid Build Coastguard Worker# It's a chicken-and-egg I'm afraid:
12*cda5da8dSAndroid Build Coastguard Worker# We're imported before _opcode's made.
13*cda5da8dSAndroid Build Coastguard Worker# With exception unheeded
14*cda5da8dSAndroid Build Coastguard Worker# (stack_effect is not needed)
15*cda5da8dSAndroid Build Coastguard Worker# Both our chickens and eggs are allayed.
16*cda5da8dSAndroid Build Coastguard Worker#     --Larry Hastings, 2013/11/23
17*cda5da8dSAndroid Build Coastguard Worker
18*cda5da8dSAndroid Build Coastguard Workertry:
19*cda5da8dSAndroid Build Coastguard Worker    from _opcode import stack_effect
20*cda5da8dSAndroid Build Coastguard Worker    __all__.append('stack_effect')
21*cda5da8dSAndroid Build Coastguard Workerexcept ImportError:
22*cda5da8dSAndroid Build Coastguard Worker    pass
23*cda5da8dSAndroid Build Coastguard Worker
24*cda5da8dSAndroid Build Coastguard Workercmp_op = ('<', '<=', '==', '!=', '>', '>=')
25*cda5da8dSAndroid Build Coastguard Worker
26*cda5da8dSAndroid Build Coastguard Workerhasconst = []
27*cda5da8dSAndroid Build Coastguard Workerhasname = []
28*cda5da8dSAndroid Build Coastguard Workerhasjrel = []
29*cda5da8dSAndroid Build Coastguard Workerhasjabs = []
30*cda5da8dSAndroid Build Coastguard Workerhaslocal = []
31*cda5da8dSAndroid Build Coastguard Workerhascompare = []
32*cda5da8dSAndroid Build Coastguard Workerhasfree = []
33*cda5da8dSAndroid Build Coastguard Workerhasnargs = [] # unused
34*cda5da8dSAndroid Build Coastguard Worker
35*cda5da8dSAndroid Build Coastguard Workeropmap = {}
36*cda5da8dSAndroid Build Coastguard Workeropname = ['<%r>' % (op,) for op in range(256)]
37*cda5da8dSAndroid Build Coastguard Worker
38*cda5da8dSAndroid Build Coastguard Workerdef def_op(name, op):
39*cda5da8dSAndroid Build Coastguard Worker    opname[op] = name
40*cda5da8dSAndroid Build Coastguard Worker    opmap[name] = op
41*cda5da8dSAndroid Build Coastguard Worker
42*cda5da8dSAndroid Build Coastguard Workerdef name_op(name, op):
43*cda5da8dSAndroid Build Coastguard Worker    def_op(name, op)
44*cda5da8dSAndroid Build Coastguard Worker    hasname.append(op)
45*cda5da8dSAndroid Build Coastguard Worker
46*cda5da8dSAndroid Build Coastguard Workerdef jrel_op(name, op):
47*cda5da8dSAndroid Build Coastguard Worker    def_op(name, op)
48*cda5da8dSAndroid Build Coastguard Worker    hasjrel.append(op)
49*cda5da8dSAndroid Build Coastguard Worker
50*cda5da8dSAndroid Build Coastguard Workerdef jabs_op(name, op):
51*cda5da8dSAndroid Build Coastguard Worker    def_op(name, op)
52*cda5da8dSAndroid Build Coastguard Worker    hasjabs.append(op)
53*cda5da8dSAndroid Build Coastguard Worker
54*cda5da8dSAndroid Build Coastguard Worker# Instruction opcodes for compiled code
55*cda5da8dSAndroid Build Coastguard Worker# Blank lines correspond to available opcodes
56*cda5da8dSAndroid Build Coastguard Worker
57*cda5da8dSAndroid Build Coastguard Workerdef_op('CACHE', 0)
58*cda5da8dSAndroid Build Coastguard Workerdef_op('POP_TOP', 1)
59*cda5da8dSAndroid Build Coastguard Workerdef_op('PUSH_NULL', 2)
60*cda5da8dSAndroid Build Coastguard Worker
61*cda5da8dSAndroid Build Coastguard Workerdef_op('NOP', 9)
62*cda5da8dSAndroid Build Coastguard Workerdef_op('UNARY_POSITIVE', 10)
63*cda5da8dSAndroid Build Coastguard Workerdef_op('UNARY_NEGATIVE', 11)
64*cda5da8dSAndroid Build Coastguard Workerdef_op('UNARY_NOT', 12)
65*cda5da8dSAndroid Build Coastguard Worker
66*cda5da8dSAndroid Build Coastguard Workerdef_op('UNARY_INVERT', 15)
67*cda5da8dSAndroid Build Coastguard Worker
68*cda5da8dSAndroid Build Coastguard Workerdef_op('BINARY_SUBSCR', 25)
69*cda5da8dSAndroid Build Coastguard Worker
70*cda5da8dSAndroid Build Coastguard Workerdef_op('GET_LEN', 30)
71*cda5da8dSAndroid Build Coastguard Workerdef_op('MATCH_MAPPING', 31)
72*cda5da8dSAndroid Build Coastguard Workerdef_op('MATCH_SEQUENCE', 32)
73*cda5da8dSAndroid Build Coastguard Workerdef_op('MATCH_KEYS', 33)
74*cda5da8dSAndroid Build Coastguard Worker
75*cda5da8dSAndroid Build Coastguard Workerdef_op('PUSH_EXC_INFO', 35)
76*cda5da8dSAndroid Build Coastguard Workerdef_op('CHECK_EXC_MATCH', 36)
77*cda5da8dSAndroid Build Coastguard Workerdef_op('CHECK_EG_MATCH', 37)
78*cda5da8dSAndroid Build Coastguard Worker
79*cda5da8dSAndroid Build Coastguard Workerdef_op('WITH_EXCEPT_START', 49)
80*cda5da8dSAndroid Build Coastguard Workerdef_op('GET_AITER', 50)
81*cda5da8dSAndroid Build Coastguard Workerdef_op('GET_ANEXT', 51)
82*cda5da8dSAndroid Build Coastguard Workerdef_op('BEFORE_ASYNC_WITH', 52)
83*cda5da8dSAndroid Build Coastguard Workerdef_op('BEFORE_WITH', 53)
84*cda5da8dSAndroid Build Coastguard Workerdef_op('END_ASYNC_FOR', 54)
85*cda5da8dSAndroid Build Coastguard Worker
86*cda5da8dSAndroid Build Coastguard Workerdef_op('STORE_SUBSCR', 60)
87*cda5da8dSAndroid Build Coastguard Workerdef_op('DELETE_SUBSCR', 61)
88*cda5da8dSAndroid Build Coastguard Worker
89*cda5da8dSAndroid Build Coastguard Workerdef_op('GET_ITER', 68)
90*cda5da8dSAndroid Build Coastguard Workerdef_op('GET_YIELD_FROM_ITER', 69)
91*cda5da8dSAndroid Build Coastguard Workerdef_op('PRINT_EXPR', 70)
92*cda5da8dSAndroid Build Coastguard Workerdef_op('LOAD_BUILD_CLASS', 71)
93*cda5da8dSAndroid Build Coastguard Worker
94*cda5da8dSAndroid Build Coastguard Workerdef_op('LOAD_ASSERTION_ERROR', 74)
95*cda5da8dSAndroid Build Coastguard Workerdef_op('RETURN_GENERATOR', 75)
96*cda5da8dSAndroid Build Coastguard Worker
97*cda5da8dSAndroid Build Coastguard Workerdef_op('LIST_TO_TUPLE', 82)
98*cda5da8dSAndroid Build Coastguard Workerdef_op('RETURN_VALUE', 83)
99*cda5da8dSAndroid Build Coastguard Workerdef_op('IMPORT_STAR', 84)
100*cda5da8dSAndroid Build Coastguard Workerdef_op('SETUP_ANNOTATIONS', 85)
101*cda5da8dSAndroid Build Coastguard Workerdef_op('YIELD_VALUE', 86)
102*cda5da8dSAndroid Build Coastguard Workerdef_op('ASYNC_GEN_WRAP', 87)
103*cda5da8dSAndroid Build Coastguard Workerdef_op('PREP_RERAISE_STAR', 88)
104*cda5da8dSAndroid Build Coastguard Workerdef_op('POP_EXCEPT', 89)
105*cda5da8dSAndroid Build Coastguard Worker
106*cda5da8dSAndroid Build Coastguard WorkerHAVE_ARGUMENT = 90              # Opcodes from here have an argument:
107*cda5da8dSAndroid Build Coastguard Worker
108*cda5da8dSAndroid Build Coastguard Workername_op('STORE_NAME', 90)       # Index in name list
109*cda5da8dSAndroid Build Coastguard Workername_op('DELETE_NAME', 91)      # ""
110*cda5da8dSAndroid Build Coastguard Workerdef_op('UNPACK_SEQUENCE', 92)   # Number of tuple items
111*cda5da8dSAndroid Build Coastguard Workerjrel_op('FOR_ITER', 93)
112*cda5da8dSAndroid Build Coastguard Workerdef_op('UNPACK_EX', 94)
113*cda5da8dSAndroid Build Coastguard Workername_op('STORE_ATTR', 95)       # Index in name list
114*cda5da8dSAndroid Build Coastguard Workername_op('DELETE_ATTR', 96)      # ""
115*cda5da8dSAndroid Build Coastguard Workername_op('STORE_GLOBAL', 97)     # ""
116*cda5da8dSAndroid Build Coastguard Workername_op('DELETE_GLOBAL', 98)    # ""
117*cda5da8dSAndroid Build Coastguard Workerdef_op('SWAP', 99)
118*cda5da8dSAndroid Build Coastguard Workerdef_op('LOAD_CONST', 100)       # Index in const list
119*cda5da8dSAndroid Build Coastguard Workerhasconst.append(100)
120*cda5da8dSAndroid Build Coastguard Workername_op('LOAD_NAME', 101)       # Index in name list
121*cda5da8dSAndroid Build Coastguard Workerdef_op('BUILD_TUPLE', 102)      # Number of tuple items
122*cda5da8dSAndroid Build Coastguard Workerdef_op('BUILD_LIST', 103)       # Number of list items
123*cda5da8dSAndroid Build Coastguard Workerdef_op('BUILD_SET', 104)        # Number of set items
124*cda5da8dSAndroid Build Coastguard Workerdef_op('BUILD_MAP', 105)        # Number of dict entries
125*cda5da8dSAndroid Build Coastguard Workername_op('LOAD_ATTR', 106)       # Index in name list
126*cda5da8dSAndroid Build Coastguard Workerdef_op('COMPARE_OP', 107)       # Comparison operator
127*cda5da8dSAndroid Build Coastguard Workerhascompare.append(107)
128*cda5da8dSAndroid Build Coastguard Workername_op('IMPORT_NAME', 108)     # Index in name list
129*cda5da8dSAndroid Build Coastguard Workername_op('IMPORT_FROM', 109)     # Index in name list
130*cda5da8dSAndroid Build Coastguard Workerjrel_op('JUMP_FORWARD', 110)    # Number of words to skip
131*cda5da8dSAndroid Build Coastguard Workerjrel_op('JUMP_IF_FALSE_OR_POP', 111) # Number of words to skip
132*cda5da8dSAndroid Build Coastguard Workerjrel_op('JUMP_IF_TRUE_OR_POP', 112)  # ""
133*cda5da8dSAndroid Build Coastguard Workerjrel_op('POP_JUMP_FORWARD_IF_FALSE', 114)
134*cda5da8dSAndroid Build Coastguard Workerjrel_op('POP_JUMP_FORWARD_IF_TRUE', 115)
135*cda5da8dSAndroid Build Coastguard Workername_op('LOAD_GLOBAL', 116)     # Index in name list
136*cda5da8dSAndroid Build Coastguard Workerdef_op('IS_OP', 117)
137*cda5da8dSAndroid Build Coastguard Workerdef_op('CONTAINS_OP', 118)
138*cda5da8dSAndroid Build Coastguard Workerdef_op('RERAISE', 119)
139*cda5da8dSAndroid Build Coastguard Workerdef_op('COPY', 120)
140*cda5da8dSAndroid Build Coastguard Workerdef_op('BINARY_OP', 122)
141*cda5da8dSAndroid Build Coastguard Workerjrel_op('SEND', 123) # Number of bytes to skip
142*cda5da8dSAndroid Build Coastguard Workerdef_op('LOAD_FAST', 124)        # Local variable number
143*cda5da8dSAndroid Build Coastguard Workerhaslocal.append(124)
144*cda5da8dSAndroid Build Coastguard Workerdef_op('STORE_FAST', 125)       # Local variable number
145*cda5da8dSAndroid Build Coastguard Workerhaslocal.append(125)
146*cda5da8dSAndroid Build Coastguard Workerdef_op('DELETE_FAST', 126)      # Local variable number
147*cda5da8dSAndroid Build Coastguard Workerhaslocal.append(126)
148*cda5da8dSAndroid Build Coastguard Workerjrel_op('POP_JUMP_FORWARD_IF_NOT_NONE', 128)
149*cda5da8dSAndroid Build Coastguard Workerjrel_op('POP_JUMP_FORWARD_IF_NONE', 129)
150*cda5da8dSAndroid Build Coastguard Workerdef_op('RAISE_VARARGS', 130)    # Number of raise arguments (1, 2, or 3)
151*cda5da8dSAndroid Build Coastguard Workerdef_op('GET_AWAITABLE', 131)
152*cda5da8dSAndroid Build Coastguard Workerdef_op('MAKE_FUNCTION', 132)    # Flags
153*cda5da8dSAndroid Build Coastguard Workerdef_op('BUILD_SLICE', 133)      # Number of items
154*cda5da8dSAndroid Build Coastguard Workerjrel_op('JUMP_BACKWARD_NO_INTERRUPT', 134) # Number of words to skip (backwards)
155*cda5da8dSAndroid Build Coastguard Workerdef_op('MAKE_CELL', 135)
156*cda5da8dSAndroid Build Coastguard Workerhasfree.append(135)
157*cda5da8dSAndroid Build Coastguard Workerdef_op('LOAD_CLOSURE', 136)
158*cda5da8dSAndroid Build Coastguard Workerhasfree.append(136)
159*cda5da8dSAndroid Build Coastguard Workerdef_op('LOAD_DEREF', 137)
160*cda5da8dSAndroid Build Coastguard Workerhasfree.append(137)
161*cda5da8dSAndroid Build Coastguard Workerdef_op('STORE_DEREF', 138)
162*cda5da8dSAndroid Build Coastguard Workerhasfree.append(138)
163*cda5da8dSAndroid Build Coastguard Workerdef_op('DELETE_DEREF', 139)
164*cda5da8dSAndroid Build Coastguard Workerhasfree.append(139)
165*cda5da8dSAndroid Build Coastguard Workerjrel_op('JUMP_BACKWARD', 140)    # Number of words to skip (backwards)
166*cda5da8dSAndroid Build Coastguard Worker
167*cda5da8dSAndroid Build Coastguard Workerdef_op('CALL_FUNCTION_EX', 142)  # Flags
168*cda5da8dSAndroid Build Coastguard Worker
169*cda5da8dSAndroid Build Coastguard Workerdef_op('EXTENDED_ARG', 144)
170*cda5da8dSAndroid Build Coastguard WorkerEXTENDED_ARG = 144
171*cda5da8dSAndroid Build Coastguard Workerdef_op('LIST_APPEND', 145)
172*cda5da8dSAndroid Build Coastguard Workerdef_op('SET_ADD', 146)
173*cda5da8dSAndroid Build Coastguard Workerdef_op('MAP_ADD', 147)
174*cda5da8dSAndroid Build Coastguard Workerdef_op('LOAD_CLASSDEREF', 148)
175*cda5da8dSAndroid Build Coastguard Workerhasfree.append(148)
176*cda5da8dSAndroid Build Coastguard Workerdef_op('COPY_FREE_VARS', 149)
177*cda5da8dSAndroid Build Coastguard Worker
178*cda5da8dSAndroid Build Coastguard Workerdef_op('RESUME', 151)   # This must be kept in sync with deepfreeze.py
179*cda5da8dSAndroid Build Coastguard Workerdef_op('MATCH_CLASS', 152)
180*cda5da8dSAndroid Build Coastguard Worker
181*cda5da8dSAndroid Build Coastguard Workerdef_op('FORMAT_VALUE', 155)
182*cda5da8dSAndroid Build Coastguard Workerdef_op('BUILD_CONST_KEY_MAP', 156)
183*cda5da8dSAndroid Build Coastguard Workerdef_op('BUILD_STRING', 157)
184*cda5da8dSAndroid Build Coastguard Worker
185*cda5da8dSAndroid Build Coastguard Workername_op('LOAD_METHOD', 160)
186*cda5da8dSAndroid Build Coastguard Worker
187*cda5da8dSAndroid Build Coastguard Workerdef_op('LIST_EXTEND', 162)
188*cda5da8dSAndroid Build Coastguard Workerdef_op('SET_UPDATE', 163)
189*cda5da8dSAndroid Build Coastguard Workerdef_op('DICT_MERGE', 164)
190*cda5da8dSAndroid Build Coastguard Workerdef_op('DICT_UPDATE', 165)
191*cda5da8dSAndroid Build Coastguard Workerdef_op('PRECALL', 166)
192*cda5da8dSAndroid Build Coastguard Worker
193*cda5da8dSAndroid Build Coastguard Workerdef_op('CALL', 171)
194*cda5da8dSAndroid Build Coastguard Workerdef_op('KW_NAMES', 172)
195*cda5da8dSAndroid Build Coastguard Workerhasconst.append(172)
196*cda5da8dSAndroid Build Coastguard Worker
197*cda5da8dSAndroid Build Coastguard Workerjrel_op('POP_JUMP_BACKWARD_IF_NOT_NONE', 173)
198*cda5da8dSAndroid Build Coastguard Workerjrel_op('POP_JUMP_BACKWARD_IF_NONE', 174)
199*cda5da8dSAndroid Build Coastguard Workerjrel_op('POP_JUMP_BACKWARD_IF_FALSE', 175)
200*cda5da8dSAndroid Build Coastguard Workerjrel_op('POP_JUMP_BACKWARD_IF_TRUE', 176)
201*cda5da8dSAndroid Build Coastguard Worker
202*cda5da8dSAndroid Build Coastguard Worker
203*cda5da8dSAndroid Build Coastguard Workerdel def_op, name_op, jrel_op, jabs_op
204*cda5da8dSAndroid Build Coastguard Worker
205*cda5da8dSAndroid Build Coastguard Worker_nb_ops = [
206*cda5da8dSAndroid Build Coastguard Worker    ("NB_ADD", "+"),
207*cda5da8dSAndroid Build Coastguard Worker    ("NB_AND", "&"),
208*cda5da8dSAndroid Build Coastguard Worker    ("NB_FLOOR_DIVIDE", "//"),
209*cda5da8dSAndroid Build Coastguard Worker    ("NB_LSHIFT", "<<"),
210*cda5da8dSAndroid Build Coastguard Worker    ("NB_MATRIX_MULTIPLY", "@"),
211*cda5da8dSAndroid Build Coastguard Worker    ("NB_MULTIPLY", "*"),
212*cda5da8dSAndroid Build Coastguard Worker    ("NB_REMAINDER", "%"),
213*cda5da8dSAndroid Build Coastguard Worker    ("NB_OR", "|"),
214*cda5da8dSAndroid Build Coastguard Worker    ("NB_POWER", "**"),
215*cda5da8dSAndroid Build Coastguard Worker    ("NB_RSHIFT", ">>"),
216*cda5da8dSAndroid Build Coastguard Worker    ("NB_SUBTRACT", "-"),
217*cda5da8dSAndroid Build Coastguard Worker    ("NB_TRUE_DIVIDE", "/"),
218*cda5da8dSAndroid Build Coastguard Worker    ("NB_XOR", "^"),
219*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_ADD", "+="),
220*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_AND", "&="),
221*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_FLOOR_DIVIDE", "//="),
222*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_LSHIFT", "<<="),
223*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_MATRIX_MULTIPLY", "@="),
224*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_MULTIPLY", "*="),
225*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_REMAINDER", "%="),
226*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_OR", "|="),
227*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_POWER", "**="),
228*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_RSHIFT", ">>="),
229*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_SUBTRACT", "-="),
230*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_TRUE_DIVIDE", "/="),
231*cda5da8dSAndroid Build Coastguard Worker    ("NB_INPLACE_XOR", "^="),
232*cda5da8dSAndroid Build Coastguard Worker]
233*cda5da8dSAndroid Build Coastguard Worker
234*cda5da8dSAndroid Build Coastguard Worker_specializations = {
235*cda5da8dSAndroid Build Coastguard Worker    "BINARY_OP": [
236*cda5da8dSAndroid Build Coastguard Worker        "BINARY_OP_ADAPTIVE",
237*cda5da8dSAndroid Build Coastguard Worker        "BINARY_OP_ADD_FLOAT",
238*cda5da8dSAndroid Build Coastguard Worker        "BINARY_OP_ADD_INT",
239*cda5da8dSAndroid Build Coastguard Worker        "BINARY_OP_ADD_UNICODE",
240*cda5da8dSAndroid Build Coastguard Worker        "BINARY_OP_INPLACE_ADD_UNICODE",
241*cda5da8dSAndroid Build Coastguard Worker        "BINARY_OP_MULTIPLY_FLOAT",
242*cda5da8dSAndroid Build Coastguard Worker        "BINARY_OP_MULTIPLY_INT",
243*cda5da8dSAndroid Build Coastguard Worker        "BINARY_OP_SUBTRACT_FLOAT",
244*cda5da8dSAndroid Build Coastguard Worker        "BINARY_OP_SUBTRACT_INT",
245*cda5da8dSAndroid Build Coastguard Worker    ],
246*cda5da8dSAndroid Build Coastguard Worker    "BINARY_SUBSCR": [
247*cda5da8dSAndroid Build Coastguard Worker        "BINARY_SUBSCR_ADAPTIVE",
248*cda5da8dSAndroid Build Coastguard Worker        "BINARY_SUBSCR_DICT",
249*cda5da8dSAndroid Build Coastguard Worker        "BINARY_SUBSCR_GETITEM",
250*cda5da8dSAndroid Build Coastguard Worker        "BINARY_SUBSCR_LIST_INT",
251*cda5da8dSAndroid Build Coastguard Worker        "BINARY_SUBSCR_TUPLE_INT",
252*cda5da8dSAndroid Build Coastguard Worker    ],
253*cda5da8dSAndroid Build Coastguard Worker    "CALL": [
254*cda5da8dSAndroid Build Coastguard Worker        "CALL_ADAPTIVE",
255*cda5da8dSAndroid Build Coastguard Worker        "CALL_PY_EXACT_ARGS",
256*cda5da8dSAndroid Build Coastguard Worker        "CALL_PY_WITH_DEFAULTS",
257*cda5da8dSAndroid Build Coastguard Worker    ],
258*cda5da8dSAndroid Build Coastguard Worker    "COMPARE_OP": [
259*cda5da8dSAndroid Build Coastguard Worker        "COMPARE_OP_ADAPTIVE",
260*cda5da8dSAndroid Build Coastguard Worker        "COMPARE_OP_FLOAT_JUMP",
261*cda5da8dSAndroid Build Coastguard Worker        "COMPARE_OP_INT_JUMP",
262*cda5da8dSAndroid Build Coastguard Worker        "COMPARE_OP_STR_JUMP",
263*cda5da8dSAndroid Build Coastguard Worker    ],
264*cda5da8dSAndroid Build Coastguard Worker    "EXTENDED_ARG": [
265*cda5da8dSAndroid Build Coastguard Worker        "EXTENDED_ARG_QUICK",
266*cda5da8dSAndroid Build Coastguard Worker    ],
267*cda5da8dSAndroid Build Coastguard Worker    "JUMP_BACKWARD": [
268*cda5da8dSAndroid Build Coastguard Worker        "JUMP_BACKWARD_QUICK",
269*cda5da8dSAndroid Build Coastguard Worker    ],
270*cda5da8dSAndroid Build Coastguard Worker    "LOAD_ATTR": [
271*cda5da8dSAndroid Build Coastguard Worker        "LOAD_ATTR_ADAPTIVE",
272*cda5da8dSAndroid Build Coastguard Worker        "LOAD_ATTR_INSTANCE_VALUE",
273*cda5da8dSAndroid Build Coastguard Worker        "LOAD_ATTR_MODULE",
274*cda5da8dSAndroid Build Coastguard Worker        "LOAD_ATTR_SLOT",
275*cda5da8dSAndroid Build Coastguard Worker        "LOAD_ATTR_WITH_HINT",
276*cda5da8dSAndroid Build Coastguard Worker    ],
277*cda5da8dSAndroid Build Coastguard Worker    "LOAD_CONST": [
278*cda5da8dSAndroid Build Coastguard Worker        "LOAD_CONST__LOAD_FAST",
279*cda5da8dSAndroid Build Coastguard Worker    ],
280*cda5da8dSAndroid Build Coastguard Worker    "LOAD_FAST": [
281*cda5da8dSAndroid Build Coastguard Worker        "LOAD_FAST__LOAD_CONST",
282*cda5da8dSAndroid Build Coastguard Worker        "LOAD_FAST__LOAD_FAST",
283*cda5da8dSAndroid Build Coastguard Worker    ],
284*cda5da8dSAndroid Build Coastguard Worker    "LOAD_GLOBAL": [
285*cda5da8dSAndroid Build Coastguard Worker        "LOAD_GLOBAL_ADAPTIVE",
286*cda5da8dSAndroid Build Coastguard Worker        "LOAD_GLOBAL_BUILTIN",
287*cda5da8dSAndroid Build Coastguard Worker        "LOAD_GLOBAL_MODULE",
288*cda5da8dSAndroid Build Coastguard Worker    ],
289*cda5da8dSAndroid Build Coastguard Worker    "LOAD_METHOD": [
290*cda5da8dSAndroid Build Coastguard Worker        "LOAD_METHOD_ADAPTIVE",
291*cda5da8dSAndroid Build Coastguard Worker        "LOAD_METHOD_CLASS",
292*cda5da8dSAndroid Build Coastguard Worker        "LOAD_METHOD_MODULE",
293*cda5da8dSAndroid Build Coastguard Worker        "LOAD_METHOD_NO_DICT",
294*cda5da8dSAndroid Build Coastguard Worker        "LOAD_METHOD_WITH_DICT",
295*cda5da8dSAndroid Build Coastguard Worker        "LOAD_METHOD_WITH_VALUES",
296*cda5da8dSAndroid Build Coastguard Worker    ],
297*cda5da8dSAndroid Build Coastguard Worker    "PRECALL": [
298*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_ADAPTIVE",
299*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_BOUND_METHOD",
300*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_BUILTIN_CLASS",
301*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_BUILTIN_FAST_WITH_KEYWORDS",
302*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS",
303*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_NO_KW_BUILTIN_FAST",
304*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_NO_KW_BUILTIN_O",
305*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_NO_KW_ISINSTANCE",
306*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_NO_KW_LEN",
307*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_NO_KW_LIST_APPEND",
308*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST",
309*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS",
310*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_NO_KW_METHOD_DESCRIPTOR_O",
311*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_NO_KW_STR_1",
312*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_NO_KW_TUPLE_1",
313*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_NO_KW_TYPE_1",
314*cda5da8dSAndroid Build Coastguard Worker        "PRECALL_PYFUNC",
315*cda5da8dSAndroid Build Coastguard Worker    ],
316*cda5da8dSAndroid Build Coastguard Worker    "RESUME": [
317*cda5da8dSAndroid Build Coastguard Worker        "RESUME_QUICK",
318*cda5da8dSAndroid Build Coastguard Worker    ],
319*cda5da8dSAndroid Build Coastguard Worker    "STORE_ATTR": [
320*cda5da8dSAndroid Build Coastguard Worker        "STORE_ATTR_ADAPTIVE",
321*cda5da8dSAndroid Build Coastguard Worker        "STORE_ATTR_INSTANCE_VALUE",
322*cda5da8dSAndroid Build Coastguard Worker        "STORE_ATTR_SLOT",
323*cda5da8dSAndroid Build Coastguard Worker        "STORE_ATTR_WITH_HINT",
324*cda5da8dSAndroid Build Coastguard Worker    ],
325*cda5da8dSAndroid Build Coastguard Worker    "STORE_FAST": [
326*cda5da8dSAndroid Build Coastguard Worker        "STORE_FAST__LOAD_FAST",
327*cda5da8dSAndroid Build Coastguard Worker        "STORE_FAST__STORE_FAST",
328*cda5da8dSAndroid Build Coastguard Worker    ],
329*cda5da8dSAndroid Build Coastguard Worker    "STORE_SUBSCR": [
330*cda5da8dSAndroid Build Coastguard Worker        "STORE_SUBSCR_ADAPTIVE",
331*cda5da8dSAndroid Build Coastguard Worker        "STORE_SUBSCR_DICT",
332*cda5da8dSAndroid Build Coastguard Worker        "STORE_SUBSCR_LIST_INT",
333*cda5da8dSAndroid Build Coastguard Worker    ],
334*cda5da8dSAndroid Build Coastguard Worker    "UNPACK_SEQUENCE": [
335*cda5da8dSAndroid Build Coastguard Worker        "UNPACK_SEQUENCE_ADAPTIVE",
336*cda5da8dSAndroid Build Coastguard Worker        "UNPACK_SEQUENCE_LIST",
337*cda5da8dSAndroid Build Coastguard Worker        "UNPACK_SEQUENCE_TUPLE",
338*cda5da8dSAndroid Build Coastguard Worker        "UNPACK_SEQUENCE_TWO_TUPLE",
339*cda5da8dSAndroid Build Coastguard Worker    ],
340*cda5da8dSAndroid Build Coastguard Worker}
341*cda5da8dSAndroid Build Coastguard Worker_specialized_instructions = [
342*cda5da8dSAndroid Build Coastguard Worker    opcode for family in _specializations.values() for opcode in family
343*cda5da8dSAndroid Build Coastguard Worker]
344*cda5da8dSAndroid Build Coastguard Worker_specialization_stats = [
345*cda5da8dSAndroid Build Coastguard Worker    "success",
346*cda5da8dSAndroid Build Coastguard Worker    "failure",
347*cda5da8dSAndroid Build Coastguard Worker    "hit",
348*cda5da8dSAndroid Build Coastguard Worker    "deferred",
349*cda5da8dSAndroid Build Coastguard Worker    "miss",
350*cda5da8dSAndroid Build Coastguard Worker    "deopt",
351*cda5da8dSAndroid Build Coastguard Worker]
352*cda5da8dSAndroid Build Coastguard Worker
353*cda5da8dSAndroid Build Coastguard Worker_cache_format = {
354*cda5da8dSAndroid Build Coastguard Worker    "LOAD_GLOBAL": {
355*cda5da8dSAndroid Build Coastguard Worker        "counter": 1,
356*cda5da8dSAndroid Build Coastguard Worker        "index": 1,
357*cda5da8dSAndroid Build Coastguard Worker        "module_keys_version": 2,
358*cda5da8dSAndroid Build Coastguard Worker        "builtin_keys_version": 1,
359*cda5da8dSAndroid Build Coastguard Worker    },
360*cda5da8dSAndroid Build Coastguard Worker    "BINARY_OP": {
361*cda5da8dSAndroid Build Coastguard Worker        "counter": 1,
362*cda5da8dSAndroid Build Coastguard Worker    },
363*cda5da8dSAndroid Build Coastguard Worker    "UNPACK_SEQUENCE": {
364*cda5da8dSAndroid Build Coastguard Worker        "counter": 1,
365*cda5da8dSAndroid Build Coastguard Worker    },
366*cda5da8dSAndroid Build Coastguard Worker    "COMPARE_OP": {
367*cda5da8dSAndroid Build Coastguard Worker        "counter": 1,
368*cda5da8dSAndroid Build Coastguard Worker        "mask": 1,
369*cda5da8dSAndroid Build Coastguard Worker    },
370*cda5da8dSAndroid Build Coastguard Worker    "BINARY_SUBSCR": {
371*cda5da8dSAndroid Build Coastguard Worker        "counter": 1,
372*cda5da8dSAndroid Build Coastguard Worker        "type_version": 2,
373*cda5da8dSAndroid Build Coastguard Worker        "func_version": 1,
374*cda5da8dSAndroid Build Coastguard Worker    },
375*cda5da8dSAndroid Build Coastguard Worker    "LOAD_ATTR": {
376*cda5da8dSAndroid Build Coastguard Worker        "counter": 1,
377*cda5da8dSAndroid Build Coastguard Worker        "version": 2,
378*cda5da8dSAndroid Build Coastguard Worker        "index": 1,
379*cda5da8dSAndroid Build Coastguard Worker    },
380*cda5da8dSAndroid Build Coastguard Worker    "STORE_ATTR": {
381*cda5da8dSAndroid Build Coastguard Worker        "counter": 1,
382*cda5da8dSAndroid Build Coastguard Worker        "version": 2,
383*cda5da8dSAndroid Build Coastguard Worker        "index": 1,
384*cda5da8dSAndroid Build Coastguard Worker    },
385*cda5da8dSAndroid Build Coastguard Worker    "LOAD_METHOD": {
386*cda5da8dSAndroid Build Coastguard Worker        "counter": 1,
387*cda5da8dSAndroid Build Coastguard Worker        "type_version": 2,
388*cda5da8dSAndroid Build Coastguard Worker        "dict_offset": 1,
389*cda5da8dSAndroid Build Coastguard Worker        "keys_version": 2,
390*cda5da8dSAndroid Build Coastguard Worker        "descr": 4,
391*cda5da8dSAndroid Build Coastguard Worker    },
392*cda5da8dSAndroid Build Coastguard Worker    "CALL": {
393*cda5da8dSAndroid Build Coastguard Worker        "counter": 1,
394*cda5da8dSAndroid Build Coastguard Worker        "func_version": 2,
395*cda5da8dSAndroid Build Coastguard Worker        "min_args": 1,
396*cda5da8dSAndroid Build Coastguard Worker    },
397*cda5da8dSAndroid Build Coastguard Worker    "PRECALL": {
398*cda5da8dSAndroid Build Coastguard Worker        "counter": 1,
399*cda5da8dSAndroid Build Coastguard Worker    },
400*cda5da8dSAndroid Build Coastguard Worker    "STORE_SUBSCR": {
401*cda5da8dSAndroid Build Coastguard Worker        "counter": 1,
402*cda5da8dSAndroid Build Coastguard Worker    },
403*cda5da8dSAndroid Build Coastguard Worker}
404*cda5da8dSAndroid Build Coastguard Worker
405*cda5da8dSAndroid Build Coastguard Worker_inline_cache_entries = [
406*cda5da8dSAndroid Build Coastguard Worker    sum(_cache_format.get(opname[opcode], {}).values()) for opcode in range(256)
407*cda5da8dSAndroid Build Coastguard Worker]
408