circuitpython/tests/cmdline/cmd_showbc.py.exp
Damien George 8c1d23a0e2 py: Modify bytecode "with" behaviour so it doesn't use any heap.
Before this patch a "with" block needed to create a bound method object
on the heap for the __exit__ call.  Now it doesn't because we use
load_method instead of load_attr, and save the method+self on the stack.
2015-04-24 01:52:28 +01:00

449 lines
9.2 KiB
Plaintext

File cmdline/cmd_showbc.py, code block '<module>' (descriptor: \.\+, bytecode @\.\+ bytes)
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
arg names:
(N_STATE 3)
(N_EXC_STACK 0)
bc=-3 line=1
########
bc=\\d\+ line=134
00 MAKE_FUNCTION \.\+
\\d\+ STORE_NAME f
\\d\+ LOAD_CONST_SMALL_INT 1
\\d\+ BUILD_TUPLE 1
\\d\+ LOAD_NULL
\\d\+ MAKE_FUNCTION_DEFARGS \.\+
\\d\+ STORE_NAME f
\\d\+ MAKE_FUNCTION \.\+
\\d\+ STORE_NAME f
\\d\+ LOAD_BUILD_CLASS
\\d\+ MAKE_FUNCTION \.\+
\\d\+ LOAD_CONST_STRING 'Class'
\\d\+ CALL_FUNCTION n=2 nkw=0
\\d\+ STORE_NAME Class
\\d\+ LOAD_CONST_NONE
\\d\+ RETURN_VALUE
File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ bytes)
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
arg names:
(N_STATE 22)
(N_EXC_STACK 2)
(INIT_CELL 14)
(INIT_CELL 15)
(INIT_CELL 16)
bc=-6 line=1
########
bc=\\d\+ line=118
00 LOAD_CONST_NONE
01 LOAD_CONST_FALSE
02 BINARY_OP 5 __add__
03 LOAD_CONST_TRUE
04 BINARY_OP 5 __add__
05 LOAD_CONST_ELLIPSIS
06 BINARY_OP 5 __add__
07 STORE_FAST 0
08 LOAD_CONST_SMALL_INT 0
09 STORE_FAST 0
10 LOAD_CONST_SMALL_INT 1000
13 STORE_FAST 0
14 LOAD_CONST_SMALL_INT -1000
17 STORE_FAST 0
18 LOAD_CONST_SMALL_INT 1
19 STORE_FAST 0
20 LOAD_CONST_SMALL_INT 1
21 LOAD_CONST_SMALL_INT 2
22 BUILD_TUPLE 2
24 STORE_DEREF 14
26 LOAD_CONST_SMALL_INT 1
27 LOAD_CONST_SMALL_INT 2
28 BUILD_LIST 2
30 STORE_FAST 1
31 LOAD_CONST_SMALL_INT 1
32 LOAD_CONST_SMALL_INT 2
33 BUILD_SET 2
35 STORE_FAST 2
36 BUILD_MAP 0
38 STORE_DEREF 15
40 BUILD_MAP 1
42 LOAD_CONST_SMALL_INT 2
43 LOAD_CONST_SMALL_INT 1
44 STORE_MAP
45 STORE_FAST 3
46 LOAD_CONST_STRING 'a'
49 STORE_FAST 4
50 LOAD_CONST_BYTES a
53 STORE_FAST 5
54 LOAD_CONST_SMALL_INT 1
55 STORE_FAST 6
56 LOAD_CONST_SMALL_INT 2
57 STORE_FAST 7
58 LOAD_FAST 0
59 LOAD_DEREF 14
61 BINARY_OP 5 __add__
62 STORE_FAST 8
63 LOAD_FAST 0
64 UNARY_OP 3
65 STORE_FAST 9
66 LOAD_FAST 0
67 UNARY_OP 0
68 NOT
69 STORE_FAST 10
70 LOAD_FAST 0
71 LOAD_DEREF 14
73 DUP_TOP
74 ROT_THREE
75 BINARY_OP 26 __eq__
76 JUMP_IF_FALSE_OR_POP 84
79 LOAD_FAST 1
80 BINARY_OP 26 __eq__
81 JUMP 86
84 ROT_TWO
85 POP_TOP
86 STORE_FAST 10
87 LOAD_FAST 0
88 LOAD_DEREF 14
90 BINARY_OP 26 __eq__
91 JUMP_IF_FALSE_OR_POP 98
94 LOAD_DEREF 14
96 LOAD_FAST 1
97 BINARY_OP 26 __eq__
98 UNARY_OP 0
99 NOT
100 STORE_FAST 10
101 LOAD_DEREF 14
103 LOAD_ATTR c (cache=0)
107 STORE_FAST 11
108 LOAD_FAST 11
109 LOAD_DEREF 14
111 STORE_ATTR c (cache=0)
115 LOAD_DEREF 14
117 LOAD_CONST_SMALL_INT 0
118 LOAD_SUBSCR
119 STORE_FAST 12
120 LOAD_FAST 12
121 LOAD_DEREF 14
123 LOAD_CONST_SMALL_INT 0
124 STORE_SUBSCR
125 LOAD_DEREF 14
127 LOAD_CONST_NONE
128 LOAD_CONST_NONE
129 BUILD_SLICE 2
131 LOAD_SUBSCR
132 STORE_FAST 0
133 LOAD_FAST 1
134 UNPACK_SEQUENCE 2
136 STORE_FAST 0
137 STORE_DEREF 14
139 LOAD_DEREF 14
141 LOAD_FAST 0
142 ROT_TWO
143 STORE_FAST 0
144 STORE_DEREF 14
146 LOAD_FAST 1
147 LOAD_DEREF 14
149 LOAD_FAST 0
150 ROT_THREE
151 ROT_TWO
152 STORE_FAST 0
153 STORE_DEREF 14
155 STORE_FAST 1
156 DELETE_FAST 0
158 LOAD_FAST 0
159 STORE_GLOBAL gl
162 DELETE_GLOBAL gl
165 LOAD_FAST 14
166 LOAD_FAST 15
167 MAKE_CLOSURE \.\+ 2
\\d\+ LOAD_FAST 2
\\d\+ GET_ITER
\\d\+ CALL_FUNCTION n=1 nkw=0
\\d\+ STORE_FAST 0
\\d\+ LOAD_FAST 14
\\d\+ LOAD_FAST 15
\\d\+ MAKE_CLOSURE \.\+ 2
\\d\+ LOAD_FAST 2
\\d\+ GET_ITER
\\d\+ CALL_FUNCTION n=1 nkw=0
\\d\+ STORE_FAST 0
\\d\+ LOAD_FAST 14
\\d\+ LOAD_FAST 15
\\d\+ MAKE_CLOSURE \.\+ 2
\\d\+ LOAD_FAST 2
\\d\+ GET_ITER
\\d\+ CALL_FUNCTION n=1 nkw=0
\\d\+ STORE_FAST 0
\\d\+ LOAD_FAST 0
\\d\+ CALL_FUNCTION n=0 nkw=0
\\d\+ POP_TOP
\\d\+ LOAD_FAST 0
\\d\+ LOAD_CONST_SMALL_INT 1
\\d\+ CALL_FUNCTION n=1 nkw=0
\\d\+ POP_TOP
\\d\+ LOAD_FAST 0
\\d\+ LOAD_CONST_STRING 'b'
\\d\+ LOAD_CONST_SMALL_INT 1
\\d\+ CALL_FUNCTION n=0 nkw=1
\\d\+ POP_TOP
\\d\+ LOAD_FAST 0
\\d\+ LOAD_DEREF 14
\\d\+ LOAD_NULL
\\d\+ CALL_FUNCTION_VAR_KW n=0 nkw=0
\\d\+ POP_TOP
\\d\+ LOAD_FAST 0
\\d\+ LOAD_METHOD b
\\d\+ CALL_METHOD n=0 nkw=0
\\d\+ POP_TOP
\\d\+ LOAD_FAST 0
\\d\+ LOAD_METHOD b
\\d\+ LOAD_CONST_SMALL_INT 1
\\d\+ CALL_METHOD n=1 nkw=0
\\d\+ POP_TOP
\\d\+ LOAD_FAST 0
\\d\+ LOAD_METHOD b
\\d\+ LOAD_CONST_STRING 'c'
\\d\+ LOAD_CONST_SMALL_INT 1
\\d\+ CALL_METHOD n=0 nkw=1
\\d\+ POP_TOP
\\d\+ LOAD_FAST 0
\\d\+ LOAD_METHOD b
\\d\+ LOAD_FAST 1
\\d\+ LOAD_NULL
\\d\+ CALL_METHOD_VAR_KW n=0 nkw=0
\\d\+ POP_TOP
\\d\+ LOAD_FAST 0
\\d\+ POP_JUMP_IF_FALSE \\d\+
\\d\+ LOAD_DEREF 16
\\d\+ POP_TOP
\\d\+ JUMP \\d\+
\\d\+ LOAD_GLOBAL y (cache=0)
\\d\+ POP_TOP
\\d\+ JUMP \\d\+
\\d\+ LOAD_DEREF 14
\\d\+ POP_TOP
\\d\+ LOAD_FAST 0
\\d\+ POP_JUMP_IF_TRUE \\d\+
\\d\+ JUMP \\d\+
\\d\+ LOAD_DEREF 14
\\d\+ POP_TOP
\\d\+ LOAD_FAST 0
\\d\+ POP_JUMP_IF_FALSE \\d\+
\\d\+ LOAD_DEREF 14
\\d\+ GET_ITER
\\d\+ FOR_ITER \\d\+
\\d\+ STORE_FAST 0
\\d\+ LOAD_FAST 1
\\d\+ POP_TOP
\\d\+ JUMP \\d\+
\\d\+ SETUP_FINALLY \\d\+
\\d\+ SETUP_EXCEPT \\d\+
\\d\+ JUMP \\d\+
\\d\+ JUMP \\d\+
\\d\+ LOAD_FAST 0
\\d\+ POP_JUMP_IF_TRUE \\d\+
\\d\+ POP_BLOCK
\\d\+ JUMP \\d\+
\\d\+ POP_TOP
\\d\+ POP_TOP
\\d\+ POP_TOP
\\d\+ LOAD_DEREF 14
\\d\+ POP_TOP
\\d\+ POP_EXCEPT
\\d\+ JUMP \\d\+
\\d\+ END_FINALLY
\\d\+ POP_BLOCK
\\d\+ LOAD_CONST_NONE
\\d\+ LOAD_FAST 1
\\d\+ POP_TOP
\\d\+ END_FINALLY
\\d\+ LOAD_FAST 0
\\d\+ SETUP_WITH \\d\+
\\d\+ POP_TOP
\\d\+ LOAD_DEREF 14
\\d\+ POP_TOP
\\d\+ POP_BLOCK
\\d\+ LOAD_CONST_NONE
\\d\+ WITH_CLEANUP
\\d\+ END_FINALLY
\\d\+ LOAD_CONST_SMALL_INT 1
\\d\+ STORE_DEREF 16
\\d\+ LOAD_FAST_N 16
\\d\+ MAKE_CLOSURE \.\+ 1
\\d\+ STORE_FAST 13
\\d\+ LOAD_CONST_SMALL_INT 0
\\d\+ LOAD_CONST_NONE
\\d\+ IMPORT_NAME 'a'
\\d\+ STORE_FAST 0
\\d\+ LOAD_CONST_SMALL_INT 0
\\d\+ LOAD_CONST_STRING 'b'
\\d\+ BUILD_TUPLE 1
\\d\+ IMPORT_NAME 'a'
\\d\+ IMPORT_FROM 'b'
\\d\+ STORE_DEREF 14
\\d\+ POP_TOP
\\d\+ LOAD_CONST_SMALL_INT 0
\\d\+ LOAD_CONST_STRING '*'
\\d\+ BUILD_TUPLE 1
\\d\+ IMPORT_NAME 'a'
\\d\+ IMPORT_STAR
\\d\+ RAISE_VARARGS 0
\\d\+ LOAD_CONST_SMALL_INT 1
\\d\+ RAISE_VARARGS 1
\\d\+ LOAD_CONST_NONE
\\d\+ RETURN_VALUE
\\d\+ LOAD_CONST_SMALL_INT 1
\\d\+ RETURN_VALUE
File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ bytes)
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
arg names: a
(N_STATE 5)
(N_EXC_STACK 0)
(INIT_CELL 0)
########
bc=\\d\+ line=124
00 LOAD_CONST_SMALL_INT 2
01 BUILD_TUPLE 1
03 LOAD_NULL
04 LOAD_FAST 0
05 MAKE_CLOSURE_DEFARGS \.\+ 1
\\d\+ STORE_FAST 1
\\d\+ LOAD_CONST_NONE
\\d\+ RETURN_VALUE
File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ bytes)
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
arg names:
(N_STATE 2)
(N_EXC_STACK 0)
bc=-3 line=1
bc=0 line=129
bc=3 line=130
bc=6 line=131
00 LOAD_CONST_NONE
01 YIELD_VALUE
02 POP_TOP
03 LOAD_CONST_SMALL_INT 1
04 YIELD_VALUE
05 POP_TOP
06 LOAD_CONST_SMALL_INT 1
07 GET_ITER
08 LOAD_CONST_NONE
09 YIELD_FROM
10 POP_TOP
11 LOAD_CONST_NONE
12 RETURN_VALUE
File cmdline/cmd_showbc.py, code block 'Class' (descriptor: \.\+, bytecode @\.\+ bytes)
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
arg names:
(N_STATE 1)
(N_EXC_STACK 0)
bc=-3 line=1
bc=10 line=135
00 LOAD_NAME __name__ (cache=0)
03 STORE_NAME __module__
05 LOAD_CONST_STRING 'Class'
08 STORE_NAME __qualname__
10 LOAD_CONST_NONE
11 RETURN_VALUE
File cmdline/cmd_showbc.py, code block '<genexpr>' (descriptor: \.\+, bytecode @\.\+ bytes)
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
arg names: c e
(N_STATE 6)
(N_EXC_STACK 0)
bc=-\\d\+ line=1
00 LOAD_FAST 2
01 FOR_ITER 17
04 STORE_FAST 3
05 LOAD_DEREF 1
07 POP_JUMP_IF_FALSE 1
10 LOAD_DEREF 0
12 YIELD_VALUE
13 POP_TOP
14 JUMP 1
17 LOAD_CONST_NONE
18 RETURN_VALUE
File cmdline/cmd_showbc.py, code block '<listcomp>' (descriptor: \.\+, bytecode @\.\+ bytes)
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
arg names: c e
(N_STATE 7)
(N_EXC_STACK 0)
bc=-\\d\+ line=1
00 BUILD_LIST 0
02 LOAD_FAST 2
03 FOR_ITER 19
06 STORE_FAST 3
07 LOAD_DEREF 1
09 POP_JUMP_IF_FALSE 3
12 LOAD_DEREF 0
14 LIST_APPEND 2
16 JUMP 3
19 RETURN_VALUE
File cmdline/cmd_showbc.py, code block '<dictcomp>' (descriptor: \.\+, bytecode @\.\+ bytes)
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
arg names: c e
(N_STATE 8)
(N_EXC_STACK 0)
bc=-\\d\+ line=1
########
00 BUILD_MAP 0
02 LOAD_FAST 2
03 FOR_ITER 21
06 STORE_FAST 3
07 LOAD_DEREF 1
09 POP_JUMP_IF_FALSE 3
12 LOAD_DEREF 0
14 LOAD_DEREF 0
16 MAP_ADD 2
18 JUMP 3
21 RETURN_VALUE
File cmdline/cmd_showbc.py, code block 'closure' (descriptor: \.\+, bytecode @\.\+ bytes)
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
arg names: x
(N_STATE 4)
(N_EXC_STACK 0)
bc=-\\d\+ line=1
########
bc=\\d\+ line=105
00 LOAD_DEREF 0
02 LOAD_CONST_SMALL_INT 1
03 BINARY_OP 5 __add__
04 STORE_FAST 1
05 LOAD_CONST_SMALL_INT 1
06 STORE_DEREF 0
08 DELETE_DEREF 0
10 LOAD_CONST_NONE
11 RETURN_VALUE
File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ bytes)
Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
########
\.\+5b
arg names: b a
(N_STATE 4)
(N_EXC_STACK 0)
bc=-\\d\+ line=1
########
bc=\\d\+ line=125
00 LOAD_FAST 1
01 LOAD_DEREF 0
03 BINARY_OP 5 __add__
04 RETURN_VALUE
mem: total=\\d\+, current=\\d\+, peak=\\d\+
stack: \\d\+ out of \\d\+
GC: total: \\d\+, used: \\d\+, free: \\d\+
No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+