annotate Lib/opcode.py @ 28646:193b8aec00ce legacy-trunk

Changes from Jonathan Riehl to allow his pgen extension (PEP 269) to work. This includes some more code that used to be part of pgen in the main parser; I'm okay with that. I'll see if the Windows build needs work next.
author Guido van Rossum <guido@python.org>
date Thu, 17 Apr 2003 14:55:42 +0000
parents 04a93b7bdce4
children ab4fbf8ebab3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28091
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
1
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
2 """
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
3 opcode module - potentially shared between dis and other modules which
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
4 operate on bytecodes (e.g. peephole optimizers).
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
5 """
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
6
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
7 __all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs",
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
8 "haslocal", "hascompare", "hasfree", "opname", "opmap",
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
9 "HAVE_ARGUMENT", "EXTENDED_ARG"]
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
10
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
11 cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is',
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
12 'is not', 'exception match', 'BAD')
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
13
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
14 hasconst = []
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
15 hasname = []
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
16 hasjrel = []
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
17 hasjabs = []
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
18 haslocal = []
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
19 hascompare = []
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
20 hasfree = []
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
21
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
22 opmap = {}
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
23 opname = [''] * 256
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
24 for op in range(256): opname[op] = '<' + `op` + '>'
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
25 del op
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
26
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
27 def def_op(name, op):
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
28 opname[op] = name
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
29 opmap[name] = op
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
30
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
31 def name_op(name, op):
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
32 def_op(name, op)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
33 hasname.append(op)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
34
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
35 def jrel_op(name, op):
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
36 def_op(name, op)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
37 hasjrel.append(op)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
38
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
39 def jabs_op(name, op):
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
40 def_op(name, op)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
41 hasjabs.append(op)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
42
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
43 # Instruction opcodes for compiled code
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
44
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
45 def_op('STOP_CODE', 0)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
46 def_op('POP_TOP', 1)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
47 def_op('ROT_TWO', 2)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
48 def_op('ROT_THREE', 3)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
49 def_op('DUP_TOP', 4)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
50 def_op('ROT_FOUR', 5)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
51
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
52 def_op('UNARY_POSITIVE', 10)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
53 def_op('UNARY_NEGATIVE', 11)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
54 def_op('UNARY_NOT', 12)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
55 def_op('UNARY_CONVERT', 13)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
56
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
57 def_op('UNARY_INVERT', 15)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
58
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
59 def_op('BINARY_POWER', 19)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
60
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
61 def_op('BINARY_MULTIPLY', 20)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
62 def_op('BINARY_DIVIDE', 21)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
63 def_op('BINARY_MODULO', 22)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
64 def_op('BINARY_ADD', 23)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
65 def_op('BINARY_SUBTRACT', 24)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
66 def_op('BINARY_SUBSCR', 25)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
67 def_op('BINARY_FLOOR_DIVIDE', 26)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
68 def_op('BINARY_TRUE_DIVIDE', 27)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
69 def_op('INPLACE_FLOOR_DIVIDE', 28)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
70 def_op('INPLACE_TRUE_DIVIDE', 29)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
71
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
72 def_op('SLICE+0', 30)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
73 def_op('SLICE+1', 31)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
74 def_op('SLICE+2', 32)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
75 def_op('SLICE+3', 33)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
76
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
77 def_op('STORE_SLICE+0', 40)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
78 def_op('STORE_SLICE+1', 41)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
79 def_op('STORE_SLICE+2', 42)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
80 def_op('STORE_SLICE+3', 43)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
81
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
82 def_op('DELETE_SLICE+0', 50)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
83 def_op('DELETE_SLICE+1', 51)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
84 def_op('DELETE_SLICE+2', 52)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
85 def_op('DELETE_SLICE+3', 53)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
86
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
87 def_op('INPLACE_ADD', 55)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
88 def_op('INPLACE_SUBTRACT', 56)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
89 def_op('INPLACE_MULTIPLY', 57)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
90 def_op('INPLACE_DIVIDE', 58)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
91 def_op('INPLACE_MODULO', 59)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
92 def_op('STORE_SUBSCR', 60)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
93 def_op('DELETE_SUBSCR', 61)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
94
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
95 def_op('BINARY_LSHIFT', 62)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
96 def_op('BINARY_RSHIFT', 63)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
97 def_op('BINARY_AND', 64)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
98 def_op('BINARY_XOR', 65)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
99 def_op('BINARY_OR', 66)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
100 def_op('INPLACE_POWER', 67)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
101 def_op('GET_ITER', 68)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
102
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
103 def_op('PRINT_EXPR', 70)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
104 def_op('PRINT_ITEM', 71)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
105 def_op('PRINT_NEWLINE', 72)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
106 def_op('PRINT_ITEM_TO', 73)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
107 def_op('PRINT_NEWLINE_TO', 74)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
108 def_op('INPLACE_LSHIFT', 75)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
109 def_op('INPLACE_RSHIFT', 76)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
110 def_op('INPLACE_AND', 77)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
111 def_op('INPLACE_XOR', 78)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
112 def_op('INPLACE_OR', 79)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
113 def_op('BREAK_LOOP', 80)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
114
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
115 def_op('LOAD_LOCALS', 82)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
116 def_op('RETURN_VALUE', 83)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
117 def_op('IMPORT_STAR', 84)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
118 def_op('EXEC_STMT', 85)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
119 def_op('YIELD_VALUE', 86)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
120
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
121 def_op('POP_BLOCK', 87)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
122 def_op('END_FINALLY', 88)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
123 def_op('BUILD_CLASS', 89)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
124
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
125 HAVE_ARGUMENT = 90 # Opcodes from here have an argument:
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
126
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
127 name_op('STORE_NAME', 90) # Index in name list
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
128 name_op('DELETE_NAME', 91) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
129 def_op('UNPACK_SEQUENCE', 92) # Number of tuple items
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
130 jrel_op('FOR_ITER', 93)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
131
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
132 name_op('STORE_ATTR', 95) # Index in name list
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
133 name_op('DELETE_ATTR', 96) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
134 name_op('STORE_GLOBAL', 97) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
135 name_op('DELETE_GLOBAL', 98) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
136 def_op('DUP_TOPX', 99) # number of items to duplicate
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
137 def_op('LOAD_CONST', 100) # Index in const list
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
138 hasconst.append(100)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
139 name_op('LOAD_NAME', 101) # Index in name list
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
140 def_op('BUILD_TUPLE', 102) # Number of tuple items
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
141 def_op('BUILD_LIST', 103) # Number of list items
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
142 def_op('BUILD_MAP', 104) # Always zero for now
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
143 name_op('LOAD_ATTR', 105) # Index in name list
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
144 def_op('COMPARE_OP', 106) # Comparison operator
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
145 hascompare.append(106)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
146 name_op('IMPORT_NAME', 107) # Index in name list
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
147 name_op('IMPORT_FROM', 108) # Index in name list
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
148
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
149 jrel_op('JUMP_FORWARD', 110) # Number of bytes to skip
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
150 jrel_op('JUMP_IF_FALSE', 111) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
151 jrel_op('JUMP_IF_TRUE', 112) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
152 jabs_op('JUMP_ABSOLUTE', 113) # Target byte offset from beginning of code
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
153
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
154 name_op('LOAD_GLOBAL', 116) # Index in name list
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
155
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
156 jabs_op('CONTINUE_LOOP', 119) # Target address
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
157 jrel_op('SETUP_LOOP', 120) # Distance to target address
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
158 jrel_op('SETUP_EXCEPT', 121) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
159 jrel_op('SETUP_FINALLY', 122) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
160
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
161 def_op('LOAD_FAST', 124) # Local variable number
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
162 haslocal.append(124)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
163 def_op('STORE_FAST', 125) # Local variable number
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
164 haslocal.append(125)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
165 def_op('DELETE_FAST', 126) # Local variable number
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
166 haslocal.append(126)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
167
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
168 def_op('RAISE_VARARGS', 130) # Number of raise arguments (1, 2, or 3)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
169 def_op('CALL_FUNCTION', 131) # #args + (#kwargs << 8)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
170 def_op('MAKE_FUNCTION', 132) # Number of args with default values
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
171 def_op('BUILD_SLICE', 133) # Number of items
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
172
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
173 def_op('MAKE_CLOSURE', 134)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
174 def_op('LOAD_CLOSURE', 135)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
175 hasfree.append(135)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
176 def_op('LOAD_DEREF', 136)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
177 hasfree.append(136)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
178 def_op('STORE_DEREF', 137)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
179 hasfree.append(137)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
180
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
181 def_op('CALL_FUNCTION_VAR', 140) # #args + (#kwargs << 8)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
182 def_op('CALL_FUNCTION_KW', 141) # #args + (#kwargs << 8)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
183 def_op('CALL_FUNCTION_VAR_KW', 142) # #args + (#kwargs << 8)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
184
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
185 def_op('EXTENDED_ARG', 143)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
186 EXTENDED_ARG = 143
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
187
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
188 del def_op, name_op, jrel_op, jabs_op