opcode.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. // Auto-generated by Tools/build/generate_opcode_h.py from Lib/opcode.py
  2. #ifndef Py_OPCODE_H
  3. #define Py_OPCODE_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /* Instruction opcodes for compiled code */
  8. #define CACHE 0
  9. #define POP_TOP 1
  10. #define PUSH_NULL 2
  11. #define INTERPRETER_EXIT 3
  12. #define END_FOR 4
  13. #define END_SEND 5
  14. #define NOP 9
  15. #define UNARY_NEGATIVE 11
  16. #define UNARY_NOT 12
  17. #define UNARY_INVERT 15
  18. #define RESERVED 17
  19. #define BINARY_SUBSCR 25
  20. #define BINARY_SLICE 26
  21. #define STORE_SLICE 27
  22. #define GET_LEN 30
  23. #define MATCH_MAPPING 31
  24. #define MATCH_SEQUENCE 32
  25. #define MATCH_KEYS 33
  26. #define PUSH_EXC_INFO 35
  27. #define CHECK_EXC_MATCH 36
  28. #define CHECK_EG_MATCH 37
  29. #define WITH_EXCEPT_START 49
  30. #define GET_AITER 50
  31. #define GET_ANEXT 51
  32. #define BEFORE_ASYNC_WITH 52
  33. #define BEFORE_WITH 53
  34. #define END_ASYNC_FOR 54
  35. #define CLEANUP_THROW 55
  36. #define STORE_SUBSCR 60
  37. #define DELETE_SUBSCR 61
  38. #define GET_ITER 68
  39. #define GET_YIELD_FROM_ITER 69
  40. #define LOAD_BUILD_CLASS 71
  41. #define LOAD_ASSERTION_ERROR 74
  42. #define RETURN_GENERATOR 75
  43. #define RETURN_VALUE 83
  44. #define SETUP_ANNOTATIONS 85
  45. #define LOAD_LOCALS 87
  46. #define POP_EXCEPT 89
  47. #define HAVE_ARGUMENT 90
  48. #define STORE_NAME 90
  49. #define DELETE_NAME 91
  50. #define UNPACK_SEQUENCE 92
  51. #define FOR_ITER 93
  52. #define UNPACK_EX 94
  53. #define STORE_ATTR 95
  54. #define DELETE_ATTR 96
  55. #define STORE_GLOBAL 97
  56. #define DELETE_GLOBAL 98
  57. #define SWAP 99
  58. #define LOAD_CONST 100
  59. #define LOAD_NAME 101
  60. #define BUILD_TUPLE 102
  61. #define BUILD_LIST 103
  62. #define BUILD_SET 104
  63. #define BUILD_MAP 105
  64. #define LOAD_ATTR 106
  65. #define COMPARE_OP 107
  66. #define IMPORT_NAME 108
  67. #define IMPORT_FROM 109
  68. #define JUMP_FORWARD 110
  69. #define POP_JUMP_IF_FALSE 114
  70. #define POP_JUMP_IF_TRUE 115
  71. #define LOAD_GLOBAL 116
  72. #define IS_OP 117
  73. #define CONTAINS_OP 118
  74. #define RERAISE 119
  75. #define COPY 120
  76. #define RETURN_CONST 121
  77. #define BINARY_OP 122
  78. #define SEND 123
  79. #define LOAD_FAST 124
  80. #define STORE_FAST 125
  81. #define DELETE_FAST 126
  82. #define LOAD_FAST_CHECK 127
  83. #define POP_JUMP_IF_NOT_NONE 128
  84. #define POP_JUMP_IF_NONE 129
  85. #define RAISE_VARARGS 130
  86. #define GET_AWAITABLE 131
  87. #define MAKE_FUNCTION 132
  88. #define BUILD_SLICE 133
  89. #define JUMP_BACKWARD_NO_INTERRUPT 134
  90. #define MAKE_CELL 135
  91. #define LOAD_CLOSURE 136
  92. #define LOAD_DEREF 137
  93. #define STORE_DEREF 138
  94. #define DELETE_DEREF 139
  95. #define JUMP_BACKWARD 140
  96. #define LOAD_SUPER_ATTR 141
  97. #define CALL_FUNCTION_EX 142
  98. #define LOAD_FAST_AND_CLEAR 143
  99. #define EXTENDED_ARG 144
  100. #define LIST_APPEND 145
  101. #define SET_ADD 146
  102. #define MAP_ADD 147
  103. #define COPY_FREE_VARS 149
  104. #define YIELD_VALUE 150
  105. #define RESUME 151
  106. #define MATCH_CLASS 152
  107. #define FORMAT_VALUE 155
  108. #define BUILD_CONST_KEY_MAP 156
  109. #define BUILD_STRING 157
  110. #define LIST_EXTEND 162
  111. #define SET_UPDATE 163
  112. #define DICT_MERGE 164
  113. #define DICT_UPDATE 165
  114. #define CALL 171
  115. #define KW_NAMES 172
  116. #define CALL_INTRINSIC_1 173
  117. #define CALL_INTRINSIC_2 174
  118. #define LOAD_FROM_DICT_OR_GLOBALS 175
  119. #define LOAD_FROM_DICT_OR_DEREF 176
  120. #define MIN_INSTRUMENTED_OPCODE 237
  121. #define INSTRUMENTED_LOAD_SUPER_ATTR 237
  122. #define INSTRUMENTED_POP_JUMP_IF_NONE 238
  123. #define INSTRUMENTED_POP_JUMP_IF_NOT_NONE 239
  124. #define INSTRUMENTED_RESUME 240
  125. #define INSTRUMENTED_CALL 241
  126. #define INSTRUMENTED_RETURN_VALUE 242
  127. #define INSTRUMENTED_YIELD_VALUE 243
  128. #define INSTRUMENTED_CALL_FUNCTION_EX 244
  129. #define INSTRUMENTED_JUMP_FORWARD 245
  130. #define INSTRUMENTED_JUMP_BACKWARD 246
  131. #define INSTRUMENTED_RETURN_CONST 247
  132. #define INSTRUMENTED_FOR_ITER 248
  133. #define INSTRUMENTED_POP_JUMP_IF_FALSE 249
  134. #define INSTRUMENTED_POP_JUMP_IF_TRUE 250
  135. #define INSTRUMENTED_END_FOR 251
  136. #define INSTRUMENTED_END_SEND 252
  137. #define INSTRUMENTED_INSTRUCTION 253
  138. #define INSTRUMENTED_LINE 254
  139. #define MIN_PSEUDO_OPCODE 256
  140. #define SETUP_FINALLY 256
  141. #define SETUP_CLEANUP 257
  142. #define SETUP_WITH 258
  143. #define POP_BLOCK 259
  144. #define JUMP 260
  145. #define JUMP_NO_INTERRUPT 261
  146. #define LOAD_METHOD 262
  147. #define LOAD_SUPER_METHOD 263
  148. #define LOAD_ZERO_SUPER_METHOD 264
  149. #define LOAD_ZERO_SUPER_ATTR 265
  150. #define STORE_FAST_MAYBE_NULL 266
  151. #define MAX_PSEUDO_OPCODE 266
  152. #define BINARY_OP_ADD_FLOAT 6
  153. #define BINARY_OP_ADD_INT 7
  154. #define BINARY_OP_ADD_UNICODE 8
  155. #define BINARY_OP_INPLACE_ADD_UNICODE 10
  156. #define BINARY_OP_MULTIPLY_FLOAT 13
  157. #define BINARY_OP_MULTIPLY_INT 14
  158. #define BINARY_OP_SUBTRACT_FLOAT 16
  159. #define BINARY_OP_SUBTRACT_INT 18
  160. #define BINARY_SUBSCR_DICT 19
  161. #define BINARY_SUBSCR_GETITEM 20
  162. #define BINARY_SUBSCR_LIST_INT 21
  163. #define BINARY_SUBSCR_TUPLE_INT 22
  164. #define CALL_PY_EXACT_ARGS 23
  165. #define CALL_PY_WITH_DEFAULTS 24
  166. #define CALL_BOUND_METHOD_EXACT_ARGS 28
  167. #define CALL_BUILTIN_CLASS 29
  168. #define CALL_BUILTIN_FAST_WITH_KEYWORDS 34
  169. #define CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 38
  170. #define CALL_NO_KW_BUILTIN_FAST 39
  171. #define CALL_NO_KW_BUILTIN_O 40
  172. #define CALL_NO_KW_ISINSTANCE 41
  173. #define CALL_NO_KW_LEN 42
  174. #define CALL_NO_KW_LIST_APPEND 43
  175. #define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 44
  176. #define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 45
  177. #define CALL_NO_KW_METHOD_DESCRIPTOR_O 46
  178. #define CALL_NO_KW_STR_1 47
  179. #define CALL_NO_KW_TUPLE_1 48
  180. #define CALL_NO_KW_TYPE_1 56
  181. #define COMPARE_OP_FLOAT 57
  182. #define COMPARE_OP_INT 58
  183. #define COMPARE_OP_STR 59
  184. #define FOR_ITER_LIST 62
  185. #define FOR_ITER_TUPLE 63
  186. #define FOR_ITER_RANGE 64
  187. #define FOR_ITER_GEN 65
  188. #define LOAD_SUPER_ATTR_ATTR 66
  189. #define LOAD_SUPER_ATTR_METHOD 67
  190. #define LOAD_ATTR_CLASS 70
  191. #define LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 72
  192. #define LOAD_ATTR_INSTANCE_VALUE 73
  193. #define LOAD_ATTR_MODULE 76
  194. #define LOAD_ATTR_PROPERTY 77
  195. #define LOAD_ATTR_SLOT 78
  196. #define LOAD_ATTR_WITH_HINT 79
  197. #define LOAD_ATTR_METHOD_LAZY_DICT 80
  198. #define LOAD_ATTR_METHOD_NO_DICT 81
  199. #define LOAD_ATTR_METHOD_WITH_VALUES 82
  200. #define LOAD_CONST__LOAD_FAST 84
  201. #define LOAD_FAST__LOAD_CONST 86
  202. #define LOAD_FAST__LOAD_FAST 88
  203. #define LOAD_GLOBAL_BUILTIN 111
  204. #define LOAD_GLOBAL_MODULE 112
  205. #define STORE_ATTR_INSTANCE_VALUE 113
  206. #define STORE_ATTR_SLOT 148
  207. #define STORE_ATTR_WITH_HINT 153
  208. #define STORE_FAST__LOAD_FAST 154
  209. #define STORE_FAST__STORE_FAST 158
  210. #define STORE_SUBSCR_DICT 159
  211. #define STORE_SUBSCR_LIST_INT 160
  212. #define UNPACK_SEQUENCE_LIST 161
  213. #define UNPACK_SEQUENCE_TUPLE 166
  214. #define UNPACK_SEQUENCE_TWO_TUPLE 167
  215. #define SEND_GEN 168
  216. #define HAS_ARG(op) ((((op) >= HAVE_ARGUMENT) && (!IS_PSEUDO_OPCODE(op)))\
  217. || ((op) == JUMP) \
  218. || ((op) == JUMP_NO_INTERRUPT) \
  219. || ((op) == LOAD_METHOD) \
  220. || ((op) == LOAD_SUPER_METHOD) \
  221. || ((op) == LOAD_ZERO_SUPER_METHOD) \
  222. || ((op) == LOAD_ZERO_SUPER_ATTR) \
  223. || ((op) == STORE_FAST_MAYBE_NULL) \
  224. )
  225. #define HAS_CONST(op) (false\
  226. || ((op) == LOAD_CONST) \
  227. || ((op) == RETURN_CONST) \
  228. || ((op) == KW_NAMES) \
  229. )
  230. #define NB_ADD 0
  231. #define NB_AND 1
  232. #define NB_FLOOR_DIVIDE 2
  233. #define NB_LSHIFT 3
  234. #define NB_MATRIX_MULTIPLY 4
  235. #define NB_MULTIPLY 5
  236. #define NB_REMAINDER 6
  237. #define NB_OR 7
  238. #define NB_POWER 8
  239. #define NB_RSHIFT 9
  240. #define NB_SUBTRACT 10
  241. #define NB_TRUE_DIVIDE 11
  242. #define NB_XOR 12
  243. #define NB_INPLACE_ADD 13
  244. #define NB_INPLACE_AND 14
  245. #define NB_INPLACE_FLOOR_DIVIDE 15
  246. #define NB_INPLACE_LSHIFT 16
  247. #define NB_INPLACE_MATRIX_MULTIPLY 17
  248. #define NB_INPLACE_MULTIPLY 18
  249. #define NB_INPLACE_REMAINDER 19
  250. #define NB_INPLACE_OR 20
  251. #define NB_INPLACE_POWER 21
  252. #define NB_INPLACE_RSHIFT 22
  253. #define NB_INPLACE_SUBTRACT 23
  254. #define NB_INPLACE_TRUE_DIVIDE 24
  255. #define NB_INPLACE_XOR 25
  256. /* Defined in Lib/opcode.py */
  257. #define ENABLE_SPECIALIZATION 1
  258. #define IS_PSEUDO_OPCODE(op) (((op) >= MIN_PSEUDO_OPCODE) && ((op) <= MAX_PSEUDO_OPCODE))
  259. #ifdef __cplusplus
  260. }
  261. #endif
  262. #endif /* !Py_OPCODE_H */