LEFT | RIGHT |
1 | 1 |
2 """ | 2 """ |
3 opcode module - potentially shared between dis and other modules which | 3 opcode module - potentially shared between dis and other modules which |
4 operate on bytecodes (e.g. peephole optimizers). | 4 operate on bytecodes (e.g. peephole optimizers). |
5 """ | 5 """ |
6 | 6 |
7 __all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs", | 7 __all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs", |
8 "haslocal", "hascompare", "hasfree", "opname", "opmap", | 8 "haslocal", "hascompare", "hasfree", "opname", "opmap", |
9 "HAVE_ARGUMENT", "EXTENDED_ARG"] | 9 "HAVE_ARGUMENT", "EXTENDED_ARG"] |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 def_op('POP_TOP', 1) | 47 def_op('POP_TOP', 1) |
48 def_op('ROT_TWO', 2) | 48 def_op('ROT_TWO', 2) |
49 def_op('ROT_THREE', 3) | 49 def_op('ROT_THREE', 3) |
50 def_op('DUP_TOP', 4) | 50 def_op('DUP_TOP', 4) |
51 def_op('ROT_FOUR', 5) | 51 def_op('ROT_FOUR', 5) |
52 | 52 |
53 def_op('NOP', 9) | 53 def_op('NOP', 9) |
54 def_op('UNARY_POSITIVE', 10) | 54 def_op('UNARY_POSITIVE', 10) |
55 def_op('UNARY_NEGATIVE', 11) | 55 def_op('UNARY_NEGATIVE', 11) |
56 def_op('UNARY_NOT', 12) | 56 def_op('UNARY_NOT', 12) |
| 57 def_op('UNARY_CONVERT', 13) |
57 | 58 |
58 def_op('UNARY_INVERT', 15) | 59 def_op('UNARY_INVERT', 15) |
59 | 60 |
60 def_op('BINARY_POWER', 19) | 61 def_op('BINARY_POWER', 19) |
61 def_op('BINARY_MULTIPLY', 20) | 62 def_op('BINARY_MULTIPLY', 20) |
62 | 63 def_op('BINARY_DIVIDE', 21) |
63 def_op('BINARY_MODULO', 22) | 64 def_op('BINARY_MODULO', 22) |
64 def_op('BINARY_ADD', 23) | 65 def_op('BINARY_ADD', 23) |
65 def_op('BINARY_SUBTRACT', 24) | 66 def_op('BINARY_SUBTRACT', 24) |
66 def_op('BINARY_SUBSCR', 25) | 67 def_op('BINARY_SUBSCR', 25) |
67 def_op('BINARY_FLOOR_DIVIDE', 26) | 68 def_op('BINARY_FLOOR_DIVIDE', 26) |
68 def_op('BINARY_TRUE_DIVIDE', 27) | 69 def_op('BINARY_TRUE_DIVIDE', 27) |
69 def_op('INPLACE_FLOOR_DIVIDE', 28) | 70 def_op('INPLACE_FLOOR_DIVIDE', 28) |
70 def_op('INPLACE_TRUE_DIVIDE', 29) | 71 def_op('INPLACE_TRUE_DIVIDE', 29) |
| 72 def_op('SLICE+0', 30) |
| 73 def_op('SLICE+1', 31) |
| 74 def_op('SLICE+2', 32) |
| 75 def_op('SLICE+3', 33) |
| 76 |
| 77 def_op('STORE_SLICE+0', 40) |
| 78 def_op('STORE_SLICE+1', 41) |
| 79 def_op('STORE_SLICE+2', 42) |
| 80 def_op('STORE_SLICE+3', 43) |
| 81 |
| 82 def_op('DELETE_SLICE+0', 50) |
| 83 def_op('DELETE_SLICE+1', 51) |
| 84 def_op('DELETE_SLICE+2', 52) |
| 85 def_op('DELETE_SLICE+3', 53) |
71 | 86 |
72 def_op('STORE_MAP', 54) | 87 def_op('STORE_MAP', 54) |
73 def_op('INPLACE_ADD', 55) | 88 def_op('INPLACE_ADD', 55) |
74 def_op('INPLACE_SUBTRACT', 56) | 89 def_op('INPLACE_SUBTRACT', 56) |
75 def_op('INPLACE_MULTIPLY', 57) | 90 def_op('INPLACE_MULTIPLY', 57) |
76 | 91 def_op('INPLACE_DIVIDE', 58) |
77 def_op('INPLACE_MODULO', 59) | 92 def_op('INPLACE_MODULO', 59) |
78 def_op('STORE_SUBSCR', 60) | 93 def_op('STORE_SUBSCR', 60) |
79 def_op('DELETE_SUBSCR', 61) | 94 def_op('DELETE_SUBSCR', 61) |
80 def_op('BINARY_LSHIFT', 62) | 95 def_op('BINARY_LSHIFT', 62) |
81 def_op('BINARY_RSHIFT', 63) | 96 def_op('BINARY_RSHIFT', 63) |
82 def_op('BINARY_AND', 64) | 97 def_op('BINARY_AND', 64) |
83 def_op('BINARY_XOR', 65) | 98 def_op('BINARY_XOR', 65) |
84 def_op('BINARY_OR', 66) | 99 def_op('BINARY_OR', 66) |
85 def_op('INPLACE_POWER', 67) | 100 def_op('INPLACE_POWER', 67) |
86 def_op('GET_ITER', 68) | 101 def_op('GET_ITER', 68) |
87 def_op('STORE_LOCALS', 69) | |
88 | 102 |
89 def_op('PRINT_EXPR', 70) | 103 def_op('PRINT_EXPR', 70) |
90 def_op('LOAD_BUILD_CLASS', 71) | 104 def_op('PRINT_ITEM', 71) |
91 | 105 def_op('PRINT_NEWLINE', 72) |
| 106 def_op('PRINT_ITEM_TO', 73) |
| 107 def_op('PRINT_NEWLINE_TO', 74) |
92 def_op('INPLACE_LSHIFT', 75) | 108 def_op('INPLACE_LSHIFT', 75) |
93 def_op('INPLACE_RSHIFT', 76) | 109 def_op('INPLACE_RSHIFT', 76) |
94 def_op('INPLACE_AND', 77) | 110 def_op('INPLACE_AND', 77) |
95 def_op('INPLACE_XOR', 78) | 111 def_op('INPLACE_XOR', 78) |
96 def_op('INPLACE_OR', 79) | 112 def_op('INPLACE_OR', 79) |
97 def_op('BREAK_LOOP', 80) | 113 def_op('BREAK_LOOP', 80) |
98 def_op('WITH_CLEANUP', 81) | 114 def_op('WITH_CLEANUP', 81) |
99 | 115 def_op('LOAD_LOCALS', 82) |
100 def_op('RETURN_VALUE', 83) | 116 def_op('RETURN_VALUE', 83) |
101 def_op('IMPORT_STAR', 84) | 117 def_op('IMPORT_STAR', 84) |
102 | 118 def_op('EXEC_STMT', 85) |
103 def_op('YIELD_VALUE', 86) | 119 def_op('YIELD_VALUE', 86) |
104 def_op('POP_BLOCK', 87) | 120 def_op('POP_BLOCK', 87) |
105 def_op('END_FINALLY', 88) | 121 def_op('END_FINALLY', 88) |
106 def_op('POP_EXCEPT', 89) | 122 def_op('BUILD_CLASS', 89) |
107 | 123 |
108 HAVE_ARGUMENT = 90 # Opcodes from here have an argument: | 124 HAVE_ARGUMENT = 90 # Opcodes from here have an argument: |
109 | 125 |
110 name_op('STORE_NAME', 90) # Index in name list | 126 name_op('STORE_NAME', 90) # Index in name list |
111 name_op('DELETE_NAME', 91) # "" | 127 name_op('DELETE_NAME', 91) # "" |
112 def_op('UNPACK_SEQUENCE', 92) # Number of tuple items | 128 def_op('UNPACK_SEQUENCE', 92) # Number of tuple items |
113 jrel_op('FOR_ITER', 93) | 129 jrel_op('FOR_ITER', 93) |
114 def_op('UNPACK_EX', 94) | 130 def_op('LIST_APPEND', 94) |
115 name_op('STORE_ATTR', 95) # Index in name list | 131 name_op('STORE_ATTR', 95) # Index in name list |
116 name_op('DELETE_ATTR', 96) # "" | 132 name_op('DELETE_ATTR', 96) # "" |
117 name_op('STORE_GLOBAL', 97) # "" | 133 name_op('STORE_GLOBAL', 97) # "" |
118 name_op('DELETE_GLOBAL', 98) # "" | 134 name_op('DELETE_GLOBAL', 98) # "" |
119 def_op('DUP_TOPX', 99) # number of items to duplicate | 135 def_op('DUP_TOPX', 99) # number of items to duplicate |
120 def_op('LOAD_CONST', 100) # Index in const list | 136 def_op('LOAD_CONST', 100) # Index in const list |
121 hasconst.append(100) | 137 hasconst.append(100) |
122 name_op('LOAD_NAME', 101) # Index in name list | 138 name_op('LOAD_NAME', 101) # Index in name list |
123 def_op('BUILD_TUPLE', 102) # Number of tuple items | 139 def_op('BUILD_TUPLE', 102) # Number of tuple items |
124 def_op('BUILD_LIST', 103) # Number of list items | 140 def_op('BUILD_LIST', 103) # Number of list items |
125 def_op('BUILD_SET', 104) # Number of set items | 141 def_op('BUILD_MAP', 104) # Number of dict entries (upto 255) |
126 def_op('BUILD_MAP', 105) # Number of dict entries (upto 255) | 142 name_op('LOAD_ATTR', 105) # Index in name list |
127 name_op('LOAD_ATTR', 106) # Index in name list | 143 def_op('COMPARE_OP', 106) # Comparison operator |
128 def_op('COMPARE_OP', 107) # Comparison operator | 144 hascompare.append(106) |
129 hascompare.append(107) | 145 name_op('IMPORT_NAME', 107) # Index in name list |
130 name_op('IMPORT_NAME', 108) # Index in name list | 146 name_op('IMPORT_FROM', 108) # Index in name list |
131 name_op('IMPORT_FROM', 109) # Index in name list | |
132 | 147 |
133 jrel_op('JUMP_FORWARD', 110) # Number of bytes to skip | 148 jrel_op('JUMP_FORWARD', 110) # Number of bytes to skip |
134 jabs_op('JUMP_IF_FALSE_OR_POP', 111) # Target byte offset from beginning of code | 149 jabs_op('JUMP_IF_FALSE_OR_POP', 111) # Target byte offset from beginning of code |
135 jabs_op('JUMP_IF_TRUE_OR_POP', 112) # "" | 150 jabs_op('JUMP_IF_TRUE_OR_POP', 112) # "" |
136 jabs_op('JUMP_ABSOLUTE', 113) # "" | 151 jabs_op('JUMP_ABSOLUTE', 113) # "" |
137 jabs_op('POP_JUMP_IF_FALSE', 114) # "" | 152 jabs_op('POP_JUMP_IF_FALSE', 114) # "" |
138 jabs_op('POP_JUMP_IF_TRUE', 115) # "" | 153 jabs_op('POP_JUMP_IF_TRUE', 115) # "" |
139 | 154 |
140 name_op('LOAD_GLOBAL', 116) # Index in name list | 155 name_op('LOAD_GLOBAL', 116) # Index in name list |
141 | 156 |
(...skipping 20 matching lines...) Expand all Loading... |
162 hasfree.append(136) | 177 hasfree.append(136) |
163 def_op('STORE_DEREF', 137) | 178 def_op('STORE_DEREF', 137) |
164 hasfree.append(137) | 179 hasfree.append(137) |
165 | 180 |
166 def_op('CALL_FUNCTION_VAR', 140) # #args + (#kwargs << 8) | 181 def_op('CALL_FUNCTION_VAR', 140) # #args + (#kwargs << 8) |
167 def_op('CALL_FUNCTION_KW', 141) # #args + (#kwargs << 8) | 182 def_op('CALL_FUNCTION_KW', 141) # #args + (#kwargs << 8) |
168 def_op('CALL_FUNCTION_VAR_KW', 142) # #args + (#kwargs << 8) | 183 def_op('CALL_FUNCTION_VAR_KW', 142) # #args + (#kwargs << 8) |
169 def_op('EXTENDED_ARG', 143) | 184 def_op('EXTENDED_ARG', 143) |
170 EXTENDED_ARG = 143 | 185 EXTENDED_ARG = 143 |
171 | 186 |
172 def_op('LIST_APPEND', 145) | |
173 def_op('SET_ADD', 146) | |
174 def_op('MAP_ADD', 147) | |
175 | |
176 | |
177 del def_op, name_op, jrel_op, jabs_op | 187 del def_op, name_op, jrel_op, jabs_op |
LEFT | RIGHT |