1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"content-type" content=
"text/html; charset=UTF-8">
5 <title>mu.arc.t
</title>
6 <meta name=
"Generator" content=
"Vim/7.4">
7 <meta name=
"plugin-version" content=
"vim7.4_v1">
8 <meta name=
"syntax" content=
"scheme">
9 <meta name=
"settings" content=
"use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
10 <meta name=
"colorscheme" content=
"minimal">
11 <style type=
"text/css">
13 pre
{ white-space: pre-wrap
; font-family: monospace
; color: #aaaaaa; background-color: #000000; }
14 body
{ font-family: monospace
; color: #aaaaaa; background-color: #000000; }
17 .Global { color: #00af87; }
18 .SalientComment { color: #00ffff; }
19 .CommentedCode { color: #666666; }
20 .Mu, .Mu .Normal, .Mu .Constant { color: #eeeeee; }
21 .Op { color: #ff8888; }
22 .Delimiter { color: #600060; }
23 .Normal { color: #aaaaaa; }
24 .Comment { color: #8080ff; }
25 .Constant, .MuConstant { color: #008080; }
26 .Identifier { color: #008080; }
30 <script type='text/javascript'
>
37 <pre id='vimCodeElement'
>
38 <span class=
"Comment">; Mu: An exploration on making the global structure of programs more accessible.
</span>
39 <span class=
"Comment">;
</span>
40 <span class=
"Comment">;
"Is it a language, or an operating system, or a virtual machine? Mu.
"</span>
41 <span class=
"Comment">; (with apologies to Robert Pirsig:
<a href=
"http://en.wikipedia.org/wiki/Mu_%28negative%29#In_popular_culture">http://en.wikipedia.org/wiki/Mu_%
28negative%
29#In_popular_culture
</a>)
</span>
42 <span class=
"Comment">;
</span>
43 <span class=
"SalientComment">;; Motivation
</span>
44 <span class=
"Comment">;
</span>
45 <span class=
"Comment">; I want to live in a world where I can have an itch to tweak a program, clone
</span>
46 <span class=
"Comment">; its open-source repository, orient myself on how it's organized, and make
</span>
47 <span class=
"Comment">; the simple change I envisioned, all in an afternoon. This codebase tries to
</span>
48 <span class=
"Comment">; make this possible for its readers. (More details:
<a href=
"http://akkartik.name/about">http://akkartik.name/about
</a>)
</span>
49 <span class=
"Comment">;
</span>
50 <span class=
"Comment">; What helps comprehend the global structure of programs? For starters, let's
</span>
51 <span class=
"Comment">; enumerate what doesn't: idiomatic code, adherence to a style guide or naming
</span>
52 <span class=
"Comment">; convention, consistent indentation, API documentation for each class, etc.
</span>
53 <span class=
"Comment">; These conventional considerations improve matters in the small, but don't
</span>
54 <span class=
"Comment">; help understand global organization. They help existing programmers manage
</span>
55 <span class=
"Comment">; day-to-day operations, but they can't turn outsider programmers into
</span>
56 <span class=
"Comment">; insiders. (Elaboration:
<a href=
"http://akkartik.name/post/readable-bad">http://akkartik.name/post/readable-bad
</a>)
</span>
57 <span class=
"Comment">;
</span>
58 <span class=
"Comment">; In my experience, two things have improved matters so far: version control
</span>
59 <span class=
"Comment">; and automated tests. Version control lets me rewind back to earlier, simpler
</span>
60 <span class=
"Comment">; times when the codebase was simpler, when its core skeleton was easier to
</span>
61 <span class=
"Comment">; ascertain. Indeed, arguably what came first is by definition the skeleton of
</span>
62 <span class=
"Comment">; a program, modulo major rewrites. Once you understand the skeleton, it
</span>
63 <span class=
"Comment">; becomes tractable to 'play back' later major features one by one. (Previous
</span>
64 <span class=
"Comment">; project that fleshed out this idea:
<a href=
"http://akkartik.name/post/wart-layers">http://akkartik.name/post/wart-layers
</a>)
</span>
65 <span class=
"Comment">;
</span>
66 <span class=
"Comment">; The second and biggest boost to comprehension comes from tests. Tests are
</span>
67 <span class=
"Comment">; good for writers for well-understood reasons: they avoid regressions, and
</span>
68 <span class=
"Comment">; they can influence code to be more decoupled and easier to change. In
</span>
69 <span class=
"Comment">; addition, tests are also good for the outsider reader because they permit
</span>
70 <span class=
"Comment">; active reading. If you can't build a program and run its tests it can't help
</span>
71 <span class=
"Comment">; you understand it. It hangs limp at best, and might even be actively
</span>
72 <span class=
"Comment">; misleading. If you can run its tests, however, it comes alive. You can step
</span>
73 <span class=
"Comment">; through scenarios in a debugger. You can add logging and scan logs to make
</span>
74 <span class=
"Comment">; sense of them. You can run what-if scenarios:
"why is this line not written
</span>
75 <span class=
"Comment">; like this?
" Make a change, rerun tests:
"Oh, that's why.
" (Elaboration:
</span>
76 <span class=
"Comment">;
<a href=
"http://akkartik.name/post/literate-programming">http://akkartik.name/post/literate-programming
</a>)
</span>
77 <span class=
"Comment">;
</span>
78 <span class=
"Comment">; However, tests are only useful to the extent that they exist. Think back to
</span>
79 <span class=
"Comment">; your most recent codebase. Do you feel comfortable releasing a new version
</span>
80 <span class=
"Comment">; just because the tests pass? I'm not aware of any such project. There's just
</span>
81 <span class=
"Comment">; too many situations envisaged by the authors that were never encoded in a
</span>
82 <span class=
"Comment">; test. Even disciplined authors can't test for performance or race conditions
</span>
83 <span class=
"Comment">; or fault tolerance. If a line is phrased just so because of some subtle
</span>
84 <span class=
"Comment">; performance consideration, it's hard to communicate to newcomers.
</span>
85 <span class=
"Comment">;
</span>
86 <span class=
"Comment">; This isn't an arcane problem, and it isn't just a matter of altruism. As
</span>
87 <span class=
"Comment">; more and more such implicit considerations proliferate, and as the original
</span>
88 <span class=
"Comment">; authors are replaced by latecomers for day-to-day operations, knowledge is
</span>
89 <span class=
"Comment">; actively forgotten and lost. The once-pristine codebase turns into legacy
</span>
90 <span class=
"Comment">; code that is hard to modify without expensive and stress-inducing
</span>
91 <span class=
"Comment">; regressions.
</span>
92 <span class=
"Comment">;
</span>
93 <span class=
"Comment">; How to write tests for performance, fault tolerance, race conditions, etc.?
</span>
94 <span class=
"Comment">; How can we state and verify that a codepath doesn't ever perform memory
</span>
95 <span class=
"Comment">; allocation, or write to disk? It requires better, more observable primitives
</span>
96 <span class=
"Comment">; than we currently have. Modern operating systems have their roots in the
</span>
97 <span class=
"Comment">;
70s. Their interfaces were not designed to be testable. They provide no way
</span>
98 <span class=
"Comment">; to simulate a full disk, or a specific sequence of writes from different
</span>
99 <span class=
"Comment">; threads. We need something better.
</span>
100 <span class=
"Comment">;
</span>
101 <span class=
"Comment">; This project tries to move, groping, towards that 'something better', a
</span>
102 <span class=
"Comment">; platform that is both thoroughly tested and allows programs written for it
</span>
103 <span class=
"Comment">; to be thoroughly tested. It tries to answer the question:
</span>
104 <span class=
"Comment">;
</span>
105 <span class=
"Comment">; If Denis Ritchie and Ken Thompson were to set out today to co-design unix
</span>
106 <span class=
"Comment">; and C, knowing what we know about automated tests, what would they do
</span>
107 <span class=
"Comment">; differently?
</span>
108 <span class=
"Comment">;
</span>
109 <span class=
"Comment">; To try to impose *some* constraints on this gigantic yak-shave, we'll try to
</span>
110 <span class=
"Comment">; keep both language and OS as simple as possible, focused entirely on
</span>
111 <span class=
"Comment">; permitting more kinds of tests, on first *collecting* all the information
</span>
112 <span class=
"Comment">; about implicit considerations in some form so that readers and tools can
</span>
113 <span class=
"Comment">; have at least some hope of making sense of it.
</span>
114 <span class=
"Comment">;
</span>
115 <span class=
"Comment">; The initial language will be just assembly. We'll try to make it convenient
</span>
116 <span class=
"Comment">; to program in with some simple localized rewrite rules inspired by lisp
</span>
117 <span class=
"Comment">; macros and literate programming. Programmers will have to do their own
</span>
118 <span class=
"Comment">; memory management and register allocation, but we'll provide libraries to
</span>
119 <span class=
"Comment">; help with them.
</span>
120 <span class=
"Comment">;
</span>
121 <span class=
"Comment">; The initial OS will provide just memory management and concurrency
</span>
122 <span class=
"Comment">; primitives. No users or permissions (we don't live on mainframes anymore),
</span>
123 <span class=
"Comment">; no kernel- vs user-mode, no virtual memory or process abstraction, all
</span>
124 <span class=
"Comment">; threads sharing a single address space (use VMs for security and
</span>
125 <span class=
"Comment">; sandboxing). The only use case we care about is getting a test harness to
</span>
126 <span class=
"Comment">; run some code, feed it data through blocking channels, stop it and observe
</span>
127 <span class=
"Comment">; its internals. The code under test is expected to cooperate in such testing,
</span>
128 <span class=
"Comment">; by logging important events for the test harness to observe. (More info:
</span>
129 <span class=
"Comment">;
<a href=
"http://akkartik.name/post/tracing-tests">http://akkartik.name/post/tracing-tests
</a>)
</span>
130 <span class=
"Comment">;
</span>
131 <span class=
"Comment">; The common thread here is elimination of abstractions, and it's not an
</span>
132 <span class=
"Comment">; accident. Abstractions help insiders manage the evolution of a codebase, but
</span>
133 <span class=
"Comment">; they actively hinder outsiders in understanding it from scratch. This
</span>
134 <span class=
"Comment">; matters, because the funnel to turn outsiders into insiders is critical to
</span>
135 <span class=
"Comment">; the long-term life of a codebase. Perhaps authors should raise their
</span>
136 <span class=
"Comment">; estimation of the costs of abstraction, and go against their instincts for
</span>
137 <span class=
"Comment">; introducing it. That's what I'll be trying to do: question every abstraction
</span>
138 <span class=
"Comment">; before I introduce it. We'll see how it goes.
</span>
140 <span class=
"Comment">; ---
</span>
142 <span class=
"SalientComment">;; Getting started
</span>
143 <span class=
"Comment">;
</span>
144 <span class=
"Comment">; Mu is currently built atop Racket and Arc, but this is temporary and
</span>
145 <span class=
"Comment">; contingent. We want to keep our options open, whether to port to a different
</span>
146 <span class=
"Comment">; host language, and easy to rewrite to native code for any platform. So we'll
</span>
147 <span class=
"Comment">; try to avoid 'cheating': relying on the host platform for advanced
</span>
148 <span class=
"Comment">; functionality.
</span>
149 <span class=
"Comment">;
</span>
150 <span class=
"Comment">; Other than that, we'll say no more about the code, and focus in the rest of
</span>
151 <span class=
"Comment">; this file on the scenarios the code cares about.
</span>
153 <span class=
"Delimiter">(
</span>selective-load
<span class=
"Constant">"mu.arc
"</span> section-level
<span class=
"Delimiter">)
</span>
154 <span class=
"CommentedCode">;? (quit)
</span>
156 <span class=
"Delimiter">(
</span>section
<span class=
"Constant">20</span>
158 <span class=
"Comment">; Our language is assembly-like in that functions consist of series of
</span>
159 <span class=
"Comment">; statements, and statements consist of an operation and its arguments (input
</span>
160 <span class=
"Comment">; and output).
</span>
161 <span class=
"Comment">;
</span>
162 <span class=
"Comment">; oarg1, oarg2, ...
<span class=
"Op"><-
</span> op arg1, arg2, ...
</span>
163 <span class=
"Comment">;
</span>
164 <span class=
"Comment">; Args must be atomic, like an integer or a memory address, they can't be
</span>
165 <span class=
"Comment">; expressions doing arithmetic or function calls. But we can have any number
</span>
166 <span class=
"Comment">; of them.
</span>
167 <span class=
"Comment">;
</span>
168 <span class=
"Comment">; Since we're building on lisp, our code samples won't look quite like the
</span>
169 <span class=
"Comment">; idealized syntax above. For now they will look like this:
</span>
170 <span class=
"Comment">;
</span>
171 <span class=
"Comment">; (function f [
</span>
172 <span class=
"Comment">; (oarg1 oarg2 ...
<span class=
"Op"><-
</span> op arg1 arg2 ...)
</span>
173 <span class=
"Comment">; ...
</span>
174 <span class=
"Comment">; ...
</span>
175 <span class=
"Comment">; ])
</span>
176 <span class=
"Comment">;
</span>
177 <span class=
"Comment">; Each arg/oarg can contain metadata separated by slashes and colons. In this
</span>
178 <span class=
"Comment">; first example below, the only metadata is types: 'integer' for a memory
</span>
179 <span class=
"Comment">; location containing an integer, and 'literal' for a value included directly
</span>
180 <span class=
"Comment">; in code. (Assembly languages traditionally call them 'immediate' operands.)
</span>
181 <span class=
"Comment">; In the future a simple tool will check that the types line up as expected in
</span>
182 <span class=
"Comment">; each op. A different tool might add types where they aren't provided.
</span>
183 <span class=
"Comment">; Instead of a monolithic compiler I want to build simple, lightweight tools
</span>
184 <span class=
"Comment">; that can be combined in various ways, say for using different typecheckers
</span>
185 <span class=
"Comment">; in different subsystems.
</span>
186 <span class=
"Comment">;
</span>
187 <span class=
"Comment">; In our tests we'll define such mu functions using a call to 'add-code', so
</span>
188 <span class=
"Comment">; look for it when reading the code examples. Everything outside 'add-code' is
</span>
189 <span class=
"Comment">; just test-harness details that can be skipped at first.
</span>
191 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
192 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
193 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"literal
"</span><span class=
"Delimiter">)
</span>
194 <span class=
"Delimiter">(
</span>add-code
195 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
196 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
197 <span class=
"Delimiter">])))
</span>
198 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
199 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
200 <span class=
"CommentedCode">;? (prn memory*)
</span>
201 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> <span class=
"Constant">23</span><span class=
"Delimiter">)
</span>
202 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'copy' writes its lone 'arg' after the instruction name to its lone 'oarg' or output arg before the arrow. After this test, the value
23 is stored in memory address
1.
"</span><span class=
"Delimiter">))
</span>
203 <span class=
"CommentedCode">;? (quit)
</span>
205 <span class=
"Comment">; Our basic arithmetic ops can operate on memory locations or literals.
</span>
206 <span class=
"Comment">; (Ignore hardware details like registers for now.)
</span>
208 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
209 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"add
"</span><span class=
"Delimiter">)
</span>
210 <span class=
"Delimiter">(
</span>add-code
211 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
212 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
213 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
214 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
215 <span class=
"Delimiter">])))
</span>
216 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
217 <span class=
"CommentedCode">;? (prn memory*)
</span>
218 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">3</span> <span class=
"Constant">3</span> <span class=
"Constant">4</span><span class=
"Delimiter">))
</span>
219 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'add' operates on two addresses
"</span><span class=
"Delimiter">))
</span>
220 <span class=
"CommentedCode">;? (quit)
</span>
222 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
223 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"add-literal
"</span><span class=
"Delimiter">)
</span>
224 <span class=
"Delimiter">(
</span>add-code
225 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
226 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"MuConstant">2</span>:literal
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
227 <span class=
"Delimiter">])))
</span>
228 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
229 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> <span class=
"Constant">5</span><span class=
"Delimiter">)
</span>
230 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - ops can take 'literal' operands (but not return them)
"</span><span class=
"Delimiter">))
</span>
232 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
233 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"sub-literal
"</span><span class=
"Delimiter">)
</span>
234 <span class=
"Delimiter">(
</span>add-code
235 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
236 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> subtract
<span class=
"MuConstant">1</span>:literal
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
237 <span class=
"Delimiter">])))
</span>
238 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
239 <span class=
"CommentedCode">;? (prn memory*)
</span>
240 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> <span class=
"Constant">-
2</span><span class=
"Delimiter">)
</span>
241 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'subtract'
"</span><span class=
"Delimiter">))
</span>
243 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
244 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"mul-literal
"</span><span class=
"Delimiter">)
</span>
245 <span class=
"Delimiter">(
</span>add-code
246 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
247 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> multiply
<span class=
"MuConstant">2</span>:literal
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
248 <span class=
"Delimiter">])))
</span>
249 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
250 <span class=
"CommentedCode">;? (prn memory*)
</span>
251 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> <span class=
"Constant">6</span><span class=
"Delimiter">)
</span>
252 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'multiply'
"</span><span class=
"Delimiter">))
</span>
254 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
255 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"div-literal
"</span><span class=
"Delimiter">)
</span>
256 <span class=
"Delimiter">(
</span>add-code
257 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
258 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> divide
<span class=
"MuConstant">8</span>:literal
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
259 <span class=
"Delimiter">])))
</span>
260 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
261 <span class=
"CommentedCode">;? (prn memory*)
</span>
262 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> <span class=
"Delimiter">(
</span>/ real
.8 <span class=
"Constant">3</span><span class=
"Delimiter">))
</span>
263 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'divide'
"</span><span class=
"Delimiter">))
</span>
265 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
266 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"idiv-literal
"</span><span class=
"Delimiter">)
</span>
267 <span class=
"Delimiter">(
</span>add-code
268 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
269 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> divide-with-remainder
<span class=
"MuConstant">23</span>:literal
<span class=
"MuConstant">6</span>:literal
<span class=
"Delimiter">)
</span></span>
270 <span class=
"Delimiter">])))
</span>
271 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
272 <span class=
"CommentedCode">;? (prn memory*)
</span>
273 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">3</span> <span class=
"Constant">2</span> <span class=
"Constant">5</span><span class=
"Delimiter">))
</span>
274 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'divide-with-remainder' performs integer division
"</span><span class=
"Delimiter">))
</span>
276 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
277 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"dummy-oarg
"</span><span class=
"Delimiter">)
</span>
278 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
279 <span class=
"Delimiter">(
</span>add-code
280 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
281 <span class=
"Mu"><span class=
"Delimiter">(
</span>_
<span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> divide-with-remainder
<span class=
"MuConstant">23</span>:literal
<span class=
"MuConstant">6</span>:literal
<span class=
"Delimiter">)
</span></span>
282 <span class=
"Delimiter">])))
</span>
283 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
284 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">2</span> <span class=
"Constant">5</span><span class=
"Delimiter">))
</span>
285 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - '_' oarg can ignore some results
"</span><span class=
"Delimiter">))
</span>
286 <span class=
"CommentedCode">;? (quit)
</span>
288 <span class=
"Comment">; Basic boolean operations: and, or, not
</span>
289 <span class=
"Comment">; There are easy ways to encode booleans in binary, but we'll skip past those
</span>
290 <span class=
"Comment">; details for now.
</span>
292 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
293 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"and-literal
"</span><span class=
"Delimiter">)
</span>
294 <span class=
"Delimiter">(
</span>add-code
295 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
296 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:boolean
<span class=
"Op"><-
</span> and
<span class=
"MuConstant">t
</span>:literal
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
297 <span class=
"Delimiter">])))
</span>
298 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
299 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
300 <span class=
"CommentedCode">;? (prn memory*)
</span>
301 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> nil
<span class=
"Delimiter">)
</span>
302 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - logical 'and' for booleans
"</span><span class=
"Delimiter">))
</span>
304 <span class=
"Comment">; Basic comparison operations
</span>
306 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
307 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"lt-literal
"</span><span class=
"Delimiter">)
</span>
308 <span class=
"Delimiter">(
</span>add-code
309 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
310 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:boolean
<span class=
"Op"><-
</span> less-than
<span class=
"MuConstant">4</span>:literal
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
311 <span class=
"Delimiter">])))
</span>
312 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
313 <span class=
"CommentedCode">;? (prn memory*)
</span>
314 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> nil
<span class=
"Delimiter">)
</span>
315 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'less-than' inequality operator
"</span><span class=
"Delimiter">))
</span>
317 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
318 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"le-literal-false
"</span><span class=
"Delimiter">)
</span>
319 <span class=
"Delimiter">(
</span>add-code
320 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
321 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:boolean
<span class=
"Op"><-
</span> lesser-or-equal
<span class=
"MuConstant">4</span>:literal
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
322 <span class=
"Delimiter">])))
</span>
323 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
324 <span class=
"CommentedCode">;? (prn memory*)
</span>
325 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> nil
<span class=
"Delimiter">)
</span>
326 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'lesser-or-equal'
"</span><span class=
"Delimiter">))
</span>
328 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
329 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"le-literal-true
"</span><span class=
"Delimiter">)
</span>
330 <span class=
"Delimiter">(
</span>add-code
331 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
332 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:boolean
<span class=
"Op"><-
</span> lesser-or-equal
<span class=
"MuConstant">4</span>:literal
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
333 <span class=
"Delimiter">])))
</span>
334 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
335 <span class=
"CommentedCode">;? (prn memory*)
</span>
336 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> t
<span class=
"Delimiter">)
</span>
337 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'lesser-or-equal' returns true for equal operands
"</span><span class=
"Delimiter">))
</span>
339 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
340 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"le-literal-true-
2"</span><span class=
"Delimiter">)
</span>
341 <span class=
"Delimiter">(
</span>add-code
342 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
343 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:boolean
<span class=
"Op"><-
</span> lesser-or-equal
<span class=
"MuConstant">4</span>:literal
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)
</span></span>
344 <span class=
"Delimiter">])))
</span>
345 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
346 <span class=
"CommentedCode">;? (prn memory*)
</span>
347 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> t
<span class=
"Delimiter">)
</span>
348 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'lesser-or-equal' -
2"</span><span class=
"Delimiter">))
</span>
350 <span class=
"Comment">; Control flow operations: jump, jump-if, jump-unless
</span>
351 <span class=
"Comment">; These introduce a new type -- 'offset' -- for literals that refer to memory
</span>
352 <span class=
"Comment">; locations relative to the current location.
</span>
354 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
355 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"jump-skip
"</span><span class=
"Delimiter">)
</span>
356 <span class=
"Delimiter">(
</span>add-code
357 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
358 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">8</span>:literal
<span class=
"Delimiter">)
</span></span>
359 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">jump
</span> <span class=
"MuConstant">1</span>:offset
<span class=
"Delimiter">)
</span></span>
360 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; should be skipped
</span></span>
361 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
362 <span class=
"Delimiter">])))
</span>
363 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
364 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
365 <span class=
"CommentedCode">;? (prn memory*)
</span>
366 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">8</span><span class=
"Delimiter">))
</span>
367 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'jump' skips some instructions
"</span><span class=
"Delimiter">))
</span>
368 <span class=
"CommentedCode">;? (quit)
</span>
370 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
371 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"jump-target
"</span><span class=
"Delimiter">)
</span>
372 <span class=
"Delimiter">(
</span>add-code
373 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
374 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">8</span>:literal
<span class=
"Delimiter">)
</span></span>
375 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">jump
</span> <span class=
"MuConstant">1</span>:offset
<span class=
"Delimiter">)
</span></span>
376 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; should be skipped
</span></span>
377 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
378 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
379 <span class=
"Delimiter">])))
</span> <span class=
"Comment">; never reached
</span>
380 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
381 <span class=
"CommentedCode">;? (prn memory*)
</span>
382 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">8</span><span class=
"Delimiter">))
</span>
383 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'jump' doesn't skip too many instructions
"</span><span class=
"Delimiter">))
</span>
384 <span class=
"CommentedCode">;? (quit)
</span>
386 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
387 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"jump-if-skip
"</span><span class=
"Delimiter">)
</span>
388 <span class=
"Delimiter">(
</span>add-code
389 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
390 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
391 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:boolean
<span class=
"Op"><-
</span> equal
<span class=
"MuConstant">1</span>:literal
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
392 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">jump-if
</span> <span class=
"Constant">1</span>:boolean
<span class=
"MuConstant">1</span>:offset
<span class=
"Delimiter">)
</span></span>
393 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
394 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
395 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
396 <span class=
"Delimiter">])))
</span>
397 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
398 <span class=
"CommentedCode">;? (prn memory*)
</span>
399 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> t
<span class=
"Constant">2</span> <span class=
"Constant">1</span><span class=
"Delimiter">))
</span>
400 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'jump-if' is a conditional 'jump'
"</span><span class=
"Delimiter">))
</span>
402 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
403 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"jump-if-fallthrough
"</span><span class=
"Delimiter">)
</span>
404 <span class=
"Delimiter">(
</span>add-code
405 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
406 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:boolean
<span class=
"Op"><-
</span> equal
<span class=
"MuConstant">1</span>:literal
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
407 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">jump-if
</span> <span class=
"Constant">3</span>:boolean
<span class=
"MuConstant">1</span>:offset
<span class=
"Delimiter">)
</span></span>
408 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
409 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
410 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
411 <span class=
"Delimiter">])))
</span>
412 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
413 <span class=
"CommentedCode">;? (prn memory*)
</span>
414 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> nil
<span class=
"Constant">2</span> <span class=
"Constant">3</span><span class=
"Delimiter">))
</span>
415 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - if 'jump-if's first arg is false, it doesn't skip any instructions
"</span><span class=
"Delimiter">))
</span>
417 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
418 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"jump-if-backward
"</span><span class=
"Delimiter">)
</span>
419 <span class=
"Delimiter">(
</span>add-code
420 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
421 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
422 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
423 <span class=
"Mu"><span class=
"Comment">; loop
</span></span>
424 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">2</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
425 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> equal
<span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
426 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">jump-if
</span> <span class=
"Constant">3</span>:boolean
<span class=
"MuConstant">-
3</span>:offset
<span class=
"Delimiter">)
</span> <span class=
"Comment">; to loop
</span></span>
427 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
428 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
429 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
430 <span class=
"Delimiter">])))
</span>
431 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
432 <span class=
"CommentedCode">;? (prn memory*)
</span>
433 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">2</span> <span class=
"Constant">4</span> <span class=
"Constant">3</span> nil
<span class=
"Constant">4</span> <span class=
"Constant">3</span><span class=
"Delimiter">))
</span>
434 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'jump-if' can take a negative offset to make backward jumps
"</span><span class=
"Delimiter">))
</span>
436 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
437 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"jump-label
"</span><span class=
"Delimiter">)
</span>
438 <span class=
"Delimiter">(
</span>add-code
439 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
440 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
441 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
442 <span class=
"Mu"><span class=
"Identifier">loop
</span></span>
443 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">2</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
444 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> equal
<span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
445 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">jump-if
</span> <span class=
"Constant">3</span>:boolean
<span class=
"Identifier">loop
</span>:offset
<span class=
"Delimiter">)
</span></span>
446 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
447 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
448 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
449 <span class=
"Delimiter">])))
</span>
450 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
451 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"-
")))
</span>
452 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
453 <span class=
"CommentedCode">;? (prn memory*)
</span>
454 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">2</span> <span class=
"Constant">4</span> <span class=
"Constant">3</span> nil
<span class=
"Constant">4</span> <span class=
"Constant">3</span><span class=
"Delimiter">))
</span>
455 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'jump-if' can take a negative offset to make backward jumps
"</span><span class=
"Delimiter">))
</span>
456 <span class=
"CommentedCode">;? (quit)
</span>
458 <span class=
"Comment">; Data movement relies on addressing modes:
</span>
459 <span class=
"Comment">; 'direct' - refers to a memory location; default for most types.
</span>
460 <span class=
"Comment">; 'literal' - directly encoded in the code; implicit for some types like 'offset'.
</span>
462 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
463 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"direct-addressing
"</span><span class=
"Delimiter">)
</span>
464 <span class=
"Delimiter">(
</span>add-code
465 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
466 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
467 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"Constant">1</span>:integer
<span class=
"Delimiter">)
</span></span>
468 <span class=
"Delimiter">])))
</span>
469 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
470 <span class=
"CommentedCode">;? (prn memory*)
</span>
471 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">34</span> <span class=
"Constant">2</span> <span class=
"Constant">34</span><span class=
"Delimiter">))
</span>
472 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'copy' performs direct addressing
"</span><span class=
"Delimiter">))
</span>
474 <span class=
"Comment">; 'Indirect' addressing refers to an address stored in a memory location.
</span>
475 <span class=
"Comment">; Indicated by the metadata 'deref'. Usually requires an address type.
</span>
476 <span class=
"Comment">; In the test below, the memory location
1 contains '
2', so an indirect read
</span>
477 <span class=
"Comment">; of location
1 returns the value of location
2.
</span>
479 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
480 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"indirect-addressing
"</span><span class=
"Delimiter">)
</span>
481 <span class=
"Delimiter">(
</span>add-code
482 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
483 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; unsafe; can't do this in general
</span></span>
484 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
485 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"Constant">1</span>:integer-address/deref
<span class=
"Delimiter">)
</span></span>
486 <span class=
"Delimiter">])))
</span>
487 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
488 <span class=
"CommentedCode">;? (prn memory*)
</span>
489 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">2</span> <span class=
"Constant">34</span> <span class=
"Constant">3</span> <span class=
"Constant">34</span><span class=
"Delimiter">))
</span>
490 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'copy' performs indirect addressing
"</span><span class=
"Delimiter">))
</span>
492 <span class=
"Comment">; Output args can use indirect addressing. In the test below the value is
</span>
493 <span class=
"Comment">; stored at the location stored in location
1 (i.e. location
2).
</span>
495 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
496 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"indirect-addressing-oarg
"</span><span class=
"Delimiter">)
</span>
497 <span class=
"Delimiter">(
</span>add-code
498 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
499 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
500 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
501 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer-address/deref
<span class=
"Op"><-
</span> add
<span class=
"Constant">2</span>:integer
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
502 <span class=
"Delimiter">])))
</span>
503 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
504 <span class=
"CommentedCode">;? (prn memory*)
</span>
505 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">2</span> <span class=
"Constant">36</span><span class=
"Delimiter">))
</span>
506 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - instructions can perform indirect addressing on output arg
"</span><span class=
"Delimiter">))
</span>
508 <span class=
"SalientComment">;; Compound data types
</span>
509 <span class=
"Comment">;
</span>
510 <span class=
"Comment">; Until now we've dealt with scalar types like integers and booleans and
</span>
511 <span class=
"Comment">; addresses, where mu looks like other assembly languages. In addition, mu
</span>
512 <span class=
"Comment">; provides first-class support for compound types: arrays and and-records.
</span>
513 <span class=
"Comment">;
</span>
514 <span class=
"Comment">; 'get' accesses fields in and-records
</span>
515 <span class=
"Comment">; 'index' accesses indices in arrays
</span>
516 <span class=
"Comment">;
</span>
517 <span class=
"Comment">; Both operations require knowledge about the types being worked on, so all
</span>
518 <span class=
"Comment">; types used in mu programs are defined in a single global system-wide table
</span>
519 <span class=
"Comment">; (see type* in mu.arc for the complete list of types; we'll add to it over
</span>
520 <span class=
"Comment">; time).
</span>
522 <span class=
"Comment">; first a sanity check that the table of types is consistent
</span>
523 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
524 <span class=
"Delimiter">(
</span>each
<span class=
"Delimiter">(
</span>typ typeinfo
<span class=
"Delimiter">)
</span> <span class=
"Global">type*
</span>
525 <span class=
"Delimiter">(
</span>when typeinfo!and-record
526 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>is typeinfo!size
<span class=
"Delimiter">(
</span>len typeinfo!elems
<span class=
"Delimiter">)))
</span>
527 <span class=
"Delimiter">(
</span>when typeinfo!fields
528 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>is typeinfo!size
<span class=
"Delimiter">(
</span>len typeinfo!fields
<span class=
"Delimiter">))))))
</span>
530 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
531 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"get-record
"</span><span class=
"Delimiter">)
</span>
532 <span class=
"Delimiter">(
</span>add-code
533 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
534 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
535 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
536 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:integer-boolean-pair
<span class=
"MuConstant">1</span>:offset
<span class=
"Delimiter">)
</span></span>
537 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:integer-boolean-pair
<span class=
"MuConstant">0</span>:offset
<span class=
"Delimiter">)
</span></span>
538 <span class=
"Delimiter">])))
</span>
539 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
540 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
541 <span class=
"CommentedCode">;? (prn memory*)
</span>
542 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">34</span> <span class=
"Constant">2</span> nil
<span class=
"Constant">3</span> nil
<span class=
"Constant">4</span> <span class=
"Constant">34</span><span class=
"Delimiter">))
</span>
543 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'get' accesses fields of and-records
"</span><span class=
"Delimiter">))
</span>
544 <span class=
"CommentedCode">;? (quit)
</span>
546 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
547 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"get-indirect
"</span><span class=
"Delimiter">)
</span>
548 <span class=
"Delimiter">(
</span>add-code
549 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
550 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
551 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
552 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer-boolean-pair-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
553 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:boolean
<span class=
"Op"><-
</span> get
<span class=
"Constant">3</span>:integer-boolean-pair-address/deref
<span class=
"MuConstant">1</span>:offset
<span class=
"Delimiter">)
</span></span>
554 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">3</span>:integer-boolean-pair-address/deref
<span class=
"MuConstant">0</span>:offset
<span class=
"Delimiter">)
</span></span>
555 <span class=
"Delimiter">])))
</span>
556 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
557 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
558 <span class=
"CommentedCode">;? (prn memory*)
</span>
559 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">34</span> <span class=
"Constant">2</span> nil
<span class=
"Constant">3</span> <span class=
"Constant">1</span> <span class=
"Constant">4</span> nil
<span class=
"Constant">5</span> <span class=
"Constant">34</span><span class=
"Delimiter">))
</span>
560 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'get' accesses fields of and-record address
"</span><span class=
"Delimiter">))
</span>
562 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
563 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"get-indirect-repeated
"</span><span class=
"Delimiter">)
</span>
564 <span class=
"Delimiter">(
</span>add-code
565 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
566 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
567 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">35</span>:literal
<span class=
"Delimiter">)
</span></span>
568 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">36</span>:literal
<span class=
"Delimiter">)
</span></span>
569 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer-point-pair-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; unsafe
</span></span>
570 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer-point-pair-address-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; unsafe
</span></span>
571 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer-integer-pair
<span class=
"Op"><-
</span> get
<span class=
"Constant">5</span>:integer-point-pair-address-address/deref/deref
<span class=
"MuConstant">1</span>:offset
<span class=
"Delimiter">)
</span></span>
572 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">5</span>:integer-point-pair-address-address/deref/deref
<span class=
"MuConstant">0</span>:offset
<span class=
"Delimiter">)
</span></span>
573 <span class=
"Delimiter">])))
</span>
574 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
575 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains
<span class=
"Constant">6</span> <span class=
"Delimiter">'(
</span><span class=
"Constant">35</span> <span class=
"Constant">36</span> <span class=
"Constant">34</span><span class=
"Delimiter">))
</span>
576 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'get' can deref multiple times
"</span><span class=
"Delimiter">))
</span>
577 <span class=
"CommentedCode">;? (quit)
</span>
579 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
580 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"get-compound-field
"</span><span class=
"Delimiter">)
</span>
581 <span class=
"Delimiter">(
</span>add-code
582 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
583 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
584 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">35</span>:literal
<span class=
"Delimiter">)
</span></span>
585 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">36</span>:literal
<span class=
"Delimiter">)
</span></span>
586 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer-integer-pair
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:integer-point-pair
<span class=
"MuConstant">1</span>:offset
<span class=
"Delimiter">)
</span></span>
587 <span class=
"Delimiter">])))
</span>
588 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
589 <span class=
"CommentedCode">;? (prn memory*)
</span>
590 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">34</span> <span class=
"Constant">2</span> <span class=
"Constant">35</span> <span class=
"Constant">3</span> <span class=
"Constant">36</span> <span class=
"Constant">4</span> <span class=
"Constant">35</span> <span class=
"Constant">5</span> <span class=
"Constant">36</span><span class=
"Delimiter">))
</span>
591 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'get' accesses fields spanning multiple locations
"</span><span class=
"Delimiter">))
</span>
593 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
594 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"get-address
"</span><span class=
"Delimiter">)
</span>
595 <span class=
"Delimiter">(
</span>add-code
596 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
597 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
598 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
599 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean-address
<span class=
"Op"><-
</span> get-address
<span class=
"Constant">1</span>:integer-boolean-pair
<span class=
"MuConstant">1</span>:offset
<span class=
"Delimiter">)
</span></span>
600 <span class=
"Delimiter">])))
</span>
601 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
602 <span class=
"CommentedCode">;? (prn memory*)
</span>
603 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">34</span> <span class=
"Constant">2</span> t
<span class=
"Constant">3</span> <span class=
"Constant">2</span><span class=
"Delimiter">))
</span>
604 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'get-address' returns address of fields of and-records
"</span><span class=
"Delimiter">))
</span>
606 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
607 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"get-address-indirect
"</span><span class=
"Delimiter">)
</span>
608 <span class=
"Delimiter">(
</span>add-code
609 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
610 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
611 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
612 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer-boolean-pair-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
613 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:boolean-address
<span class=
"Op"><-
</span> get-address
<span class=
"Constant">3</span>:integer-boolean-pair-address/deref
<span class=
"MuConstant">1</span>:offset
<span class=
"Delimiter">)
</span></span>
614 <span class=
"Delimiter">])))
</span>
615 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
616 <span class=
"CommentedCode">;? (prn memory*)
</span>
617 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">34</span> <span class=
"Constant">2</span> t
<span class=
"Constant">3</span> <span class=
"Constant">1</span> <span class=
"Constant">4</span> <span class=
"Constant">2</span><span class=
"Delimiter">))
</span>
618 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'get-address' accesses fields of and-record address
"</span><span class=
"Delimiter">))
</span>
620 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
621 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"index-literal
"</span><span class=
"Delimiter">)
</span>
622 <span class=
"Delimiter">(
</span>add-code
623 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
624 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
625 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
626 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
627 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
628 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
629 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer-boolean-pair
<span class=
"Op"><-
</span> index
<span class=
"Constant">1</span>:integer-boolean-pair-array
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
630 <span class=
"Delimiter">])))
</span>
631 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
632 <span class=
"CommentedCode">;? (prn memory*)
</span>
633 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">2</span> <span class=
"Constant">23</span> <span class=
"Constant">3</span> nil
<span class=
"Constant">4</span> <span class=
"Constant">24</span> <span class=
"Constant">5</span> t
<span class=
"Constant">6</span> <span class=
"Constant">24</span> <span class=
"Constant">7</span> t
<span class=
"Delimiter">))
</span>
634 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'index' accesses indices of arrays
"</span><span class=
"Delimiter">))
</span>
635 <span class=
"CommentedCode">;? (quit)
</span>
637 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
638 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"index-direct
"</span><span class=
"Delimiter">)
</span>
639 <span class=
"Delimiter">(
</span>add-code
640 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
641 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
642 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
643 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
644 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
645 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
646 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
647 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer-boolean-pair
<span class=
"Op"><-
</span> index
<span class=
"Constant">1</span>:integer-boolean-pair-array
<span class=
"Constant">6</span>:integer
<span class=
"Delimiter">)
</span></span>
648 <span class=
"Delimiter">])))
</span>
649 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
650 <span class=
"CommentedCode">;? (prn memory*)
</span>
651 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">2</span> <span class=
"Constant">23</span> <span class=
"Constant">3</span> nil
<span class=
"Constant">4</span> <span class=
"Constant">24</span> <span class=
"Constant">5</span> t
<span class=
"Constant">6</span> <span class=
"Constant">1</span> <span class=
"Constant">7</span> <span class=
"Constant">24</span> <span class=
"Constant">8</span> t
<span class=
"Delimiter">))
</span>
652 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'index' accesses indices of arrays
"</span><span class=
"Delimiter">))
</span>
653 <span class=
"CommentedCode">;? (quit)
</span>
655 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
656 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"index-indirect
"</span><span class=
"Delimiter">)
</span>
657 <span class=
"Delimiter">(
</span>add-code
658 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
659 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
660 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
661 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
662 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
663 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
664 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
665 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer-boolean-pair-array-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
666 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:integer-boolean-pair
<span class=
"Op"><-
</span> index
<span class=
"Constant">7</span>:integer-boolean-pair-array-address/deref
<span class=
"Constant">6</span>:integer
<span class=
"Delimiter">)
</span></span>
667 <span class=
"Delimiter">])))
</span>
668 <span class=
"CommentedCode">;? (= dump-trace* (obj blacklist '(
"sz
" "m
" "setm
" "addr
" "cvt0
" "cvt1
")))
</span>
669 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
670 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
671 <span class=
"CommentedCode">;? (prn memory*)
</span>
672 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">2</span> <span class=
"Constant">23</span> <span class=
"Constant">3</span> nil
<span class=
"Constant">4</span> <span class=
"Constant">24</span> <span class=
"Constant">5</span> t
<span class=
"Constant">6</span> <span class=
"Constant">1</span> <span class=
"Constant">7</span> <span class=
"Constant">1</span> <span class=
"Constant">8</span> <span class=
"Constant">24</span> <span class=
"Constant">9</span> t
<span class=
"Delimiter">))
</span>
673 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'index' accesses indices of array address
"</span><span class=
"Delimiter">))
</span>
674 <span class=
"CommentedCode">;? (quit)
</span>
676 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
677 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"index-indirect-multiple
"</span><span class=
"Delimiter">)
</span>
678 <span class=
"Delimiter">(
</span>add-code
679 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
680 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
681 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
682 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
683 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">25</span>:literal
<span class=
"Delimiter">)
</span></span>
684 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">26</span>:literal
<span class=
"Delimiter">)
</span></span>
685 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer-array-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; unsafe
</span></span>
686 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer-array-address-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">6</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; unsafe
</span></span>
687 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:integer
<span class=
"Op"><-
</span> index
<span class=
"Constant">7</span>:integer-array-address-address/deref/deref
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
688 <span class=
"Delimiter">])))
</span>
689 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
690 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.8</span> <span class=
"Constant">24</span><span class=
"Delimiter">)
</span>
691 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'index' can deref multiple times
"</span><span class=
"Delimiter">))
</span>
693 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
694 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"index-address
"</span><span class=
"Delimiter">)
</span>
695 <span class=
"Delimiter">(
</span>add-code
696 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
697 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
698 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
699 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
700 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
701 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
702 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
703 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer-boolean-pair-address
<span class=
"Op"><-
</span> index-address
<span class=
"Constant">1</span>:integer-boolean-pair-array
<span class=
"Constant">6</span>:integer
<span class=
"Delimiter">)
</span></span>
704 <span class=
"Delimiter">])))
</span>
705 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
706 <span class=
"CommentedCode">;? (prn memory*)
</span>
707 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">2</span> <span class=
"Constant">23</span> <span class=
"Constant">3</span> nil
<span class=
"Constant">4</span> <span class=
"Constant">24</span> <span class=
"Constant">5</span> t
<span class=
"Constant">6</span> <span class=
"Constant">1</span> <span class=
"Constant">7</span> <span class=
"Constant">4</span><span class=
"Delimiter">))
</span>
708 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'index-address' returns addresses of indices of arrays
"</span><span class=
"Delimiter">))
</span>
710 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
711 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"index-address-indirect
"</span><span class=
"Delimiter">)
</span>
712 <span class=
"Delimiter">(
</span>add-code
713 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
714 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
715 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
716 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
717 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
718 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
719 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
720 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer-boolean-pair-array-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
721 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:integer-boolean-pair-address
<span class=
"Op"><-
</span> index-address
<span class=
"Constant">7</span>:integer-boolean-pair-array-address/deref
<span class=
"Constant">6</span>:integer
<span class=
"Delimiter">)
</span></span>
722 <span class=
"Delimiter">])))
</span>
723 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
724 <span class=
"CommentedCode">;? (prn memory*)
</span>
725 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">2</span> <span class=
"Constant">23</span> <span class=
"Constant">3</span> nil
<span class=
"Constant">4</span> <span class=
"Constant">24</span> <span class=
"Constant">5</span> t
<span class=
"Constant">6</span> <span class=
"Constant">1</span> <span class=
"Constant">7</span> <span class=
"Constant">1</span> <span class=
"Constant">8</span> <span class=
"Constant">4</span><span class=
"Delimiter">))
</span>
726 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'index-address' returns addresses of indices of array addresses
"</span><span class=
"Delimiter">))
</span>
728 <span class=
"Comment">; Array values know their length. Record lengths are saved in the types table.
</span>
730 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
731 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"len-array
"</span><span class=
"Delimiter">)
</span>
732 <span class=
"Delimiter">(
</span>add-code
733 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
734 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
735 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
736 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
737 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
738 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
739 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> length
<span class=
"Constant">1</span>:integer-boolean-pair-array
<span class=
"Delimiter">)
</span></span>
740 <span class=
"Delimiter">])))
</span>
741 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
742 <span class=
"CommentedCode">;? (prn memory*)
</span>
743 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.6</span> <span class=
"Constant">2</span><span class=
"Delimiter">)
</span>
744 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'length' of array
"</span><span class=
"Delimiter">))
</span>
746 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
747 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"len-array-indirect
"</span><span class=
"Delimiter">)
</span>
748 <span class=
"Delimiter">(
</span>add-code
749 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
750 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
751 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
752 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
753 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
754 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
755 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
756 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> length
<span class=
"Constant">6</span>:integer-boolean-pair-array-address/deref
<span class=
"Delimiter">)
</span></span>
757 <span class=
"Delimiter">])))
</span>
758 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
759 <span class=
"CommentedCode">;? (= dump-trace* (obj blacklist '(
"sz
" "m
" "setm
" "addr
" "cvt0
" "cvt1
")))
</span>
760 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
761 <span class=
"CommentedCode">;? (prn memory*)
</span>
762 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.7</span> <span class=
"Constant">2</span><span class=
"Delimiter">)
</span>
763 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'length' of array address
"</span><span class=
"Delimiter">))
</span>
765 <span class=
"Comment">; 'sizeof' is a helper to determine the amount of memory required by a type.
</span>
766 <span class=
"Comment">; Only for non-arrays.
</span>
768 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
769 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"sizeof-record
"</span><span class=
"Delimiter">)
</span>
770 <span class=
"Delimiter">(
</span>add-code
771 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
772 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> sizeof integer-boolean-pair:literal
<span class=
"Delimiter">)
</span></span>
773 <span class=
"Delimiter">])))
</span>
774 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
775 <span class=
"CommentedCode">;? (prn memory*)
</span>
776 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> <span class=
"Constant">2</span><span class=
"Delimiter">)
</span>
777 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' returns space required by arg
"</span><span class=
"Delimiter">))
</span>
779 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
780 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"sizeof-record-not-len
"</span><span class=
"Delimiter">)
</span>
781 <span class=
"Delimiter">(
</span>add-code
782 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
783 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> sizeof integer-point-pair:literal
<span class=
"Delimiter">)
</span></span>
784 <span class=
"Delimiter">])))
</span>
785 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
786 <span class=
"CommentedCode">;? (prn memory*)
</span>
787 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> <span class=
"Constant">2</span><span class=
"Delimiter">)
</span>
788 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' is different from number of elems
"</span><span class=
"Delimiter">))
</span>
790 <span class=
"Comment">; Regardless of a type's length, you can move it around just like a primitive.
</span>
792 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
793 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"copy-record
"</span><span class=
"Delimiter">)
</span>
794 <span class=
"Delimiter">(
</span>add-code
795 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
796 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
797 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
798 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
799 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer-boolean-pair
<span class=
"Op"><-
</span> copy
<span class=
"Constant">1</span>:integer-boolean-pair
<span class=
"Delimiter">)
</span></span>
800 <span class=
"Delimiter">])))
</span>
801 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
802 <span class=
"CommentedCode">;? (prn memory*)
</span>
803 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">34</span> <span class=
"Constant">2</span> nil
<span class=
"Constant">3</span> <span class=
"Constant">34</span> <span class=
"Constant">4</span> nil
<span class=
"Delimiter">))
</span>
804 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - ops can operate on records spanning multiple locations
"</span><span class=
"Delimiter">))
</span>
806 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
807 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"copy-record2
"</span><span class=
"Delimiter">)
</span>
808 <span class=
"Delimiter">(
</span>add-code
809 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
810 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
811 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">35</span>:literal
<span class=
"Delimiter">)
</span></span>
812 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">36</span>:literal
<span class=
"Delimiter">)
</span></span>
813 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
814 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
815 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
816 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer-point-pair
<span class=
"Op"><-
</span> copy
<span class=
"Constant">1</span>:integer-point-pair
<span class=
"Delimiter">)
</span></span>
817 <span class=
"Delimiter">])))
</span>
818 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "sizeof
")))
</span>
819 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
820 <span class=
"CommentedCode">;? (prn memory*)
</span>
821 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">34</span> <span class=
"Constant">2</span> <span class=
"Constant">35</span> <span class=
"Constant">3</span> <span class=
"Constant">36</span>
822 <span class=
"Comment">; result
</span>
823 <span class=
"Constant">4</span> <span class=
"Constant">34</span> <span class=
"Constant">5</span> <span class=
"Constant">35</span> <span class=
"Constant">6</span> <span class=
"Constant">36</span><span class=
"Delimiter">))
</span>
824 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - ops can operate on records with fields spanning multiple locations
"</span><span class=
"Delimiter">))
</span>
826 <span class=
"Delimiter">)
</span> <span class=
"Comment">; section
20</span>
828 <span class=
"Delimiter">(
</span>section
<span class=
"Constant">100</span>
830 <span class=
"Comment">; A special kind of record is the 'tagged type'. It lets us represent
</span>
831 <span class=
"Comment">; dynamically typed values, which save type information in memory rather than
</span>
832 <span class=
"Comment">; in the code to use them. This will let us do things like create heterogenous
</span>
833 <span class=
"Comment">; lists containing both integers and strings. Tagged values admit two
</span>
834 <span class=
"Comment">; operations:
</span>
835 <span class=
"Comment">;
</span>
836 <span class=
"Comment">; 'save-type' - turns a regular value into a tagged-value of the appropriate type
</span>
837 <span class=
"Comment">; 'maybe-coerce' - turns a tagged value into a regular value if the type matches
</span>
838 <span class=
"Comment">;
</span>
839 <span class=
"Comment">; The payload of a tagged value must occupy just one location. Save pointers
</span>
840 <span class=
"Comment">; to records.
</span>
842 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
843 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"tagged-value
"</span><span class=
"Delimiter">)
</span>
844 <span class=
"CommentedCode">;? (= dump-trace* (obj blacklist '(
"sz
" "m
" "setm
" "addr
" "cvt0
" "cvt1
")))
</span>
845 <span class=
"Delimiter">(
</span>add-code
846 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
847 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:type
<span class=
"Op"><-
</span> copy integer:literal
<span class=
"Delimiter">)
</span></span>
848 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
849 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Constant">4</span>:boolean
<span class=
"Op"><-
</span> maybe-coerce
<span class=
"Constant">1</span>:tagged-value integer:literal
<span class=
"Delimiter">)
</span></span>
850 <span class=
"Delimiter">])))
</span>
851 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
852 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
853 <span class=
"CommentedCode">;? (prn completed-routines*)
</span>
854 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
855 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
856 <span class=
"CommentedCode">;? (prn memory*)
</span>
857 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">34</span><span class=
"Delimiter">)
</span>
858 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.4</span> t
<span class=
"Delimiter">))
</span>
859 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'maybe-coerce' copies value only if type tag matches
"</span><span class=
"Delimiter">))
</span>
860 <span class=
"CommentedCode">;? (quit)
</span>
862 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
863 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"tagged-value-
2"</span><span class=
"Delimiter">)
</span>
864 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
865 <span class=
"Delimiter">(
</span>add-code
866 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
867 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:type
<span class=
"Op"><-
</span> copy integer-address:literal
<span class=
"Delimiter">)
</span></span>
868 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
869 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Constant">4</span>:boolean
<span class=
"Op"><-
</span> maybe-coerce
<span class=
"Constant">1</span>:tagged-value boolean:literal
<span class=
"Delimiter">)
</span></span>
870 <span class=
"Delimiter">])))
</span>
871 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
872 <span class=
"CommentedCode">;? (prn memory*)
</span>
873 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">0</span><span class=
"Delimiter">)
</span>
874 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.4</span> nil
<span class=
"Delimiter">))
</span>
875 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'maybe-coerce' doesn't copy value when type tag doesn't match
"</span><span class=
"Delimiter">))
</span>
877 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
878 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"save-type
"</span><span class=
"Delimiter">)
</span>
879 <span class=
"Delimiter">(
</span>add-code
880 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
881 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
882 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:tagged-value
<span class=
"Op"><-
</span> save-type
<span class=
"Constant">1</span>:integer
<span class=
"Delimiter">)
</span></span>
883 <span class=
"Delimiter">])))
</span>
884 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
885 <span class=
"CommentedCode">;? (prn memory*)
</span>
886 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">34</span> <span class=
"Constant">2</span> <span class=
"Delimiter">'
</span>integer
<span class=
"Constant">3</span> <span class=
"Constant">34</span><span class=
"Delimiter">))
</span>
887 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'save-type' saves the type of a value at runtime, turning it into a tagged-value
"</span><span class=
"Delimiter">))
</span>
889 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
890 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"init-tagged-value
"</span><span class=
"Delimiter">)
</span>
891 <span class=
"Delimiter">(
</span>add-code
892 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
893 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
894 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:tagged-value-address
<span class=
"Op"><-
</span> init-tagged-value integer:literal
<span class=
"Constant">1</span>:integer
<span class=
"Delimiter">)
</span></span>
895 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Constant">4</span>:boolean
<span class=
"Op"><-
</span> maybe-coerce
<span class=
"Constant">2</span>:tagged-value-address/deref integer:literal
<span class=
"Delimiter">)
</span></span>
896 <span class=
"Delimiter">])))
</span>
897 <span class=
"CommentedCode">;? (= dump-trace* (obj blacklist '(
"sz
" "m
" "setm
" "addr
" "cvt0
" "cvt1
" "sizeof
")))
</span>
898 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
899 <span class=
"CommentedCode">;? (prn memory*)
</span>
900 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">34</span><span class=
"Delimiter">)
</span>
901 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.4</span> t
<span class=
"Delimiter">))
</span>
902 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'init-tagged-value' is the converse of 'maybe-coerce'
"</span><span class=
"Delimiter">))
</span>
903 <span class=
"CommentedCode">;? (quit)
</span>
905 <span class=
"Comment">; Now that we can package values together with their types, we can construct a
</span>
906 <span class=
"Comment">; dynamically typed list.
</span>
908 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
909 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"list
"</span><span class=
"Delimiter">)
</span>
910 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
911 <span class=
"Delimiter">(
</span>add-code
912 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
913 <span class=
"Comment">;
1 points at first node: tagged-value (int
34)
</span>
914 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:list-address
<span class=
"Op"><-
</span> new list:literal
<span class=
"Delimiter">)
</span></span>
915 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:tagged-value-address
<span class=
"Op"><-
</span> list-value-address
<span class=
"Constant">1</span>:list-address
<span class=
"Delimiter">)
</span></span>
916 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:type-address
<span class=
"Op"><-
</span> get-address
<span class=
"Constant">2</span>:tagged-value-address/deref type:offset
<span class=
"Delimiter">)
</span></span>
917 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:type-address/deref
<span class=
"Op"><-
</span> copy integer:literal
<span class=
"Delimiter">)
</span></span>
918 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:location
<span class=
"Op"><-
</span> get-address
<span class=
"Constant">2</span>:tagged-value-address/deref payload:offset
<span class=
"Delimiter">)
</span></span>
919 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:location/deref
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
920 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:list-address-address
<span class=
"Op"><-
</span> get-address
<span class=
"Constant">1</span>:list-address/deref cdr:offset
<span class=
"Delimiter">)
</span></span>
921 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:list-address-address/deref
<span class=
"Op"><-
</span> new list:literal
<span class=
"Delimiter">)
</span></span>
922 <span class=
"Comment">;
6 points at second node: tagged-value (boolean t)
</span>
923 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:list-address
<span class=
"Op"><-
</span> copy
<span class=
"Constant">5</span>:list-address-address/deref
<span class=
"Delimiter">)
</span></span>
924 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:tagged-value-address
<span class=
"Op"><-
</span> list-value-address
<span class=
"Constant">6</span>:list-address
<span class=
"Delimiter">)
</span></span>
925 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:type-address
<span class=
"Op"><-
</span> get-address
<span class=
"Constant">7</span>:tagged-value-address/deref type:offset
<span class=
"Delimiter">)
</span></span>
926 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:type-address/deref
<span class=
"Op"><-
</span> copy boolean:literal
<span class=
"Delimiter">)
</span></span>
927 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">9</span>:location
<span class=
"Op"><-
</span> get-address
<span class=
"Constant">7</span>:tagged-value-address/deref payload:offset
<span class=
"Delimiter">)
</span></span>
928 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">9</span>:location/deref
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
929 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">10</span>:list-address
<span class=
"Op"><-
</span> get
<span class=
"Constant">6</span>:list-address/deref
<span class=
"MuConstant">1</span>:offset
<span class=
"Delimiter">)
</span></span>
930 <span class=
"Delimiter">])))
</span>
931 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!main
932 <span class=
"Delimiter">(
</span>enq routine
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
933 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> first rep.routine!alloc
934 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
")))
</span>
935 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
936 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">)
</span>
937 <span class=
"CommentedCode">;? (prn memory*)
</span>
938 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
939 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
940 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~all first
<span class=
"Delimiter">(
</span>map
<span class=
"Global">memory*
</span> <span class=
"Delimiter">'(
</span><span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">3</span><span class=
"Delimiter">)))
</span>
941 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span>.first
<span class=
"Delimiter">'
</span>integer
<span class=
"Delimiter">)
</span>
942 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.4</span> <span class=
"Delimiter">(
</span>+ first
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span>
943 <span class=
"Delimiter">(
</span>~is
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ first
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span> <span class=
"Constant">34</span><span class=
"Delimiter">)
</span>
944 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.5</span> <span class=
"Delimiter">(
</span>+ first
<span class=
"Constant">2</span><span class=
"Delimiter">))
</span>
945 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> second
<span class=
"Global">memory*
</span><span class=
"Constant">.6</span>
946 <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span>
947 <span class=
"Delimiter">(
</span>~is
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ first
<span class=
"Constant">2</span><span class=
"Delimiter">))
</span> second
<span class=
"Delimiter">)
</span>
948 <span class=
"Delimiter">(
</span>~all second
<span class=
"Delimiter">(
</span>map
<span class=
"Global">memory*
</span> <span class=
"Delimiter">'(
</span><span class=
"Constant">6</span> <span class=
"Constant">7</span> <span class=
"Constant">8</span><span class=
"Delimiter">)))
</span>
949 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span>.second
<span class=
"Delimiter">'
</span>boolean
<span class=
"Delimiter">)
</span>
950 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.9</span> <span class=
"Delimiter">(
</span>+ second
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span>
951 <span class=
"Delimiter">(
</span>~is
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ second
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span> t
<span class=
"Delimiter">)
</span>
952 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.10</span> nil
<span class=
"Delimiter">))))
</span>
953 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - lists can contain elements of different types
"</span><span class=
"Delimiter">))))
</span>
954 <span class=
"Delimiter">(
</span>add-code
955 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test2
<span class=
"Delimiter">[
</span></span>
956 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">10</span>:list-address
<span class=
"Op"><-
</span> list-next
<span class=
"Constant">1</span>:list-address
<span class=
"Delimiter">)
</span></span>
957 <span class=
"Delimiter">])))
</span>
958 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
959 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>test2
<span class=
"Delimiter">)
</span>
960 <span class=
"CommentedCode">;? (prn memory*)
</span>
961 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
962 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
963 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.10</span> <span class=
"Global">memory*
</span><span class=
"Constant">.6</span><span class=
"Delimiter">)
</span>
964 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'list-next can move a list pointer to the next node
"</span><span class=
"Delimiter">))
</span>
965 <span class=
"CommentedCode">;? (quit)
</span>
967 <span class=
"Comment">; 'init-list' takes a variable number of args and constructs a list containing
</span>
968 <span class=
"Comment">; them. Just integers for now.
</span>
970 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
971 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"init-list
"</span><span class=
"Delimiter">)
</span>
972 <span class=
"Delimiter">(
</span>add-code
973 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
974 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> init-list
<span class=
"MuConstant">3</span>:literal
<span class=
"MuConstant">4</span>:literal
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)
</span></span>
975 <span class=
"Delimiter">])))
</span>
976 <span class=
"CommentedCode">;? (= dump-trace* (obj blacklist '(
"sz
" "m
" "setm
" "addr
" "cvt0
" "cvt1
" "sizeof
")))
</span>
977 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
978 <span class=
"CommentedCode">;? (prn memory*)
</span>
979 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> first
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span>
980 <span class=
"CommentedCode">;? (prn first)
</span>
981 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span>.first
<span class=
"Delimiter">'
</span>integer
<span class=
"Delimiter">)
</span>
982 <span class=
"Delimiter">(
</span>~is
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ first
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span> <span class=
"Constant">3</span><span class=
"Delimiter">)
</span>
983 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> second
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ first
<span class=
"Constant">2</span><span class=
"Delimiter">))
</span>
984 <span class=
"CommentedCode">;? (prn second)
</span>
985 <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span>.second
<span class=
"Delimiter">'
</span>integer
<span class=
"Delimiter">)
</span>
986 <span class=
"Delimiter">(
</span>~is
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ second
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
987 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> third
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ second
<span class=
"Constant">2</span><span class=
"Delimiter">))
</span>
988 <span class=
"CommentedCode">;? (prn third)
</span>
989 <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span>.third
<span class=
"Delimiter">'
</span>integer
<span class=
"Delimiter">)
</span>
990 <span class=
"Delimiter">(
</span>~is
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ third
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span> <span class=
"Constant">5</span><span class=
"Delimiter">)
</span>
991 <span class=
"Delimiter">(
</span>~is
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ third
<span class=
"Constant">2</span><span class=
"Delimiter">)
</span> nil
<span class=
"Delimiter">)))))))
</span>
992 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'init-list' can construct a list of integers
"</span><span class=
"Delimiter">)))
</span>
994 <span class=
"Delimiter">)
</span> <span class=
"Comment">; section
100</span>
996 <span class=
"Delimiter">(
</span>section
<span class=
"Constant">20</span>
998 <span class=
"SalientComment">;; Functions
</span>
999 <span class=
"Comment">;
</span>
1000 <span class=
"Comment">; Just like the table of types is centralized, functions are conceptualized as
</span>
1001 <span class=
"Comment">; a centralized table of operations just like the
"primitives
" we've seen so
</span>
1002 <span class=
"Comment">; far. If you create a function you can call it like any other op.
</span>
1004 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1005 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn
"</span><span class=
"Delimiter">)
</span>
1006 <span class=
"Delimiter">(
</span>add-code
1007 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1008 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
1009 <span class=
"Delimiter">])
</span>
1010 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1011 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1012 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
1013 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"Delimiter">)
</span></span>
1014 <span class=
"Delimiter">])))
</span>
1015 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1016 <span class=
"CommentedCode">;? (prn memory*)
</span>
1017 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">3</span> <span class=
"Constant">3</span> <span class=
"Constant">4</span><span class=
"Delimiter">))
</span>
1018 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - calling a user-defined function runs its instructions
"</span><span class=
"Delimiter">))
</span>
1019 <span class=
"CommentedCode">;? (quit)
</span>
1021 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1022 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-once
"</span><span class=
"Delimiter">)
</span>
1023 <span class=
"Delimiter">(
</span>add-code
1024 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1025 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1026 <span class=
"Delimiter">])
</span>
1027 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1028 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"Delimiter">)
</span></span>
1029 <span class=
"Delimiter">])))
</span>
1030 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
")))
</span>
1031 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1032 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">2</span> <span class=
"Global">curr-cycle*
</span><span class=
"Delimiter">)
</span>
1033 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - calling a user-defined function runs its instructions exactly once
"</span> <span class=
"Global">curr-cycle*
</span><span class=
"Delimiter">))
</span>
1034 <span class=
"CommentedCode">;? (quit)
</span>
1036 <span class=
"Comment">; User-defined functions communicate with their callers through two
</span>
1037 <span class=
"Comment">; primitives:
</span>
1038 <span class=
"Comment">;
</span>
1039 <span class=
"Comment">; 'arg' - to access inputs
</span>
1040 <span class=
"Comment">; 'reply' - to return outputs
</span>
1042 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1043 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-reply
"</span><span class=
"Delimiter">)
</span>
1044 <span class=
"Delimiter">(
</span>add-code
1045 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1046 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
1047 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
1048 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1049 <span class=
"Delimiter">])
</span>
1050 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1051 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1052 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
1053 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"Delimiter">)
</span></span>
1054 <span class=
"Delimiter">])))
</span>
1055 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1056 <span class=
"CommentedCode">;? (prn memory*)
</span>
1057 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">3</span> <span class=
"Constant">3</span> <span class=
"Constant">4</span><span class=
"Delimiter">))
</span>
1058 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'reply' stops executing the current function
"</span><span class=
"Delimiter">))
</span>
1059 <span class=
"CommentedCode">;? (quit)
</span>
1061 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1062 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-reply-nested
"</span><span class=
"Delimiter">)
</span>
1063 <span class=
"Delimiter">(
</span>add-code
1064 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1065 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> test2
<span class=
"Delimiter">)
</span></span>
1066 <span class=
"Delimiter">])
</span>
1067 <span class=
"Mu"><span class=
"Delimiter">(
</span>function test2
<span class=
"Delimiter">[
</span></span>
1068 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
1069 <span class=
"Delimiter">])
</span>
1070 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1071 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1072 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"Delimiter">)
</span></span>
1073 <span class=
"Delimiter">])))
</span>
1074 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1075 <span class=
"CommentedCode">;? (prn memory*)
</span>
1076 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">2</span> <span class=
"Constant">34</span> <span class=
"Constant">3</span> <span class=
"Constant">34</span><span class=
"Delimiter">))
</span>
1077 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'reply' stops executing any callers as necessary
"</span><span class=
"Delimiter">))
</span>
1078 <span class=
"CommentedCode">;? (quit)
</span>
1080 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1081 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-reply-once
"</span><span class=
"Delimiter">)
</span>
1082 <span class=
"Delimiter">(
</span>add-code
1083 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1084 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
1085 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
1086 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1087 <span class=
"Delimiter">])
</span>
1088 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1089 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1090 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
1091 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"Delimiter">)
</span></span>
1092 <span class=
"Delimiter">])))
</span>
1093 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
")))
</span>
1094 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1095 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">5</span> <span class=
"Global">curr-cycle*
</span><span class=
"Delimiter">)
</span>
1096 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'reply' executes instructions exactly once
"</span> <span class=
"Global">curr-cycle*
</span><span class=
"Delimiter">))
</span>
1097 <span class=
"CommentedCode">;? (quit)
</span>
1099 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1100 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"reply-increments-caller-pc
"</span><span class=
"Delimiter">)
</span>
1101 <span class=
"Delimiter">(
</span>add-code
1102 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function callee
<span class=
"Delimiter">[
</span></span>
1103 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
1104 <span class=
"Delimiter">])
</span>
1105 <span class=
"Mu"><span class=
"Delimiter">(
</span>function caller
<span class=
"Delimiter">[
</span></span>
1106 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
1107 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
1108 <span class=
"Delimiter">])))
</span>
1109 <span class=
"Delimiter">(
</span>freeze
<span class=
"Global">function*
</span><span class=
"Delimiter">)
</span>
1110 <span class=
"Delimiter">(
</span>=
<span class=
"Global">routine*
</span> <span class=
"Delimiter">(
</span>make-routine
<span class=
"Delimiter">'
</span>caller
<span class=
"Delimiter">))
</span>
1111 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>is
<span class=
"Constant">0</span> pc.routine*
<span class=
"Delimiter">))
</span>
1112 <span class=
"Delimiter">(
</span>push-stack
<span class=
"Global">routine*
</span> <span class=
"Delimiter">'
</span>callee
<span class=
"Delimiter">)
</span> <span class=
"Comment">; pretend call was at first instruction of caller
</span>
1113 <span class=
"Delimiter">(
</span>run-for-time-slice
<span class=
"Constant">1</span><span class=
"Delimiter">)
</span>
1114 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> pc.routine*
<span class=
"Delimiter">)
</span>
1115 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'reply' should increment pc in caller (to move past calling instruction)
"</span><span class=
"Delimiter">))
</span>
1117 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1118 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-arg-sequential
"</span><span class=
"Delimiter">)
</span>
1119 <span class=
"Delimiter">(
</span>add-code
1120 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1121 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1122 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1123 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">4</span>:integer
<span class=
"Constant">5</span>:integer
<span class=
"Delimiter">)
</span></span>
1124 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
1125 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1126 <span class=
"Delimiter">])
</span>
1127 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1128 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1129 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
1130 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
1131 <span class=
"Delimiter">])))
</span>
1132 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1133 <span class=
"CommentedCode">;? (prn memory*)
</span>
1134 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">3</span> <span class=
"Constant">3</span> <span class=
"Constant">4</span>
1135 <span class=
"Comment">; test1's temporaries
</span>
1136 <span class=
"Constant">4</span> <span class=
"Constant">1</span> <span class=
"Constant">5</span> <span class=
"Constant">3</span><span class=
"Delimiter">))
</span>
1137 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'arg' accesses in order the operands of the most recent function call (the caller)
"</span><span class=
"Delimiter">))
</span>
1138 <span class=
"CommentedCode">;? (quit)
</span>
1140 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1141 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-arg-random-access
"</span><span class=
"Delimiter">)
</span>
1142 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1143 <span class=
"Delimiter">(
</span>add-code
1144 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1145 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">input
</span> <span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1146 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">input
</span> <span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
1147 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">4</span>:integer
<span class=
"Constant">5</span>:integer
<span class=
"Delimiter">)
</span></span>
1148 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
1149 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; should never run
</span></span>
1150 <span class=
"Delimiter">])
</span>
1151 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1152 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1153 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
1154 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
1155 <span class=
"Delimiter">])))
</span>
1156 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1157 <span class=
"CommentedCode">;? (prn memory*)
</span>
1158 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">3</span> <span class=
"Constant">3</span> <span class=
"Constant">4</span>
1159 <span class=
"Comment">; test's temporaries
</span>
1160 <span class=
"Constant">4</span> <span class=
"Constant">1</span> <span class=
"Constant">5</span> <span class=
"Constant">3</span><span class=
"Delimiter">))
</span>
1161 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'arg' with index can access function call arguments out of order
"</span><span class=
"Delimiter">))
</span>
1162 <span class=
"CommentedCode">;? (quit)
</span>
1164 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1165 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-arg-random-then-sequential
"</span><span class=
"Delimiter">)
</span>
1166 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1167 <span class=
"Delimiter">(
</span>add-code
1168 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1169 <span class=
"Mu"><span class=
"Delimiter">(
</span>_
<span class=
"Op"><-
</span> <span class=
"Identifier">input
</span> <span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1170 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; takes next arg after index
1</span></span>
1171 <span class=
"Delimiter">])
</span> <span class=
"Comment">; should never run
</span>
1172 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1173 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"MuConstant">1</span>:literal
<span class=
"MuConstant">2</span>:literal
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
1174 <span class=
"Delimiter">])))
</span>
1175 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1176 <span class=
"CommentedCode">;? (prn memory*)
</span>
1177 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">3</span><span class=
"Delimiter">))
</span>
1178 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'arg' with index resets index for later calls
"</span><span class=
"Delimiter">))
</span>
1179 <span class=
"CommentedCode">;? (quit)
</span>
1181 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1182 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-arg-status
"</span><span class=
"Delimiter">)
</span>
1183 <span class=
"Delimiter">(
</span>add-code
1184 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1185 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1186 <span class=
"Delimiter">])
</span>
1187 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1188 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1189 <span class=
"Delimiter">])))
</span>
1190 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1191 <span class=
"CommentedCode">;? (prn memory*)
</span>
1192 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">4</span> <span class=
"Constant">1</span> <span class=
"Constant">5</span> t
<span class=
"Delimiter">))
</span>
1193 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'arg' sets a second oarg when arg exists
"</span><span class=
"Delimiter">))
</span>
1194 <span class=
"CommentedCode">;? (quit)
</span>
1196 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1197 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-arg-missing
"</span><span class=
"Delimiter">)
</span>
1198 <span class=
"Delimiter">(
</span>add-code
1199 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1200 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1201 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1202 <span class=
"Delimiter">])
</span>
1203 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1204 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1205 <span class=
"Delimiter">])))
</span>
1206 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1207 <span class=
"CommentedCode">;? (prn memory*)
</span>
1208 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">4</span> <span class=
"Constant">1</span><span class=
"Delimiter">))
</span>
1209 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - missing 'arg' doesn't cause error
"</span><span class=
"Delimiter">))
</span>
1210 <span class=
"CommentedCode">;? (quit)
</span>
1212 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1213 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-arg-missing-
2"</span><span class=
"Delimiter">)
</span>
1214 <span class=
"Delimiter">(
</span>add-code
1215 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1216 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1217 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Constant">6</span>:boolean
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1218 <span class=
"Delimiter">])
</span>
1219 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1220 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1221 <span class=
"Delimiter">])))
</span>
1222 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1223 <span class=
"CommentedCode">;? (prn memory*)
</span>
1224 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">4</span> <span class=
"Constant">1</span> <span class=
"Constant">6</span> nil
<span class=
"Delimiter">))
</span>
1225 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - missing 'arg' wipes second oarg when provided
"</span><span class=
"Delimiter">))
</span>
1226 <span class=
"CommentedCode">;? (quit)
</span>
1228 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1229 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-arg-missing-
3"</span><span class=
"Delimiter">)
</span>
1230 <span class=
"Delimiter">(
</span>add-code
1231 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1232 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1233 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1234 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Constant">6</span>:boolean
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1235 <span class=
"Delimiter">])
</span>
1236 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1237 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1238 <span class=
"Delimiter">])))
</span>
1239 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1240 <span class=
"CommentedCode">;? (prn memory*)
</span>
1241 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">4</span> <span class=
"Constant">1</span> <span class=
"Constant">6</span> nil
<span class=
"Delimiter">))
</span>
1242 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - missing 'arg' consistently wipes its oarg
"</span><span class=
"Delimiter">))
</span>
1243 <span class=
"CommentedCode">;? (quit)
</span>
1245 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1246 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-arg-missing-
4"</span><span class=
"Delimiter">)
</span>
1247 <span class=
"Delimiter">(
</span>add-code
1248 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1249 <span class=
"Comment">; if given two args, adds them; if given one arg, increments
</span>
1250 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1251 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Constant">6</span>:boolean
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1252 {
<span class=
"CommentedCode">begin
</span>
1253 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">break-if
</span> <span class=
"Constant">6</span>:boolean
<span class=
"Delimiter">)
</span></span>
1254 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1256 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">4</span>:integer
<span class=
"Constant">5</span>:integer
<span class=
"Delimiter">)
</span></span>
1257 <span class=
"Delimiter">])
</span>
1258 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1259 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1260 <span class=
"Delimiter">])))
</span>
1261 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1262 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1263 <span class=
"CommentedCode">;? (prn memory*)
</span>
1264 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">4</span> <span class=
"Constant">34</span> <span class=
"Constant">5</span> <span class=
"Constant">1</span> <span class=
"Constant">6</span> nil
<span class=
"Constant">7</span> <span class=
"Constant">35</span><span class=
"Delimiter">))
</span>
1265 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - function with optional second arg
"</span><span class=
"Delimiter">))
</span>
1266 <span class=
"CommentedCode">;? (quit)
</span>
1268 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1269 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-arg-by-value
"</span><span class=
"Delimiter">)
</span>
1270 <span class=
"Delimiter">(
</span>add-code
1271 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1272 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; overwrite caller memory
</span></span>
1273 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1274 <span class=
"Delimiter">])
</span> <span class=
"Comment">; arg not clobbered
</span>
1275 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1276 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1277 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"Constant">1</span>:integer
<span class=
"Delimiter">)
</span></span>
1278 <span class=
"Delimiter">])))
</span>
1279 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1280 <span class=
"CommentedCode">;? (prn memory*)
</span>
1281 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">0</span> <span class=
"Constant">2</span> <span class=
"Constant">34</span><span class=
"Delimiter">))
</span>
1282 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'arg' passes by value
"</span><span class=
"Delimiter">))
</span>
1284 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1285 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"arg-record
"</span><span class=
"Delimiter">)
</span>
1286 <span class=
"Delimiter">(
</span>add-code
1287 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1288 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer-boolean-pair
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1289 <span class=
"Delimiter">])
</span>
1290 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1291 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1292 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
1293 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"Constant">1</span>:integer-boolean-pair
<span class=
"Delimiter">)
</span></span>
1294 <span class=
"Delimiter">])))
</span>
1295 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1296 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">34</span> <span class=
"Constant">2</span> nil
<span class=
"Constant">4</span> <span class=
"Constant">34</span> <span class=
"Constant">5</span> nil
<span class=
"Delimiter">))
</span>
1297 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'arg' can copy records spanning multiple locations
"</span><span class=
"Delimiter">))
</span>
1299 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1300 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"arg-record-indirect
"</span><span class=
"Delimiter">)
</span>
1301 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1302 <span class=
"Delimiter">(
</span>add-code
1303 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1304 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer-boolean-pair
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1305 <span class=
"Delimiter">])
</span>
1306 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1307 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1308 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
1309 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer-boolean-pair-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1310 <span class=
"Mu"><span class=
"Delimiter">(
</span>test1
<span class=
"Constant">3</span>:integer-boolean-pair-address/deref
<span class=
"Delimiter">)
</span></span>
1311 <span class=
"Delimiter">])))
</span>
1312 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1313 <span class=
"CommentedCode">;? (prn memory*)
</span>
1314 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">34</span> <span class=
"Constant">2</span> nil
<span class=
"Constant">3</span> <span class=
"Constant">1</span> <span class=
"Constant">4</span> <span class=
"Constant">34</span> <span class=
"Constant">5</span> nil
<span class=
"Delimiter">))
</span>
1315 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'arg' can copy records spanning multiple locations in indirect mode
"</span><span class=
"Delimiter">))
</span>
1317 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1318 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-reply-oarg
"</span><span class=
"Delimiter">)
</span>
1319 <span class=
"Delimiter">(
</span>add-code
1320 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1321 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1322 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1323 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">4</span>:integer
<span class=
"Constant">5</span>:integer
<span class=
"Delimiter">)
</span></span>
1324 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"Constant">6</span>:integer
<span class=
"Delimiter">)
</span></span>
1325 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1326 <span class=
"Delimiter">])
</span>
1327 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1328 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1329 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
1330 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> test1
<span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
1331 <span class=
"Delimiter">])))
</span>
1332 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1333 <span class=
"CommentedCode">;? (prn memory*)
</span>
1334 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">3</span> <span class=
"Constant">3</span> <span class=
"Constant">4</span>
1335 <span class=
"Comment">; test1's temporaries
</span>
1336 <span class=
"Constant">4</span> <span class=
"Constant">1</span> <span class=
"Constant">5</span> <span class=
"Constant">3</span> <span class=
"Constant">6</span> <span class=
"Constant">4</span><span class=
"Delimiter">))
</span>
1337 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'reply' can take aguments that are returned, or written back into output args of caller
"</span><span class=
"Delimiter">))
</span>
1339 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1340 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-reply-oarg-multiple
"</span><span class=
"Delimiter">)
</span>
1341 <span class=
"Delimiter">(
</span>add-code
1342 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1343 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1344 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1345 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">4</span>:integer
<span class=
"Constant">5</span>:integer
<span class=
"Delimiter">)
</span></span>
1346 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"Constant">6</span>:integer
<span class=
"Constant">5</span>:integer
<span class=
"Delimiter">)
</span></span>
1347 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1348 <span class=
"Delimiter">])
</span>
1349 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1350 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1351 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
1352 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> test1
<span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
1353 <span class=
"Delimiter">])))
</span>
1354 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1355 <span class=
"CommentedCode">;? (prn memory*)
</span>
1356 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">3</span> <span class=
"Constant">3</span> <span class=
"Constant">4</span> <span class=
"Constant">7</span> <span class=
"Constant">3</span>
1357 <span class=
"Comment">; test1's temporaries
</span>
1358 <span class=
"Constant">4</span> <span class=
"Constant">1</span> <span class=
"Constant">5</span> <span class=
"Constant">3</span> <span class=
"Constant">6</span> <span class=
"Constant">4</span><span class=
"Delimiter">))
</span>
1359 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'reply' permits a function to return multiple values at once
"</span><span class=
"Delimiter">))
</span>
1361 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1362 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-fn-prepare-reply
"</span><span class=
"Delimiter">)
</span>
1363 <span class=
"Delimiter">(
</span>add-code
1364 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
1365 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1366 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
1367 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">4</span>:integer
<span class=
"Constant">5</span>:integer
<span class=
"Delimiter">)
</span></span>
1368 <span class=
"Mu"><span class=
"Delimiter">(
</span>prepare-reply
<span class=
"Constant">6</span>:integer
<span class=
"Constant">5</span>:integer
<span class=
"Delimiter">)
</span></span>
1369 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
1370 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1371 <span class=
"Delimiter">])
</span>
1372 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
1373 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
1374 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
1375 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> test1
<span class=
"Constant">1</span>:integer
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
1376 <span class=
"Delimiter">])))
</span>
1377 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1378 <span class=
"CommentedCode">;? (prn memory*)
</span>
1379 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">1</span> <span class=
"Constant">2</span> <span class=
"Constant">3</span> <span class=
"Constant">3</span> <span class=
"Constant">4</span> <span class=
"Constant">7</span> <span class=
"Constant">3</span>
1380 <span class=
"Comment">; test1's temporaries
</span>
1381 <span class=
"Constant">4</span> <span class=
"Constant">1</span> <span class=
"Constant">5</span> <span class=
"Constant">3</span> <span class=
"Constant">6</span> <span class=
"Constant">4</span><span class=
"Delimiter">))
</span>
1382 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - without args, 'reply' returns values from previous 'prepare-reply'.
"</span><span class=
"Delimiter">))
</span>
1384 <span class=
"Delimiter">)
</span> <span class=
"Comment">; section
20</span>
1386 <span class=
"Delimiter">(
</span>section
<span class=
"Constant">11</span>
1388 <span class=
"SalientComment">;; Structured programming
</span>
1389 <span class=
"Comment">;
</span>
1390 <span class=
"Comment">; Our jump operators are quite inconvenient to use, so mu provides a
</span>
1391 <span class=
"Comment">; lightweight tool called 'convert-braces' to work in a slightly more
</span>
1392 <span class=
"Comment">; convenient format with nested braces:
</span>
1393 <span class=
"Comment">;
</span>
1394 <span class=
"Comment">; {
</span>
1395 <span class=
"Comment">; some instructions
</span>
1396 <span class=
"Comment">; {
</span>
1397 <span class=
"Comment">; more instructions
</span>
1398 <span class=
"Comment">; }
</span>
1399 <span class=
"Comment">; }
</span>
1400 <span class=
"Comment">;
</span>
1401 <span class=
"Comment">; Braces are like labels in assembly language, they require no special
</span>
1402 <span class=
"Comment">; parsing. The operations 'loop' and 'break' jump to just after the enclosing
</span>
1403 <span class=
"Comment">; '{' and '}' respectively.
</span>
1404 <span class=
"Comment">;
</span>
1405 <span class=
"Comment">; Conditional and unconditional 'loop' and 'break' should give us
80% of the
</span>
1406 <span class=
"Comment">; benefits of the control-flow primitives we're used to in other languages,
</span>
1407 <span class=
"Comment">; like 'if', 'while', 'for', etc.
</span>
1408 <span class=
"Comment">;
</span>
1409 <span class=
"Comment">; Compare 'unquoted blocks' using {} with 'quoted blocks' using [] that we've
</span>
1410 <span class=
"Comment">; gotten used to seeing. Quoted blocks are used by top-level instructions to
</span>
1411 <span class=
"Comment">; provide code without running it.
</span>
1413 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1414 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-braces
"</span><span class=
"Delimiter">)
</span>
1415 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1416 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"c{
0" "c{
1")))
</span>
1417 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1418 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1419 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1420 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1421 {
<span class=
"CommentedCode">begin
</span> <span class=
"Comment">; 'begin' is just a hack because racket turns braces into parens
</span>
1422 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>not-equal
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">)))
</span></span>
1423 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">break-if
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">)))
</span></span>
1424 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">5</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1426 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)))))
</span></span>
1427 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1428 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1429 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1430 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>not-equal
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">)))
</span></span>
1431 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump-if
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">1</span> offset
<span class=
"Delimiter">)))
</span></span>
1432 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">5</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1433 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)))))
</span></span>
1434 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-braces replaces break-if with a jump-if to after the next close-brace
"</span><span class=
"Delimiter">))
</span>
1435 <span class=
"CommentedCode">;? (quit)
</span>
1437 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1438 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-braces-empty-block
"</span><span class=
"Delimiter">)
</span>
1439 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1440 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"c{
0" "c{
1")))
</span>
1441 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1442 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1443 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1444 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1445 {
<span class=
"CommentedCode">begin
</span>
1446 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">break
</span><span class=
"Delimiter">)))
</span></span>
1448 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)))))
</span></span>
1449 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1450 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1451 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1452 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> offset
<span class=
"Delimiter">)))
</span></span>
1453 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)))))
</span></span>
1454 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-braces works for degenerate blocks
"</span><span class=
"Delimiter">))
</span>
1455 <span class=
"CommentedCode">;? (quit)
</span>
1457 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1458 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-braces-nested-break
"</span><span class=
"Delimiter">)
</span>
1459 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1460 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1461 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1462 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1463 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1464 {
<span class=
"CommentedCode">begin
</span>
1465 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>not-equal
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">)))
</span></span>
1466 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">break-if
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">)))
</span></span>
1467 {
<span class=
"CommentedCode">begin
</span>
1468 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">5</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1471 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)))))
</span></span>
1472 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1473 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1474 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1475 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>not-equal
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">)))
</span></span>
1476 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump-if
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">1</span> offset
<span class=
"Delimiter">)))
</span></span>
1477 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">5</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1478 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)))))
</span></span>
1479 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-braces balances braces when converting break
"</span><span class=
"Delimiter">))
</span>
1481 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1482 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-braces-repeated-jump
"</span><span class=
"Delimiter">)
</span>
1483 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1484 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"c{
0" "c{
1")))
</span>
1485 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1486 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1487 {
<span class=
"CommentedCode">begin
</span>
1488 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">break
</span><span class=
"Delimiter">)))
</span></span>
1489 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1491 {
<span class=
"CommentedCode">begin
</span>
1492 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">break
</span><span class=
"Delimiter">)))
</span></span>
1493 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1495 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1496 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1497 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">1</span> offset
<span class=
"Delimiter">)))
</span></span>
1498 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1499 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">1</span> offset
<span class=
"Delimiter">)))
</span></span>
1500 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1501 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1502 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-braces handles jumps on jumps
"</span><span class=
"Delimiter">))
</span>
1503 <span class=
"CommentedCode">;? (quit)
</span>
1505 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1506 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-braces-nested-loop
"</span><span class=
"Delimiter">)
</span>
1507 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1508 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1509 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1510 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1511 {
<span class=
"CommentedCode">begin
</span>
1512 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1513 {
<span class=
"CommentedCode">begin
</span>
1514 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>not-equal
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">)))
</span></span>
1516 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">loop-if
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">)))
</span></span>
1517 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">5</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1519 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)))))
</span></span>
1520 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1521 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1522 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1523 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>not-equal
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">)))
</span></span>
1524 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump-if
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">4</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">-
3</span> offset
<span class=
"Delimiter">)))
</span></span>
1525 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">5</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1526 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)))))
</span></span>
1527 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-braces balances braces when converting 'loop'
"</span><span class=
"Delimiter">))
</span>
1529 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1530 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-braces-label
"</span><span class=
"Delimiter">)
</span>
1531 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1532 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1533 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1535 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1536 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1538 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1539 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-braces skips past labels
"</span><span class=
"Delimiter">))
</span>
1540 <span class=
"CommentedCode">;? (quit)
</span>
1542 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1543 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-braces-label-increments-offset
"</span><span class=
"Delimiter">)
</span>
1544 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1545 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1546 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1547 {
<span class=
"CommentedCode">begin
</span>
1548 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">break
</span><span class=
"Delimiter">)))
</span></span>
1551 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1552 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1553 <span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">1</span> offset
<span class=
"Delimiter">)))
</span>
1555 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1556 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-braces treats labels as instructions
"</span><span class=
"Delimiter">))
</span>
1557 <span class=
"CommentedCode">;? (quit)
</span>
1559 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1560 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-braces-label-increments-offset2
"</span><span class=
"Delimiter">)
</span>
1561 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1562 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"c{
0" "c{
1")))
</span>
1563 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1564 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1565 {
<span class=
"CommentedCode">begin
</span>
1566 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">break
</span><span class=
"Delimiter">)))
</span></span>
1569 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1570 {
<span class=
"CommentedCode">begin
</span>
1571 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">break
</span><span class=
"Delimiter">)))
</span></span>
1572 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1574 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1575 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1576 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">1</span> offset
<span class=
"Delimiter">)))
</span></span>
1578 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1579 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">1</span> offset
<span class=
"Delimiter">)))
</span></span>
1580 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1581 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1582 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-braces treats labels as instructions -
2"</span><span class=
"Delimiter">))
</span>
1583 <span class=
"CommentedCode">;? (quit)
</span>
1585 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1586 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"break-multiple
"</span><span class=
"Delimiter">)
</span>
1587 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1588 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"-
")))
</span>
1589 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1590 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1591 {
<span class=
"CommentedCode">begin
</span>
1592 {
<span class=
"CommentedCode">begin
</span>
1593 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">break
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">2</span> blocks
<span class=
"Delimiter">)))
</span></span>
1595 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1596 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1597 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1598 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">5</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1599 }
<span class=
"Delimiter">))
</span>
1600 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1601 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">4</span> offset
<span class=
"Delimiter">)))
</span></span>
1602 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1603 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1604 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1605 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">5</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1606 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'break' can take an extra arg with number of nested blocks to exit
"</span><span class=
"Delimiter">))
</span>
1607 <span class=
"CommentedCode">;? (quit)
</span>
1609 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1610 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"loop
"</span><span class=
"Delimiter">)
</span>
1611 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1612 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1613 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1614 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1615 {
<span class=
"CommentedCode">begin
</span>
1616 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1617 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">loop
</span><span class=
"Delimiter">)))
</span></span>
1618 }
<span class=
"Delimiter">))
</span>
1619 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1620 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1621 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1622 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">-
2</span> offset
<span class=
"Delimiter">)))))
</span></span>
1623 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'loop' jumps to start of containing block
"</span><span class=
"Delimiter">))
</span>
1624 <span class=
"CommentedCode">;? (quit)
</span>
1626 <span class=
"Comment">; todo: fuzz-test invariant: convert-braces offsets should be robust to any
</span>
1627 <span class=
"Comment">; number of inner blocks inside but not around the loop block.
</span>
1629 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1630 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"loop-nested
"</span><span class=
"Delimiter">)
</span>
1631 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1632 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1633 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1634 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1635 {
<span class=
"CommentedCode">begin
</span>
1636 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1637 {
<span class=
"CommentedCode">begin
</span>
1638 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1640 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">loop
</span><span class=
"Delimiter">)))
</span></span>
1641 }
<span class=
"Delimiter">))
</span>
1642 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1643 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1644 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1645 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1646 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">-
3</span> offset
<span class=
"Delimiter">)))))
</span></span>
1647 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'loop' correctly jumps back past nested braces
"</span><span class=
"Delimiter">))
</span>
1649 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1650 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"loop-multiple
"</span><span class=
"Delimiter">)
</span>
1651 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1652 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"-
")))
</span>
1653 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-braces
1654 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1655 {
<span class=
"CommentedCode">begin
</span>
1656 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1657 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1658 {
<span class=
"CommentedCode">begin
</span>
1659 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">loop
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">2</span> blocks
<span class=
"Delimiter">)))
</span></span>
1661 }
<span class=
"Delimiter">))
</span>
1662 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1663 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1664 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1665 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">-
3</span> offset
<span class=
"Delimiter">)))))
</span></span>
1666 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'loop' can take an extra arg with number of nested blocks to exit
"</span><span class=
"Delimiter">))
</span>
1667 <span class=
"CommentedCode">;? (quit)
</span>
1669 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1670 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-labels
"</span><span class=
"Delimiter">)
</span>
1671 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1672 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-labels
1673 <span class=
"Mu"><span class=
"Delimiter">'(
</span><span class=
"Identifier">loop
</span></span>
1674 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Identifier">loop
</span> offset
<span class=
"Delimiter">)))))
</span></span>
1675 <span class=
"Mu"><span class=
"Delimiter">'(
</span><span class=
"Identifier">loop
</span></span>
1676 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Identifier">jump
</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">-
2</span> offset
<span class=
"Delimiter">)))))
</span></span>
1677 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'convert-labels' rewrites jumps to labels
"</span><span class=
"Delimiter">))
</span>
1679 <span class=
"SalientComment">;; Variables
</span>
1680 <span class=
"Comment">;
</span>
1681 <span class=
"Comment">; A big convenience high-level languages provide is the ability to name memory
</span>
1682 <span class=
"Comment">; locations. In mu, a lightweight tool called 'convert-names' provides this
</span>
1683 <span class=
"Comment">; convenience.
</span>
1685 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1686 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names
"</span><span class=
"Delimiter">)
</span>
1687 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1688 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1689 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1690 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1691 <span class=
"Mu"><span class=
"Delimiter">(((
</span>y integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1692 <span class=
"Mu"><span class=
"Delimiter">(((
</span>z integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1693 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1694 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1695 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1696 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names renames symbolic names to integer locations
"</span><span class=
"Delimiter">))
</span>
1698 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1699 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-compound
"</span><span class=
"Delimiter">)
</span>
1700 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1701 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1702 <span class=
"Comment">; copying
0 into pair is meaningless; just for testing
</span>
1703 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x integer-boolean-pair
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1704 <span class=
"Mu"><span class=
"Delimiter">(((
</span>y integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1705 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer-boolean-pair
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1706 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1707 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names increments integer locations by the size of the type of the previous var
"</span><span class=
"Delimiter">))
</span>
1709 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1710 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-nil
"</span><span class=
"Delimiter">)
</span>
1711 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1712 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1713 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1714 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1715 <span class=
"Mu"><span class=
"Delimiter">(((
</span>y integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1716 <span class=
"Comment">; nil location is meaningless; just for testing
</span>
1717 <span class=
"Mu"><span class=
"Delimiter">(((
</span>nil integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1718 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1719 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1720 <span class=
"Mu"><span class=
"Delimiter">(((
</span>nil integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1721 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names never renames nil
"</span><span class=
"Delimiter">))
</span>
1723 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1724 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-string
"</span><span class=
"Delimiter">)
</span>
1725 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1726 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1727 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer-address
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>new
<span class=
"Delimiter">))
</span> <span class=
"Constant">"foo
"</span><span class=
"Delimiter">)))
</span></span>
1728 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer-address
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>new
<span class=
"Delimiter">))
</span> <span class=
"Constant">"foo
"</span><span class=
"Delimiter">)))
</span></span>
1729 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"convert-names passes through raw strings (just a convenience arg for 'new')
"</span><span class=
"Delimiter">))
</span>
1731 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1732 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-raw
"</span><span class=
"Delimiter">)
</span>
1733 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1734 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1735 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1736 <span class=
"Mu"><span class=
"Delimiter">(((
</span>y integer
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>raw
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1737 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1738 <span class=
"Mu"><span class=
"Delimiter">(((
</span>y integer
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>raw
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1739 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names never renames raw operands
"</span><span class=
"Delimiter">))
</span>
1741 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1742 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-literal
"</span><span class=
"Delimiter">)
</span>
1743 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1744 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1745 <span class=
"Comment">; meaningless; just for testing
</span>
1746 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x literal
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1747 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x literal
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1748 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names never renames literals
"</span><span class=
"Delimiter">))
</span>
1750 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1751 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-literal-
2"</span><span class=
"Delimiter">)
</span>
1752 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1753 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1754 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>x literal
<span class=
"Delimiter">)))))
</span></span>
1755 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>x literal
<span class=
"Delimiter">)))))
</span></span>
1756 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names never renames literals, even when the name matches a variable
"</span><span class=
"Delimiter">))
</span>
1758 <span class=
"Comment">; kludgy support for 'fork' below
</span>
1759 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1760 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-functions
"</span><span class=
"Delimiter">)
</span>
1761 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1762 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1763 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1764 <span class=
"Mu"><span class=
"Delimiter">(((
</span>y integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1765 <span class=
"Comment">; meaningless; just for testing
</span>
1766 <span class=
"Mu"><span class=
"Delimiter">(((
</span>z fn
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1767 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1768 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1769 <span class=
"Mu"><span class=
"Delimiter">(((
</span>z fn
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
1770 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names never renames fns
"</span><span class=
"Delimiter">))
</span>
1772 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1773 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-record-fields
"</span><span class=
"Delimiter">)
</span>
1774 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1775 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"cn0
")))
</span>
1776 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1777 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>get
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">34</span> integer-boolean-pair
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>bool offset
<span class=
"Delimiter">)))))
</span></span>
1778 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>get
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">34</span> integer-boolean-pair
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">1</span> offset
<span class=
"Delimiter">)))))
</span></span>
1779 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names replaces record field offsets
"</span><span class=
"Delimiter">))
</span>
1781 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1782 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-record-fields-ambiguous
"</span><span class=
"Delimiter">)
</span>
1783 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1784 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>errsafe
<span class=
"Delimiter">(
</span>convert-names
1785 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>bool boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">t
</span> literal
<span class=
"Delimiter">)))
</span></span>
1786 <span class=
"Mu"><span class=
"Delimiter">(((
</span>x integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>get
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">34</span> integer-boolean-pair
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>bool offset
<span class=
"Delimiter">))))))
</span></span>
1787 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names doesn't allow offsets and variables with the same name in a function
"</span><span class=
"Delimiter">))
</span>
1789 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1790 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-record-fields-ambiguous-
2"</span><span class=
"Delimiter">)
</span>
1791 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1792 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>errsafe
<span class=
"Delimiter">(
</span>convert-names
1793 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>get
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">34</span> integer-boolean-pair
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>bool offset
<span class=
"Delimiter">)))
</span></span>
1794 <span class=
"Mu"><span class=
"Delimiter">(((
</span>bool boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">t
</span> literal
<span class=
"Delimiter">))))))
</span></span>
1795 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names doesn't allow offsets and variables with the same name in a function -
2"</span><span class=
"Delimiter">))
</span>
1797 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1798 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-record-fields-indirect
"</span><span class=
"Delimiter">)
</span>
1799 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1800 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"cn0
")))
</span>
1801 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1802 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>get
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">34</span> integer-boolean-pair-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>bool offset
<span class=
"Delimiter">)))))
</span></span>
1803 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>get
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">34</span> integer-boolean-pair-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">1</span> offset
<span class=
"Delimiter">)))))
</span></span>
1804 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names replaces field offsets for record addresses
"</span><span class=
"Delimiter">))
</span>
1805 <span class=
"CommentedCode">;? (quit)
</span>
1807 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1808 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-record-fields-multiple
"</span><span class=
"Delimiter">)
</span>
1809 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1810 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1811 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">2</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>get
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">1</span> integer-boolean-pair
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>bool offset
<span class=
"Delimiter">)))
</span></span>
1812 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>get
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">1</span> integer-boolean-pair
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>bool offset
<span class=
"Delimiter">)))))
</span></span>
1813 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">2</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>get
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">1</span> integer-boolean-pair
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">1</span> offset
<span class=
"Delimiter">)))
</span></span>
1814 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">3</span> boolean
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>get
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">1</span> integer-boolean-pair
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">1</span> offset
<span class=
"Delimiter">)))))
</span></span>
1815 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names replaces field offsets with multiple mentions
"</span><span class=
"Delimiter">))
</span>
1816 <span class=
"CommentedCode">;? (quit)
</span>
1818 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1819 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-label
"</span><span class=
"Delimiter">)
</span>
1820 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1821 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1822 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1823 foo
<span class=
"Delimiter">))
</span>
1824 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
1825 foo
<span class=
"Delimiter">))
</span>
1826 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names skips past labels
"</span><span class=
"Delimiter">))
</span>
1827 <span class=
"CommentedCode">;? (quit)
</span>
1829 <span class=
"Delimiter">)
</span> <span class=
"Comment">; section
11</span>
1831 <span class=
"Delimiter">(
</span>section
<span class=
"Constant">20</span>
1833 <span class=
"Comment">; A rudimentary memory allocator. Eventually we want to write this in mu.
</span>
1834 <span class=
"Comment">;
</span>
1835 <span class=
"Comment">; No deallocation yet; let's see how much code we can build in mu before we
</span>
1836 <span class=
"Comment">; feel the need for it.
</span>
1838 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1839 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-primitive
"</span><span class=
"Delimiter">)
</span>
1840 <span class=
"Delimiter">(
</span>add-code
1841 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
1842 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer-address
<span class=
"Op"><-
</span> new integer:literal
<span class=
"Delimiter">)
</span></span>
1843 <span class=
"Delimiter">])))
</span>
1844 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!main
1845 <span class=
"Delimiter">(
</span>enq routine
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
1846 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> before rep.routine!alloc
1847 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1848 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">)
</span>
1849 <span class=
"CommentedCode">;? (prn memory*)
</span>
1850 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> before
<span class=
"Delimiter">)
</span>
1851 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'new' returns current high-water mark
"</span><span class=
"Delimiter">))
</span>
1852 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso rep.routine!alloc
<span class=
"Delimiter">(
</span>+ before
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span>
1853 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'new' on primitive types increments high-water mark by their size
"</span><span class=
"Delimiter">))))
</span>
1854 <span class=
"CommentedCode">;? (quit)
</span>
1856 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1857 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-array-literal
"</span><span class=
"Delimiter">)
</span>
1858 <span class=
"Delimiter">(
</span>add-code
1859 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
1860 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:type-array-address
<span class=
"Op"><-
</span> new type-array:literal
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)
</span></span>
1861 <span class=
"Delimiter">])))
</span>
1862 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!main
1863 <span class=
"Delimiter">(
</span>enq routine
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
1864 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> before rep.routine!alloc
1865 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">)
</span>
1866 <span class=
"CommentedCode">;? (prn memory*)
</span>
1867 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> before
<span class=
"Delimiter">)
</span>
1868 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'new' on array with literal size returns current high-water mark
"</span><span class=
"Delimiter">))
</span>
1869 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso rep.routine!alloc
<span class=
"Delimiter">(
</span>+ before
<span class=
"Constant">6</span><span class=
"Delimiter">))
</span>
1870 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'new' on primitive arrays increments high-water mark by their size
"</span><span class=
"Delimiter">))))
</span>
1872 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1873 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"new-array-direct
"</span><span class=
"Delimiter">)
</span>
1874 <span class=
"Delimiter">(
</span>add-code
1875 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
1876 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)
</span></span>
1877 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:type-array-address
<span class=
"Op"><-
</span> new type-array:literal
<span class=
"Constant">1</span>:integer
<span class=
"Delimiter">)
</span></span>
1878 <span class=
"Delimiter">])))
</span>
1879 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!main
1880 <span class=
"Delimiter">(
</span>enq routine
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
1881 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> before rep.routine!alloc
1882 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">)
</span>
1883 <span class=
"CommentedCode">;? (prn memory*)
</span>
1884 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> before
<span class=
"Delimiter">)
</span>
1885 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'new' on array with variable size returns current high-water mark
"</span><span class=
"Delimiter">))
</span>
1886 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso rep.routine!alloc
<span class=
"Delimiter">(
</span>+ before
<span class=
"Constant">6</span><span class=
"Delimiter">))
</span>
1887 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'new' on primitive arrays increments high-water mark by their (variable) size
"</span><span class=
"Delimiter">))))
</span>
1889 <span class=
"Comment">; Even though our memory locations can now have names, the names are all
</span>
1890 <span class=
"Comment">; globals, accessible from any function. To isolate functions from their
</span>
1891 <span class=
"Comment">; callers we need local variables, and mu provides them using a special
</span>
1892 <span class=
"Comment">; variable called default-space. When you initialize such a variable (likely
</span>
1893 <span class=
"Comment">; with a call to our just-defined memory allocator) mu interprets memory
</span>
1894 <span class=
"Comment">; locations as offsets from its value. If default-space is set to
1000, for
</span>
1895 <span class=
"Comment">; example, reads and writes to memory location
1 will really go to
1001.
</span>
1896 <span class=
"Comment">;
</span>
1897 <span class=
"Comment">; 'default-space' is itself hard-coded to be function-local; it's nil in a new
</span>
1898 <span class=
"Comment">; function, and it's restored when functions return to their callers. But the
</span>
1899 <span class=
"Comment">; actual space allocation is independent. So you can define closures, or do
</span>
1900 <span class=
"Comment">; even more funky things like share locals between two coroutines.
</span>
1902 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1903 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"set-default-space
"</span><span class=
"Delimiter">)
</span>
1904 <span class=
"Delimiter">(
</span>add-code
1905 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
1906 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
1907 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
1908 <span class=
"Delimiter">])))
</span>
1909 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!main
1910 <span class=
"Delimiter">(
</span>enq routine
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
1911 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> before rep.routine!alloc
1912 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1913 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">)
</span>
1914 <span class=
"CommentedCode">;? (prn memory*)
</span>
1915 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~and
<span class=
"Delimiter">(
</span>~is
<span class=
"Constant">23</span> <span class=
"Global">memory*
</span><span class=
"Constant">.1</span><span class=
"Delimiter">)
</span>
1916 <span class=
"Delimiter">(
</span>is
<span class=
"Constant">23</span> <span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ before
<span class=
"Constant">2</span><span class=
"Delimiter">))))
</span>
1917 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - default-space implicitly modifies variable locations
"</span><span class=
"Delimiter">))))
</span>
1918 <span class=
"CommentedCode">;? (quit)
</span>
1920 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1921 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"set-default-space-skips-offset
"</span><span class=
"Delimiter">)
</span>
1922 <span class=
"Delimiter">(
</span>add-code
1923 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
1924 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
1925 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:offset
<span class=
"Delimiter">)
</span></span>
1926 <span class=
"Delimiter">])))
</span>
1927 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!main
1928 <span class=
"Delimiter">(
</span>enq routine
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
1929 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> before rep.routine!alloc
1930 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1931 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">)
</span>
1932 <span class=
"CommentedCode">;? (prn memory*)
</span>
1933 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~and
<span class=
"Delimiter">(
</span>~is
<span class=
"Constant">23</span> <span class=
"Global">memory*
</span><span class=
"Constant">.1</span><span class=
"Delimiter">)
</span>
1934 <span class=
"Delimiter">(
</span>is
<span class=
"Constant">23</span> <span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ before
<span class=
"Constant">2</span><span class=
"Delimiter">))))
</span>
1935 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - default-space skips 'offset' types just like literals
"</span><span class=
"Delimiter">))))
</span>
1937 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1938 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"default-space-bounds-check
"</span><span class=
"Delimiter">)
</span>
1939 <span class=
"Delimiter">(
</span>add-code
1940 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
1941 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
1942 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
1943 <span class=
"Delimiter">])))
</span>
1944 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
1945 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1946 <span class=
"CommentedCode">;? (prn memory*)
</span>
1947 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine
<span class=
"Delimiter">(
</span>car
<span class=
"Global">completed-routines*
</span><span class=
"Delimiter">)
</span>
1948 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>no rep.routine!error
<span class=
"Delimiter">)
</span>
1949 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - default-space checks bounds
"</span><span class=
"Delimiter">)))
</span>
1951 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1952 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"default-space-and-get-indirect
"</span><span class=
"Delimiter">)
</span>
1953 <span class=
"Delimiter">(
</span>add-code
1954 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
1955 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)
</span></span>
1956 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer-boolean-pair-address
<span class=
"Op"><-
</span> new integer-boolean-pair:literal
<span class=
"Delimiter">)
</span></span>
1957 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer-address
<span class=
"Op"><-
</span> get-address
<span class=
"Constant">1</span>:integer-boolean-pair-address/deref
<span class=
"MuConstant">0</span>:offset
<span class=
"Delimiter">)
</span></span>
1958 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer-address/deref
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1959 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer/raw
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:integer-boolean-pair-address/deref
<span class=
"MuConstant">0</span>:offset
<span class=
"Delimiter">)
</span></span>
1960 <span class=
"Delimiter">])))
</span>
1961 <span class=
"CommentedCode">;? (= dump-trace* (obj blacklist '(
"sz
" "m
" "setm
" "addr
" "cvt0
" "cvt1
")))
</span>
1962 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1963 <span class=
"CommentedCode">;? (prn memory*)
</span>
1964 <span class=
"CommentedCode">;? (prn completed-routines*)
</span>
1965 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
1966 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
1967 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">34</span> <span class=
"Global">memory*
</span><span class=
"Constant">.3</span><span class=
"Delimiter">)
</span>
1968 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - indirect 'get' works in the presence of default-space
"</span><span class=
"Delimiter">))
</span>
1969 <span class=
"CommentedCode">;? (quit)
</span>
1971 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1972 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"default-space-and-index-indirect
"</span><span class=
"Delimiter">)
</span>
1973 <span class=
"Delimiter">(
</span>add-code
1974 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
1975 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)
</span></span>
1976 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer-array-address
<span class=
"Op"><-
</span> new integer-array:literal
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
1977 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer-address
<span class=
"Op"><-
</span> index-address
<span class=
"Constant">1</span>:integer-array-address/deref
<span class=
"MuConstant">2</span>:offset
<span class=
"Delimiter">)
</span></span>
1978 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer-address/deref
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
1979 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer/raw
<span class=
"Op"><-
</span> index
<span class=
"Constant">1</span>:integer-array-address/deref
<span class=
"MuConstant">2</span>:offset
<span class=
"Delimiter">)
</span></span>
1980 <span class=
"Delimiter">])))
</span>
1981 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "array-info
")))
</span>
1982 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
1983 <span class=
"CommentedCode">;? (prn memory*)
</span>
1984 <span class=
"CommentedCode">;? (prn completed-routines*)
</span>
1985 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
1986 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
1987 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">34</span> <span class=
"Global">memory*
</span><span class=
"Constant">.3</span><span class=
"Delimiter">)
</span>
1988 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - indirect 'index' works in the presence of default-space
"</span><span class=
"Delimiter">))
</span>
1989 <span class=
"CommentedCode">;? (quit)
</span>
1991 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
1992 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-names-default-space
"</span><span class=
"Delimiter">)
</span>
1993 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
1994 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-names
1995 <span class=
"Mu"><span class=
"Delimiter">'((((
</span>x integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">4</span> literal
<span class=
"Delimiter">)))
</span></span>
1996 <span class=
"Mu"><span class=
"Delimiter">(((
</span>y integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">2</span> literal
<span class=
"Delimiter">)))
</span></span>
1997 <span class=
"Comment">; unsafe in general; don't write random values to 'default-space'
</span>
1998 <span class=
"Mu"><span class=
"Delimiter">(((
</span>default-space integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>add
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>x integer
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>y integer
<span class=
"Delimiter">)))))
</span></span>
1999 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">4</span> literal
<span class=
"Delimiter">)))
</span></span>
2000 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">2</span> literal
<span class=
"Delimiter">)))
</span></span>
2001 <span class=
"Mu"><span class=
"Delimiter">(((
</span>default-space integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>add
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">)))))
</span></span>
2002 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-names never renames default-space
"</span><span class=
"Delimiter">))
</span>
2004 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2005 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"suppress-default-space
"</span><span class=
"Delimiter">)
</span>
2006 <span class=
"Delimiter">(
</span>add-code
2007 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2008 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
2009 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer/raw
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
2010 <span class=
"Delimiter">])))
</span>
2011 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!main
2012 <span class=
"Delimiter">(
</span>enq routine
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
2013 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> before rep.routine!alloc
2014 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2015 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">)
</span>
2016 <span class=
"CommentedCode">;? (prn memory*)
</span>
2017 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~and
<span class=
"Delimiter">(
</span>is
<span class=
"Constant">23</span> <span class=
"Global">memory*
</span><span class=
"Constant">.1</span><span class=
"Delimiter">)
</span>
2018 <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">23</span> <span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ before
<span class=
"Constant">1</span><span class=
"Delimiter">))))
</span>
2019 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - default-space skipped for locations with metadata 'raw'
"</span><span class=
"Delimiter">))))
</span>
2020 <span class=
"CommentedCode">;? (quit)
</span>
2022 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2023 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"array-copy-indirect-scoped
"</span><span class=
"Delimiter">)
</span>
2024 <span class=
"Delimiter">(
</span>add-code
2025 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2026 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">10</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; pretend allocation
</span></span>
2027 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">10</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; unsafe
</span></span>
2028 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; raw location
12</span></span>
2029 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
2030 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
2031 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
2032 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
2033 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer-boolean-pair-array-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">12</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; unsafe
</span></span>
2034 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer-boolean-pair-array
<span class=
"Op"><-
</span> copy
<span class=
"Constant">6</span>:integer-boolean-pair-array-address/deref
<span class=
"Delimiter">)
</span></span>
2035 <span class=
"Delimiter">])))
</span>
2036 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2037 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "m
" "sizeof
")))
</span>
2038 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2039 <span class=
"CommentedCode">;? (prn memory*)
</span>
2040 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
2041 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
2042 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span><span class=
"Constant">.18</span> <span class=
"Constant">2</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; variable
7</span>
2043 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - indirect array copy in the presence of 'default-space'
"</span><span class=
"Delimiter">))
</span>
2044 <span class=
"CommentedCode">;? (quit)
</span>
2046 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2047 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"len-array-indirect-scoped
"</span><span class=
"Delimiter">)
</span>
2048 <span class=
"Delimiter">(
</span>add-code
2049 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2050 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">10</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; pretend allocation
</span></span>
2051 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">10</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; unsafe
</span></span>
2052 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; raw location
12</span></span>
2053 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
2054 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
2055 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
2056 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
2057 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">12</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; unsafe
</span></span>
2058 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> length
<span class=
"Constant">6</span>:integer-boolean-pair-array-address/deref
<span class=
"Delimiter">)
</span></span>
2059 <span class=
"Delimiter">])))
</span>
2060 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "addr
" "sz
" "array-len
")))
</span>
2061 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2062 <span class=
"CommentedCode">;? (prn memory*)
</span>
2063 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span><span class=
"Constant">.18</span> <span class=
"Constant">2</span><span class=
"Delimiter">)
</span>
2064 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'len' accesses length of array address
"</span><span class=
"Delimiter">))
</span>
2065 <span class=
"CommentedCode">;? (quit)
</span>
2067 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2068 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"default-space-shared
"</span><span class=
"Delimiter">)
</span>
2069 <span class=
"Delimiter">(
</span>add-code
2070 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function init-counter
<span class=
"Delimiter">[
</span></span>
2071 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
2072 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; initialize to
3</span></span>
2073 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> default-space:space-address
<span class=
"Delimiter">)
</span></span>
2074 <span class=
"Delimiter">])
</span>
2075 <span class=
"Mu"><span class=
"Delimiter">(
</span>function increment-counter
<span class=
"Delimiter">[
</span></span>
2076 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2077 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">1</span>:integer
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; increment
</span></span>
2078 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"Constant">1</span>:integer
<span class=
"Delimiter">)
</span></span>
2079 <span class=
"Delimiter">])
</span>
2080 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
2081 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:space-address
<span class=
"Op"><-
</span> init-counter
<span class=
"Delimiter">)
</span></span>
2082 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> increment-counter
<span class=
"Constant">1</span>:space-address
<span class=
"Delimiter">)
</span></span>
2083 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> increment-counter
<span class=
"Constant">1</span>:space-address
<span class=
"Delimiter">)
</span></span>
2084 <span class=
"Delimiter">])))
</span>
2085 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2086 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
2087 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
2088 <span class=
"CommentedCode">;? (prn memory*)
</span>
2089 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
2090 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">5</span><span class=
"Delimiter">))
</span>
2091 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - multiple calls to a function can share locals
"</span><span class=
"Delimiter">))
</span>
2092 <span class=
"CommentedCode">;? (quit)
</span>
2094 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2095 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"default-space-closure
"</span><span class=
"Delimiter">)
</span>
2096 <span class=
"Delimiter">(
</span>add-code
2097 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function init-counter
<span class=
"Delimiter">[
</span></span>
2098 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
2099 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; initialize to
3</span></span>
2100 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> default-space:space-address
<span class=
"Delimiter">)
</span></span>
2101 <span class=
"Delimiter">])
</span>
2102 <span class=
"Mu"><span class=
"Delimiter">(
</span>function increment-counter
<span class=
"Delimiter">[
</span></span>
2103 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
2104 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">0</span>:space-address
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; share outer space
</span></span>
2105 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer/space:
1 <span class=
"Op"><-
</span> add
<span class=
"Constant">1</span>:integer/space:
1 <span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; increment
</span></span>
2106 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; dummy
</span></span>
2107 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"Constant">1</span>:integer/space:
1<span class=
"Delimiter">)
</span></span>
2108 <span class=
"Delimiter">])
</span>
2109 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
2110 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:space-address
<span class=
"Op"><-
</span> init-counter
<span class=
"Delimiter">)
</span></span>
2111 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> increment-counter
<span class=
"Constant">1</span>:space-address
<span class=
"Delimiter">)
</span></span>
2112 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> increment-counter
<span class=
"Constant">1</span>:space-address
<span class=
"Delimiter">)
</span></span>
2113 <span class=
"Delimiter">])))
</span>
2114 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2115 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2116 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
2117 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
2118 <span class=
"CommentedCode">;? (prn memory*)
</span>
2119 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
2120 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">5</span><span class=
"Delimiter">))
</span>
2121 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - multiple calls to a function can share locals
"</span><span class=
"Delimiter">))
</span>
2122 <span class=
"CommentedCode">;? (quit)
</span>
2124 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2125 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"default-space-closure-with-names
"</span><span class=
"Delimiter">)
</span>
2126 <span class=
"Delimiter">(
</span>add-code
2127 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function init-counter
<span class=
"Delimiter">[
</span></span>
2128 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
2129 <span class=
"Mu"><span class=
"Delimiter">(
</span>x:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
2130 <span class=
"Mu"><span class=
"Delimiter">(
</span>y:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; correct copy of y
</span></span>
2131 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> default-space:space-address
<span class=
"Delimiter">)
</span></span>
2132 <span class=
"Delimiter">])
</span>
2133 <span class=
"Mu"><span class=
"Delimiter">(
</span>function increment-counter
<span class=
"Delimiter">[
</span></span>
2134 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
2135 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">0</span>:space-address/names:init-counter
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; outer space must be created by 'init-counter' above
</span></span>
2136 <span class=
"Mu"><span class=
"Delimiter">(
</span>y:integer/space:
1 <span class=
"Op"><-
</span> add y:integer/space:
1 <span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; increment
</span></span>
2137 <span class=
"Mu"><span class=
"Delimiter">(
</span>y:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; dummy
</span></span>
2138 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> y:integer/space:
1<span class=
"Delimiter">)
</span></span>
2139 <span class=
"Delimiter">])
</span>
2140 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
2141 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:space-address/names:init-counter
<span class=
"Op"><-
</span> init-counter
<span class=
"Delimiter">)
</span></span>
2142 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> increment-counter
<span class=
"Constant">1</span>:space-address/names:init-counter
<span class=
"Delimiter">)
</span></span>
2143 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> increment-counter
<span class=
"Constant">1</span>:space-address/names:init-counter
<span class=
"Delimiter">)
</span></span>
2144 <span class=
"Delimiter">])))
</span>
2145 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2146 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2147 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
2148 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
2149 <span class=
"CommentedCode">;? (prn memory*)
</span>
2150 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
2151 <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">5</span><span class=
"Delimiter">))
</span>
2152 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - multiple calls to a function can share locals
"</span><span class=
"Delimiter">))
</span>
2153 <span class=
"CommentedCode">;? (quit)
</span>
2155 <span class=
"Delimiter">)
</span> <span class=
"Comment">; section
20</span>
2157 <span class=
"Delimiter">(
</span>section
<span class=
"Constant">100</span>
2159 <span class=
"SalientComment">;; Dynamic dispatch
</span>
2160 <span class=
"Comment">;
</span>
2161 <span class=
"Comment">; Putting it all together, here's how you define generic functions that run
</span>
2162 <span class=
"Comment">; different code based on the types of their args.
</span>
2164 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2165 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"dispatch-clause
"</span><span class=
"Delimiter">)
</span>
2166 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2167 <span class=
"Delimiter">(
</span>add-code
2168 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
2169 <span class=
"Comment">; doesn't matter too much how many locals you allocate space for (here
20)
</span>
2170 <span class=
"Comment">; if it's slightly too many -- memory is plentiful
</span>
2171 <span class=
"Comment">; if it's too few -- mu will raise an error
</span>
2172 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">20</span>:literal
<span class=
"Delimiter">)
</span></span>
2173 <span class=
"Mu"><span class=
"Delimiter">(
</span>first-arg-box:tagged-value-address
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2174 <span class=
"Comment">; if given integers, add them
</span>
2175 {
<span class=
"CommentedCode">begin
</span>
2176 <span class=
"Mu"><span class=
"Delimiter">(
</span>first-arg:integer match?:boolean
<span class=
"Op"><-
</span> maybe-coerce first-arg-box:tagged-value-address/deref integer:literal
<span class=
"Delimiter">)
</span></span>
2177 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">break-unless
</span> match?:boolean
<span class=
"Delimiter">)
</span></span>
2178 <span class=
"Mu"><span class=
"Delimiter">(
</span>second-arg-box:tagged-value-address
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2179 <span class=
"Mu"><span class=
"Delimiter">(
</span>second-arg:integer
<span class=
"Op"><-
</span> maybe-coerce second-arg-box:tagged-value-address/deref integer:literal
<span class=
"Delimiter">)
</span></span>
2180 <span class=
"Mu"><span class=
"Delimiter">(
</span>result:integer
<span class=
"Op"><-
</span> add first-arg:integer second-arg:integer
<span class=
"Delimiter">)
</span></span>
2181 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> result:integer
<span class=
"Delimiter">)
</span></span>
2183 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
2184 <span class=
"Delimiter">])
</span>
2185 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
2186 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:tagged-value-address
<span class=
"Op"><-
</span> init-tagged-value integer:literal
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
2187 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:tagged-value-address
<span class=
"Op"><-
</span> init-tagged-value integer:literal
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
2188 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> test1
<span class=
"Constant">1</span>:tagged-value-address
<span class=
"Constant">2</span>:tagged-value-address
<span class=
"Delimiter">)
</span></span>
2189 <span class=
"Delimiter">])))
</span>
2190 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2191 <span class=
"CommentedCode">;? (prn memory*)
</span>
2192 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">37</span><span class=
"Delimiter">)
</span>
2193 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - an example function that checks that its oarg is an integer
"</span><span class=
"Delimiter">))
</span>
2194 <span class=
"CommentedCode">;? (quit)
</span>
2196 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2197 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"dispatch-multiple-clauses
"</span><span class=
"Delimiter">)
</span>
2198 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2199 <span class=
"Delimiter">(
</span>add-code
2200 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
2201 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">20</span>:literal
<span class=
"Delimiter">)
</span></span>
2202 <span class=
"Mu"><span class=
"Delimiter">(
</span>first-arg-box:tagged-value-address
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2203 <span class=
"Comment">; if given integers, add them
</span>
2204 {
<span class=
"CommentedCode">begin
</span>
2205 <span class=
"Mu"><span class=
"Delimiter">(
</span>first-arg:integer match?:boolean
<span class=
"Op"><-
</span> maybe-coerce first-arg-box:tagged-value-address/deref integer:literal
<span class=
"Delimiter">)
</span></span>
2206 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">break-unless
</span> match?:boolean
<span class=
"Delimiter">)
</span></span>
2207 <span class=
"Mu"><span class=
"Delimiter">(
</span>second-arg-box:tagged-value-address
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2208 <span class=
"Mu"><span class=
"Delimiter">(
</span>second-arg:integer
<span class=
"Op"><-
</span> maybe-coerce second-arg-box:tagged-value-address/deref integer:literal
<span class=
"Delimiter">)
</span></span>
2209 <span class=
"Mu"><span class=
"Delimiter">(
</span>result:integer
<span class=
"Op"><-
</span> add first-arg:integer second-arg:integer
<span class=
"Delimiter">)
</span></span>
2210 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> result:integer
<span class=
"Delimiter">)
</span></span>
2212 <span class=
"Comment">; if given booleans, or them (it's a silly kind of generic function)
</span>
2213 {
<span class=
"CommentedCode">begin
</span>
2214 <span class=
"Mu"><span class=
"Delimiter">(
</span>first-arg:boolean match?:boolean
<span class=
"Op"><-
</span> maybe-coerce first-arg-box:tagged-value-address/deref boolean:literal
<span class=
"Delimiter">)
</span></span>
2215 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">break-unless
</span> match?:boolean
<span class=
"Delimiter">)
</span></span>
2216 <span class=
"Mu"><span class=
"Delimiter">(
</span>second-arg-box:tagged-value-address
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2217 <span class=
"Mu"><span class=
"Delimiter">(
</span>second-arg:boolean
<span class=
"Op"><-
</span> maybe-coerce second-arg-box:tagged-value-address/deref boolean:literal
<span class=
"Delimiter">)
</span></span>
2218 <span class=
"Mu"><span class=
"Delimiter">(
</span>result:boolean
<span class=
"Op"><-
</span> or first-arg:boolean second-arg:boolean
<span class=
"Delimiter">)
</span></span>
2219 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> result:integer
<span class=
"Delimiter">)
</span></span>
2221 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
2222 <span class=
"Delimiter">])
</span>
2223 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
2224 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:tagged-value-address
<span class=
"Op"><-
</span> init-tagged-value boolean:literal
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
2225 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:tagged-value-address
<span class=
"Op"><-
</span> init-tagged-value boolean:literal
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
2226 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> test1
<span class=
"Constant">1</span>:tagged-value-address
<span class=
"Constant">2</span>:tagged-value-address
<span class=
"Delimiter">)
</span></span>
2227 <span class=
"Delimiter">])))
</span>
2228 <span class=
"CommentedCode">;? (each stmt function*!test-fn
</span>
2229 <span class=
"CommentedCode">;? (prn
" " stmt))
</span>
2230 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2231 <span class=
"CommentedCode">;? (wipe dump-trace*)
</span>
2232 <span class=
"CommentedCode">;? (prn memory*)
</span>
2233 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> t
<span class=
"Delimiter">)
</span>
2234 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - an example function that can do different things (dispatch) based on the type of its args or oargs
"</span><span class=
"Delimiter">))
</span>
2235 <span class=
"CommentedCode">;? (quit)
</span>
2237 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2238 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"dispatch-multiple-calls
"</span><span class=
"Delimiter">)
</span>
2239 <span class=
"Delimiter">(
</span>add-code
2240 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
2241 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">20</span>:literal
<span class=
"Delimiter">)
</span></span>
2242 <span class=
"Mu"><span class=
"Delimiter">(
</span>first-arg-box:tagged-value-address
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2243 <span class=
"Comment">; if given integers, add them
</span>
2244 {
<span class=
"CommentedCode">begin
</span>
2245 <span class=
"Mu"><span class=
"Delimiter">(
</span>first-arg:integer match?:boolean
<span class=
"Op"><-
</span> maybe-coerce first-arg-box:tagged-value-address/deref integer:literal
<span class=
"Delimiter">)
</span></span>
2246 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">break-unless
</span> match?:boolean
<span class=
"Delimiter">)
</span></span>
2247 <span class=
"Mu"><span class=
"Delimiter">(
</span>second-arg-box:tagged-value-address
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2248 <span class=
"Mu"><span class=
"Delimiter">(
</span>second-arg:integer
<span class=
"Op"><-
</span> maybe-coerce second-arg-box:tagged-value-address/deref integer:literal
<span class=
"Delimiter">)
</span></span>
2249 <span class=
"Mu"><span class=
"Delimiter">(
</span>result:integer
<span class=
"Op"><-
</span> add first-arg:integer second-arg:integer
<span class=
"Delimiter">)
</span></span>
2250 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> result:integer
<span class=
"Delimiter">)
</span></span>
2252 <span class=
"Comment">; if given booleans, or them (it's a silly kind of generic function)
</span>
2253 {
<span class=
"CommentedCode">begin
</span>
2254 <span class=
"Mu"><span class=
"Delimiter">(
</span>first-arg:boolean match?:boolean
<span class=
"Op"><-
</span> maybe-coerce first-arg-box:tagged-value-address/deref boolean:literal
<span class=
"Delimiter">)
</span></span>
2255 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">break-unless
</span> match?:boolean
<span class=
"Delimiter">)
</span></span>
2256 <span class=
"Mu"><span class=
"Delimiter">(
</span>second-arg-box:tagged-value-address
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2257 <span class=
"Mu"><span class=
"Delimiter">(
</span>second-arg:boolean
<span class=
"Op"><-
</span> maybe-coerce second-arg-box:tagged-value-address/deref boolean:literal
<span class=
"Delimiter">)
</span></span>
2258 <span class=
"Mu"><span class=
"Delimiter">(
</span>result:boolean
<span class=
"Op"><-
</span> or first-arg:boolean second-arg:boolean
<span class=
"Delimiter">)
</span></span>
2259 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> result:integer
<span class=
"Delimiter">)
</span></span>
2261 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
2262 <span class=
"Delimiter">])
</span>
2263 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
2264 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:tagged-value-address
<span class=
"Op"><-
</span> init-tagged-value boolean:literal
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
2265 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:tagged-value-address
<span class=
"Op"><-
</span> init-tagged-value boolean:literal
<span class=
"MuConstant">nil
</span>:literal
<span class=
"Delimiter">)
</span></span>
2266 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> test1
<span class=
"Constant">1</span>:tagged-value-address
<span class=
"Constant">2</span>:tagged-value-address
<span class=
"Delimiter">)
</span></span>
2267 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">10</span>:tagged-value-address
<span class=
"Op"><-
</span> init-tagged-value integer:literal
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
2268 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">11</span>:tagged-value-address
<span class=
"Op"><-
</span> init-tagged-value integer:literal
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
2269 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">12</span>:integer
<span class=
"Op"><-
</span> test1
<span class=
"Constant">10</span>:tagged-value-address
<span class=
"Constant">11</span>:tagged-value-address
<span class=
"Delimiter">)
</span></span>
2270 <span class=
"Delimiter">])))
</span>
2271 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2272 <span class=
"CommentedCode">;? (prn memory*)
</span>
2273 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~and
<span class=
"Delimiter">(
</span>is
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> t
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>is
<span class=
"Global">memory*
</span><span class=
"Constant">.12</span> <span class=
"Constant">37</span><span class=
"Delimiter">))
</span>
2274 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - different calls can exercise different clauses of the same function
"</span><span class=
"Delimiter">))
</span>
2276 <span class=
"Comment">; We can also dispatch based on the type of the operands or results at the
</span>
2277 <span class=
"Comment">; caller.
</span>
2279 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2280 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"dispatch-otype
"</span><span class=
"Delimiter">)
</span>
2281 <span class=
"Delimiter">(
</span>add-code
2282 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
2283 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:type
<span class=
"Op"><-
</span> otype
<span class=
"MuConstant">0</span>:offset
<span class=
"Delimiter">)
</span></span>
2284 {
<span class=
"CommentedCode">begin
</span>
2285 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> equal
<span class=
"Constant">4</span>:type integer:literal
<span class=
"Delimiter">)
</span></span>
2286 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">break-unless
</span> <span class=
"Constant">5</span>:boolean
<span class=
"Delimiter">)
</span></span>
2287 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2288 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2289 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">6</span>:integer
<span class=
"Constant">7</span>:integer
<span class=
"Delimiter">)
</span></span>
2291 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"Constant">8</span>:integer
<span class=
"Delimiter">)
</span></span>
2292 <span class=
"Delimiter">])
</span>
2293 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
2294 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> test1
<span class=
"MuConstant">1</span>:literal
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
2295 <span class=
"Delimiter">])))
</span>
2296 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2297 <span class=
"CommentedCode">;? (prn memory*)
</span>
2298 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
2299 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - an example function that checks that its oarg is an integer
"</span><span class=
"Delimiter">))
</span>
2300 <span class=
"CommentedCode">;? (quit)
</span>
2302 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2303 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"dispatch-otype-multiple-clauses
"</span><span class=
"Delimiter">)
</span>
2304 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2305 <span class=
"Delimiter">(
</span>add-code
2306 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
2307 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:type
<span class=
"Op"><-
</span> otype
<span class=
"MuConstant">0</span>:offset
<span class=
"Delimiter">)
</span></span>
2308 {
<span class=
"CommentedCode">begin
</span>
2309 <span class=
"Comment">; integer needed? add args
</span>
2310 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> equal
<span class=
"Constant">4</span>:type integer:literal
<span class=
"Delimiter">)
</span></span>
2311 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">break-unless
</span> <span class=
"Constant">5</span>:boolean
<span class=
"Delimiter">)
</span></span>
2312 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2313 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2314 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">6</span>:integer
<span class=
"Constant">7</span>:integer
<span class=
"Delimiter">)
</span></span>
2315 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"Constant">8</span>:integer
<span class=
"Delimiter">)
</span></span>
2317 {
<span class=
"CommentedCode">begin
</span>
2318 <span class=
"Comment">; boolean needed? 'or' args
</span>
2319 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> equal
<span class=
"Constant">4</span>:type boolean:literal
<span class=
"Delimiter">)
</span></span>
2320 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">break-unless
</span> <span class=
"Constant">5</span>:boolean
<span class=
"MuConstant">4</span>:offset
<span class=
"Delimiter">)
</span></span>
2321 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:boolean
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2322 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:boolean
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2323 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:boolean
<span class=
"Op"><-
</span> or
<span class=
"Constant">6</span>:boolean
<span class=
"Constant">7</span>:boolean
<span class=
"Delimiter">)
</span></span>
2324 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"Constant">8</span>:boolean
<span class=
"Delimiter">)
</span></span>
2325 }
<span class=
"Delimiter">])
</span>
2326 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
2327 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:boolean
<span class=
"Op"><-
</span> test1
<span class=
"MuConstant">t
</span>:literal
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
2328 <span class=
"Delimiter">])))
</span>
2329 <span class=
"CommentedCode">;? (each stmt function*!test1
</span>
2330 <span class=
"CommentedCode">;? (prn
" " stmt))
</span>
2331 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2332 <span class=
"CommentedCode">;? (wipe dump-trace*)
</span>
2333 <span class=
"CommentedCode">;? (prn memory*)
</span>
2334 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> t
<span class=
"Delimiter">)
</span>
2335 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - an example function that can do different things (dispatch) based on the type of its args or oargs
"</span><span class=
"Delimiter">))
</span>
2336 <span class=
"CommentedCode">;? (quit)
</span>
2338 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2339 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"dispatch-otype-multiple-calls
"</span><span class=
"Delimiter">)
</span>
2340 <span class=
"Delimiter">(
</span>add-code
2341 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function test1
<span class=
"Delimiter">[
</span></span>
2342 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:type
<span class=
"Op"><-
</span> otype
<span class=
"MuConstant">0</span>:offset
<span class=
"Delimiter">)
</span></span>
2343 {
<span class=
"CommentedCode">begin
</span>
2344 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> equal
<span class=
"Constant">4</span>:type integer:literal
<span class=
"Delimiter">)
</span></span>
2345 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">break-unless
</span> <span class=
"Constant">5</span>:boolean
<span class=
"Delimiter">)
</span></span>
2346 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2347 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2348 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">6</span>:integer
<span class=
"Constant">7</span>:integer
<span class=
"Delimiter">)
</span></span>
2349 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"Constant">8</span>:integer
<span class=
"Delimiter">)
</span></span>
2351 {
<span class=
"CommentedCode">begin
</span>
2352 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> equal
<span class=
"Constant">4</span>:type boolean:literal
<span class=
"Delimiter">)
</span></span>
2353 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">break-unless
</span> <span class=
"Constant">5</span>:boolean
<span class=
"Delimiter">)
</span></span>
2354 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:boolean
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2355 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:boolean
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2356 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:boolean
<span class=
"Op"><-
</span> or
<span class=
"Constant">6</span>:boolean
<span class=
"Constant">7</span>:boolean
<span class=
"Delimiter">)
</span></span>
2357 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"Constant">8</span>:boolean
<span class=
"Delimiter">)
</span></span>
2358 }
<span class=
"Delimiter">])
</span>
2359 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
2360 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:boolean
<span class=
"Op"><-
</span> test1
<span class=
"MuConstant">t
</span>:literal
<span class=
"MuConstant">t
</span>:literal
<span class=
"Delimiter">)
</span></span>
2361 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> test1
<span class=
"MuConstant">3</span>:literal
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
2362 <span class=
"Delimiter">])))
</span>
2363 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2364 <span class=
"CommentedCode">;? (prn memory*)
</span>
2365 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~and
<span class=
"Delimiter">(
</span>is
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> t
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">7</span><span class=
"Delimiter">))
</span>
2366 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - different calls can exercise different clauses of the same function
"</span><span class=
"Delimiter">))
</span>
2368 <span class=
"Delimiter">)
</span> <span class=
"Comment">; section
100</span>
2370 <span class=
"Delimiter">(
</span>section
<span class=
"Constant">20</span>
2372 <span class=
"SalientComment">;; Concurrency
</span>
2373 <span class=
"Comment">;
</span>
2374 <span class=
"Comment">; A rudimentary process scheduler. You can 'run' multiple functions at once,
</span>
2375 <span class=
"Comment">; and they share the virtual processor.
</span>
2376 <span class=
"Comment">;
</span>
2377 <span class=
"Comment">; There's also a 'fork' primitive to let functions create new threads of
</span>
2378 <span class=
"Comment">; execution (we call them routines).
</span>
2379 <span class=
"Comment">;
</span>
2380 <span class=
"Comment">; Eventually we want to allow callers to influence how much of their CPU they
</span>
2381 <span class=
"Comment">; give to their 'children', or to rescind a child's running privileges.
</span>
2383 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2384 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"scheduler
"</span><span class=
"Delimiter">)
</span>
2385 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
2386 <span class=
"Delimiter">(
</span>add-code
2387 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2388 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
2389 <span class=
"Delimiter">])
</span>
2390 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2391 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
2392 <span class=
"Delimiter">])))
</span>
2393 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>f1
<span class=
"Delimiter">'
</span>f2
<span class=
"Delimiter">)
</span>
2394 <span class=
"Delimiter">(
</span>when
<span class=
"Delimiter">(
</span>~iso
<span class=
"Constant">2</span> <span class=
"Global">curr-cycle*
</span><span class=
"Delimiter">)
</span>
2395 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - scheduler didn't run the right number of instructions:
"</span> <span class=
"Global">curr-cycle*
</span><span class=
"Delimiter">))
</span>
2396 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>obj
<span class=
"Constant">1</span> <span class=
"Constant">3</span> <span class=
"Constant">2</span> <span class=
"Constant">4</span><span class=
"Delimiter">))
</span>
2397 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - scheduler runs multiple functions:
"</span> <span class=
"Global">memory*
</span><span class=
"Delimiter">))
</span>
2398 <span class=
"Delimiter">(
</span>check-trace-contents
<span class=
"Constant">"scheduler orders functions correctly
"</span>
2399 <span class=
"Delimiter">'((
</span><span class=
"Constant">"schedule
"</span> <span class=
"Constant">"f1
"</span><span class=
"Delimiter">)
</span>
2400 <span class=
"Delimiter">(
</span><span class=
"Constant">"schedule
"</span> <span class=
"Constant">"f2
"</span><span class=
"Delimiter">)
</span>
2401 <span class=
"Delimiter">))
</span>
2402 <span class=
"Delimiter">(
</span>check-trace-contents
<span class=
"Constant">"scheduler orders schedule and run events correctly
"</span>
2403 <span class=
"Delimiter">'((
</span><span class=
"Constant">"schedule
"</span> <span class=
"Constant">"f1
"</span><span class=
"Delimiter">)
</span>
2404 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f1
0"</span><span class=
"Delimiter">)
</span>
2405 <span class=
"Delimiter">(
</span><span class=
"Constant">"schedule
"</span> <span class=
"Constant">"f2
"</span><span class=
"Delimiter">)
</span>
2406 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f2
0"</span><span class=
"Delimiter">)
</span>
2407 <span class=
"Delimiter">))
</span>
2409 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2410 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"scheduler-alternate
"</span><span class=
"Delimiter">)
</span>
2411 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
2412 <span class=
"Delimiter">(
</span>add-code
2413 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2414 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2415 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2416 <span class=
"Delimiter">])
</span>
2417 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2418 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2419 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2420 <span class=
"Delimiter">])))
</span>
2421 <span class=
"Delimiter">(
</span>=
<span class=
"Global">scheduling-interval*
</span> <span class=
"Constant">1</span><span class=
"Delimiter">)
</span>
2422 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>f1
<span class=
"Delimiter">'
</span>f2
<span class=
"Delimiter">)
</span>
2423 <span class=
"Delimiter">(
</span>check-trace-contents
<span class=
"Constant">"scheduler alternates between routines
"</span>
2424 <span class=
"Delimiter">'((
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f1
0"</span><span class=
"Delimiter">)
</span>
2425 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f2
0"</span><span class=
"Delimiter">)
</span>
2426 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f1
1"</span><span class=
"Delimiter">)
</span>
2427 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f2
1"</span><span class=
"Delimiter">)
</span>
2428 <span class=
"Delimiter">))
</span>
2430 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2431 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"scheduler-sleep
"</span><span class=
"Delimiter">)
</span>
2432 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
2433 <span class=
"Delimiter">(
</span>add-code
2434 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2435 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2436 <span class=
"Delimiter">])
</span>
2437 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2438 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2439 <span class=
"Delimiter">])))
</span>
2440 <span class=
"Comment">; add one baseline routine to run (empty running-routines* handled below)
</span>
2441 <span class=
"Delimiter">(
</span>enq make-routine!f1
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
2442 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>is
<span class=
"Constant">1</span> len.running-routines*
<span class=
"Delimiter">))
</span>
2443 <span class=
"Comment">; sleeping routine
</span>
2444 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!f2
2445 <span class=
"Mu"><span class=
"Delimiter">(
</span>= rep.routine!sleep
<span class=
"Delimiter">'(
</span>for-some-cycles
<span class=
"Constant">23</span><span class=
"Delimiter">))
</span></span>
2446 <span class=
"Delimiter">(
</span>set
<span class=
"Global">sleeping-routines*
</span>.routine
<span class=
"Delimiter">))
</span>
2447 <span class=
"Comment">; not yet time for it to wake up
</span>
2448 <span class=
"Delimiter">(
</span>=
<span class=
"Global">curr-cycle*
</span> <span class=
"Constant">23</span><span class=
"Delimiter">)
</span>
2449 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2450 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "schedule
")))
</span>
2451 <span class=
"Delimiter">(
</span>update-scheduler-state
<span class=
"Delimiter">)
</span>
2452 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> len.running-routines*
<span class=
"Delimiter">)
</span>
2453 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - scheduler lets routines sleep
"</span><span class=
"Delimiter">))
</span>
2455 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2456 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"scheduler-wakeup
"</span><span class=
"Delimiter">)
</span>
2457 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
2458 <span class=
"Delimiter">(
</span>add-code
2459 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2460 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2461 <span class=
"Delimiter">])
</span>
2462 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2463 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2464 <span class=
"Delimiter">])))
</span>
2465 <span class=
"Comment">; add one baseline routine to run (empty running-routines* handled below)
</span>
2466 <span class=
"Delimiter">(
</span>enq make-routine!f1
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
2467 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>is
<span class=
"Constant">1</span> len.running-routines*
<span class=
"Delimiter">))
</span>
2468 <span class=
"Comment">; sleeping routine
</span>
2469 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!f2
2470 <span class=
"Delimiter">(
</span>= rep.routine!sleep
<span class=
"Delimiter">'(
</span>for-some-cycles
<span class=
"Constant">23</span><span class=
"Delimiter">))
</span>
2471 <span class=
"Delimiter">(
</span>set
<span class=
"Global">sleeping-routines*
</span>.routine
<span class=
"Delimiter">))
</span>
2472 <span class=
"Comment">; time for it to wake up
</span>
2473 <span class=
"Delimiter">(
</span>=
<span class=
"Global">curr-cycle*
</span> <span class=
"Constant">24</span><span class=
"Delimiter">)
</span>
2474 <span class=
"Delimiter">(
</span>update-scheduler-state
<span class=
"Delimiter">)
</span>
2475 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">2</span> len.running-routines*
<span class=
"Delimiter">)
</span>
2476 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - scheduler wakes up sleeping routines at the right time
"</span><span class=
"Delimiter">))
</span>
2478 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2479 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"scheduler-sleep-location
"</span><span class=
"Delimiter">)
</span>
2480 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
2481 <span class=
"Delimiter">(
</span>add-code
2482 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2483 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2484 <span class=
"Delimiter">])
</span>
2485 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2486 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2487 <span class=
"Delimiter">])))
</span>
2488 <span class=
"Comment">; add one baseline routine to run (empty running-routines* handled below)
</span>
2489 <span class=
"Delimiter">(
</span>enq make-routine!f1
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
2490 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>is
<span class=
"Constant">1</span> len.running-routines*
<span class=
"Delimiter">))
</span>
2491 <span class=
"Comment">; blocked routine waiting for location
23 to change
</span>
2492 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!f2
2493 <span class=
"Delimiter">(
</span>= rep.routine!sleep
<span class=
"Delimiter">'(
</span>until-location-changes
<span class=
"Constant">23</span> <span class=
"Constant">0</span><span class=
"Delimiter">))
</span>
2494 <span class=
"Delimiter">(
</span>set
<span class=
"Global">sleeping-routines*
</span>.routine
<span class=
"Delimiter">))
</span>
2495 <span class=
"Comment">; leave memory location
23 unchanged
</span>
2496 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.23</span> <span class=
"Constant">0</span><span class=
"Delimiter">)
</span>
2497 <span class=
"CommentedCode">;? (prn memory*)
</span>
2498 <span class=
"CommentedCode">;? (prn running-routines*)
</span>
2499 <span class=
"CommentedCode">;? (prn sleeping-routines*)
</span>
2500 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2501 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "schedule
")))
</span>
2502 <span class=
"Delimiter">(
</span>update-scheduler-state
<span class=
"Delimiter">)
</span>
2503 <span class=
"CommentedCode">;? (prn running-routines*)
</span>
2504 <span class=
"CommentedCode">;? (prn sleeping-routines*)
</span>
2505 <span class=
"Comment">; routine remains blocked
</span>
2506 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> len.running-routines*
<span class=
"Delimiter">)
</span>
2507 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - scheduler lets routines block on locations
"</span><span class=
"Delimiter">))
</span>
2508 <span class=
"CommentedCode">;? (quit)
</span>
2510 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2511 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"scheduler-wakeup-location
"</span><span class=
"Delimiter">)
</span>
2512 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
2513 <span class=
"Delimiter">(
</span>add-code
2514 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2515 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2516 <span class=
"Delimiter">])
</span>
2517 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2518 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2519 <span class=
"Delimiter">])))
</span>
2520 <span class=
"Comment">; add one baseline routine to run (empty running-routines* handled below)
</span>
2521 <span class=
"Delimiter">(
</span>enq make-routine!f1
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
2522 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>is
<span class=
"Constant">1</span> len.running-routines*
<span class=
"Delimiter">))
</span>
2523 <span class=
"Comment">; blocked routine waiting for location
23 to change
</span>
2524 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!f2
2525 <span class=
"Delimiter">(
</span>= rep.routine!sleep
<span class=
"Delimiter">'(
</span>until-location-changes
<span class=
"Constant">23</span> <span class=
"Constant">0</span><span class=
"Delimiter">))
</span>
2526 <span class=
"Delimiter">(
</span>set
<span class=
"Global">sleeping-routines*
</span>.routine
<span class=
"Delimiter">))
</span>
2527 <span class=
"Comment">; change memory location
23</span>
2528 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.23</span> <span class=
"Constant">1</span><span class=
"Delimiter">)
</span>
2529 <span class=
"Delimiter">(
</span>update-scheduler-state
<span class=
"Delimiter">)
</span>
2530 <span class=
"Comment">; routine unblocked
</span>
2531 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">2</span> len.running-routines*
<span class=
"Delimiter">)
</span>
2532 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - scheduler unblocks routines blocked on locations
"</span><span class=
"Delimiter">))
</span>
2534 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2535 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"scheduler-skip
"</span><span class=
"Delimiter">)
</span>
2536 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
2537 <span class=
"Delimiter">(
</span>add-code
2538 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2539 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2540 <span class=
"Delimiter">])))
</span>
2541 <span class=
"Comment">; running-routines* is empty
</span>
2542 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>empty
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">))
</span>
2543 <span class=
"Comment">; sleeping routine
</span>
2544 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!f1
2545 <span class=
"Delimiter">(
</span>= rep.routine!sleep
<span class=
"Delimiter">'(
</span>for-some-cycles
<span class=
"Constant">34</span><span class=
"Delimiter">))
</span>
2546 <span class=
"Delimiter">(
</span>set
<span class=
"Global">sleeping-routines*
</span>.routine
<span class=
"Delimiter">))
</span>
2547 <span class=
"Comment">; long time left for it to wake up
</span>
2548 <span class=
"Delimiter">(
</span>=
<span class=
"Global">curr-cycle*
</span> <span class=
"Constant">0</span><span class=
"Delimiter">)
</span>
2549 <span class=
"Delimiter">(
</span>update-scheduler-state
<span class=
"Delimiter">)
</span>
2550 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>is
<span class=
"Global">curr-cycle*
</span> <span class=
"Constant">35</span><span class=
"Delimiter">))
</span>
2551 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> len.running-routines*
<span class=
"Delimiter">)
</span>
2552 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - scheduler skips ahead to earliest sleeping routines when nothing to run
"</span><span class=
"Delimiter">))
</span>
2554 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2555 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"scheduler-deadlock
"</span><span class=
"Delimiter">)
</span>
2556 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
2557 <span class=
"Delimiter">(
</span>add-code
2558 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2559 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2560 <span class=
"Delimiter">])))
</span>
2561 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>empty
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">))
</span>
2562 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>empty
<span class=
"Global">completed-routines*
</span><span class=
"Delimiter">))
</span>
2563 <span class=
"Comment">; blocked routine
</span>
2564 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!f1
2565 <span class=
"Delimiter">(
</span>= rep.routine!sleep
<span class=
"Delimiter">'(
</span>until-location-changes
<span class=
"Constant">23</span> <span class=
"Constant">0</span><span class=
"Delimiter">))
</span>
2566 <span class=
"Delimiter">(
</span>set
<span class=
"Global">sleeping-routines*
</span>.routine
<span class=
"Delimiter">))
</span>
2567 <span class=
"Comment">; location it's waiting on is 'unchanged'
</span>
2568 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.23</span> <span class=
"Constant">0</span><span class=
"Delimiter">)
</span>
2569 <span class=
"Delimiter">(
</span>update-scheduler-state
<span class=
"Delimiter">)
</span>
2570 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>~empty
<span class=
"Global">completed-routines*
</span><span class=
"Delimiter">))
</span>
2571 <span class=
"CommentedCode">;? (prn completed-routines*)
</span>
2572 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine
<span class=
"Global">completed-routines*
</span><span class=
"Constant">.0</span>
2573 <span class=
"Delimiter">(
</span>when
<span class=
"Delimiter">(
</span>~posmatch
<span class=
"Constant">"deadlock
"</span> rep.routine!error
<span class=
"Delimiter">)
</span>
2574 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - scheduler detects deadlock
"</span><span class=
"Delimiter">)))
</span>
2575 <span class=
"CommentedCode">;? (quit)
</span>
2577 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2578 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"scheduler-deadlock2
"</span><span class=
"Delimiter">)
</span>
2579 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
2580 <span class=
"Delimiter">(
</span>add-code
2581 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2582 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2583 <span class=
"Delimiter">])))
</span>
2584 <span class=
"Comment">; running-routines* is empty
</span>
2585 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>empty
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">))
</span>
2586 <span class=
"Comment">; blocked routine
</span>
2587 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!f1
2588 <span class=
"Delimiter">(
</span>= rep.routine!sleep
<span class=
"Delimiter">'(
</span>until-location-changes
<span class=
"Constant">23</span> <span class=
"Constant">0</span><span class=
"Delimiter">))
</span>
2589 <span class=
"Delimiter">(
</span>set
<span class=
"Global">sleeping-routines*
</span>.routine
<span class=
"Delimiter">))
</span>
2590 <span class=
"Comment">; but is about to become ready
</span>
2591 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.23</span> <span class=
"Constant">1</span><span class=
"Delimiter">)
</span>
2592 <span class=
"Delimiter">(
</span>update-scheduler-state
<span class=
"Delimiter">)
</span>
2593 <span class=
"Delimiter">(
</span>when
<span class=
"Delimiter">(
</span>~empty
<span class=
"Global">completed-routines*
</span><span class=
"Delimiter">)
</span>
2594 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - scheduler ignores sleeping but ready threads when detecting deadlock
"</span><span class=
"Delimiter">))
</span>
2596 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2597 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"sleep
"</span><span class=
"Delimiter">)
</span>
2598 <span class=
"Delimiter">(
</span>add-code
2599 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2600 <span class=
"Mu"><span class=
"Delimiter">(
</span>sleep for-some-cycles:literal
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
2601 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2602 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2603 <span class=
"Delimiter">])
</span>
2604 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2605 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2606 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2607 <span class=
"Delimiter">])))
</span>
2608 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "schedule
")))
</span>
2609 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>f1
<span class=
"Delimiter">'
</span>f2
<span class=
"Delimiter">)
</span>
2610 <span class=
"Delimiter">(
</span>check-trace-contents
<span class=
"Constant">"scheduler handles sleeping routines
"</span>
2611 <span class=
"Delimiter">'((
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f1
0"</span><span class=
"Delimiter">)
</span>
2612 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"sleeping until
2"</span><span class=
"Delimiter">)
</span>
2613 <span class=
"Delimiter">(
</span><span class=
"Constant">"schedule
"</span> <span class=
"Constant">"pushing f1 to sleep queue
"</span><span class=
"Delimiter">)
</span>
2614 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f2
0"</span><span class=
"Delimiter">)
</span>
2615 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f2
1"</span><span class=
"Delimiter">)
</span>
2616 <span class=
"Delimiter">(
</span><span class=
"Constant">"schedule
"</span> <span class=
"Constant">"waking up f1
"</span><span class=
"Delimiter">)
</span>
2617 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f1
1"</span><span class=
"Delimiter">)
</span>
2618 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f1
2"</span><span class=
"Delimiter">)
</span>
2619 <span class=
"Delimiter">))
</span>
2621 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2622 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"sleep-long
"</span><span class=
"Delimiter">)
</span>
2623 <span class=
"Delimiter">(
</span>add-code
2624 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2625 <span class=
"Mu"><span class=
"Delimiter">(
</span>sleep for-some-cycles:literal
<span class=
"MuConstant">20</span>:literal
<span class=
"Delimiter">)
</span></span>
2626 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2627 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2628 <span class=
"Delimiter">])
</span>
2629 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2630 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2631 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2632 <span class=
"Delimiter">])))
</span>
2633 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "schedule
")))
</span>
2634 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>f1
<span class=
"Delimiter">'
</span>f2
<span class=
"Delimiter">)
</span>
2635 <span class=
"Delimiter">(
</span>check-trace-contents
<span class=
"Constant">"scheduler progresses sleeping routines when there are no routines left to run
"</span>
2636 <span class=
"Delimiter">'((
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f1
0"</span><span class=
"Delimiter">)
</span>
2637 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"sleeping until
21"</span><span class=
"Delimiter">)
</span>
2638 <span class=
"Delimiter">(
</span><span class=
"Constant">"schedule
"</span> <span class=
"Constant">"pushing f1 to sleep queue
"</span><span class=
"Delimiter">)
</span>
2639 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f2
0"</span><span class=
"Delimiter">)
</span>
2640 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f2
1"</span><span class=
"Delimiter">)
</span>
2641 <span class=
"Delimiter">(
</span><span class=
"Constant">"schedule
"</span> <span class=
"Constant">"waking up f1
"</span><span class=
"Delimiter">)
</span>
2642 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f1
1"</span><span class=
"Delimiter">)
</span>
2643 <span class=
"Delimiter">(
</span><span class=
"Constant">"run
"</span> <span class=
"Constant">"f1
2"</span><span class=
"Delimiter">)
</span>
2644 <span class=
"Delimiter">))
</span>
2646 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2647 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"sleep-location
"</span><span class=
"Delimiter">)
</span>
2648 <span class=
"Delimiter">(
</span>add-code
2649 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2650 <span class=
"Comment">; waits for memory location
1 to be set, before computing its successor
</span>
2651 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
2652 <span class=
"Mu"><span class=
"Delimiter">(
</span>sleep until-location-changes:literal
<span class=
"Constant">1</span>:integer
<span class=
"Delimiter">)
</span></span>
2653 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">1</span>:integer
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
2654 <span class=
"Delimiter">])
</span>
2655 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2656 <span class=
"Mu"><span class=
"Delimiter">(
</span>sleep for-some-cycles:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
2657 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; set to value
</span></span>
2658 <span class=
"Delimiter">])))
</span>
2659 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "schedule
")))
</span>
2660 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2661 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>f1
<span class=
"Delimiter">'
</span>f2
<span class=
"Delimiter">)
</span>
2662 <span class=
"CommentedCode">;? (prn int-canon.memory*)
</span>
2663 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
2664 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
2665 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; successor of value
</span>
2666 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - sleep can block on a memory location
"</span><span class=
"Delimiter">))
</span>
2667 <span class=
"CommentedCode">;? (quit)
</span>
2669 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2670 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"sleep-scoped-location
"</span><span class=
"Delimiter">)
</span>
2671 <span class=
"Delimiter">(
</span>add-code
2672 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2673 <span class=
"Comment">; waits for memory location
1 to be changed, before computing its successor
</span>
2674 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">10</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; array of locals
</span></span>
2675 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">10</span>:literal
<span class=
"Delimiter">)
</span></span>
2676 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; really location
12</span></span>
2677 <span class=
"Mu"><span class=
"Delimiter">(
</span>sleep until-location-changes:literal
<span class=
"Constant">1</span>:integer
<span class=
"Delimiter">)
</span></span>
2678 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> add
<span class=
"Constant">1</span>:integer
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
2679 <span class=
"Delimiter">])
</span>
2680 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2681 <span class=
"Mu"><span class=
"Delimiter">(
</span>sleep for-some-cycles:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
2682 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">12</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; set to value
</span></span>
2683 <span class=
"Delimiter">])))
</span>
2684 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "schedule
")))
</span>
2685 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>f1
<span class=
"Delimiter">'
</span>f2
<span class=
"Delimiter">)
</span>
2686 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.13</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; successor of value
</span>
2687 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - sleep can block on a scoped memory location
"</span><span class=
"Delimiter">))
</span>
2688 <span class=
"CommentedCode">;? (quit)
</span>
2690 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2691 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"fork
"</span><span class=
"Delimiter">)
</span>
2692 <span class=
"Delimiter">(
</span>add-code
2693 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2694 <span class=
"Mu"><span class=
"Delimiter">(
</span>fork f2:fn
<span class=
"Delimiter">)
</span></span>
2695 <span class=
"Delimiter">])
</span>
2696 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2697 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
2698 <span class=
"Delimiter">])))
</span>
2699 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>f1
<span class=
"Delimiter">)
</span>
2700 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
2701 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - fork works
"</span><span class=
"Delimiter">))
</span>
2703 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2704 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"fork-with-args
"</span><span class=
"Delimiter">)
</span>
2705 <span class=
"Delimiter">(
</span>add-code
2706 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2707 <span class=
"Mu"><span class=
"Delimiter">(
</span>fork f2:fn
<span class=
"MuConstant">nil
</span>:literal
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
2708 <span class=
"Delimiter">])
</span>
2709 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2710 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2711 <span class=
"Delimiter">])))
</span>
2712 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>f1
<span class=
"Delimiter">)
</span>
2713 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
2714 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - fork can pass args
"</span><span class=
"Delimiter">))
</span>
2716 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2717 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"fork-copies-args
"</span><span class=
"Delimiter">)
</span>
2718 <span class=
"Delimiter">(
</span>add-code
2719 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2720 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)
</span></span>
2721 <span class=
"Mu"><span class=
"Delimiter">(
</span>x:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
2722 <span class=
"Mu"><span class=
"Delimiter">(
</span>fork f2:fn
<span class=
"MuConstant">nil
</span>:literal x:integer
<span class=
"Delimiter">)
</span></span>
2723 <span class=
"Mu"><span class=
"Delimiter">(
</span>x:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; should be ignored
</span></span>
2724 <span class=
"Delimiter">])
</span>
2725 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f2
<span class=
"Delimiter">[
</span></span>
2726 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
2727 <span class=
"Delimiter">])))
</span>
2728 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>f1
<span class=
"Delimiter">)
</span>
2729 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
2730 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - fork passes args by value
"</span><span class=
"Delimiter">))
</span>
2732 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2733 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"fork-global
"</span><span class=
"Delimiter">)
</span>
2734 <span class=
"Delimiter">(
</span>add-code
2735 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
2736 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer/raw
<span class=
"Op"><-
</span> copy
<span class=
"Constant">2</span>:integer/space:global
<span class=
"Delimiter">)
</span></span>
2737 <span class=
"Delimiter">])
</span>
2738 <span class=
"Mu"><span class=
"Delimiter">(
</span>function main
<span class=
"Delimiter">[
</span></span>
2739 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)
</span></span>
2740 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
2741 <span class=
"Mu"><span class=
"Delimiter">(
</span>fork f1:fn default-space:space-address
<span class=
"Delimiter">)
</span></span>
2742 <span class=
"Delimiter">])))
</span>
2743 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2744 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
2745 <span class=
"Delimiter">(
</span>awhen rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
2746 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">memory*
</span><span class=
"Constant">.1</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
2747 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - fork can take a space of global variables to access
"</span><span class=
"Delimiter">))
</span>
2749 <span class=
"Comment">; The scheduler needs to keep track of the call stack for each routine.
</span>
2750 <span class=
"Comment">; Eventually we'll want to save this information in mu's address space itself,
</span>
2751 <span class=
"Comment">; along with the types array, the magic buffers for args and oargs, and so on.
</span>
2752 <span class=
"Comment">;
</span>
2753 <span class=
"Comment">; Eventually we want the right stack-management primitives to build delimited
</span>
2754 <span class=
"Comment">; continuations in mu.
</span>
2756 <span class=
"Comment">; Routines can throw errors.
</span>
2757 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2758 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"array-bounds-check
"</span><span class=
"Delimiter">)
</span>
2759 <span class=
"Delimiter">(
</span>add-code
2760 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2761 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
2762 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">23</span>:literal
<span class=
"Delimiter">)
</span></span>
2763 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
2764 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> index
<span class=
"Constant">1</span>:integer-array
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
2765 <span class=
"Delimiter">])))
</span>
2766 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2767 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2768 <span class=
"CommentedCode">;? (prn memory*)
</span>
2769 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine
<span class=
"Delimiter">(
</span>car
<span class=
"Global">completed-routines*
</span><span class=
"Delimiter">)
</span>
2770 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>no rep.routine!error
<span class=
"Delimiter">)
</span>
2771 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'index' throws an error if out of bounds
"</span><span class=
"Delimiter">)))
</span>
2773 <span class=
"Delimiter">)
</span> <span class=
"Comment">; section
20</span>
2775 <span class=
"Delimiter">(
</span>section
<span class=
"Constant">100</span>
2777 <span class=
"SalientComment">;; Synchronization
</span>
2778 <span class=
"Comment">;
</span>
2779 <span class=
"Comment">; Mu synchronizes using channels rather than locks, like Erlang and Go.
</span>
2780 <span class=
"Comment">;
</span>
2781 <span class=
"Comment">; The two ends of a channel will usually belong to different routines, but
</span>
2782 <span class=
"Comment">; each end should only be used by a single one. Don't try to read from or
</span>
2783 <span class=
"Comment">; write to it from multiple routines at once.
</span>
2784 <span class=
"Comment">;
</span>
2785 <span class=
"Comment">; To avoid locking, writer and reader will never write to the same location.
</span>
2786 <span class=
"Comment">; So channels will include fields in pairs, one for the writer and one for the
</span>
2787 <span class=
"Comment">; reader.
</span>
2789 <span class=
"Comment">; The core circular buffer contains values at index 'first-full' up to (but
</span>
2790 <span class=
"Comment">; not including) index 'first-empty'. The reader always modifies it at
</span>
2791 <span class=
"Comment">; first-full, while the writer always modifies it at first-empty.
</span>
2792 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2793 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-new
"</span><span class=
"Delimiter">)
</span>
2794 <span class=
"Delimiter">(
</span>add-code
2795 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2796 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
2797 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:channel-address/deref first-full:offset
<span class=
"Delimiter">)
</span></span>
2798 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:channel-address/deref first-free:offset
<span class=
"Delimiter">)
</span></span>
2799 <span class=
"Delimiter">])))
</span>
2800 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2801 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2802 <span class=
"CommentedCode">;? (prn memory*)
</span>
2803 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">0</span> <span class=
"Global">memory*
</span><span class=
"Constant">.2</span><span class=
"Delimiter">)
</span>
2804 <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">0</span> <span class=
"Global">memory*
</span><span class=
"Constant">.3</span><span class=
"Delimiter">))
</span>
2805 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'init-channel' initializes 'first-full and 'first-free to
0"</span><span class=
"Delimiter">))
</span>
2807 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2808 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-write
"</span><span class=
"Delimiter">)
</span>
2809 <span class=
"Delimiter">(
</span>add-code
2810 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2811 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
2812 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
2813 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:tagged-value
<span class=
"Op"><-
</span> save-type
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
2814 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
2815 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:channel-address/deref first-full:offset
<span class=
"Delimiter">)
</span></span>
2816 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:channel-address/deref first-free:offset
<span class=
"Delimiter">)
</span></span>
2817 <span class=
"Delimiter">])))
</span>
2818 <span class=
"CommentedCode">;? (prn function*!write)
</span>
2819 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2820 <span class=
"CommentedCode">;? (= dump-trace* (obj blacklist '(
"sz
" "m
" "setm
" "addr
" "array-len
" "cvt0
" "cvt1
")))
</span>
2821 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"jump
")))
</span>
2822 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "reply
")))
</span>
2823 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2824 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
2825 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
2826 <span class=
"CommentedCode">;? (prn canon.memory*)
</span>
2827 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">0</span> <span class=
"Global">memory*
</span><span class=
"Constant">.5</span><span class=
"Delimiter">)
</span>
2828 <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> <span class=
"Global">memory*
</span><span class=
"Constant">.6</span><span class=
"Delimiter">))
</span>
2829 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'write' enqueues item to channel
"</span><span class=
"Delimiter">))
</span>
2830 <span class=
"CommentedCode">;? (quit)
</span>
2832 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2833 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-read
"</span><span class=
"Delimiter">)
</span>
2834 <span class=
"Delimiter">(
</span>add-code
2835 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2836 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
2837 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
2838 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:tagged-value
<span class=
"Op"><-
</span> save-type
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
2839 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
2840 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:tagged-value
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> read
<span class=
"Constant">1</span>:channel-address
<span class=
"Delimiter">)
</span></span>
2841 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> maybe-coerce
<span class=
"Constant">5</span>:tagged-value integer:literal
<span class=
"Delimiter">)
</span></span>
2842 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:channel-address/deref first-full:offset
<span class=
"Delimiter">)
</span></span>
2843 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">9</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:channel-address/deref first-free:offset
<span class=
"Delimiter">)
</span></span>
2844 <span class=
"Delimiter">])))
</span>
2845 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2846 <span class=
"CommentedCode">;? (= dump-trace* (obj blacklist '(
"sz
" "m
" "setm
" "addr
" "array-len
" "cvt0
" "cvt1
")))
</span>
2847 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2848 <span class=
"CommentedCode">;? (prn int-canon.memory*)
</span>
2849 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.7</span> <span class=
"Constant">34</span><span class=
"Delimiter">)
</span>
2850 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'read' returns written value
"</span><span class=
"Delimiter">))
</span>
2851 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> <span class=
"Global">memory*
</span><span class=
"Constant">.8</span><span class=
"Delimiter">)
</span>
2852 <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> <span class=
"Global">memory*
</span><span class=
"Constant">.9</span><span class=
"Delimiter">))
</span>
2853 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'read' dequeues item from channel
"</span><span class=
"Delimiter">))
</span>
2855 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2856 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-write-wrap
"</span><span class=
"Delimiter">)
</span>
2857 <span class=
"Delimiter">(
</span>add-code
2858 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2859 <span class=
"Comment">; channel with
1 slot
</span>
2860 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
2861 <span class=
"Comment">; write a value
</span>
2862 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
2863 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:tagged-value
<span class=
"Op"><-
</span> save-type
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
2864 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
2865 <span class=
"Comment">; first-free will now be
1</span>
2866 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:channel-address/deref first-free:offset
<span class=
"Delimiter">)
</span></span>
2867 <span class=
"Comment">; read one value
</span>
2868 <span class=
"Mu"><span class=
"Delimiter">(
</span>_
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> read
<span class=
"Constant">1</span>:channel-address
<span class=
"Delimiter">)
</span></span>
2869 <span class=
"Comment">; write a second value; verify that first-free wraps around to
0.
</span>
2870 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
2871 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:channel-address/deref first-free:offset
<span class=
"Delimiter">)
</span></span>
2872 <span class=
"Delimiter">])))
</span>
2873 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2874 <span class=
"CommentedCode">;? (= dump-trace* (obj blacklist '(
"sz
" "m
" "setm
" "addr
" "array-len
" "cvt0
" "cvt1
")))
</span>
2875 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2876 <span class=
"CommentedCode">;? (prn canon.memory*)
</span>
2877 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> <span class=
"Global">memory*
</span><span class=
"Constant">.5</span><span class=
"Delimiter">)
</span>
2878 <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">0</span> <span class=
"Global">memory*
</span><span class=
"Constant">.6</span><span class=
"Delimiter">))
</span>
2879 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'write' can wrap pointer back to start
"</span><span class=
"Delimiter">))
</span>
2881 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2882 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-read-wrap
"</span><span class=
"Delimiter">)
</span>
2883 <span class=
"Delimiter">(
</span>add-code
2884 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2885 <span class=
"Comment">; channel with
1 slot
</span>
2886 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
2887 <span class=
"Comment">; write a value
</span>
2888 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
2889 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:tagged-value
<span class=
"Op"><-
</span> save-type
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
2890 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
2891 <span class=
"Comment">; read one value
</span>
2892 <span class=
"Mu"><span class=
"Delimiter">(
</span>_
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> read
<span class=
"Constant">1</span>:channel-address
<span class=
"Delimiter">)
</span></span>
2893 <span class=
"Comment">; first-full will now be
1</span>
2894 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:channel-address/deref first-full:offset
<span class=
"Delimiter">)
</span></span>
2895 <span class=
"Comment">; write a second value
</span>
2896 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
2897 <span class=
"Comment">; read second value; verify that first-full wraps around to
0.
</span>
2898 <span class=
"Mu"><span class=
"Delimiter">(
</span>_
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> read
<span class=
"Constant">1</span>:channel-address
<span class=
"Delimiter">)
</span></span>
2899 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> get
<span class=
"Constant">1</span>:channel-address/deref first-full:offset
<span class=
"Delimiter">)
</span></span>
2900 <span class=
"Delimiter">])))
</span>
2901 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2902 <span class=
"CommentedCode">;? (= dump-trace* (obj blacklist '(
"sz
" "m
" "setm
" "addr
" "array-len
" "cvt0
" "cvt1
")))
</span>
2903 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2904 <span class=
"CommentedCode">;? (prn canon.memory*)
</span>
2905 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> <span class=
"Global">memory*
</span><span class=
"Constant">.5</span><span class=
"Delimiter">)
</span>
2906 <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">0</span> <span class=
"Global">memory*
</span><span class=
"Constant">.6</span><span class=
"Delimiter">))
</span>
2907 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'read' can wrap pointer back to start
"</span><span class=
"Delimiter">))
</span>
2909 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2910 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-new-empty-not-full
"</span><span class=
"Delimiter">)
</span>
2911 <span class=
"Delimiter">(
</span>add-code
2912 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2913 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
2914 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:boolean
<span class=
"Op"><-
</span> empty?
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Delimiter">)
</span></span>
2915 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:boolean
<span class=
"Op"><-
</span> full?
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Delimiter">)
</span></span>
2916 <span class=
"Delimiter">])))
</span>
2917 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2918 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2919 <span class=
"CommentedCode">;? (prn memory*)
</span>
2920 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is t
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span><span class=
"Delimiter">)
</span>
2921 <span class=
"Delimiter">(
</span>~is nil
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span><span class=
"Delimiter">))
</span>
2922 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - a new channel is always empty, never full
"</span><span class=
"Delimiter">))
</span>
2924 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2925 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-write-not-empty
"</span><span class=
"Delimiter">)
</span>
2926 <span class=
"Delimiter">(
</span>add-code
2927 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2928 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
2929 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
2930 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:tagged-value
<span class=
"Op"><-
</span> save-type
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
2931 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
2932 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> empty?
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Delimiter">)
</span></span>
2933 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:boolean
<span class=
"Op"><-
</span> full?
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Delimiter">)
</span></span>
2934 <span class=
"Delimiter">])))
</span>
2935 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2936 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2937 <span class=
"CommentedCode">;? (prn memory*)
</span>
2938 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is nil
<span class=
"Global">memory*
</span><span class=
"Constant">.5</span><span class=
"Delimiter">)
</span>
2939 <span class=
"Delimiter">(
</span>~is nil
<span class=
"Global">memory*
</span><span class=
"Constant">.6</span><span class=
"Delimiter">))
</span>
2940 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - a channel after writing is never empty
"</span><span class=
"Delimiter">))
</span>
2942 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2943 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-write-full
"</span><span class=
"Delimiter">)
</span>
2944 <span class=
"Delimiter">(
</span>add-code
2945 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2946 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
2947 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
2948 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:tagged-value
<span class=
"Op"><-
</span> save-type
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
2949 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
2950 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> empty?
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Delimiter">)
</span></span>
2951 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:boolean
<span class=
"Op"><-
</span> full?
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Delimiter">)
</span></span>
2952 <span class=
"Delimiter">])))
</span>
2953 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2954 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2955 <span class=
"CommentedCode">;? (prn memory*)
</span>
2956 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is nil
<span class=
"Global">memory*
</span><span class=
"Constant">.5</span><span class=
"Delimiter">)
</span>
2957 <span class=
"Delimiter">(
</span>~is t
<span class=
"Global">memory*
</span><span class=
"Constant">.6</span><span class=
"Delimiter">))
</span>
2958 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - a channel after writing may be full
"</span><span class=
"Delimiter">))
</span>
2960 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2961 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-read-not-full
"</span><span class=
"Delimiter">)
</span>
2962 <span class=
"Delimiter">(
</span>add-code
2963 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2964 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
2965 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
2966 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:tagged-value
<span class=
"Op"><-
</span> save-type
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
2967 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
2968 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
2969 <span class=
"Mu"><span class=
"Delimiter">(
</span>_
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> read
<span class=
"Constant">1</span>:channel-address
<span class=
"Delimiter">)
</span></span>
2970 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> empty?
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Delimiter">)
</span></span>
2971 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:boolean
<span class=
"Op"><-
</span> full?
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Delimiter">)
</span></span>
2972 <span class=
"Delimiter">])))
</span>
2973 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2974 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2975 <span class=
"CommentedCode">;? (prn memory*)
</span>
2976 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is nil
<span class=
"Global">memory*
</span><span class=
"Constant">.5</span><span class=
"Delimiter">)
</span>
2977 <span class=
"Delimiter">(
</span>~is nil
<span class=
"Global">memory*
</span><span class=
"Constant">.6</span><span class=
"Delimiter">))
</span>
2978 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - a channel after reading is never full
"</span><span class=
"Delimiter">))
</span>
2980 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
2981 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-read-empty
"</span><span class=
"Delimiter">)
</span>
2982 <span class=
"Delimiter">(
</span>add-code
2983 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
2984 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
2985 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
2986 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:tagged-value
<span class=
"Op"><-
</span> save-type
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
2987 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
2988 <span class=
"Mu"><span class=
"Delimiter">(
</span>_
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> read
<span class=
"Constant">1</span>:channel-address
<span class=
"Delimiter">)
</span></span>
2989 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:boolean
<span class=
"Op"><-
</span> empty?
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Delimiter">)
</span></span>
2990 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:boolean
<span class=
"Op"><-
</span> full?
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Delimiter">)
</span></span>
2991 <span class=
"Delimiter">])))
</span>
2992 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
2993 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
2994 <span class=
"CommentedCode">;? (prn memory*)
</span>
2995 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is t
<span class=
"Global">memory*
</span><span class=
"Constant">.5</span><span class=
"Delimiter">)
</span>
2996 <span class=
"Delimiter">(
</span>~is nil
<span class=
"Global">memory*
</span><span class=
"Constant">.6</span><span class=
"Delimiter">))
</span>
2997 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - a channel after reading may be empty
"</span><span class=
"Delimiter">))
</span>
2999 <span class=
"Comment">; The key property of channels; writing to a full channel blocks the current
</span>
3000 <span class=
"Comment">; routine until it creates space. Ditto reading from an empty channel.
</span>
3002 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3003 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-read-block
"</span><span class=
"Delimiter">)
</span>
3004 <span class=
"Delimiter">(
</span>add-code
3005 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3006 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
3007 <span class=
"Comment">; channel is empty, but receives a read
</span>
3008 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:tagged-value
<span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> read
<span class=
"Constant">1</span>:channel-address
<span class=
"Delimiter">)
</span></span>
3009 <span class=
"Delimiter">])))
</span>
3010 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
3011 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "schedule
")))
</span>
3012 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3013 <span class=
"CommentedCode">;? (prn int-canon.memory*)
</span>
3014 <span class=
"CommentedCode">;? (prn sleeping-routines*)
</span>
3015 <span class=
"CommentedCode">;? (prn completed-routines*)
</span>
3016 <span class=
"Comment">; read should cause the routine to sleep, and
</span>
3017 <span class=
"Comment">; the sole sleeping routine should trigger the deadlock detector
</span>
3018 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine
<span class=
"Delimiter">(
</span>car
<span class=
"Global">completed-routines*
</span><span class=
"Delimiter">)
</span>
3019 <span class=
"Delimiter">(
</span>when
<span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>no routine
<span class=
"Delimiter">)
</span>
3020 <span class=
"Delimiter">(
</span>no rep.routine!error
<span class=
"Delimiter">)
</span>
3021 <span class=
"Delimiter">(
</span>~posmatch
<span class=
"Constant">"deadlock
"</span> rep.routine!error
<span class=
"Delimiter">))
</span>
3022 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'read' on empty channel blocks (puts the routine to sleep until the channel gets data)
"</span><span class=
"Delimiter">)))
</span>
3023 <span class=
"CommentedCode">;? (quit)
</span>
3025 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3026 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-write-block
"</span><span class=
"Delimiter">)
</span>
3027 <span class=
"Delimiter">(
</span>add-code
3028 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3029 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">1</span>:literal
<span class=
"Delimiter">)
</span></span>
3030 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">34</span>:literal
<span class=
"Delimiter">)
</span></span>
3031 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:tagged-value
<span class=
"Op"><-
</span> save-type
<span class=
"Constant">2</span>:integer
<span class=
"Delimiter">)
</span></span>
3032 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
3033 <span class=
"Comment">; channel has capacity
1, but receives a second write
</span>
3034 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address
<span class=
"Constant">3</span>:tagged-value
<span class=
"Delimiter">)
</span></span>
3035 <span class=
"Delimiter">])))
</span>
3036 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
3037 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "schedule
" "addr
")))
</span>
3038 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3039 <span class=
"CommentedCode">;? (prn int-canon.memory*)
</span>
3040 <span class=
"CommentedCode">;? (prn running-routines*)
</span>
3041 <span class=
"CommentedCode">;? (prn sleeping-routines*)
</span>
3042 <span class=
"CommentedCode">;? (prn completed-routines*)
</span>
3043 <span class=
"Comment">; second write should cause the routine to sleep, and
</span>
3044 <span class=
"Comment">; the sole sleeping routine should trigger the deadlock detector
</span>
3045 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine
<span class=
"Delimiter">(
</span>car
<span class=
"Global">completed-routines*
</span><span class=
"Delimiter">)
</span>
3046 <span class=
"Delimiter">(
</span>when
<span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>no routine
<span class=
"Delimiter">)
</span>
3047 <span class=
"Delimiter">(
</span>no rep.routine!error
<span class=
"Delimiter">)
</span>
3048 <span class=
"Delimiter">(
</span>~posmatch
<span class=
"Constant">"deadlock
"</span> rep.routine!error
<span class=
"Delimiter">))
</span>
3049 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'write' on full channel blocks (puts the routine to sleep until the channel gets data)
"</span><span class=
"Delimiter">)))
</span>
3050 <span class=
"CommentedCode">;? (quit)
</span>
3052 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3053 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-handoff
"</span><span class=
"Delimiter">)
</span>
3054 <span class=
"Delimiter">(
</span>add-code
3055 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function consumer
<span class=
"Delimiter">[
</span></span>
3056 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
3057 <span class=
"Mu"><span class=
"Delimiter">(
</span>chan:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; create a channel
</span></span>
3058 <span class=
"Mu"><span class=
"Delimiter">(
</span>fork producer:fn
<span class=
"MuConstant">nil
</span>:literal chan:channel-address
<span class=
"Delimiter">)
</span> <span class=
"Comment">; fork a routine to produce a value in it
</span></span>
3059 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:tagged-value/raw
<span class=
"Op"><-
</span> read chan:channel-address
<span class=
"Delimiter">)
</span> <span class=
"Comment">; wait for input on channel
</span></span>
3060 <span class=
"Delimiter">])
</span>
3061 <span class=
"Mu"><span class=
"Delimiter">(
</span>function producer
<span class=
"Delimiter">[
</span></span>
3062 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
3063 <span class=
"Mu"><span class=
"Delimiter">(
</span>n:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
3064 <span class=
"Mu"><span class=
"Delimiter">(
</span>ochan:channel-address
<span class=
"Op"><-
</span> <span class=
"Identifier">next-input
</span><span class=
"Delimiter">)
</span></span>
3065 <span class=
"Mu"><span class=
"Delimiter">(
</span>x:tagged-value
<span class=
"Op"><-
</span> save-type n:integer
<span class=
"Delimiter">)
</span></span>
3066 <span class=
"Mu"><span class=
"Delimiter">(
</span>ochan:channel-address/deref
<span class=
"Op"><-
</span> write ochan:channel-address x:tagged-value
<span class=
"Delimiter">)
</span></span>
3067 <span class=
"Delimiter">])))
</span>
3068 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
3069 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"schedule
" "run
" "addr
")))
</span>
3070 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"-
")))
</span>
3071 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>consumer
<span class=
"Delimiter">)
</span>
3072 <span class=
"CommentedCode">;? (prn memory*)
</span>
3073 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
3074 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
3075 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">24</span> <span class=
"Global">memory*
</span><span class=
"Constant">.2</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; location
1 contains tagged-value x above
</span>
3076 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - channels are meant to be shared between routines
"</span><span class=
"Delimiter">))
</span>
3077 <span class=
"CommentedCode">;? (quit)
</span>
3079 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3080 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"channel-handoff-routine
"</span><span class=
"Delimiter">)
</span>
3081 <span class=
"Delimiter">(
</span>add-code
3082 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function consumer
<span class=
"Delimiter">[
</span></span>
3083 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
3084 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address
<span class=
"Op"><-
</span> init-channel
<span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span> <span class=
"Comment">; create a channel
</span></span>
3085 <span class=
"Mu"><span class=
"Delimiter">(
</span>fork producer:fn default-space:space-address
<span class=
"Delimiter">)
</span> <span class=
"Comment">; pass it as a global to another routine
</span></span>
3086 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:tagged-value/raw
<span class=
"Op"><-
</span> read
<span class=
"Constant">1</span>:channel-address
<span class=
"Delimiter">)
</span> <span class=
"Comment">; wait for input on channel
</span></span>
3087 <span class=
"Delimiter">])
</span>
3088 <span class=
"Mu"><span class=
"Delimiter">(
</span>function producer
<span class=
"Delimiter">[
</span></span>
3089 <span class=
"Mu"><span class=
"Delimiter">(
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
3090 <span class=
"Mu"><span class=
"Delimiter">(
</span>n:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">24</span>:literal
<span class=
"Delimiter">)
</span></span>
3091 <span class=
"Mu"><span class=
"Delimiter">(
</span>x:tagged-value
<span class=
"Op"><-
</span> save-type n:integer
<span class=
"Delimiter">)
</span></span>
3092 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:channel-address/space:global/deref
<span class=
"Op"><-
</span> write
<span class=
"Constant">1</span>:channel-address/space:global x:tagged-value
<span class=
"Delimiter">)
</span></span>
3093 <span class=
"Delimiter">])))
</span>
3094 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>consumer
<span class=
"Delimiter">)
</span>
3095 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
3096 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
3097 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">24</span> <span class=
"Global">memory*
</span><span class=
"Constant">.2</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; location
1 contains tagged-value x above
</span>
3098 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - channels are meant to be shared between routines
"</span><span class=
"Delimiter">))
</span>
3100 <span class=
"Delimiter">)
</span> <span class=
"Comment">; section
100</span>
3102 <span class=
"Delimiter">(
</span>section
<span class=
"Constant">10</span>
3104 <span class=
"SalientComment">;; Separating concerns
</span>
3105 <span class=
"Comment">;
</span>
3106 <span class=
"Comment">; Lightweight tools can also operate on quoted lists of statements surrounded
</span>
3107 <span class=
"Comment">; by square brackets. In the example below, we mimic Go's 'defer' keyword
</span>
3108 <span class=
"Comment">; using 'convert-quotes'. It lets us write code anywhere in a function, but
</span>
3109 <span class=
"Comment">; have it run just before the function exits. Great for keeping code to
</span>
3110 <span class=
"Comment">; reclaim memory or other resources close to the code to allocate it. (C++
</span>
3111 <span class=
"Comment">; programmers know this as RAII.) We'll use 'defer' when we build a memory
</span>
3112 <span class=
"Comment">; deallocation routine like C's 'free'.
</span>
3113 <span class=
"Comment">;
</span>
3114 <span class=
"Comment">; More powerful reorderings are also possible like in Literate Programming or
</span>
3115 <span class=
"Comment">; Aspect-Oriented Programming; one advantage of prohibiting arbitrarily nested
</span>
3116 <span class=
"Comment">; code is that we can naturally name 'join points' wherever we want.
</span>
3118 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3119 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-quotes-defer
"</span><span class=
"Delimiter">)
</span>
3120 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3121 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-quotes
3122 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
3123 <span class=
"Mu"><span class=
"Delimiter">(
</span>defer
<span class=
"Delimiter">[
</span></span>
3124 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">6</span>:literal
<span class=
"Delimiter">)
</span></span>
3125 <span class=
"Delimiter">])
</span>
3126 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)))
</span></span>
3127 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
3128 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)
</span></span>
3129 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">6</span>:literal
<span class=
"Delimiter">)))
</span></span>
3130 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-quotes can handle 'defer'
"</span><span class=
"Delimiter">))
</span>
3132 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3133 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-quotes-defer-reply
"</span><span class=
"Delimiter">)
</span>
3134 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3135 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-quotes
3136 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3137 <span class=
"Mu"><span class=
"Delimiter">(
</span>defer
<span class=
"Delimiter">[
</span></span>
3138 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3139 <span class=
"Delimiter">])
</span>
3140 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3141 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
3142 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3143 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3144 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3145 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3146 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3147 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
3148 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3149 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3150 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3151 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-quotes inserts code at early exits
"</span><span class=
"Delimiter">))
</span>
3153 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3154 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-quotes-defer-reply-arg
"</span><span class=
"Delimiter">)
</span>
3155 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3156 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-quotes
3157 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3158 <span class=
"Mu"><span class=
"Delimiter">(
</span>defer
<span class=
"Delimiter">[
</span></span>
3159 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3160 <span class=
"Delimiter">])
</span>
3161 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3162 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span> <span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
3163 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3164 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3165 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3166 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3167 <span class=
"Mu"><span class=
"Delimiter">(
</span>prepare-reply
<span class=
"MuConstant">2</span>:literal
<span class=
"Delimiter">)
</span></span>
3168 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3169 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Identifier">reply
</span><span class=
"Delimiter">)
</span></span>
3170 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3171 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3172 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3173 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-quotes inserts code at early exits
"</span><span class=
"Delimiter">))
</span>
3175 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3176 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"convert-quotes-label
"</span><span class=
"Delimiter">)
</span>
3177 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3178 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>convert-quotes
3179 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
3181 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)))
</span></span>
3182 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
3184 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)))
</span></span>
3185 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - convert-quotes can handle labels
"</span><span class=
"Delimiter">))
</span>
3187 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3188 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"before
"</span><span class=
"Delimiter">)
</span>
3189 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3190 <span class=
"Delimiter">(
</span>add-code
3191 <span class=
"Mu"><span class=
"Delimiter">'((
</span>before label1
<span class=
"Delimiter">[
</span></span>
3192 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3193 <span class=
"Delimiter">])))
</span>
3194 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>as cons
<span class=
"Global">before*
</span>!label1
<span class=
"Delimiter">)
</span>
3195 <span class=
"Delimiter">'(
</span><span class=
"Comment">; fragment
</span>
3196 <span class=
"Delimiter">(
</span>
3197 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">))))
</span></span>
3198 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'before' records fragments of code to insert before labels
"</span><span class=
"Delimiter">))
</span>
3200 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>insert-code
3201 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3202 <span class=
"Mu">label1
</span>
3203 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3204 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3205 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3206 <span class=
"Mu">label1
</span>
3207 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3208 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'insert-code' can insert fragments before labels
"</span><span class=
"Delimiter">))
</span>
3210 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3211 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"before-multiple
"</span><span class=
"Delimiter">)
</span>
3212 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3213 <span class=
"Delimiter">(
</span>add-code
3214 <span class=
"Mu"><span class=
"Delimiter">'((
</span>before label1
<span class=
"Delimiter">[
</span></span>
3215 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3216 <span class=
"Delimiter">])
</span>
3217 <span class=
"Mu"><span class=
"Delimiter">(
</span>before label1
<span class=
"Delimiter">[
</span></span>
3218 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3219 <span class=
"Delimiter">])))
</span>
3220 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>as cons
<span class=
"Global">before*
</span>!label1
<span class=
"Delimiter">)
</span>
3221 <span class=
"Delimiter">'(
</span><span class=
"Comment">; fragment
</span>
3222 <span class=
"Delimiter">(
</span>
3223 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">))
</span></span>
3224 <span class=
"Delimiter">(
</span>
3225 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">))))
</span></span>
3226 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'before' records fragments in order
"</span><span class=
"Delimiter">))
</span>
3228 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>insert-code
3229 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3230 <span class=
"Mu">label1
</span>
3231 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3232 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3233 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3234 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3235 <span class=
"Mu">label1
</span>
3236 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3237 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'insert-code' can insert multiple fragments in order before label
"</span><span class=
"Delimiter">))
</span>
3239 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3240 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"before-scoped
"</span><span class=
"Delimiter">)
</span>
3241 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3242 <span class=
"Delimiter">(
</span>add-code
3243 <span class=
"Mu"><span class=
"Delimiter">'((
</span>before f/label1
<span class=
"Delimiter">[
</span> <span class=
"Comment">; label1 only inside function f
</span></span>
3244 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3245 <span class=
"Delimiter">])))
</span>
3246 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>insert-code
3247 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3248 <span class=
"Mu">label1
</span>
3249 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">))
</span></span>
3250 <span class=
"Delimiter">'
</span>f
<span class=
"Delimiter">)
</span>
3251 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3252 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3253 <span class=
"Mu">label1
</span>
3254 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3255 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'insert-code' can insert fragments before labels just in specified functions
"</span><span class=
"Delimiter">))
</span>
3257 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3258 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"before-scoped2
"</span><span class=
"Delimiter">)
</span>
3259 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3260 <span class=
"Delimiter">(
</span>add-code
3261 <span class=
"Mu"><span class=
"Delimiter">'((
</span>before f/label1
<span class=
"Delimiter">[
</span> <span class=
"Comment">; label1 only inside function f
</span></span>
3262 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3263 <span class=
"Delimiter">])))
</span>
3264 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>insert-code
3265 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3266 <span class=
"Mu">label1
</span>
3267 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3268 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3269 <span class=
"Mu">label1
</span>
3270 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3271 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'insert-code' ignores labels not in specified functions
"</span><span class=
"Delimiter">))
</span>
3273 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3274 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"after
"</span><span class=
"Delimiter">)
</span>
3275 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3276 <span class=
"Delimiter">(
</span>add-code
3277 <span class=
"Mu"><span class=
"Delimiter">'((
</span>after label1
<span class=
"Delimiter">[
</span></span>
3278 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3279 <span class=
"Delimiter">])))
</span>
3280 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>as cons
<span class=
"Global">after*
</span>!label1
<span class=
"Delimiter">)
</span>
3281 <span class=
"Delimiter">'(
</span><span class=
"Comment">; fragment
</span>
3282 <span class=
"Delimiter">(
</span>
3283 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">))))
</span></span>
3284 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'after' records fragments of code to insert after labels
"</span><span class=
"Delimiter">))
</span>
3286 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>insert-code
3287 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3288 <span class=
"Mu">label1
</span>
3289 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3290 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3291 <span class=
"Mu">label1
</span>
3292 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3293 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3294 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'insert-code' can insert fragments after labels
"</span><span class=
"Delimiter">))
</span>
3296 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3297 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"after-multiple
"</span><span class=
"Delimiter">)
</span>
3298 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3299 <span class=
"Delimiter">(
</span>add-code
3300 <span class=
"Mu"><span class=
"Delimiter">'((
</span>after label1
<span class=
"Delimiter">[
</span></span>
3301 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3302 <span class=
"Delimiter">])
</span>
3303 <span class=
"Mu"><span class=
"Delimiter">(
</span>after label1
<span class=
"Delimiter">[
</span></span>
3304 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3305 <span class=
"Delimiter">])))
</span>
3306 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>as cons
<span class=
"Global">after*
</span>!label1
<span class=
"Delimiter">)
</span>
3307 <span class=
"Delimiter">'(
</span><span class=
"Comment">; fragment
</span>
3308 <span class=
"Delimiter">(
</span>
3309 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">))
</span></span>
3310 <span class=
"Delimiter">(
</span>
3311 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">))))
</span></span>
3312 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'after' records fragments in *reverse* order
"</span><span class=
"Delimiter">))
</span>
3314 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>insert-code
3315 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3316 <span class=
"Mu">label1
</span>
3317 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3318 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3319 <span class=
"Mu">label1
</span>
3320 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3321 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3322 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3323 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'insert-code' can insert multiple fragments in order after label
"</span><span class=
"Delimiter">))
</span>
3325 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3326 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"before-after
"</span><span class=
"Delimiter">)
</span>
3327 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3328 <span class=
"Delimiter">(
</span>add-code
3329 <span class=
"Mu"><span class=
"Delimiter">'((
</span>before label1
<span class=
"Delimiter">[
</span></span>
3330 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3331 <span class=
"Delimiter">])
</span>
3332 <span class=
"Mu"><span class=
"Delimiter">(
</span>after label1
<span class=
"Delimiter">[
</span></span>
3333 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3334 <span class=
"Delimiter">])))
</span>
3335 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">and
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>as cons
<span class=
"Global">before*
</span>!label1
<span class=
"Delimiter">)
</span>
3336 <span class=
"Delimiter">'(
</span><span class=
"Comment">; fragment
</span>
3337 <span class=
"Delimiter">(
</span>
3338 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">))))
</span></span>
3339 <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>as cons
<span class=
"Global">after*
</span>!label1
<span class=
"Delimiter">)
</span>
3340 <span class=
"Delimiter">'(
</span><span class=
"Comment">; fragment
</span>
3341 <span class=
"Delimiter">(
</span>
3342 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))))
</span></span>
3343 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'before' and 'after' fragments work together
"</span><span class=
"Delimiter">))
</span>
3345 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>insert-code
3346 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3347 <span class=
"Mu">label1
</span>
3348 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3349 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3350 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3351 <span class=
"Mu">label1
</span>
3352 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3353 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3354 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'insert-code' can insert multiple fragments around label
"</span><span class=
"Delimiter">))
</span>
3356 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3357 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"before-after-multiple
"</span><span class=
"Delimiter">)
</span>
3358 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3359 <span class=
"Delimiter">(
</span>add-code
3360 <span class=
"Mu"><span class=
"Delimiter">'((
</span>before label1
<span class=
"Delimiter">[
</span></span>
3361 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3362 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3363 <span class=
"Delimiter">])
</span>
3364 <span class=
"Mu"><span class=
"Delimiter">(
</span>after label1
<span class=
"Delimiter">[
</span></span>
3365 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3366 <span class=
"Delimiter">])
</span>
3367 <span class=
"Mu"><span class=
"Delimiter">(
</span>before label1
<span class=
"Delimiter">[
</span></span>
3368 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3369 <span class=
"Delimiter">])
</span>
3370 <span class=
"Mu"><span class=
"Delimiter">(
</span>after label1
<span class=
"Delimiter">[
</span></span>
3371 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3372 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3373 <span class=
"Delimiter">])))
</span>
3374 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>as cons
<span class=
"Global">before*
</span>!label1
<span class=
"Delimiter">)
</span>
3375 <span class=
"Delimiter">'(
</span><span class=
"Comment">; fragment
</span>
3376 <span class=
"Delimiter">(
</span>
3377 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3378 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">))
</span></span>
3379 <span class=
"Delimiter">(
</span>
3380 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">))))
</span></span>
3381 <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>as cons
<span class=
"Global">after*
</span>!label1
<span class=
"Delimiter">)
</span>
3382 <span class=
"Delimiter">'(
</span><span class=
"Comment">; fragment
</span>
3383 <span class=
"Delimiter">(
</span>
3384 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3385 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">))
</span></span>
3386 <span class=
"Delimiter">(
</span>
3387 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))))
</span></span>
3388 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - multiple 'before' and 'after' fragments at once
"</span><span class=
"Delimiter">))
</span>
3390 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>insert-code
3391 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3392 <span class=
"Mu">label1
</span>
3393 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3394 <span class=
"Mu"><span class=
"Delimiter">'((
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3395 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3396 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3397 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3398 <span class=
"Mu">label1
</span>
3399 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">6</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3400 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">7</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3401 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3402 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">8</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)))
</span></span>
3403 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'insert-code' can insert multiple fragments around label -
2"</span><span class=
"Delimiter">))
</span>
3405 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3406 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"before-after-independent
"</span><span class=
"Delimiter">)
</span>
3407 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3408 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span><span class=
"Normal">do
</span>
3409 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3410 <span class=
"Delimiter">(
</span>add-code
3411 <span class=
"Mu"><span class=
"Delimiter">'((
</span>before label1
<span class=
"Delimiter">[
</span></span>
3412 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3413 <span class=
"Delimiter">])
</span>
3414 <span class=
"Mu"><span class=
"Delimiter">(
</span>after label1
<span class=
"Delimiter">[
</span></span>
3415 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3416 <span class=
"Delimiter">])
</span>
3417 <span class=
"Mu"><span class=
"Delimiter">(
</span>before label1
<span class=
"Delimiter">[
</span></span>
3418 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3419 <span class=
"Delimiter">])
</span>
3420 <span class=
"Mu"><span class=
"Delimiter">(
</span>after label1
<span class=
"Delimiter">[
</span></span>
3421 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3422 <span class=
"Delimiter">])))
</span>
3423 <span class=
"Delimiter">(
</span>list
<span class=
"Global">before*
</span>!label1
<span class=
"Global">after*
</span>!label1
<span class=
"Delimiter">))
</span>
3424 <span class=
"Delimiter">(
</span><span class=
"Normal">do
</span>
3425 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3426 <span class=
"Delimiter">(
</span>add-code
3427 <span class=
"Mu"><span class=
"Delimiter">'((
</span>before label1
<span class=
"Delimiter">[
</span></span>
3428 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3429 <span class=
"Delimiter">])
</span>
3430 <span class=
"Mu"><span class=
"Delimiter">(
</span>before label1
<span class=
"Delimiter">[
</span></span>
3431 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3432 <span class=
"Delimiter">])
</span>
3433 <span class=
"Mu"><span class=
"Delimiter">(
</span>after label1
<span class=
"Delimiter">[
</span></span>
3434 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3435 <span class=
"Delimiter">])
</span>
3436 <span class=
"Mu"><span class=
"Delimiter">(
</span>after label1
<span class=
"Delimiter">[
</span></span>
3437 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3438 <span class=
"Delimiter">])))
</span>
3439 <span class=
"Delimiter">(
</span>list
<span class=
"Global">before*
</span>!label1
<span class=
"Global">after*
</span>!label1
<span class=
"Delimiter">)))
</span>
3440 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - order matters between 'before' and between 'after' fragments, but not *across* 'before' and 'after' fragments
"</span><span class=
"Delimiter">))
</span>
3442 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3443 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"before-after-braces
"</span><span class=
"Delimiter">)
</span>
3444 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3445 <span class=
"Delimiter">(
</span>=
<span class=
"Global">function*
</span> <span class=
"Delimiter">(
</span>table
<span class=
"Delimiter">))
</span>
3446 <span class=
"Delimiter">(
</span>add-code
3447 <span class=
"Mu"><span class=
"Delimiter">'((
</span>after label1
<span class=
"Delimiter">[
</span></span>
3448 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3449 <span class=
"Delimiter">])
</span>
3450 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f1
<span class=
"Delimiter">[
</span></span>
3451 {
<span class=
"CommentedCode">begin
</span>
3452 <span class=
"Mu">label1
</span>
3454 <span class=
"Delimiter">])))
</span>
3455 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"cn0
")))
</span>
3456 <span class=
"Delimiter">(
</span>freeze
<span class=
"Global">function*
</span><span class=
"Delimiter">)
</span>
3457 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">function*
</span>!f1
3458 <span class=
"Mu"><span class=
"Delimiter">'(
</span>label1
</span>
3459 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
3460 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - before/after works inside blocks
"</span><span class=
"Delimiter">))
</span>
3462 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3463 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"before-after-any-order
"</span><span class=
"Delimiter">)
</span>
3464 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3465 <span class=
"Delimiter">(
</span>=
<span class=
"Global">function*
</span> <span class=
"Delimiter">(
</span>table
<span class=
"Delimiter">))
</span>
3466 <span class=
"Delimiter">(
</span>add-code
3467 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
3468 {
<span class=
"CommentedCode">begin
</span>
3469 <span class=
"Mu">label1
</span>
3471 <span class=
"Delimiter">])
</span>
3472 <span class=
"Mu"><span class=
"Delimiter">(
</span>after label1
<span class=
"Delimiter">[
</span></span>
3473 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3474 <span class=
"Delimiter">])))
</span>
3475 <span class=
"Delimiter">(
</span>freeze
<span class=
"Global">function*
</span><span class=
"Delimiter">)
</span>
3476 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">function*
</span>!f1
3477 <span class=
"Mu"><span class=
"Delimiter">'(
</span>label1
</span>
3478 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
3479 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - before/after can come after the function they need to modify
"</span><span class=
"Delimiter">))
</span>
3480 <span class=
"CommentedCode">;? (quit)
</span>
3482 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3483 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"multiple-defs
"</span><span class=
"Delimiter">)
</span>
3484 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3485 <span class=
"Delimiter">(
</span>=
<span class=
"Global">function*
</span> <span class=
"Delimiter">(
</span>table
<span class=
"Delimiter">))
</span>
3486 <span class=
"Delimiter">(
</span>add-code
3487 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
3488 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3489 <span class=
"Delimiter">])
</span>
3490 <span class=
"Mu"><span class=
"Delimiter">(
</span>function f1
<span class=
"Delimiter">[
</span></span>
3491 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3492 <span class=
"Delimiter">])))
</span>
3493 <span class=
"Delimiter">(
</span>freeze
<span class=
"Global">function*
</span><span class=
"Delimiter">)
</span>
3494 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">function*
</span>!f1
3495 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))
</span></span>
3496 <span class=
"Mu"><span class=
"Delimiter">(((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
3497 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - multiple 'def' of the same function add clauses
"</span><span class=
"Delimiter">))
</span>
3499 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3500 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"def!
"</span><span class=
"Delimiter">)
</span>
3501 <span class=
"Delimiter">(
</span>=
<span class=
"Global">traces*
</span> <span class=
"Delimiter">(
</span>queue
<span class=
"Delimiter">))
</span>
3502 <span class=
"Delimiter">(
</span>=
<span class=
"Global">function*
</span> <span class=
"Delimiter">(
</span>table
<span class=
"Delimiter">))
</span>
3503 <span class=
"Delimiter">(
</span>add-code
3504 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function f1
<span class=
"Delimiter">[
</span></span>
3505 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3506 <span class=
"Delimiter">])
</span>
3507 <span class=
"Mu"><span class=
"Delimiter">(
</span>function! f1
<span class=
"Delimiter">[
</span></span>
3508 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> copy
<span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3509 <span class=
"Delimiter">])))
</span>
3510 <span class=
"Delimiter">(
</span>freeze
<span class=
"Global">function*
</span><span class=
"Delimiter">)
</span>
3511 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">function*
</span>!f1
3512 <span class=
"Mu"><span class=
"Delimiter">'((((
</span><span class=
"Constant">2</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>copy
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">0</span> literal
<span class=
"Delimiter">)))))
</span></span>
3513 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'def!' clears all previous clauses
"</span><span class=
"Delimiter">))
</span>
3515 <span class=
"Delimiter">)
</span> <span class=
"Comment">; section
10</span>
3517 <span class=
"SalientComment">;; ---
</span>
3519 <span class=
"Delimiter">(
</span>section
<span class=
"Constant">100</span> <span class=
"Comment">; string utilities
</span>
3521 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3522 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-new
"</span><span class=
"Delimiter">)
</span>
3523 <span class=
"Delimiter">(
</span>add-code
3524 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3525 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new string:literal
<span class=
"MuConstant">5</span>:literal
<span class=
"Delimiter">)
</span></span>
3526 <span class=
"Delimiter">])))
</span>
3527 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!main
3528 <span class=
"Delimiter">(
</span>enq routine
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
3529 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> before rep.routine!alloc
3530 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">)
</span>
3531 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso rep.routine!alloc
<span class=
"Delimiter">(
</span>+ before
<span class=
"Constant">5</span> <span class=
"Constant">1</span><span class=
"Delimiter">))
</span>
3532 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'new' allocates arrays of bytes for strings
"</span><span class=
"Delimiter">))))
</span>
3534 <span class=
"Comment">; Convenience: initialize strings using string literals
</span>
3535 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3536 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-literal
"</span><span class=
"Delimiter">)
</span>
3537 <span class=
"Delimiter">(
</span>add-code
3538 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3539 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"hello
"</span><span class=
"Delimiter">)
</span></span>
3540 <span class=
"Delimiter">])))
</span>
3541 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> routine make-routine!main
3542 <span class=
"Delimiter">(
</span>enq routine
<span class=
"Global">running-routines*
</span><span class=
"Delimiter">)
</span>
3543 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> before rep.routine!alloc
3544 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
3545 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"schedule
" "run
" "addr
")))
</span>
3546 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">)
</span>
3547 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso rep.routine!alloc
<span class=
"Delimiter">(
</span>+ before
<span class=
"Constant">5</span> <span class=
"Constant">1</span><span class=
"Delimiter">))
</span>
3548 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'new' allocates arrays of bytes for string literals
"</span><span class=
"Delimiter">))
</span>
3549 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains-array before
<span class=
"Constant">"hello
"</span><span class=
"Delimiter">)
</span>
3550 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'new' initializes allocated memory to string literal
"</span><span class=
"Delimiter">))))
</span>
3552 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3553 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"strcat
"</span><span class=
"Delimiter">)
</span>
3554 <span class=
"Delimiter">(
</span>add-code
3555 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3556 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"hello,
"</span><span class=
"Delimiter">)
</span></span>
3557 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">" world!
"</span><span class=
"Delimiter">)
</span></span>
3558 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:string-address
<span class=
"Op"><-
</span> strcat
<span class=
"Constant">1</span>:string-address
<span class=
"Constant">2</span>:string-address
<span class=
"Delimiter">)
</span></span>
3559 <span class=
"Delimiter">])))
</span>
3560 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3561 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">"hello, world!
"</span><span class=
"Delimiter">)
</span>
3562 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'strcat' concatenates strings
"</span><span class=
"Delimiter">))
</span>
3564 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3565 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"interpolate
"</span><span class=
"Delimiter">)
</span>
3566 <span class=
"Delimiter">(
</span>add-code
3567 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3568 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"hello, _!
"</span><span class=
"Delimiter">)
</span></span>
3569 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"abc
"</span><span class=
"Delimiter">)
</span></span>
3570 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:string-address
<span class=
"Op"><-
</span> interpolate
<span class=
"Constant">1</span>:string-address
<span class=
"Constant">2</span>:string-address
<span class=
"Delimiter">)
</span></span>
3571 <span class=
"Delimiter">])))
</span>
3572 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
")))
</span>
3573 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3574 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">"hello, abc!
"</span><span class=
"Delimiter">)
</span>
3575 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'interpolate' splices strings
"</span><span class=
"Delimiter">))
</span>
3577 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3578 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"interpolate-empty
"</span><span class=
"Delimiter">)
</span>
3579 <span class=
"Delimiter">(
</span>add-code
3580 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3581 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"hello!
"</span><span class=
"Delimiter">)
</span></span>
3582 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"abc
"</span><span class=
"Delimiter">)
</span></span>
3583 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:string-address
<span class=
"Op"><-
</span> interpolate
<span class=
"Constant">1</span>:string-address
<span class=
"Constant">2</span>:string-address
<span class=
"Delimiter">)
</span></span>
3584 <span class=
"Delimiter">])))
</span>
3585 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
")))
</span>
3586 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3587 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">"hello!
"</span><span class=
"Delimiter">)
</span>
3588 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'interpolate' without underscore returns template
"</span><span class=
"Delimiter">))
</span>
3590 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3591 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"interpolate-at-start
"</span><span class=
"Delimiter">)
</span>
3592 <span class=
"Delimiter">(
</span>add-code
3593 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3594 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"_, hello!
"</span><span class=
"Delimiter">)
</span></span>
3595 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"abc
"</span><span class=
"Delimiter">)
</span></span>
3596 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:string-address
<span class=
"Op"><-
</span> interpolate
<span class=
"Constant">1</span>:string-address
<span class=
"Constant">2</span>:string-address
<span class=
"Delimiter">)
</span></span>
3597 <span class=
"Delimiter">])))
</span>
3598 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
")))
</span>
3599 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3600 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">"abc, hello
"</span><span class=
"Delimiter">)
</span>
3601 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'interpolate' splices strings at start
"</span><span class=
"Delimiter">))
</span>
3603 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3604 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"interpolate-at-end
"</span><span class=
"Delimiter">)
</span>
3605 <span class=
"Delimiter">(
</span>add-code
3606 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3607 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"hello, _
"</span><span class=
"Delimiter">)
</span></span>
3608 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"abc
"</span><span class=
"Delimiter">)
</span></span>
3609 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:string-address
<span class=
"Op"><-
</span> interpolate
<span class=
"Constant">1</span>:string-address
<span class=
"Constant">2</span>:string-address
<span class=
"Delimiter">)
</span></span>
3610 <span class=
"Delimiter">])))
</span>
3611 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
")))
</span>
3612 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3613 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">"hello, abc
"</span><span class=
"Delimiter">)
</span>
3614 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'interpolate' splices strings at start
"</span><span class=
"Delimiter">))
</span>
3616 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3617 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"interpolate-varargs
"</span><span class=
"Delimiter">)
</span>
3618 <span class=
"Delimiter">(
</span>add-code
3619 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3620 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"hello, _, _, and _!
"</span><span class=
"Delimiter">)
</span></span>
3621 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"abc
"</span><span class=
"Delimiter">)
</span></span>
3622 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">3</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"def
"</span><span class=
"Delimiter">)
</span></span>
3623 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">4</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"ghi
"</span><span class=
"Delimiter">)
</span></span>
3624 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">5</span>:string-address
<span class=
"Op"><-
</span> interpolate
<span class=
"Constant">1</span>:string-address
<span class=
"Constant">2</span>:string-address
<span class=
"Constant">3</span>:string-address
<span class=
"Constant">4</span>:string-address
<span class=
"Delimiter">)
</span></span>
3625 <span class=
"Delimiter">])))
</span>
3626 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
")))
</span>
3627 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
" "array-info
")))
</span>
3628 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
3629 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3630 <span class=
"CommentedCode">;? (quit)
</span>
3631 <span class=
"CommentedCode">;? (up i
1 (+
1 (memory* memory*
.5))
</span>
3632 <span class=
"CommentedCode">;? (prn (memory* (+ memory*
.5 i))))
</span>
3633 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Global">memory*
</span><span class=
"Constant">.5</span> <span class=
"Constant">"hello, abc, def, and ghi!
"</span><span class=
"Delimiter">)
</span>
3634 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'interpolate' splices in any number of strings
"</span><span class=
"Delimiter">))
</span>
3636 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3637 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-find-next
"</span><span class=
"Delimiter">)
</span>
3638 <span class=
"Delimiter">(
</span>add-code
3639 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3640 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"a/b
"</span><span class=
"Delimiter">)
</span></span>
3641 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> find-next
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">))
</span> <span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3642 <span class=
"Delimiter">])))
</span>
3643 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3644 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">1</span><span class=
"Delimiter">)
</span>
3645 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'find-next' finds first location of a character
"</span><span class=
"Delimiter">))
</span>
3647 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3648 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-find-next-empty
"</span><span class=
"Delimiter">)
</span>
3649 <span class=
"Delimiter">(
</span>add-code
3650 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3651 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">""</span><span class=
"Delimiter">)
</span></span>
3652 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> find-next
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">))
</span> <span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3653 <span class=
"Delimiter">])))
</span>
3654 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3655 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
3656 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
3657 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">0</span><span class=
"Delimiter">)
</span>
3658 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'find-next' finds first location of a character
"</span><span class=
"Delimiter">))
</span>
3660 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3661 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-find-next-initial
"</span><span class=
"Delimiter">)
</span>
3662 <span class=
"Delimiter">(
</span>add-code
3663 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3664 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"/abc
"</span><span class=
"Delimiter">)
</span></span>
3665 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> find-next
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">))
</span> <span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3666 <span class=
"Delimiter">])))
</span>
3667 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3668 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">0</span><span class=
"Delimiter">)
</span>
3669 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'find-next' handles prefix match
"</span><span class=
"Delimiter">))
</span>
3671 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3672 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-find-next-final
"</span><span class=
"Delimiter">)
</span>
3673 <span class=
"Delimiter">(
</span>add-code
3674 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3675 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"abc/
"</span><span class=
"Delimiter">)
</span></span>
3676 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> find-next
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">))
</span> <span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3677 <span class=
"Delimiter">])))
</span>
3678 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3679 <span class=
"CommentedCode">;? (prn memory*
.2)
</span>
3680 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">3</span><span class=
"Delimiter">)
</span>
3681 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'find-next' handles suffix match
"</span><span class=
"Delimiter">))
</span>
3683 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3684 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-find-next-missing
"</span><span class=
"Delimiter">)
</span>
3685 <span class=
"Delimiter">(
</span>add-code
3686 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3687 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"abc
"</span><span class=
"Delimiter">)
</span></span>
3688 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> find-next
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">))
</span> <span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3689 <span class=
"Delimiter">])))
</span>
3690 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3691 <span class=
"CommentedCode">;? (prn memory*
.2)
</span>
3692 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">3</span><span class=
"Delimiter">)
</span>
3693 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'find-next' handles no match
"</span><span class=
"Delimiter">))
</span>
3695 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3696 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-find-next-invalid-index
"</span><span class=
"Delimiter">)
</span>
3697 <span class=
"Delimiter">(
</span>add-code
3698 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3699 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"abc
"</span><span class=
"Delimiter">)
</span></span>
3700 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> find-next
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">))
</span> <span class=
"MuConstant">4</span>:literal
<span class=
"Delimiter">)
</span></span>
3701 <span class=
"Delimiter">])))
</span>
3702 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
")))
</span>
3703 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3704 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
3705 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
3706 <span class=
"CommentedCode">;? (prn memory*
.2)
</span>
3707 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
3708 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'find-next' skips invalid index (past end of string)
"</span><span class=
"Delimiter">))
</span>
3710 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3711 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-find-next-first
"</span><span class=
"Delimiter">)
</span>
3712 <span class=
"Delimiter">(
</span>add-code
3713 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3714 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"ab/c/
"</span><span class=
"Delimiter">)
</span></span>
3715 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> find-next
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">))
</span> <span class=
"MuConstant">0</span>:literal
<span class=
"Delimiter">)
</span></span>
3716 <span class=
"Delimiter">])))
</span>
3717 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3718 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">2</span><span class=
"Delimiter">)
</span>
3719 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'find-next' finds first of multiple options
"</span><span class=
"Delimiter">))
</span>
3721 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3722 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-find-next-second
"</span><span class=
"Delimiter">)
</span>
3723 <span class=
"Delimiter">(
</span>add-code
3724 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3725 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"ab/c/
"</span><span class=
"Delimiter">)
</span></span>
3726 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:integer
<span class=
"Op"><-
</span> find-next
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">))
</span> <span class=
"MuConstant">3</span>:literal
<span class=
"Delimiter">)
</span></span>
3727 <span class=
"Delimiter">])))
</span>
3728 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3729 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
3730 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'find-next' finds second of multiple options
"</span><span class=
"Delimiter">))
</span>
3732 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3733 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-split
"</span><span class=
"Delimiter">)
</span>
3734 <span class=
"Delimiter">(
</span>add-code
3735 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3736 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"a/b
"</span><span class=
"Delimiter">)
</span></span>
3737 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:string-address-array-address
<span class=
"Op"><-
</span> split
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">)))
</span></span>
3738 <span class=
"Delimiter">])))
</span>
3739 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
3740 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3741 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
3742 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
3743 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> base
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span>
3744 <span class=
"CommentedCode">;? (prn base
" " memory*.base)
</span>
3745 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span>.base
<span class=
"Constant">2</span><span class=
"Delimiter">)
</span>
3746 <span class=
"CommentedCode">;? (do1 nil prn
.111)
</span>
3747 <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ base
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span> <span class=
"Constant">"a
"</span><span class=
"Delimiter">)
</span>
3748 <span class=
"CommentedCode">;? (do1 nil prn
.111)
</span>
3749 <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ base
<span class=
"Constant">2</span><span class=
"Delimiter">))
</span> <span class=
"Constant">"b
"</span><span class=
"Delimiter">))
</span>
3750 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'split' cuts string at delimiter
"</span><span class=
"Delimiter">)))
</span>
3752 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3753 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-split2
"</span><span class=
"Delimiter">)
</span>
3754 <span class=
"Delimiter">(
</span>add-code
3755 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3756 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"a/b/c
"</span><span class=
"Delimiter">)
</span></span>
3757 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:string-address-array-address
<span class=
"Op"><-
</span> split
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">)))
</span></span>
3758 <span class=
"Delimiter">])))
</span>
3759 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
3760 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3761 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
3762 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
3763 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> base
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span>
3764 <span class=
"CommentedCode">;? (prn base
" " memory*.base)
</span>
3765 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span>.base
<span class=
"Constant">3</span><span class=
"Delimiter">)
</span>
3766 <span class=
"CommentedCode">;? (do1 nil prn
.111)
</span>
3767 <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ base
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span> <span class=
"Constant">"a
"</span><span class=
"Delimiter">)
</span>
3768 <span class=
"CommentedCode">;? (do1 nil prn
.111)
</span>
3769 <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ base
<span class=
"Constant">2</span><span class=
"Delimiter">))
</span> <span class=
"Constant">"b
"</span><span class=
"Delimiter">)
</span>
3770 <span class=
"CommentedCode">;? (do1 nil prn
.111)
</span>
3771 <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ base
<span class=
"Constant">3</span><span class=
"Delimiter">))
</span> <span class=
"Constant">"c
"</span><span class=
"Delimiter">))
</span>
3772 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'split' cuts string at two delimiters
"</span><span class=
"Delimiter">)))
</span>
3774 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3775 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-split-missing
"</span><span class=
"Delimiter">)
</span>
3776 <span class=
"Delimiter">(
</span>add-code
3777 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3778 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"abc
"</span><span class=
"Delimiter">)
</span></span>
3779 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:string-address-array-address
<span class=
"Op"><-
</span> split
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">)))
</span></span>
3780 <span class=
"Delimiter">])))
</span>
3781 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3782 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
3783 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
3784 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> base
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span>
3785 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span>.base
<span class=
"Constant">1</span><span class=
"Delimiter">)
</span>
3786 <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ base
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span> <span class=
"Constant">"abc
"</span><span class=
"Delimiter">))
</span>
3787 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'split' handles missing delimiter
"</span><span class=
"Delimiter">)))
</span>
3789 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3790 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-split-empty
"</span><span class=
"Delimiter">)
</span>
3791 <span class=
"Delimiter">(
</span>add-code
3792 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3793 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">""</span><span class=
"Delimiter">)
</span></span>
3794 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:string-address-array-address
<span class=
"Op"><-
</span> split
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">)))
</span></span>
3795 <span class=
"Delimiter">])))
</span>
3796 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"run
")))
</span>
3797 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3798 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
3799 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
3800 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> base
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span>
3801 <span class=
"CommentedCode">;? (prn base
" " memory*.base)
</span>
3802 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span>.base
<span class=
"Constant">0</span><span class=
"Delimiter">)
</span>
3803 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'split' handles empty string
"</span><span class=
"Delimiter">)))
</span>
3805 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3806 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"string-split-empty-piece
"</span><span class=
"Delimiter">)
</span>
3807 <span class=
"Delimiter">(
</span>add-code
3808 <span class=
"Mu"><span class=
"Delimiter">'((
</span>function main
<span class=
"Delimiter">[
</span></span>
3809 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">1</span>:string-address
<span class=
"Op"><-
</span> new
<span class=
"Constant">"a/b//c
"</span><span class=
"Delimiter">)
</span></span>
3810 <span class=
"Mu"><span class=
"Delimiter">(
</span><span class=
"Constant">2</span>:string-address-array-address
<span class=
"Op"><-
</span> split
<span class=
"Constant">1</span>:string-address
<span class=
"Delimiter">((
</span><span class=
"MuConstant">#\/
</span> literal
<span class=
"Delimiter">)))
</span></span>
3811 <span class=
"Delimiter">])))
</span>
3812 <span class=
"Delimiter">(
</span>run
<span class=
"Delimiter">'
</span>main
<span class=
"Delimiter">)
</span>
3813 <span class=
"Delimiter">(
</span>each routine
<span class=
"Global">completed-routines*
</span>
3814 <span class=
"Delimiter">(
</span>aif rep.routine!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">)))
</span>
3815 <span class=
"Delimiter">(
</span><span class=
"Normal">let
</span> base
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span>
3816 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span><span class=
"Normal">or
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Global">memory*
</span>.base
<span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
3817 <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ base
<span class=
"Constant">1</span><span class=
"Delimiter">))
</span> <span class=
"Constant">"a
"</span><span class=
"Delimiter">)
</span>
3818 <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ base
<span class=
"Constant">2</span><span class=
"Delimiter">))
</span> <span class=
"Constant">"b
"</span><span class=
"Delimiter">)
</span>
3819 <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ base
<span class=
"Constant">3</span><span class=
"Delimiter">))
</span> <span class=
"Constant">""</span><span class=
"Delimiter">)
</span>
3820 <span class=
"Delimiter">(
</span>~memory-contains-array
<span class=
"Delimiter">(
</span><span class=
"Global">memory*
</span> <span class=
"Delimiter">(
</span>+ base
<span class=
"Constant">4</span><span class=
"Delimiter">))
</span> <span class=
"Constant">"c
"</span><span class=
"Delimiter">))
</span>
3821 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'split' cuts string at two delimiters
"</span><span class=
"Delimiter">)))
</span>
3823 <span class=
"Delimiter">)
</span> <span class=
"Comment">; section
100 for string utilities
</span>
3825 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3826 <span class=
"Delimiter">(
</span>new-trace
<span class=
"Constant">"parse-and-record
"</span><span class=
"Delimiter">)
</span>
3827 <span class=
"Delimiter">(
</span>add-code
3828 <span class=
"Delimiter">'((
</span>and-record foo
<span class=
"Delimiter">[
</span>
3832 <span class=
"Delimiter">])))
</span>
3833 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Global">type*
</span>!foo
<span class=
"Delimiter">(
</span>obj size
<span class=
"Constant">3</span> and-record t elems
<span class=
"Delimiter">'((
</span>string
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>integer
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>boolean
<span class=
"Delimiter">))
</span> <span class=
"Normal">fields
</span> <span class=
"Delimiter">'(
</span>x y z
<span class=
"Delimiter">)))
</span>
3834 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'add-code' can add new and-records
"</span><span class=
"Delimiter">))
</span>
3836 <span class=
"SalientComment">;; unit tests for various helpers
</span>
3838 <span class=
"Comment">; tokenize-args
</span>
3839 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"== tokenize-args
"</span><span class=
"Delimiter">)
</span>
3840 <span class=
"Delimiter">(
</span>assert:iso
<span class=
"Delimiter">'((
</span>a b
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>c d
<span class=
"Delimiter">))
</span>
3841 <span class=
"Delimiter">(
</span>tokenize-arg
<span class=
"Delimiter">'
</span>a:b/c:d
<span class=
"Delimiter">))
</span>
3842 <span class=
"Comment">; numbers are not symbols
</span>
3843 <span class=
"Delimiter">(
</span>assert:iso
<span class=
"Delimiter">'((
</span>a b
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span><span class=
"Constant">1</span> d
<span class=
"Delimiter">))
</span>
3844 <span class=
"Delimiter">(
</span>tokenize-arg
<span class=
"Delimiter">'
</span>a:b/
1:d
<span class=
"Delimiter">))
</span>
3845 <span class=
"Comment">; special symbols are skipped
</span>
3846 <span class=
"Mu"><span class=
"Delimiter">(
</span>assert:iso
<span class=
"Delimiter">'
</span><span class=
"Op"><-
</span></span>
3847 <span class=
"Mu"><span class=
"Delimiter">(
</span>tokenize-arg
<span class=
"Delimiter">'
</span><span class=
"Op"><-
</span><span class=
"Delimiter">))
</span></span>
3848 <span class=
"Delimiter">(
</span>assert:iso
<span class=
"Delimiter">'
</span>_
3849 <span class=
"Delimiter">(
</span>tokenize-arg
<span class=
"Delimiter">'
</span>_
<span class=
"Delimiter">))
</span>
3851 <span class=
"Comment">; idempotent
</span>
3852 <span class=
"Delimiter">(
</span>assert:iso
<span class=
"Delimiter">(
</span>tokenize-arg:tokenize-arg
<span class=
"Delimiter">'
</span>a:b/c:d
<span class=
"Delimiter">)
</span>
3853 <span class=
"Delimiter">(
</span>tokenize-arg
<span class=
"Delimiter">'
</span>a:b/c:d
<span class=
"Delimiter">))
</span>
3855 <span class=
"Comment">; support labels
</span>
3856 <span class=
"Mu"><span class=
"Delimiter">(
</span>assert:iso
<span class=
"Delimiter">'((((
</span>default-space space-address
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>new
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>space literal
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">30</span> literal
<span class=
"Delimiter">)))
</span></span>
3857 foo
<span class=
"Delimiter">)
</span>
3858 <span class=
"Delimiter">(
</span>tokenize-args
3859 <span class=
"Mu"><span class=
"Delimiter">'((
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
3860 foo
<span class=
"Delimiter">)))
</span>
3862 <span class=
"Comment">; support braces
</span>
3863 <span class=
"Mu"><span class=
"Delimiter">(
</span>assert:iso
<span class=
"Delimiter">'((((
</span>default-space space-address
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>new
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>space literal
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span><span class=
"MuConstant">30</span> literal
<span class=
"Delimiter">)))
</span></span>
3865 {
<span class=
"CommentedCode">begin
</span>
3867 <span class=
"Mu"><span class=
"Delimiter">(((
</span>a b
<span class=
"Delimiter">))
</span> <span class=
"Op"><-
</span> <span class=
"Delimiter">((
</span>op
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>c d
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">((
</span>e f
<span class=
"Delimiter">)))
</span></span>
3868 }
<span class=
"Delimiter">)
</span>
3869 <span class=
"Delimiter">(
</span>tokenize-args
3870 <span class=
"Mu"><span class=
"Delimiter">'((
</span>default-space:space-address
<span class=
"Op"><-
</span> new space:literal
<span class=
"MuConstant">30</span>:literal
<span class=
"Delimiter">)
</span></span>
3872 {
<span class=
"CommentedCode">begin
</span>
3874 <span class=
"Mu"><span class=
"Delimiter">(
</span>a:b
<span class=
"Op"><-
</span> op c:d e:f
<span class=
"Delimiter">)
</span></span>
3875 }
<span class=
"Delimiter">)))
</span>
3877 <span class=
"Comment">; space
</span>
3878 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"== space
"</span><span class=
"Delimiter">)
</span>
3879 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3880 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Constant">0</span> <span class=
"Delimiter">(
</span>space
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))))
</span>
3881 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'space' is
0 by default
"</span><span class=
"Delimiter">))
</span>
3882 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Constant">1</span> <span class=
"Delimiter">(
</span>space
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>space
<span class=
"Constant">1</span><span class=
"Delimiter">))))
</span>
3883 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'space' picks up space when available
"</span><span class=
"Delimiter">))
</span>
3884 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">'
</span>global
<span class=
"Delimiter">(
</span>space
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>space global
<span class=
"Delimiter">))))
</span>
3885 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'space' understands routine-global space
"</span><span class=
"Delimiter">))
</span>
3887 <span class=
"Comment">; absolutize
</span>
3888 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"== absolutize
"</span><span class=
"Delimiter">)
</span>
3889 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3890 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>absolutize
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))))
</span>
3891 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'absolutize' works without routine
"</span><span class=
"Delimiter">))
</span>
3892 <span class=
"Delimiter">(
</span>=
<span class=
"Global">routine*
</span> make-routine!foo
<span class=
"Delimiter">)
</span>
3893 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>absolutize
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))))
</span>
3894 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'absolutize' works without default-space
"</span><span class=
"Delimiter">))
</span>
3895 <span class=
"Delimiter">(
</span>= rep.routine*!call-stack
.0!default-space
<span class=
"Constant">10</span><span class=
"Delimiter">)
</span>
3896 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.10</span> <span class=
"Constant">5</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; bounds check for default-space
</span>
3897 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">'((
</span><span class=
"Constant">15</span> integer
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>raw
<span class=
"Delimiter">))
</span>
3898 <span class=
"Delimiter">(
</span>absolutize
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))))
</span>
3899 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'absolutize' works with default-space
"</span><span class=
"Delimiter">))
</span>
3900 <span class=
"Delimiter">(
</span>absolutize
<span class=
"Delimiter">'((
</span><span class=
"Constant">5</span> integer
<span class=
"Delimiter">)))
</span>
3901 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~posmatch
<span class=
"Constant">"no room
"</span> rep.routine*!error
<span class=
"Delimiter">)
</span>
3902 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'absolutize' checks against default-space bounds
"</span><span class=
"Delimiter">))
</span>
3903 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">'((
</span>_ integer
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>absolutize
<span class=
"Delimiter">'((
</span>_ integer
<span class=
"Delimiter">))))
</span>
3904 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'absolutize' passes dummy args right through
"</span><span class=
"Delimiter">))
</span>
3906 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.20</span> <span class=
"Constant">5</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; pretend array
</span>
3907 <span class=
"Delimiter">(
</span>= rep.routine*!globals
<span class=
"Constant">20</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; provide it to routine global
</span>
3908 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">'((
</span><span class=
"Constant">22</span> integer
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>raw
<span class=
"Delimiter">))
</span>
3909 <span class=
"Delimiter">(
</span>absolutize
<span class=
"Delimiter">'((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>space global
<span class=
"Delimiter">))))
</span>
3910 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'absolutize' handles variables in the global space
"</span><span class=
"Delimiter">))
</span>
3912 <span class=
"Comment">; deref
</span>
3913 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"== deref
"</span><span class=
"Delimiter">)
</span>
3914 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3915 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
3916 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span>
3917 <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-address
<span class=
"Delimiter">)
</span>
3918 <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
3919 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'deref' handles simple addresses
"</span><span class=
"Delimiter">))
</span>
3920 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))
</span>
3921 <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-address
<span class=
"Delimiter">)
</span>
3922 <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">)
</span>
3923 <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
3924 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'deref' deletes just one deref
"</span><span class=
"Delimiter">))
</span>
3925 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.4</span> <span class=
"Constant">5</span><span class=
"Delimiter">)
</span>
3926 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">'((
</span><span class=
"Constant">5</span> integer
<span class=
"Delimiter">))
</span>
3927 <span class=
"Delimiter">(
</span>deref:deref
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-address-address
<span class=
"Delimiter">)
</span>
3928 <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">)
</span>
3929 <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
3930 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'deref' can be chained
"</span><span class=
"Delimiter">))
</span>
3931 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">'((
</span><span class=
"Constant">5</span> integer
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>foo
<span class=
"Delimiter">))
</span>
3932 <span class=
"Delimiter">(
</span>deref:deref
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-address-address
<span class=
"Delimiter">)
</span>
3933 <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">)
</span>
3934 <span class=
"Delimiter">(
</span>foo
<span class=
"Delimiter">)
</span>
3935 <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
3936 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'deref' skips junk
"</span><span class=
"Delimiter">))
</span>
3938 <span class=
"Comment">; addr
</span>
3939 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"== addr
"</span><span class=
"Delimiter">)
</span>
3940 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3941 <span class=
"Delimiter">(
</span>=
<span class=
"Global">routine*
</span> nil
<span class=
"Delimiter">)
</span>
3942 <span class=
"CommentedCode">;? (prn
111)
</span>
3943 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">4</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))))
</span>
3944 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - directly addressed operands are their own address
"</span><span class=
"Delimiter">))
</span>
3945 <span class=
"CommentedCode">;? (quit)
</span>
3946 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">4</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-address
<span class=
"Delimiter">))))
</span>
3947 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - directly addressed operands are their own address -
2"</span><span class=
"Delimiter">))
</span>
3948 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">4</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"MuConstant">4</span> literal
<span class=
"Delimiter">))))
</span>
3949 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'addr' doesn't understand literals
"</span><span class=
"Delimiter">))
</span>
3950 <span class=
"CommentedCode">;? (prn
201)
</span>
3951 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.4</span> <span class=
"Constant">23</span><span class=
"Delimiter">)
</span>
3952 <span class=
"CommentedCode">;? (prn
202)
</span>
3953 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">23</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
3954 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'addr' works with indirectly-addressed 'deref'
"</span><span class=
"Delimiter">))
</span>
3955 <span class=
"CommentedCode">;? (quit)
</span>
3956 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
3957 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">23</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-address-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
3958 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'addr' works with multiple 'deref'
"</span><span class=
"Delimiter">))
</span>
3960 <span class=
"Delimiter">(
</span>=
<span class=
"Global">routine*
</span> make-routine!foo
<span class=
"Delimiter">)
</span>
3961 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">4</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))))
</span>
3962 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - directly addressed operands are their own address inside routines
"</span><span class=
"Delimiter">))
</span>
3963 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">4</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-address
<span class=
"Delimiter">))))
</span>
3964 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - directly addressed operands are their own address inside routines -
2"</span><span class=
"Delimiter">))
</span>
3965 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">4</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"MuConstant">4</span> literal
<span class=
"Delimiter">))))
</span>
3966 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'addr' doesn't understand literals inside routines
"</span><span class=
"Delimiter">))
</span>
3967 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.4</span> <span class=
"Constant">23</span><span class=
"Delimiter">)
</span>
3968 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">23</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
3969 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'addr' works with indirectly-addressed 'deref' inside routines
"</span><span class=
"Delimiter">))
</span>
3971 <span class=
"CommentedCode">;? (prn
301)
</span>
3972 <span class=
"Delimiter">(
</span>= rep.routine*!call-stack
.0!default-space
<span class=
"Constant">10</span><span class=
"Delimiter">)
</span>
3973 <span class=
"CommentedCode">;? (prn
302)
</span>
3974 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.10</span> <span class=
"Constant">5</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; bounds check for default-space
</span>
3975 <span class=
"CommentedCode">;? (prn
303)
</span>
3976 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">15</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))))
</span>
3977 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - directly addressed operands in routines add default-space
"</span><span class=
"Delimiter">))
</span>
3978 <span class=
"CommentedCode">;? (quit)
</span>
3979 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">15</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-address
<span class=
"Delimiter">))))
</span>
3980 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - directly addressed operands in routines add default-space -
2"</span><span class=
"Delimiter">))
</span>
3981 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">15</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"MuConstant">4</span> literal
<span class=
"Delimiter">))))
</span>
3982 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'addr' doesn't understand literals
"</span><span class=
"Delimiter">))
</span>
3983 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.15</span> <span class=
"Constant">23</span><span class=
"Delimiter">)
</span>
3984 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">23</span> <span class=
"Delimiter">(
</span>addr
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
3985 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'addr' adds default-space before 'deref', not after
"</span><span class=
"Delimiter">))
</span>
3986 <span class=
"CommentedCode">;? (quit)
</span>
3988 <span class=
"Comment">; array-len
</span>
3989 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"== array-len
"</span><span class=
"Delimiter">)
</span>
3990 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
3991 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.35</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
3992 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">4</span> <span class=
"Delimiter">(
</span>array-len
<span class=
"Delimiter">'((
</span><span class=
"Constant">35</span> integer-boolean-pair-array
<span class=
"Delimiter">))))
</span>
3993 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'array-len'
"</span><span class=
"Delimiter">))
</span>
3994 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.34</span> <span class=
"Constant">35</span><span class=
"Delimiter">)
</span>
3995 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">4</span> <span class=
"Delimiter">(
</span>array-len
<span class=
"Delimiter">'((
</span><span class=
"Constant">34</span> integer-boolean-pair-array-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
3996 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'array-len'
"</span><span class=
"Delimiter">))
</span>
3997 <span class=
"CommentedCode">;? (quit)
</span>
3999 <span class=
"Comment">; sizeof
</span>
4000 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"== sizeof
"</span><span class=
"Delimiter">)
</span>
4001 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
4002 <span class=
"CommentedCode">;? (set dump-trace*)
</span>
4003 <span class=
"CommentedCode">;? (prn
401)
</span>
4004 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span>_ integer
<span class=
"Delimiter">))))
</span>
4005 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' works on primitives
"</span><span class=
"Delimiter">))
</span>
4006 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span>_ integer-address
<span class=
"Delimiter">))))
</span>
4007 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' works on addresses
"</span><span class=
"Delimiter">))
</span>
4008 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">2</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span>_ integer-boolean-pair
<span class=
"Delimiter">))))
</span>
4009 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' works on and-records
"</span><span class=
"Delimiter">))
</span>
4010 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">3</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span>_ integer-point-pair
<span class=
"Delimiter">))))
</span>
4011 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' works on and-records with and-record fields
"</span><span class=
"Delimiter">))
</span>
4013 <span class=
"CommentedCode">;? (prn
410)
</span>
4014 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span><span class=
"Constant">34</span> integer
<span class=
"Delimiter">))))
</span>
4015 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' works on primitive operands
"</span><span class=
"Delimiter">))
</span>
4016 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">1</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span><span class=
"Constant">34</span> integer-address
<span class=
"Delimiter">))))
</span>
4017 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' works on address operands
"</span><span class=
"Delimiter">))
</span>
4018 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">2</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span><span class=
"Constant">34</span> integer-boolean-pair
<span class=
"Delimiter">))))
</span>
4019 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' works on and-record operands
"</span><span class=
"Delimiter">))
</span>
4020 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">3</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span><span class=
"Constant">34</span> integer-point-pair
<span class=
"Delimiter">))))
</span>
4021 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' works on and-record operands with and-record fields
"</span><span class=
"Delimiter">))
</span>
4022 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">2</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span><span class=
"Constant">34</span> integer-boolean-pair-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
4023 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' works on pointers to and-records
"</span><span class=
"Delimiter">))
</span>
4024 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.35</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; size of array
</span>
4025 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.34</span> <span class=
"Constant">35</span><span class=
"Delimiter">)
</span>
4026 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"sizeof
" "array-len
")))
</span>
4027 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">9</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span><span class=
"Constant">34</span> integer-boolean-pair-array-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
4028 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' works on pointers to arrays
"</span><span class=
"Delimiter">))
</span>
4029 <span class=
"CommentedCode">;? (quit)
</span>
4031 <span class=
"CommentedCode">;? (prn
420)
</span>
4032 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.4</span> <span class=
"Constant">23</span><span class=
"Delimiter">)
</span>
4033 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">24</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-array
<span class=
"Delimiter">))))
</span>
4034 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' reads array lengths from memory
"</span><span class=
"Delimiter">))
</span>
4035 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
4036 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">24</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-array-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
4037 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' handles pointers to arrays
"</span><span class=
"Delimiter">))
</span>
4038 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.15</span> <span class=
"Constant">34</span><span class=
"Delimiter">)
</span>
4039 <span class=
"Delimiter">(
</span>=
<span class=
"Global">routine*
</span> make-routine!foo
<span class=
"Delimiter">)
</span>
4040 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">24</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-array
<span class=
"Delimiter">))))
</span>
4041 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' reads array lengths from memory inside routines
"</span><span class=
"Delimiter">))
</span>
4042 <span class=
"Delimiter">(
</span>= rep.routine*!call-stack
.0!default-space
<span class=
"Constant">10</span><span class=
"Delimiter">)
</span>
4043 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.10</span> <span class=
"Constant">5</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; bounds check for default-space
</span>
4044 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">35</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-array
<span class=
"Delimiter">))))
</span>
4045 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' reads array lengths from memory using default-space
"</span><span class=
"Delimiter">))
</span>
4046 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.35</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; size of array
</span>
4047 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.15</span> <span class=
"Constant">35</span><span class=
"Delimiter">)
</span>
4048 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"sizeof
")))
</span>
4049 <span class=
"Delimiter">(
</span>aif rep.routine*!error
<span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"error -
"</span> it
<span class=
"Delimiter">))
</span>
4050 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">9</span> <span class=
"Delimiter">(
</span>sizeof
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-boolean-pair-array-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
4051 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'sizeof' works on pointers to arrays using default-space
"</span><span class=
"Delimiter">))
</span>
4052 <span class=
"CommentedCode">;? (quit)
</span>
4054 <span class=
"Comment">; m
</span>
4055 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"== m
"</span><span class=
"Delimiter">)
</span>
4056 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
4057 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">4</span> <span class=
"Delimiter">(
</span>m
<span class=
"Delimiter">'((
</span><span class=
"MuConstant">4</span> literal
<span class=
"Delimiter">))))
</span>
4058 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'm' avoids reading memory for literals
"</span><span class=
"Delimiter">))
</span>
4059 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">4</span> <span class=
"Delimiter">(
</span>m
<span class=
"Delimiter">'((
</span><span class=
"MuConstant">4</span> offset
<span class=
"Delimiter">))))
</span>
4060 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'm' avoids reading memory for offsets
"</span><span class=
"Delimiter">))
</span>
4061 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.4</span> <span class=
"Constant">34</span><span class=
"Delimiter">)
</span>
4062 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">34</span> <span class=
"Delimiter">(
</span>m
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))))
</span>
4063 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'm' reads memory for simple types
"</span><span class=
"Delimiter">))
</span>
4064 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.3</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
4065 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">34</span> <span class=
"Delimiter">(
</span>m
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
4066 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'm' redirects addresses
"</span><span class=
"Delimiter">))
</span>
4067 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">3</span><span class=
"Delimiter">)
</span>
4068 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">34</span> <span class=
"Delimiter">(
</span>m
<span class=
"Delimiter">'((
</span><span class=
"Constant">2</span> integer-address-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
4069 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'm' multiply redirects addresses
"</span><span class=
"Delimiter">))
</span>
4070 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">34</span> nil
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>m
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-boolean-pair
<span class=
"Delimiter">))))
</span>
4071 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'm' supports compound records
"</span><span class=
"Delimiter">))
</span>
4072 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.5</span> <span class=
"Constant">35</span><span class=
"Delimiter">)
</span>
4073 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.6</span> <span class=
"Constant">36</span><span class=
"Delimiter">)
</span>
4074 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">34</span> <span class=
"Constant">35</span> <span class=
"Constant">36</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>m
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-point-pair
<span class=
"Delimiter">))))
</span>
4075 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'm' supports records with compound fields
"</span><span class=
"Delimiter">))
</span>
4076 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">34</span> <span class=
"Constant">35</span> <span class=
"Constant">36</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>m
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-point-pair-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
4077 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'm' supports indirect access to records
"</span><span class=
"Delimiter">))
</span>
4078 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.4</span> <span class=
"Constant">2</span><span class=
"Delimiter">)
</span>
4079 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">2</span> <span class=
"Constant">35</span> <span class=
"Constant">36</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>m
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-array
<span class=
"Delimiter">))))
</span>
4080 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'm' supports access to arrays
"</span><span class=
"Delimiter">))
</span>
4081 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">2</span> <span class=
"Constant">35</span> <span class=
"Constant">36</span><span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>m
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-array-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))))
</span>
4082 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'm' supports indirect access to arrays
"</span><span class=
"Delimiter">))
</span>
4084 <span class=
"Delimiter">(
</span>=
<span class=
"Global">routine*
</span> make-routine!foo
<span class=
"Delimiter">)
</span>
4085 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.10</span> <span class=
"Constant">5</span><span class=
"Delimiter">)
</span> <span class=
"Comment">; fake array
</span>
4086 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.12</span> <span class=
"Constant">34</span><span class=
"Delimiter">)
</span>
4087 <span class=
"Delimiter">(
</span>= rep.routine*!globals
<span class=
"Constant">10</span><span class=
"Delimiter">)
</span>
4088 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~iso
<span class=
"Constant">34</span> <span class=
"Delimiter">(
</span>m
<span class=
"Delimiter">'((
</span><span class=
"Constant">1</span> integer
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>space global
<span class=
"Delimiter">))))
</span>
4089 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'm' supports access to per-routine globals
"</span><span class=
"Delimiter">))
</span>
4091 <span class=
"Comment">; setm
</span>
4092 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"== setm
"</span><span class=
"Delimiter">)
</span>
4093 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span>
4094 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer
<span class=
"Delimiter">))
</span> <span class=
"Constant">34</span><span class=
"Delimiter">)
</span>
4095 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">34</span> <span class=
"Global">memory*
</span><span class=
"Constant">.4</span><span class=
"Delimiter">)
</span>
4096 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' writes primitives to memory
"</span><span class=
"Delimiter">))
</span>
4097 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-address
<span class=
"Delimiter">))
</span> <span class=
"Constant">4</span><span class=
"Delimiter">)
</span>
4098 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">4</span> <span class=
"Global">memory*
</span><span class=
"Constant">.3</span><span class=
"Delimiter">)
</span>
4099 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' writes addresses to memory
"</span><span class=
"Delimiter">))
</span>
4100 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))
</span> <span class=
"Constant">35</span><span class=
"Delimiter">)
</span>
4101 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">35</span> <span class=
"Global">memory*
</span><span class=
"Constant">.4</span><span class=
"Delimiter">)
</span>
4102 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' redirects writes
"</span><span class=
"Delimiter">))
</span>
4103 <span class=
"Delimiter">(
</span>=
<span class=
"Global">memory*
</span><span class=
"Constant">.2</span> <span class=
"Constant">3</span><span class=
"Delimiter">)
</span>
4104 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">2</span> integer-address-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))
</span> <span class=
"Constant">36</span><span class=
"Delimiter">)
</span>
4105 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~is
<span class=
"Constant">36</span> <span class=
"Global">memory*
</span><span class=
"Constant">.4</span><span class=
"Delimiter">)
</span>
4106 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' multiply redirects writes
"</span><span class=
"Delimiter">))
</span>
4107 <span class=
"CommentedCode">;? (prn
505)
</span>
4108 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-integer-pair
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">23</span> <span class=
"Constant">24</span><span class=
"Delimiter">)))
</span>
4109 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains
<span class=
"Constant">4</span> <span class=
"Delimiter">'(
</span><span class=
"Constant">23</span> <span class=
"Constant">24</span><span class=
"Delimiter">))
</span>
4110 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' writes compound records
"</span><span class=
"Delimiter">))
</span>
4111 <span class=
"Delimiter">(
</span>assert
<span class=
"Delimiter">(
</span>is
<span class=
"Global">memory*
</span><span class=
"Constant">.7</span> nil
<span class=
"Delimiter">))
</span>
4112 <span class=
"CommentedCode">;? (prn
506)
</span>
4113 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">7</span> integer-point-pair
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">23</span> <span class=
"Constant">24</span> <span class=
"Constant">25</span><span class=
"Delimiter">)))
</span>
4114 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains
<span class=
"Constant">7</span> <span class=
"Delimiter">'(
</span><span class=
"Constant">23</span> <span class=
"Constant">24</span> <span class=
"Constant">25</span><span class=
"Delimiter">))
</span>
4115 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' writes records with compound fields
"</span><span class=
"Delimiter">))
</span>
4116 <span class=
"Delimiter">(
</span>=
<span class=
"Global">routine*
</span> make-routine!foo
<span class=
"Delimiter">)
</span>
4117 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-point-pair
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">33</span> <span class=
"Constant">34</span><span class=
"Delimiter">)))
</span>
4118 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~posmatch
<span class=
"Constant">"incorrect size
"</span> rep.routine*!error
<span class=
"Delimiter">)
</span>
4119 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' checks size of target
"</span><span class=
"Delimiter">))
</span>
4120 <span class=
"Delimiter">(
</span>wipe
<span class=
"Global">routine*
</span><span class=
"Delimiter">)
</span>
4121 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-point-pair-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">43</span> <span class=
"Constant">44</span> <span class=
"Constant">45</span><span class=
"Delimiter">)))
</span>
4122 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains
<span class=
"Constant">4</span> <span class=
"Delimiter">'(
</span><span class=
"Constant">43</span> <span class=
"Constant">44</span> <span class=
"Constant">45</span><span class=
"Delimiter">))
</span>
4123 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' supports indirect writes to records
"</span><span class=
"Delimiter">))
</span>
4124 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">2</span> integer-point-pair-address-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">53</span> <span class=
"Constant">54</span> <span class=
"Constant">55</span><span class=
"Delimiter">)))
</span>
4125 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains
<span class=
"Constant">4</span> <span class=
"Delimiter">'(
</span><span class=
"Constant">53</span> <span class=
"Constant">54</span> <span class=
"Constant">55</span><span class=
"Delimiter">))
</span>
4126 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' supports multiply indirect writes to records
"</span><span class=
"Delimiter">))
</span>
4127 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-array
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">2</span> <span class=
"Constant">31</span> <span class=
"Constant">32</span><span class=
"Delimiter">)))
</span>
4128 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains
<span class=
"Constant">4</span> <span class=
"Delimiter">'(
</span><span class=
"Constant">2</span> <span class=
"Constant">31</span> <span class=
"Constant">32</span><span class=
"Delimiter">))
</span>
4129 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' writes arrays
"</span><span class=
"Delimiter">))
</span>
4130 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">3</span> integer-array-address
<span class=
"Delimiter">)
</span> <span class=
"Delimiter">(
</span>deref
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">2</span> <span class=
"Constant">41</span> <span class=
"Constant">42</span><span class=
"Delimiter">)))
</span>
4131 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~memory-contains
<span class=
"Constant">4</span> <span class=
"Delimiter">'(
</span><span class=
"Constant">2</span> <span class=
"Constant">41</span> <span class=
"Constant">42</span><span class=
"Delimiter">))
</span>
4132 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' supports indirect writes to arrays
"</span><span class=
"Delimiter">))
</span>
4133 <span class=
"Delimiter">(
</span>=
<span class=
"Global">routine*
</span> make-routine!foo
<span class=
"Delimiter">)
</span>
4134 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-array
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">2</span> <span class=
"Constant">31</span> <span class=
"Constant">32</span> <span class=
"Constant">33</span><span class=
"Delimiter">)))
</span>
4135 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~posmatch
<span class=
"Constant">"invalid array
"</span> rep.routine*!error
<span class=
"Delimiter">)
</span>
4136 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' checks that array written is well-formed
"</span><span class=
"Delimiter">))
</span>
4137 <span class=
"Delimiter">(
</span>=
<span class=
"Global">routine*
</span> make-routine!foo
<span class=
"Delimiter">)
</span>
4138 <span class=
"CommentedCode">;? (prn
111)
</span>
4139 <span class=
"CommentedCode">;? (= dump-trace* (obj whitelist '(
"sizeof
" "setm
")))
</span>
4140 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-boolean-pair-array
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">2</span> <span class=
"Constant">31</span> nil
<span class=
"Constant">32</span> nil
<span class=
"Constant">33</span><span class=
"Delimiter">)))
</span>
4141 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>~posmatch
<span class=
"Constant">"invalid array
"</span> rep.routine*!error
<span class=
"Delimiter">)
</span>
4142 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' checks that array of records is well-formed
"</span><span class=
"Delimiter">))
</span>
4143 <span class=
"Delimiter">(
</span>=
<span class=
"Global">routine*
</span> make-routine!foo
<span class=
"Delimiter">)
</span>
4144 <span class=
"CommentedCode">;? (prn
222)
</span>
4145 <span class=
"Delimiter">(
</span>setm
<span class=
"Delimiter">'((
</span><span class=
"Constant">4</span> integer-boolean-pair-array
<span class=
"Delimiter">))
</span> <span class=
"Delimiter">(
</span>annotate
<span class=
"Delimiter">'
</span>record
<span class=
"Delimiter">'(
</span><span class=
"Constant">2</span> <span class=
"Constant">31</span> nil
<span class=
"Constant">32</span> nil
<span class=
"Delimiter">)))
</span>
4146 <span class=
"Delimiter">(
</span><span class=
"Normal">if
</span> <span class=
"Delimiter">(
</span>posmatch
<span class=
"Constant">"invalid array
"</span> rep.routine*!error
<span class=
"Delimiter">)
</span>
4147 <span class=
"Delimiter">(
</span>prn
<span class=
"Constant">"F - 'setm' checks that array of records is well-formed -
2"</span><span class=
"Delimiter">))
</span>
4148 <span class=
"Delimiter">(
</span>wipe
<span class=
"Global">routine*
</span><span class=
"Delimiter">)
</span>
4150 <span class=
"Delimiter">(
</span>reset
<span class=
"Delimiter">)
</span> <span class=
"Comment">; end file with this to persist the trace for the final test
</span>
4154 <!-- vim: set foldmethod=manual : -->