You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
8.1 KiB

  1. /* Auto-generated by Tools/scripts/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 POP_TOP 1
  9. #define ROT_TWO 2
  10. #define ROT_THREE 3
  11. #define DUP_TOP 4
  12. #define DUP_TOP_TWO 5
  13. #define ROT_FOUR 6
  14. #define NOP 9
  15. #define UNARY_POSITIVE 10
  16. #define UNARY_NEGATIVE 11
  17. #define UNARY_NOT 12
  18. #define UNARY_INVERT 15
  19. #define BINARY_SUBSCR 25
  20. #define GET_LEN 30
  21. #define MATCH_MAPPING 31
  22. #define MATCH_SEQUENCE 32
  23. #define MATCH_KEYS 33
  24. #define PUSH_EXC_INFO 35
  25. #define POP_EXCEPT_AND_RERAISE 37
  26. #define WITH_EXCEPT_START 49
  27. #define GET_AITER 50
  28. #define GET_ANEXT 51
  29. #define BEFORE_ASYNC_WITH 52
  30. #define BEFORE_WITH 53
  31. #define END_ASYNC_FOR 54
  32. #define STORE_SUBSCR 60
  33. #define DELETE_SUBSCR 61
  34. #define GET_ITER 68
  35. #define GET_YIELD_FROM_ITER 69
  36. #define PRINT_EXPR 70
  37. #define LOAD_BUILD_CLASS 71
  38. #define YIELD_FROM 72
  39. #define GET_AWAITABLE 73
  40. #define LOAD_ASSERTION_ERROR 74
  41. #define LIST_TO_TUPLE 82
  42. #define RETURN_VALUE 83
  43. #define IMPORT_STAR 84
  44. #define SETUP_ANNOTATIONS 85
  45. #define YIELD_VALUE 86
  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 ROT_N 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 JUMP_IF_FALSE_OR_POP 111
  70. #define JUMP_IF_TRUE_OR_POP 112
  71. #define JUMP_ABSOLUTE 113
  72. #define POP_JUMP_IF_FALSE 114
  73. #define POP_JUMP_IF_TRUE 115
  74. #define LOAD_GLOBAL 116
  75. #define IS_OP 117
  76. #define CONTAINS_OP 118
  77. #define RERAISE 119
  78. #define COPY 120
  79. #define JUMP_IF_NOT_EXC_MATCH 121
  80. #define BINARY_OP 122
  81. #define LOAD_FAST 124
  82. #define STORE_FAST 125
  83. #define DELETE_FAST 126
  84. #define GEN_START 129
  85. #define RAISE_VARARGS 130
  86. #define CALL_FUNCTION 131
  87. #define MAKE_FUNCTION 132
  88. #define BUILD_SLICE 133
  89. #define MAKE_CELL 135
  90. #define LOAD_CLOSURE 136
  91. #define LOAD_DEREF 137
  92. #define STORE_DEREF 138
  93. #define DELETE_DEREF 139
  94. #define CALL_FUNCTION_KW 141
  95. #define CALL_FUNCTION_EX 142
  96. #define EXTENDED_ARG 144
  97. #define LIST_APPEND 145
  98. #define SET_ADD 146
  99. #define MAP_ADD 147
  100. #define LOAD_CLASSDEREF 148
  101. #define MATCH_CLASS 152
  102. #define FORMAT_VALUE 155
  103. #define BUILD_CONST_KEY_MAP 156
  104. #define BUILD_STRING 157
  105. #define LOAD_METHOD 160
  106. #define CALL_METHOD 161
  107. #define LIST_EXTEND 162
  108. #define SET_UPDATE 163
  109. #define DICT_MERGE 164
  110. #define DICT_UPDATE 165
  111. #define CALL_METHOD_KW 166
  112. #define BINARY_OP_ADAPTIVE 7
  113. #define BINARY_OP_ADD_INT 8
  114. #define BINARY_OP_ADD_FLOAT 13
  115. #define BINARY_OP_ADD_UNICODE 14
  116. #define BINARY_OP_INPLACE_ADD_UNICODE 16
  117. #define BINARY_OP_MULTIPLY_INT 17
  118. #define BINARY_OP_MULTIPLY_FLOAT 18
  119. #define BINARY_SUBSCR_ADAPTIVE 19
  120. #define BINARY_SUBSCR_LIST_INT 20
  121. #define BINARY_SUBSCR_TUPLE_INT 21
  122. #define BINARY_SUBSCR_DICT 22
  123. #define CALL_FUNCTION_ADAPTIVE 23
  124. #define CALL_FUNCTION_BUILTIN_O 24
  125. #define CALL_FUNCTION_BUILTIN_FAST 26
  126. #define CALL_FUNCTION_LEN 27
  127. #define CALL_FUNCTION_ISINSTANCE 28
  128. #define CALL_FUNCTION_PY_SIMPLE 29
  129. #define JUMP_ABSOLUTE_QUICK 34
  130. #define LOAD_ATTR_ADAPTIVE 36
  131. #define LOAD_ATTR_INSTANCE_VALUE 38
  132. #define LOAD_ATTR_WITH_HINT 39
  133. #define LOAD_ATTR_SLOT 40
  134. #define LOAD_ATTR_MODULE 41
  135. #define LOAD_GLOBAL_ADAPTIVE 42
  136. #define LOAD_GLOBAL_MODULE 43
  137. #define LOAD_GLOBAL_BUILTIN 44
  138. #define LOAD_METHOD_ADAPTIVE 45
  139. #define LOAD_METHOD_CACHED 46
  140. #define LOAD_METHOD_CLASS 47
  141. #define LOAD_METHOD_MODULE 48
  142. #define LOAD_METHOD_NO_DICT 55
  143. #define STORE_ATTR_ADAPTIVE 56
  144. #define STORE_ATTR_INSTANCE_VALUE 57
  145. #define STORE_ATTR_SLOT 58
  146. #define STORE_ATTR_WITH_HINT 59
  147. #define LOAD_FAST__LOAD_FAST 62
  148. #define STORE_FAST__LOAD_FAST 63
  149. #define LOAD_FAST__LOAD_CONST 64
  150. #define LOAD_CONST__LOAD_FAST 65
  151. #define STORE_FAST__STORE_FAST 66
  152. #define DO_TRACING 255
  153. #ifdef NEED_OPCODE_JUMP_TABLES
  154. static uint32_t _PyOpcode_RelativeJump[8] = {
  155. 0U,
  156. 0U,
  157. 536870912U,
  158. 16384U,
  159. 0U,
  160. 0U,
  161. 0U,
  162. 0U,
  163. };
  164. static uint32_t _PyOpcode_Jump[8] = {
  165. 0U,
  166. 0U,
  167. 536870912U,
  168. 34586624U,
  169. 0U,
  170. 0U,
  171. 0U,
  172. 0U,
  173. };
  174. #endif /* OPCODE_TABLES */
  175. #define HAS_CONST(op) (false\
  176. || ((op) == 100) \
  177. )
  178. #define NB_ADD 0
  179. #define NB_AND 1
  180. #define NB_FLOOR_DIVIDE 2
  181. #define NB_LSHIFT 3
  182. #define NB_MATRIX_MULTIPLY 4
  183. #define NB_MULTIPLY 5
  184. #define NB_REMAINDER 6
  185. #define NB_OR 7
  186. #define NB_POWER 8
  187. #define NB_RSHIFT 9
  188. #define NB_SUBTRACT 10
  189. #define NB_TRUE_DIVIDE 11
  190. #define NB_XOR 12
  191. #define NB_INPLACE_ADD 13
  192. #define NB_INPLACE_AND 14
  193. #define NB_INPLACE_FLOOR_DIVIDE 15
  194. #define NB_INPLACE_LSHIFT 16
  195. #define NB_INPLACE_MATRIX_MULTIPLY 17
  196. #define NB_INPLACE_MULTIPLY 18
  197. #define NB_INPLACE_REMAINDER 19
  198. #define NB_INPLACE_OR 20
  199. #define NB_INPLACE_POWER 21
  200. #define NB_INPLACE_RSHIFT 22
  201. #define NB_INPLACE_SUBTRACT 23
  202. #define NB_INPLACE_TRUE_DIVIDE 24
  203. #define NB_INPLACE_XOR 25
  204. #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT)
  205. /* Reserve some bytecodes for internal use in the compiler.
  206. * The value of 240 is arbitrary. */
  207. #define IS_ARTIFICIAL(op) ((op) > 240)
  208. #ifdef __cplusplus
  209. }
  210. #endif
  211. #endif /* !Py_OPCODE_H */