1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - 037abandon.cc</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v2">
<meta name="syntax" content="cpp">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="minimal">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; }
body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; }
* { font-size: 12pt; font-size: 1em; }
.Constant { color: #00a0a0; }
.cSpecial { color: #008000; }
.muRecipe { color: #ff8700; }
.Comment { color: #9090ff; }
.Delimiter { color: #800080; }
.Special { color: #c00000; }
.traceContains { color: #008000; }
.Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; }
.muData { color: #ffff00; }
.CommentedCode { color: #6c6c6c; }
.Identifier { color: #c0a020; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Comment">//: Reclaiming memory when it's no longer used.</span>
<span class="Comment">//: The top of the address layer has the complete life cycle of memory.</span>
<span class="Delimiter">:(scenario new_reclaim)</span>
<span class="muRecipe">def</span> main [
<span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span>
<span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:num <span class="Comment"># because 1 will get reset during abandon below</span>
<span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Comment"># abandon</span>
<span class="Constant">3</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span> <span class="Comment"># must be same size as abandoned memory to reuse</span>
<span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">3</span>:address:num
<span class="Constant">5</span>:<span class="Normal">bool</span><span class="Special"> <- </span>equal <span class="Constant">2</span>:num<span class="Delimiter">,</span> <span class="Constant">4</span>:num
]
<span class="Comment"># both allocations should have returned the same address</span>
<span class="traceContains">+mem: storing 1 in location 5</span>
<span class="Delimiter">:(before "End Decrement Refcount(old_address, payload_type, payload_size)")</span>
<span class="Normal">if</span> <span class="Delimiter">(</span>old_refcount == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
trace<span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"automatically abandoning "</span> << old_address << end<span class="Delimiter">();</span>
abandon<span class="Delimiter">(</span>old_address<span class="Delimiter">,</span> payload_type<span class="Delimiter">,</span> payload_size<span class="Delimiter">);</span>
<span class="Delimiter">}</span>
<span class="Comment">//: When abandoning addresses we'll save them to a 'free list', segregated by size.</span>
<span class="Delimiter">:(before "End routine Fields")</span>
map<<span class="Normal">int</span><span class="Delimiter">,</span> <span class="Normal">int</span>> free_list<span class="Delimiter">;</span>
<span class="Delimiter">:(code)</span>
<span class="Normal">void</span> abandon<span class="Delimiter">(</span><span class="Normal">int</span> address<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree* payload_type<span class="Delimiter">,</span> <span class="Normal">int</span> payload_size<span class="Delimiter">)</span> <span class="Delimiter">{</span>
trace<span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"abandon"</span><span class="Delimiter">)</span> << <span class="Constant">"updating refcounts inside "</span> << address << <span class="Constant">": "</span> << to_string<span class="Delimiter">(</span>payload_type<span class="Delimiter">)</span> << end<span class="Delimiter">();</span>
<span class="CommentedCode">//? Total_free += size;</span>
<span class="CommentedCode">//? ++Num_free;</span>
<span class="CommentedCode">//? cerr << "abandon: " << size << '\n';</span>
<span class="Comment">// decrement any contained refcounts</span>
<span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_array<span class="Delimiter">(</span>payload_type<span class="Delimiter">))</span> <span class="Delimiter">{</span>
reagent element<span class="Delimiter">;</span>
element<span class="Delimiter">.</span>type = copy_array_element<span class="Delimiter">(</span>payload_type<span class="Delimiter">);</span>
<span class="Normal">int</span> array_length = get_or_insert<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> address+<span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span>
assert<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name != <span class="Constant">"array"</span><span class="Delimiter">);</span>
<span class="Normal">int</span> element_size = size_of<span class="Delimiter">(</span>element<span class="Delimiter">);</span>
<span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < array_length<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span>
element<span class="Delimiter">.</span>set_value<span class="Delimiter">(</span>address + <span class="Comment">/*</span><span class="Comment">skip refcount and length</span><span class="Comment">*/</span><span class="Constant">2</span> + i*element_size<span class="Delimiter">);</span>
decrement_any_refcounts<span class="Delimiter">(</span>element<span class="Delimiter">);</span>
<span class="Delimiter">}</span>
<span class="Delimiter">}</span>
<span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_container<span class="Delimiter">(</span>payload_type<span class="Delimiter">)</span> || is_mu_exclusive_container<span class="Delimiter">(</span>payload_type<span class="Delimiter">))</span> <span class="Delimiter">{</span>
reagent tmp<span class="Delimiter">;</span>
tmp<span class="Delimiter">.</span>type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*payload_type<span class="Delimiter">);</span>
tmp<span class="Delimiter">.</span>set_value<span class="Delimiter">(</span>address + <span class="Comment">/*</span><span class="Comment">skip refcount</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span>
decrement_any_refcounts<span class="Delimiter">(</span>tmp<span class="Delimiter">);</span>
<span class="Delimiter">}</span>
<span class="Comment">// clear memory</span>
<span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> curr = address<span class="Delimiter">;</span> curr < address+payload_size<span class="Delimiter">;</span> ++curr<span class="Delimiter">)</span>
put<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span>
<span class="Comment">// append existing free list to address</span>
trace<span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"abandon"</span><span class="Delimiter">)</span> << <span class="Constant">"saving "</span> << address << <span class="Constant">" in free-list of size "</span> << payload_size << end<span class="Delimiter">();</span>
put<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> address<span class="Delimiter">,</span> get_or_insert<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> payload_size<span class="Delimiter">));</span>
put<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> payload_size<span class="Delimiter">,</span> address<span class="Delimiter">);</span>
<span class="Delimiter">}</span>
<span class="Delimiter">:(after "Allocate Special-cases")</span>
<span class="Normal">if</span> <span class="Delimiter">(</span>get_or_insert<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">))</span> <span class="Delimiter">{</span>
trace<span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"abandon"</span><span class="Delimiter">)</span> << <span class="Constant">"picking up space from free-list of size "</span> << size << end<span class="Delimiter">();</span>
<span class="Normal">int</span> result = get_or_insert<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">);</span>
trace<span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"new alloc from free list: "</span> << result << end<span class="Delimiter">();</span>
put<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">,</span> get_or_insert<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> result<span class="Delimiter">));</span>
put<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> result<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span>
<span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> curr = result<span class="Delimiter">;</span> curr < result+size<span class="Delimiter">;</span> ++curr<span class="Delimiter">)</span> <span class="Delimiter">{</span>
<span class="Normal">if</span> <span class="Delimiter">(</span>get_or_insert<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
raise << maybe<span class="Delimiter">(</span>current_recipe_name<span class="Delimiter">())</span> << <span class="Constant">"memory in free list was not zeroed out: "</span> << curr << <span class="Constant">'/'</span> << result << <span class="Constant">"; somebody wrote to us after free!!!</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span>
<span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// always fatal</span>
<span class="Delimiter">}</span>
<span class="Delimiter">}</span>
<span class="Identifier">return</span> result<span class="Delimiter">;</span>
<span class="Delimiter">}</span>
<span class="Delimiter">:(scenario new_differing_size_no_reclaim)</span>
<span class="muRecipe">def</span> main [
<span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span>
<span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:num
<span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Comment"># abandon</span>
<span class="Constant">3</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span><span class="Delimiter">,</span> <span class="Constant">2</span> <span class="Comment"># different size</span>
<span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">3</span>:address:array:num
<span class="Constant">5</span>:<span class="Normal">bool</span><span class="Special"> <- </span>equal <span class="Constant">2</span>:num<span class="Delimiter">,</span> <span class="Constant">4</span>:num
]
<span class="Comment"># no reuse</span>
<span class="traceContains">+mem: storing 0 in location 5</span>
<span class="Delimiter">:(scenario new_reclaim_array)</span>
<span class="muRecipe">def</span> main [
<span class="Constant">1</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span><span class="Delimiter">,</span> <span class="Constant">2</span>
<span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:array:num
<span class="Constant">1</span>:address:array:num<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Comment"># abandon</span>
<span class="Constant">3</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span><span class="Delimiter">,</span> <span class="Constant">2</span> <span class="Comment"># same size</span>
<span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">3</span>:address:array:num
<span class="Constant">5</span>:<span class="Normal">bool</span><span class="Special"> <- </span>equal <span class="Constant">2</span>:num<span class="Delimiter">,</span> <span class="Constant">4</span>:num
]
<span class="Comment"># both calls to new returned identical addresses</span>
<span class="traceContains">+mem: storing 1 in location 5</span>
<span class="Delimiter">:(scenario abandon_on_overwrite)</span>
<span class="muRecipe">def</span> main [
<span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span>
<span class="Comment"># over-writing one allocation with another</span>
<span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span>
<span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span>
]
<span class="traceContains">+run: {1: ("address" "number")} <- new {number: "type"}</span>
<span class="traceContains">+mem: incrementing refcount of 1000: 0 -> 1</span>
<span class="traceContains">+run: {1: ("address" "number")} <- new {number: "type"}</span>
<span class="traceContains">+mem: automatically abandoning 1000</span>
<span class="Delimiter">:(scenario abandon_after_call)</span>
<span class="muRecipe">def</span> main [
<span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span>
<span class="Comment"># passing in addresses to recipes increments refcount</span>
foo <span class="Constant">1</span>:address:num
<span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span>
]
<span class="muRecipe">def</span> foo [
<span class="Constant">2</span>:address:num<span class="Special"> <- </span>next-ingredient
<span class="Comment"># return does NOT yet decrement refcount; memory must be explicitly managed</span>
<span class="Constant">2</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span>
]
<span class="traceContains">+run: {1: ("address" "number")} <- new {number: "type"}</span>
<span class="traceContains">+mem: incrementing refcount of 1000: 0 -> 1</span>
<span class="traceContains">+run: foo {1: ("address" "number")}</span>
<span class="Comment"># leave ambiguous precisely when the next increment happens; a later layer</span>
<span class="Comment"># will mess with that</span>
<span class="traceContains">+mem: incrementing refcount of 1000: 1 -> 2</span>
<span class="traceContains">+run: {2: ("address" "number")} <- copy {0: "literal"}</span>
<span class="traceContains">+mem: decrementing refcount of 1000: 2 -> 1</span>
<span class="traceContains">+run: {1: ("address" "number")} <- copy {0: "literal"}</span>
<span class="traceContains">+mem: decrementing refcount of 1000: 1 -> 0</span>
<span class="traceContains">+mem: automatically abandoning 1000</span>
<span class="Delimiter">:(scenario abandon_on_overwrite_array)</span>
<span class="muRecipe">def</span> main [
<span class="Constant">1</span>:num<span class="Special"> <- </span>copy <span class="Constant">30</span>
<span class="Comment"># allocate an array</span>
<span class="Constant">10</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span><span class="Delimiter">,</span> <span class="Constant">20</span>
<span class="Constant">11</span>:num<span class="Special"> <- </span>copy <span class="Constant">10</span>:address:array:num <span class="Comment"># doesn't increment refcount</span>
<span class="Comment"># allocate another array in its place, implicitly freeing the previous allocation</span>
<span class="Constant">10</span>:address:array:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span><span class="Delimiter">,</span> <span class="Constant">25</span>
]
<span class="traceContains">+run: {10: ("address" "array" "number")} <- new {number: "type"}, {25: "literal"}</span>
<span class="Comment"># abandoned array is of old size (20, not 25)</span>
<span class="traceContains">+abandon: saving 1000 in free-list of size 22</span>
<span class="Delimiter">:(scenario refcounts_abandon_address_in_container)</span>
<span class="Comment"># container containing an address</span>
<span class="muData">container</span> foo [
<span class="Normal">x</span>:address:num
]
<span class="muRecipe">def</span> main [
<span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span>
<span class="Constant">2</span>:address:foo<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">foo:type</span>
*<span class="Constant">2</span>:address:foo<span class="Special"> <- </span>put *<span class="Constant">2</span>:address:foo<span class="Delimiter">,</span> <span class="Constant">x:offset</span><span class="Delimiter">,</span> <span class="Constant">1</span>:address:num
<span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span>
<span class="Constant">2</span>:address:foo<span class="Special"> <- </span>copy <span class="Constant">0</span>
]
<span class="traceContains">+run: {1: ("address" "number")} <- new {number: "type"}</span>
<span class="traceContains">+mem: incrementing refcount of 1000: 0 -> 1</span>
<span class="traceContains">+run: {2: ("address" "foo")} <- new {foo: "type"}</span>
<span class="traceContains">+mem: incrementing refcount of 1002: 0 -> 1</span>
<span class="traceContains">+run: {2: ("address" "foo"), "lookup": ()} <- put {2: ("address" "foo"), "lookup": ()}, {x: "offset"}, {1: ("address" "number")}</span>
<span class="traceContains">+mem: incrementing refcount of 1000: 1 -> 2</span>
<span class="traceContains">+run: {1: ("address" "number")} <- copy {0: "literal"}</span>
<span class="traceContains">+mem: decrementing refcount of 1000: 2 -> 1</span>
<span class="traceContains">+run: {2: ("address" "foo")} <- copy {0: "literal"}</span>
<span class="Comment"># start abandoning container containing address</span>
<span class="traceContains">+mem: decrementing refcount of 1002: 1 -> 0</span>
<span class="Comment"># nested abandon</span>
<span class="traceContains">+mem: decrementing refcount of 1000: 1 -> 0</span>
<span class="traceContains">+abandon: saving 1000 in free-list of size 2</span>
<span class="Comment"># actually abandon the container containing address</span>
<span class="traceContains">+abandon: saving 1002 in free-list of size 2</span>
<span class="Comment"># todo: move past dilated reagent</span>
<span class="Delimiter">:(scenario refcounts_abandon_address_in_array)</span>
<span class="muRecipe">def</span> main [
<span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span>
<span class="Constant">2</span>:address:array:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Delimiter">{(</span>address number<span class="Delimiter">)</span>: type<span class="Delimiter">},</span> <span class="Constant">3</span>
*<span class="Constant">2</span>:address:array:address:num<span class="Special"> <- </span>put-index *<span class="Constant">2</span>:address:array:address:num<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">1</span>:address:num
<span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span>
<span class="Constant">2</span>:address:array:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span>
]
<span class="traceContains">+run: {1: ("address" "number")} <- new {number: "type"}</span>
<span class="traceContains">+mem: incrementing refcount of 1000: 0 -> 1</span>
<span class="traceContains">+run: {2: ("address" "array" "address" "number"), "lookup": ()} <- put-index {2: ("address" "array" "address" "number"), "lookup": ()}, {1: "literal"}, {1: ("address" "number")}</span>
<span class="traceContains">+mem: incrementing refcount of 1000: 1 -> 2</span>
<span class="traceContains">+run: {1: ("address" "number")} <- copy {0: "literal"}</span>
<span class="traceContains">+mem: decrementing refcount of 1000: 2 -> 1</span>
<span class="traceContains">+run: {2: ("address" "array" "address" "number")} <- copy {0: "literal"}</span>
<span class="Comment"># nested abandon</span>
<span class="traceContains">+mem: decrementing refcount of 1000: 1 -> 0</span>
<span class="traceContains">+abandon: saving 1000 in free-list of size 2</span>
<span class="Delimiter">:(scenario refcounts_abandon_address_in_container_in_array)</span>
<span class="Comment"># container containing an address</span>
<span class="muData">container</span> foo [
<span class="Normal">x</span>:address:num
]
<span class="muRecipe">def</span> main [
<span class="Constant">1</span>:address:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span>
<span class="Constant">2</span>:address:array:foo<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">foo:type</span><span class="Delimiter">,</span> <span class="Constant">3</span>
<span class="Constant">3</span>:foo<span class="Special"> <- </span>merge <span class="Constant">1</span>:address:num
*<span class="Constant">2</span>:address:array:foo<span class="Special"> <- </span>put-index *<span class="Constant">2</span>:address:array:foo<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">3</span>:foo
<span class="Constant">1</span>:address:num<span class="Special"> <- </span>copy <span class="Constant">0</span>
<span class="Constant">3</span>:foo<span class="Special"> <- </span>merge <span class="Constant">0</span>
<span class="Constant">2</span>:address:array:foo<span class="Special"> <- </span>copy <span class="Constant">0</span>
]
<span class="traceContains">+run: {1: ("address" "number")} <- new {number: "type"}</span>
<span class="traceContains">+mem: incrementing refcount of 1000: 0 -> 1</span>
<span class="traceContains">+run: {3: "foo"} <- merge {1: ("address" "number")}</span>
<span class="traceContains">+mem: incrementing refcount of 1000: 1 -> 2</span>
<span class="traceContains">+run: {2: ("address" "array" "foo"), "lookup": ()} <- put-index {2: ("address" "array" "foo"), "lookup": ()}, {1: "literal"}, {3: "foo"}</span>
<span class="traceContains">+mem: incrementing refcount of 1000: 2 -> 3</span>
<span class="traceContains">+run: {1: ("address" "number")} <- copy {0: "literal"}</span>
<span class="traceContains">+mem: decrementing refcount of 1000: 3 -> 2</span>
<span class="traceContains">+run: {3: "foo"} <- merge {0: "literal"}</span>
<span class="traceContains">+mem: decrementing refcount of 1000: 2 -> 1</span>
<span class="traceContains">+run: {2: ("address" "array" "foo")} <- copy {0: "literal"}</span>
<span class="Comment"># nested abandon</span>
<span class="traceContains">+mem: decrementing refcount of 1000: 1 -> 0</span>
<span class="traceContains">+abandon: saving 1000 in free-list of size 2</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
|