cs107-lecture-examples

Example codes used during Harvard CS107 lectures
git clone https://git.0xfab.ch/cs107-lecture-examples.git
Log | Files | Refs | README | LICENSE

opcode.h (5509B)


      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 
      8 
      9     /* Instruction opcodes for compiled code */
     10 #define POP_TOP                   1
     11 #define ROT_TWO                   2
     12 #define ROT_THREE                 3
     13 #define DUP_TOP                   4
     14 #define DUP_TOP_TWO               5
     15 #define ROT_FOUR                  6
     16 #define NOP                       9
     17 #define UNARY_POSITIVE           10
     18 #define UNARY_NEGATIVE           11
     19 #define UNARY_NOT                12
     20 #define UNARY_INVERT             15
     21 #define BINARY_MATRIX_MULTIPLY   16
     22 #define INPLACE_MATRIX_MULTIPLY  17
     23 #define BINARY_POWER             19
     24 #define BINARY_MULTIPLY          20
     25 #define BINARY_MODULO            22
     26 #define BINARY_ADD               23
     27 #define BINARY_SUBTRACT          24
     28 #define BINARY_SUBSCR            25
     29 #define BINARY_FLOOR_DIVIDE      26
     30 #define BINARY_TRUE_DIVIDE       27
     31 #define INPLACE_FLOOR_DIVIDE     28
     32 #define INPLACE_TRUE_DIVIDE      29
     33 #define GET_LEN                  30
     34 #define MATCH_MAPPING            31
     35 #define MATCH_SEQUENCE           32
     36 #define MATCH_KEYS               33
     37 #define COPY_DICT_WITHOUT_KEYS   34
     38 #define WITH_EXCEPT_START        49
     39 #define GET_AITER                50
     40 #define GET_ANEXT                51
     41 #define BEFORE_ASYNC_WITH        52
     42 #define END_ASYNC_FOR            54
     43 #define INPLACE_ADD              55
     44 #define INPLACE_SUBTRACT         56
     45 #define INPLACE_MULTIPLY         57
     46 #define INPLACE_MODULO           59
     47 #define STORE_SUBSCR             60
     48 #define DELETE_SUBSCR            61
     49 #define BINARY_LSHIFT            62
     50 #define BINARY_RSHIFT            63
     51 #define BINARY_AND               64
     52 #define BINARY_XOR               65
     53 #define BINARY_OR                66
     54 #define INPLACE_POWER            67
     55 #define GET_ITER                 68
     56 #define GET_YIELD_FROM_ITER      69
     57 #define PRINT_EXPR               70
     58 #define LOAD_BUILD_CLASS         71
     59 #define YIELD_FROM               72
     60 #define GET_AWAITABLE            73
     61 #define LOAD_ASSERTION_ERROR     74
     62 #define INPLACE_LSHIFT           75
     63 #define INPLACE_RSHIFT           76
     64 #define INPLACE_AND              77
     65 #define INPLACE_XOR              78
     66 #define INPLACE_OR               79
     67 #define LIST_TO_TUPLE            82
     68 #define RETURN_VALUE             83
     69 #define IMPORT_STAR              84
     70 #define SETUP_ANNOTATIONS        85
     71 #define YIELD_VALUE              86
     72 #define POP_BLOCK                87
     73 #define POP_EXCEPT               89
     74 #define HAVE_ARGUMENT            90
     75 #define STORE_NAME               90
     76 #define DELETE_NAME              91
     77 #define UNPACK_SEQUENCE          92
     78 #define FOR_ITER                 93
     79 #define UNPACK_EX                94
     80 #define STORE_ATTR               95
     81 #define DELETE_ATTR              96
     82 #define STORE_GLOBAL             97
     83 #define DELETE_GLOBAL            98
     84 #define ROT_N                    99
     85 #define LOAD_CONST              100
     86 #define LOAD_NAME               101
     87 #define BUILD_TUPLE             102
     88 #define BUILD_LIST              103
     89 #define BUILD_SET               104
     90 #define BUILD_MAP               105
     91 #define LOAD_ATTR               106
     92 #define COMPARE_OP              107
     93 #define IMPORT_NAME             108
     94 #define IMPORT_FROM             109
     95 #define JUMP_FORWARD            110
     96 #define JUMP_IF_FALSE_OR_POP    111
     97 #define JUMP_IF_TRUE_OR_POP     112
     98 #define JUMP_ABSOLUTE           113
     99 #define POP_JUMP_IF_FALSE       114
    100 #define POP_JUMP_IF_TRUE        115
    101 #define LOAD_GLOBAL             116
    102 #define IS_OP                   117
    103 #define CONTAINS_OP             118
    104 #define RERAISE                 119
    105 #define JUMP_IF_NOT_EXC_MATCH   121
    106 #define SETUP_FINALLY           122
    107 #define LOAD_FAST               124
    108 #define STORE_FAST              125
    109 #define DELETE_FAST             126
    110 #define GEN_START               129
    111 #define RAISE_VARARGS           130
    112 #define CALL_FUNCTION           131
    113 #define MAKE_FUNCTION           132
    114 #define BUILD_SLICE             133
    115 #define LOAD_CLOSURE            135
    116 #define LOAD_DEREF              136
    117 #define STORE_DEREF             137
    118 #define DELETE_DEREF            138
    119 #define CALL_FUNCTION_KW        141
    120 #define CALL_FUNCTION_EX        142
    121 #define SETUP_WITH              143
    122 #define EXTENDED_ARG            144
    123 #define LIST_APPEND             145
    124 #define SET_ADD                 146
    125 #define MAP_ADD                 147
    126 #define LOAD_CLASSDEREF         148
    127 #define MATCH_CLASS             152
    128 #define SETUP_ASYNC_WITH        154
    129 #define FORMAT_VALUE            155
    130 #define BUILD_CONST_KEY_MAP     156
    131 #define BUILD_STRING            157
    132 #define LOAD_METHOD             160
    133 #define CALL_METHOD             161
    134 #define LIST_EXTEND             162
    135 #define SET_UPDATE              163
    136 #define DICT_MERGE              164
    137 #define DICT_UPDATE             165
    138 #ifdef NEED_OPCODE_JUMP_TABLES
    139 static uint32_t _PyOpcode_RelativeJump[8] = {
    140     0U,
    141     0U,
    142     536870912U,
    143     67125248U,
    144     67141632U,
    145     0U,
    146     0U,
    147     0U,
    148 };
    149 static uint32_t _PyOpcode_Jump[8] = {
    150     0U,
    151     0U,
    152     536870912U,
    153     101695488U,
    154     67141632U,
    155     0U,
    156     0U,
    157     0U,
    158 };
    159 #endif /* OPCODE_TABLES */
    160 
    161 /* EXCEPT_HANDLER is a special, implicit block type which is created when
    162    entering an except handler. It is not an opcode but we define it here
    163    as we want it to be available to both frameobject.c and ceval.c, while
    164    remaining private.*/
    165 #define EXCEPT_HANDLER 257
    166 
    167 #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT)
    168 
    169 #ifdef __cplusplus
    170 }
    171 #endif
    172 #endif /* !Py_OPCODE_H */