annotate Lib/opcode.py @ 58765:2ba7677bfa95 legacy-trunk

testCopysign was defined twice in test_math; combine the definitions
author Mark Dickinson <dickinsm@gmail.com>
date Sat, 06 Feb 2010 23:11:25 +0000
parents edfed0e32ced
children
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
31515
71a294bd7950 Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents: 28759
diff changeset
24 for op in range(256): opname[op] = '<%r>' % (op,)
28091
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
36695
b6d2f6fd3e11 PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents: 32395
diff changeset
44 # Blank lines correspond to available opcodes
28091
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
45
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
46 def_op('STOP_CODE', 0)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
47 def_op('POP_TOP', 1)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
48 def_op('ROT_TWO', 2)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
49 def_op('ROT_THREE', 3)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
50 def_op('DUP_TOP', 4)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
51 def_op('ROT_FOUR', 5)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
52
32395
6bc6abba8659 Install two code generation optimizations that depend on NOP.
Raymond Hettinger <python@rcn.com>
parents: 31618
diff changeset
53 def_op('NOP', 9)
28091
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
54 def_op('UNARY_POSITIVE', 10)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
55 def_op('UNARY_NEGATIVE', 11)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
56 def_op('UNARY_NOT', 12)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
57 def_op('UNARY_CONVERT', 13)
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('UNARY_INVERT', 15)
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_POWER', 19)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
62 def_op('BINARY_MULTIPLY', 20)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
63 def_op('BINARY_DIVIDE', 21)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
64 def_op('BINARY_MODULO', 22)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
65 def_op('BINARY_ADD', 23)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
66 def_op('BINARY_SUBTRACT', 24)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
67 def_op('BINARY_SUBSCR', 25)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
68 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
69 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
70 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
71 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
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
44334
07aa19170a67 Speed-up dictionary constructor by about 10%.
Raymond Hettinger <python@rcn.com>
parents: 36695
diff changeset
87 def_op('STORE_MAP', 54)
28091
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
88 def_op('INPLACE_ADD', 55)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
89 def_op('INPLACE_SUBTRACT', 56)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
90 def_op('INPLACE_MULTIPLY', 57)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
91 def_op('INPLACE_DIVIDE', 58)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
92 def_op('INPLACE_MODULO', 59)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
93 def_op('STORE_SUBSCR', 60)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
94 def_op('DELETE_SUBSCR', 61)
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)
36695
b6d2f6fd3e11 PEP 343 -- the with-statement.
Guido van Rossum <guido@python.org>
parents: 32395
diff changeset
114 def_op('WITH_CLEANUP', 81)
28091
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 def_op('POP_BLOCK', 87)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
121 def_op('END_FINALLY', 88)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
122 def_op('BUILD_CLASS', 89)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
123
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
124 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
125
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
126 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
127 name_op('DELETE_NAME', 91) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
128 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
129 jrel_op('FOR_ITER', 93)
50204
94e79d78dff0 Issue #2183: Simplify and optimize bytecode for list comprehensions.
Antoine Pitrou <solipsis@pitrou.net>
parents: 44339
diff changeset
130 def_op('LIST_APPEND', 94)
28091
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
131 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
132 name_op('DELETE_ATTR', 96) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
133 name_op('STORE_GLOBAL', 97) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
134 name_op('DELETE_GLOBAL', 98) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
135 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
136 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
137 hasconst.append(100)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
138 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
139 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
140 def_op('BUILD_LIST', 103) # Number of list items
58229
c2fdf25329ff Issue #2335: Backport set literals syntax from Python 3.x.
Alexandre Vassalotti <alexandre@peadrop.com>
parents: 54329
diff changeset
141 def_op('BUILD_SET', 104) # Number of set items
c2fdf25329ff Issue #2335: Backport set literals syntax from Python 3.x.
Alexandre Vassalotti <alexandre@peadrop.com>
parents: 54329
diff changeset
142 def_op('BUILD_MAP', 105) # Number of dict entries (upto 255)
c2fdf25329ff Issue #2335: Backport set literals syntax from Python 3.x.
Alexandre Vassalotti <alexandre@peadrop.com>
parents: 54329
diff changeset
143 name_op('LOAD_ATTR', 106) # Index in name list
c2fdf25329ff Issue #2335: Backport set literals syntax from Python 3.x.
Alexandre Vassalotti <alexandre@peadrop.com>
parents: 54329
diff changeset
144 def_op('COMPARE_OP', 107) # Comparison operator
c2fdf25329ff Issue #2335: Backport set literals syntax from Python 3.x.
Alexandre Vassalotti <alexandre@peadrop.com>
parents: 54329
diff changeset
145 hascompare.append(107)
c2fdf25329ff Issue #2335: Backport set literals syntax from Python 3.x.
Alexandre Vassalotti <alexandre@peadrop.com>
parents: 54329
diff changeset
146 name_op('IMPORT_NAME', 108) # Index in name list
c2fdf25329ff Issue #2335: Backport set literals syntax from Python 3.x.
Alexandre Vassalotti <alexandre@peadrop.com>
parents: 54329
diff changeset
147 name_op('IMPORT_FROM', 109) # Index in name list
28091
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
148 jrel_op('JUMP_FORWARD', 110) # Number of bytes to skip
51920
ef8fe9088696 Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 50204
diff changeset
149 jabs_op('JUMP_IF_FALSE_OR_POP', 111) # Target byte offset from beginning of code
ef8fe9088696 Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 50204
diff changeset
150 jabs_op('JUMP_IF_TRUE_OR_POP', 112) # ""
ef8fe9088696 Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 50204
diff changeset
151 jabs_op('JUMP_ABSOLUTE', 113) # ""
ef8fe9088696 Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 50204
diff changeset
152 jabs_op('POP_JUMP_IF_FALSE', 114) # ""
ef8fe9088696 Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} with
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 50204
diff changeset
153 jabs_op('POP_JUMP_IF_TRUE', 115) # ""
28091
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
154
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
155 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
156
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
157 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
158 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
159 jrel_op('SETUP_EXCEPT', 121) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
160 jrel_op('SETUP_FINALLY', 122) # ""
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
161
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
162 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
163 haslocal.append(124)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
164 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
165 haslocal.append(125)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
166 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
167 haslocal.append(126)
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
168
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
169 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
170 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
171 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
172 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
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)
54329
145376df3ad7 add a SETUP_WITH opcode
Benjamin Peterson <benjamin@python.org>
parents: 51920
diff changeset
184
145376df3ad7 add a SETUP_WITH opcode
Benjamin Peterson <benjamin@python.org>
parents: 51920
diff changeset
185 jrel_op('SETUP_WITH', 143)
145376df3ad7 add a SETUP_WITH opcode
Benjamin Peterson <benjamin@python.org>
parents: 51920
diff changeset
186
145376df3ad7 add a SETUP_WITH opcode
Benjamin Peterson <benjamin@python.org>
parents: 51920
diff changeset
187 def_op('EXTENDED_ARG', 145)
145376df3ad7 add a SETUP_WITH opcode
Benjamin Peterson <benjamin@python.org>
parents: 51920
diff changeset
188 EXTENDED_ARG = 145
58250
edfed0e32ced Issue #2333: Backport set and dict comprehensions syntax.
Alexandre Vassalotti <alexandre@peadrop.com>
parents: 58229
diff changeset
189 def_op('SET_ADD', 146)
edfed0e32ced Issue #2333: Backport set and dict comprehensions syntax.
Alexandre Vassalotti <alexandre@peadrop.com>
parents: 58229
diff changeset
190 def_op('MAP_ADD', 147)
28091
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
191
04a93b7bdce4 new opcode module - extract opcode definitions from dis.py - eventually
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
192 del def_op, name_op, jrel_op, jabs_op