diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-12-14 12:36:42 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-12-14 12:41:03 -0800 |
commit | 6c8f19d2be6eb4cd227c2ba6f3e189b8f3a72608 (patch) | |
tree | 96cfd7e5d96c9c4b4ff2ca347b5725e735be4080 | |
parent | 7b2a710e32b65120638a42bd7c38f05bff380ca3 (diff) | |
download | mu-6c8f19d2be6eb4cd227c2ba6f3e189b8f3a72608.tar.gz |
427 - ..and we're back. All mu.arc.t tests passing.
-rw-r--r-- | mu.arc | 427 | ||||
-rw-r--r-- | mu.arc.t | 262 |
2 files changed, 360 insertions, 329 deletions
diff --git a/mu.arc b/mu.arc index 2648078e..cfacf0e6 100644 --- a/mu.arc +++ b/mu.arc @@ -11,7 +11,7 @@ (mac init-fn (name . body) `(enq (fn () ;? (prn ',name) - (= (function* ',name) (convert-names:convert-labels:convert-braces:insert-code ',body ',name))) + (= (function* ',name) (convert-names:convert-labels:convert-braces:tokenize-args:insert-code ',body ',name))) initialization-fns*)) ;; persisting and checking traces for each test @@ -288,10 +288,8 @@ ;; running a single routine -; operand accessors -(def nondummy (operand) ; precondition for helpers below - (~is '_ operand)) - +; value of an arg or oarg, stripping away all metadata +; wish I could have this flag an error when arg is incorrectly formed (mac v (operand) ; for value `((,operand 0) 0)) @@ -314,6 +312,15 @@ (or (types* ty.operand.0) (err "unknown type @(tostring prn.operand)"))) +; operand accessors +(def nondummy (operand) ; precondition for helpers below + (~is '_ operand)) + +; just for convenience, 'new' instruction sometimes takes a raw string and +; allocates just enough space to store it +(def not-raw-string (operand) + (~isa operand 'string)) + ($:require "charterm/main.rkt") ; run instructions from 'routine*' for 'time-slice' @@ -459,7 +466,7 @@ ; tagged-values require one primitive save-type - (annotate 'record `(,(ty arg.0) ,(m arg.0))) + (annotate 'record `(,((ty arg.0) 0) ,(m arg.0))) ; multiprocessing run @@ -477,6 +484,7 @@ (assert (m arg.0)) sleep (let operand arg.0 +;? (tr "sleep " operand) ; store sleep as either (<cycle number> literal) or (<location> <current value>) (if (is ty.operand.0 'literal) (let delay v.operand @@ -744,6 +752,7 @@ ;; desugar structured assembly based on blocks (def convert-braces (instrs) +;? (prn "convert-braces " instrs) (let locs () ; list of information on each brace: (open/close pc) (let pc 0 (loop (instrs instrs) @@ -874,6 +883,8 @@ (continue)) (trace "cn0" instr " " canon.location " " canon.isa-field) (let (oargs op args) (parse-instr instr) +;? (tr "1") + ; rename args (if (in op 'get 'get-address) (with (basetype (typeinfo args.0) field (v args.1)) @@ -895,12 +906,15 @@ (= location.field idx)) (assert nil "couldn't find field in @instr"))))) (each arg args - (assert (~isa-field v.arg) "arg @arg is also a field name") - (when (maybe-add arg location idx) - (err "use before set: @arg")))) + (when (and nondummy.arg not-raw-string.arg) + (assert (~isa-field v.arg) "arg @arg is also a field name") + (when (maybe-add arg location idx) + (err "use before set: @arg"))))) +;? (tr "2") + ; rename oargs (each arg oargs (trace "cn0" "checking " arg) - (unless (is arg '_) + (when (and nondummy.arg not-raw-string.arg) (assert (~isa-field v.arg) "oarg @arg is also a field name") (when (maybe-add arg location idx) (trace "cn0" "location for arg " arg ": " idx) @@ -911,10 +925,10 @@ (when (acons instr) (let (oargs op args) (parse-instr instr) (each arg args - (when (and nondummy.arg (location v.arg)) + (when (and nondummy.arg not-raw-string.arg (location v.arg)) (zap location v.arg))) (each arg oargs - (when (and nondummy.arg (location v.arg)) + (when (and nondummy.arg not-raw-string.arg (location v.arg)) (zap location v.arg)))))) instrs)) @@ -995,328 +1009,328 @@ (section 100 (init-fn maybe-coerce - ((default-scope scope-address) <- new (scope literal) (30 literal)) - ((x tagged-value-address) <- new (tagged-value literal)) - ((x tagged-value-address deref) <- next-input) - ((p type) <- next-input) - ((xtype type) <- get (x tagged-value-address deref) (0 offset)) - ((match? boolean) <- equal (xtype type) (p type)) + (default-scope:scope-address <- new scope:literal 30:literal) + (x:tagged-value-address <- new tagged-value:literal) + (x:tagged-value-address/deref <- next-input) + (p:type <- next-input) + (xtype:type <- get x:tagged-value-address/deref 0:offset) + (match?:boolean <- equal xtype:type p:type) { begin - (break-if (match? boolean)) - (reply (0 literal) (nil literal)) + (break-if match?:boolean) + (reply 0:literal nil:literal) } - ((xvalue location) <- get (x tagged-value-address deref) (1 offset)) - (reply (xvalue location) (match? boolean))) + (xvalue:location <- get x:tagged-value-address/deref 1:offset) + (reply xvalue:location match?:boolean)) (init-fn new-tagged-value - ((default-scope scope-address) <- new (scope literal) (30 literal)) - ; assert (sizeof arg.0) == 1 - ((xtype type) <- next-input) - ((xtypesize integer) <- sizeof (xtype type)) - ((xcheck boolean) <- equal (xtypesize integer) (1 literal)) - (assert (xcheck boolean)) + (default-scope:scope-address <- new scope:literal 30:literal) + ; assert sizeof:arg.0 == 1 + (xtype:type <- next-input) + (xtypesize:integer <- sizeof xtype:type) + (xcheck:boolean <- equal xtypesize:integer 1:literal) + (assert xcheck:boolean) ; todo: check that arg 0 matches the type? or is that for the future typechecker? - ((result tagged-value-address) <- new (tagged-value literal)) + (result:tagged-value-address <- new tagged-value:literal) ; result->type = arg 0 - ((resulttype location) <- get-address (result tagged-value-address deref) (type offset)) - ((resulttype location deref) <- copy (xtype type)) + (resulttype:location <- get-address result:tagged-value-address/deref type:offset) + (resulttype:location/deref <- copy xtype:type) ; result->payload = arg 1 - ((locaddr location) <- get-address (result tagged-value-address deref) (payload offset)) - ((locaddr location deref) <- next-input) - (reply (result tagged-value-address))) + (locaddr:location <- get-address result:tagged-value-address/deref payload:offset) + (locaddr:location/deref <- next-input) + (reply result:tagged-value-address)) (init-fn list-next ; list-address -> list-address - ((default-scope scope-address) <- new (scope literal) (30 literal)) - ((base list-address) <- next-input) - ((result list-address) <- get (base list-address deref) (cdr offset)) - (reply (result list-address))) + (default-scope:scope-address <- new scope:literal 30:literal) + (base:list-address <- next-input) + (result:list-address <- get base:list-address/deref cdr:offset) + (reply result:list-address)) (init-fn list-value-address ; list-address -> tagged-value-address - ((default-scope scope-address) <- new (scope literal) (30 literal)) - ((base list-address) <- next-input) - ((result tagged-value-address) <- get-address (base list-address deref) (car offset)) - (reply (result tagged-value-address))) + (default-scope:scope-address <- new scope:literal 30:literal) + (base:list-address <- next-input) + (result:tagged-value-address <- get-address base:list-address/deref car:offset) + (reply result:tagged-value-address)) (init-fn new-list - ((default-scope scope-address) <- new (scope literal) (30 literal)) + (default-scope:scope-address <- new scope:literal 30:literal) ; new-list = curr = new list - ((new-list-result list-address) <- new (list literal)) - ((curr list-address) <- copy (new-list-result list-address)) + (new-list-result:list-address <- new list:literal) + (curr:list-address <- copy new-list-result:list-address) { begin ; while read curr-value - ((curr-value integer) (exists? boolean) <- next-input) - (break-unless (exists? boolean)) + (curr-value:integer exists?:boolean <- next-input) + (break-unless exists?:boolean) ; curr.cdr = new list - ((next list-address-address) <- get-address (curr list-address deref) (cdr offset)) - ((next list-address-address deref) <- new (list literal)) + (next:list-address-address <- get-address curr:list-address/deref cdr:offset) + (next:list-address-address/deref <- new list:literal) ; curr = curr.cdr - ((curr list-address) <- list-next (curr list-address)) - ; curr.car = (type curr-value) - ((dest tagged-value-address) <- list-value-address (curr list-address)) - ((dest tagged-value-address deref) <- save-type (curr-value integer)) + (curr:list-address <- list-next curr:list-address) + ; curr.car = type:curr-value + (dest:tagged-value-address <- list-value-address curr:list-address) + (dest:tagged-value-address/deref <- save-type curr-value:integer) (loop) } ; return new-list.cdr - ((new-list-result list-address) <- list-next (new-list-result list-address)) ; memory leak - (reply (new-list-result list-address))) + (new-list-result:list-address <- list-next new-list-result:list-address) ; memory leak + (reply new-list-result:list-address)) (init-fn new-channel - ((default-scope scope-address) <- new (scope literal) (30 literal)) + (default-scope:scope-address <- new scope:literal 30:literal) ; result = new channel - ((result channel-address) <- new (channel literal)) + (result:channel-address <- new channel:literal) ; result.first-full = 0 - ((full integer-address) <- get-address (result channel-address deref) (first-full offset)) - ((full integer-address deref) <- copy (0 literal)) + (full:integer-address <- get-address result:channel-address/deref first-full:offset) + (full:integer-address/deref <- copy 0:literal) ; result.first-free = 0 - ((free integer-address) <- get-address (result channel-address deref) (first-free offset)) - ((free integer-address deref) <- copy (0 literal)) + (free:integer-address <- get-address result:channel-address/deref first-free:offset) + (free:integer-address/deref <- copy 0:literal) ; result.circular-buffer = new tagged-value[arg+1] - ((capacity integer) <- next-input) - ((capacity integer) <- add (capacity integer) (1 literal)) ; unused slot for full? below - ((channel-buffer-address tagged-value-array-address-address) <- get-address (result channel-address deref) (circular-buffer offset)) - ((channel-buffer-address tagged-value-array-address-address deref) <- new (tagged-value-array literal) (capacity integer)) - (reply (result channel-address))) + (capacity:integer <- next-input) + (capacity:integer <- add capacity:integer 1:literal) ; unused slot for full? below + (channel-buffer-address:tagged-value-array-address-address <- get-address result:channel-address/deref circular-buffer:offset) + (channel-buffer-address:tagged-value-array-address-address/deref <- new tagged-value-array:literal capacity:integer) + (reply result:channel-address)) (init-fn capacity - ((default-scope scope-address) <- new (scope literal) (30 literal)) - ((chan channel) <- next-input) - ((q tagged-value-array-address) <- get (chan channel) (circular-buffer offset)) - ((qlen integer) <- length (q tagged-value-array-address deref)) - (reply (qlen integer))) + (default-scope:scope-address <- new scope:literal 30:literal) + (chan:channel <- next-input) + (q:tagged-value-array-address <- get chan:channel circular-buffer:offset) + (qlen:integer <- length q:tagged-value-array-address/deref) + (reply qlen:integer)) (init-fn write - ((default-scope scope-address) <- new (scope literal) (30 literal)) - ((chan channel-address) <- next-input) - ((val tagged-value) <- next-input) + (default-scope:scope-address <- new scope:literal 30:literal) + (chan:channel-address <- next-input) + (val:tagged-value <- next-input) { begin ; block if chan is full - ((full boolean) <- full? (chan channel-address deref)) - (break-unless (full boolean)) - ((full-address integer-address) <- get-address (chan channel-address deref) (first-full offset)) - (sleep (full-address integer-address deref)) + (full:boolean <- full? chan:channel-address/deref) + (break-unless full:boolean) + (full-address:integer-address <- get-address chan:channel-address/deref first-full:offset) + (sleep full-address:integer-address/deref) } ; store val - ((q tagged-value-array-address) <- get (chan channel-address deref) (circular-buffer offset)) - ((free integer-address) <- get-address (chan channel-address deref) (first-free offset)) - ((dest tagged-value-address) <- index-address (q tagged-value-array-address deref) (free integer-address deref)) - ((dest tagged-value-address deref) <- copy (val tagged-value)) + (q:tagged-value-array-address <- get chan:channel-address/deref circular-buffer:offset) + (free:integer-address <- get-address chan:channel-address/deref first-free:offset) + (dest:tagged-value-address <- index-address q:tagged-value-array-address/deref free:integer-address/deref) + (dest:tagged-value-address/deref <- copy val:tagged-value) ; increment free - ((free integer-address deref) <- add (free integer-address deref) (1 literal)) + (free:integer-address/deref <- add free:integer-address/deref 1:literal) { begin ; wrap free around to 0 if necessary - ((qlen integer) <- length (q tagged-value-array-address deref)) - ((remaining? boolean) <- less-than (free integer-address deref) (qlen integer)) - (break-if (remaining? boolean)) - ((free integer-address deref) <- copy (0 literal)) + (qlen:integer <- length q:tagged-value-array-address/deref) + (remaining?:boolean <- less-than free:integer-address/deref qlen:integer) + (break-if remaining?:boolean) + (free:integer-address/deref <- copy 0:literal) } - (reply (chan channel-address deref))) + reply:chan:channel-address/deref) (init-fn read - ((default-scope scope-address) <- new (scope literal) (30 literal)) - ((chan channel-address) <- next-input) + (default-scope:scope-address <- new scope:literal 30:literal) + (chan:channel-address <- next-input) { begin ; block if chan is empty - ((empty boolean) <- empty? (chan channel-address deref)) - (break-unless (empty boolean)) - ((free-address integer-address) <- get-address (chan channel-address deref) (first-free offset)) - (sleep (free-address integer-address deref)) + (empty:boolean <- empty? chan:channel-address/deref) + (break-unless empty:boolean) + (free-address:integer-address <- get-address chan:channel-address/deref first-free:offset) + (sleep free-address:integer-address/deref) } ; read result - ((full integer-address) <- get-address (chan channel-address deref) (first-full offset)) - ((q tagged-value-array-address) <- get (chan channel-address deref) (circular-buffer offset)) - ((result tagged-value) <- index (q tagged-value-array-address deref) (full integer-address deref)) + (full:integer-address <- get-address chan:channel-address/deref first-full:offset) + (q:tagged-value-array-address <- get chan:channel-address/deref circular-buffer:offset) + (result:tagged-value <- index q:tagged-value-array-address/deref full:integer-address/deref) ; increment full - ((full integer-address deref) <- add (full integer-address deref) (1 literal)) + (full:integer-address/deref <- add full:integer-address/deref 1:literal) { begin ; wrap full around to 0 if necessary - ((qlen integer) <- length (q tagged-value-array-address deref)) - ((remaining? boolean) <- less-than (full integer-address deref) (qlen integer)) - (break-if (remaining? boolean)) - ((full integer-address deref) <- copy (0 literal)) + (qlen:integer <- length q:tagged-value-array-address/deref) + (remaining?:boolean <- less-than full:integer-address/deref qlen:integer) + (break-if remaining?:boolean) + (full:integer-address/deref <- copy 0:literal) } - (reply (result tagged-value) (chan channel-address deref))) + (reply result:tagged-value chan:channel-address/deref)) ; An empty channel has first-empty and first-full both at the same value. (init-fn empty? - ((default-scope scope-address) <- new (scope literal) (30 literal)) + (default-scope:scope-address <- new scope:literal 30:literal) ; return arg.first-full == arg.first-free - ((chan channel) <- next-input) - ((full integer) <- get (chan channel) (first-full offset)) - ((free integer) <- get (chan channel) (first-free offset)) - ((result boolean) <- equal (full integer) (free integer)) - (reply (result boolean))) + (chan:channel <- next-input) + (full:integer <- get chan:channel first-full:offset) + (free:integer <- get chan:channel first-free:offset) + (result:boolean <- equal full:integer free:integer) + (reply result:boolean)) ; A full channel has first-empty just before first-full, wasting one slot. ; (Other alternatives: https://en.wikipedia.org/wiki/Circular_buffer#Full_.2F_Empty_Buffer_Distinction) (init-fn full? - ((default-scope scope-address) <- new (scope literal) (30 literal)) - ((chan channel) <- next-input) + (default-scope:scope-address <- new scope:literal 30:literal) + (chan:channel <- next-input) ; curr = chan.first-free + 1 - ((curr integer) <- get (chan channel) (first-free offset)) - ((curr integer) <- add (curr integer) (1 literal)) + (curr:integer <- get chan:channel first-free:offset) + (curr:integer <- add curr:integer 1:literal) { begin ; if (curr == chan.capacity) curr = 0 - ((qlen integer) <- capacity (chan channel)) - ((remaining? boolean) <- less-than (curr integer) (qlen integer)) - (break-if (remaining? boolean)) - ((curr integer) <- copy (0 literal)) + (qlen:integer <- capacity chan:channel) + (remaining?:boolean <- less-than curr:integer qlen:integer) + (break-if remaining?:boolean) + (curr:integer <- copy 0:literal) } ; return chan.first-full == curr - ((full integer) <- get (chan channel) (first-full offset)) - ((result boolean) <- equal (full integer) (curr integer)) - (reply (result boolean))) + (full:integer <- get chan:channel first-full:offset) + (result:boolean <- equal full:integer curr:integer) + (reply result:boolean)) (init-fn strcat - ((default-scope scope-address) <- new (scope literal) (30 literal)) + (default-scope:scope-address <- new scope:literal 30:literal) ; result = new string[a.length + b.length] - ((a string-address) <- next-input) - ((a-len integer) <- length (a string-address deref)) - ((b string-address) <- next-input) - ((b-len integer) <- length (b string-address deref)) - ((result-len integer) <- add (a-len integer) (b-len integer)) - ((result string-address) <- new (string literal) (result-len integer)) + (a:string-address <- next-input) + (a-len:integer <- length a:string-address/deref) + (b:string-address <- next-input) + (b-len:integer <- length b:string-address/deref) + (result-len:integer <- add a-len:integer b-len:integer) + (result:string-address <- new string:literal result-len:integer) ; copy a into result - ((result-idx integer) <- copy (0 literal)) - ((i integer) <- copy (0 literal)) + (result-idx:integer <- copy 0:literal) + (i:integer <- copy 0:literal) { begin ; while (i < a.length) - ((a-done? boolean) <- less-than (i integer) (a-len integer)) - (break-unless (a-done? boolean)) + (a-done?:boolean <- less-than i:integer a-len:integer) + (break-unless a-done?:boolean) ; result[result-idx] = a[i] - ((out byte-address) <- index-address (result string-address deref) (result-idx integer)) - ((in byte) <- index (a string-address deref) (i integer)) - ((out byte-address deref) <- copy (in byte)) + (out:byte-address <- index-address result:string-address/deref result-idx:integer) + (in:byte <- index a:string-address/deref i:integer) + (out:byte-address/deref <- copy in:byte) ; ++i - ((i integer) <- add (i integer) (1 literal)) + (i:integer <- add i:integer 1:literal) ; ++result-idx - ((result-idx integer) <- add (result-idx integer) (1 literal)) + (result-idx:integer <- add result-idx:integer 1:literal) (loop) } ; copy b into result - ((i integer) <- copy (0 literal)) + (i:integer <- copy 0:literal) { begin ; while (i < b.length) - ((b-done? boolean) <- less-than (i integer) (b-len integer)) - (break-unless (b-done? boolean)) + (b-done?:boolean <- less-than i:integer b-len:integer) + (break-unless b-done?:boolean) ; result[result-idx] = a[i] - ((out byte-address) <- index-address (result string-address deref) (result-idx integer)) - ((in byte) <- index (b string-address deref) (i integer)) - ((out byte-address deref) <- copy (in byte)) + (out:byte-address <- index-address result:string-address/deref result-idx:integer) + (in:byte <- index b:string-address/deref i:integer) + (out:byte-address/deref <- copy in:byte) ; ++i - ((i integer) <- add (i integer) (1 literal)) + (i:integer <- add i:integer 1:literal) ; ++result-idx - ((result-idx integer) <- add (result-idx integer) (1 literal)) + (result-idx:integer <- add result-idx:integer 1:literal) (loop) } - (reply (result string-address))) + (reply result:string-address)) ; replace underscores in first with remaining args (init-fn interpolate ; string-address template, string-address a.. - ((default-scope scope-address) <- new (scope literal) (60 literal)) - ((template string-address) <- next-input) + (default-scope:scope-address <- new scope:literal 60:literal) + (template:string-address <- next-input) ; compute result-len, space to allocate for result - ((tem-len integer) <- length (template string-address deref)) - ((result-len integer) <- copy (tem-len integer)) + (tem-len:integer <- length template:string-address/deref) + (result-len:integer <- copy tem-len:integer) { begin ; while arg received - ((a string-address) (arg-received? boolean) <- next-input) - (break-unless (arg-received? boolean)) + (a:string-address arg-received?:boolean <- next-input) + (break-unless arg-received?:boolean) ;? (print-primitive ("arg now: " literal)) -;? (print-primitive (a string-address)) -;? (print-primitive ("@" literal)) -;? (print-primitive (a string-address deref)) ; todo: test (m on scoped array) -;? (print-primitive ("\n" literal)) -;? ;? (assert (nil literal)) +;? (print-primitive a:string-address) +;? (print-primitive "@":literal) +;? print-primitive:a:string-address/deref ; todo: test (m on scoped array) +;? (print-primitive "\n":literal) +;? ;? (assert nil:literal) ; result-len = result-len + arg.length - 1 (for the 'underscore' being replaced) - ((a-len integer) <- length (a string-address deref)) - ((result-len integer) <- add (result-len integer) (a-len integer)) - ((result-len integer) <- subtract (result-len integer) (1 literal)) + (a-len:integer <- length a:string-address/deref) + (result-len:integer <- add result-len:integer a-len:integer) + (result-len:integer <- subtract result-len:integer 1:literal) ;? (print-primitive ("result-len now: " literal)) -;? (print-primitive (result-len integer)) -;? (print-primitive ("\n" literal)) +;? (print-primitive result-len:integer) +;? (print-primitive "\n":literal) (loop) } ; rewind to start of non-template args - (_ <- input (0 literal)) + (_ <- input 0:literal) ; result = new string[result-len] - ((result string-address) <- new (string literal) (result-len integer)) + (result:string-address <- new string:literal result-len:integer) ; repeatedly copy sections of template and 'holes' into result - ((result-idx integer) <- copy (0 literal)) - ((i integer) <- copy (0 literal)) + (result-idx:integer <- copy 0:literal) + (i:integer <- copy 0:literal) { begin ; while arg received - ((a string-address) (arg-received? boolean) <- next-input) - (break-unless (arg-received? boolean)) + (a:string-address arg-received?:boolean <- next-input) + (break-unless arg-received?:boolean) ; copy template into result until '_' { begin ; while (i < template.length) - ((tem-done? boolean) <- less-than (i integer) (tem-len integer)) - (break-unless (tem-done? boolean) (2 blocks)) + (tem-done?:boolean <- less-than i:integer tem-len:integer) + (break-unless tem-done?:boolean 2:blocks) ; while template[i] != '_' - ((in byte) <- index (template string-address deref) (i integer)) - ((underscore? boolean) <- equal (in byte) (#\_ literal)) - (break-if (underscore? boolean)) + (in:byte <- index template:string-address/deref i:integer) + (underscore?:boolean <- equal in:byte ((#\_ literal))) + (break-if underscore?:boolean) ; result[result-idx] = template[i] - ((out byte-address) <- index-address (result string-address deref) (result-idx integer)) - ((out byte-address deref) <- copy (in byte)) + (out:byte-address <- index-address result:string-address/deref result-idx:integer) + (out:byte-address/deref <- copy in:byte) ; ++i - ((i integer) <- add (i integer) (1 literal)) + (i:integer <- add i:integer 1:literal) ; ++result-idx - ((result-idx integer) <- add (result-idx integer) (1 literal)) + (result-idx:integer <- add result-idx:integer 1:literal) (loop) } ;? (print-primitive ("i now: " literal)) -;? (print-primitive (i integer)) -;? (print-primitive ("\n" literal)) +;? (print-primitive i:integer) +;? (print-primitive "\n":literal) ; copy 'a' into result - ((j integer) <- copy (0 literal)) + (j:integer <- copy 0:literal) { begin ; while (j < a.length) - ((arg-done? boolean) <- less-than (j integer) (a-len integer)) - (break-unless (arg-done? boolean)) + (arg-done?:boolean <- less-than j:integer a-len:integer) + (break-unless arg-done?:boolean) ; result[result-idx] = a[j] - ((in byte) <- index (a string-address deref) (j integer)) + (in:byte <- index a:string-address/deref j:integer) ;? (print-primitive ("copying: " literal)) -;? (print-primitive (in byte)) +;? (print-primitive in:byte) ;? (print-primitive (" at: " literal)) -;? (print-primitive (result-idx integer)) -;? (print-primitive ("\n" literal)) - ((out byte-address) <- index-address (result string-address deref) (result-idx integer)) - ((out byte-address deref) <- copy (in byte)) +;? (print-primitive result-idx:integer) +;? (print-primitive "\n":literal) + (out:byte-address <- index-address result:string-address/deref result-idx:integer) + (out:byte-address/deref <- copy in:byte) ; ++j - ((j integer) <- add (j integer) (1 literal)) + (j:integer <- add j:integer 1:literal) ; ++result-idx - ((result-idx integer) <- add (result-idx integer) (1 literal)) + (result-idx:integer <- add result-idx:integer 1:literal) (loop) } ; skip '_' in template - ((i integer) <- add (i integer) (1 literal)) + (i:integer <- add i:integer 1:literal) ;? (print-primitive ("i now: " literal)) -;? (print-primitive (i integer)) -;? (print-primitive ("\n" literal)) +;? (print-primitive i:integer) +;? (print-primitive "\n":literal) (loop) ; interpolate next arg } ; done with holes; copy rest of template directly into result { begin ; while (i < template.length) - ((tem-done? boolean) <- less-than (i integer) (tem-len integer)) - (break-unless (tem-done? boolean)) + (tem-done?:boolean <- less-than i:integer tem-len:integer) + (break-unless tem-done?:boolean) ; result[result-idx] = template[i] - ((in byte) <- index (template string-address deref) (i integer)) + (in:byte <- index template:string-address/deref i:integer) ;? (print-primitive ("copying: " literal)) -;? (print-primitive (in byte)) +;? (print-primitive in:byte) ;? (print-primitive (" at: " literal)) -;? (print-primitive (result-idx integer)) -;? (print-primitive ("\n" literal)) - ((out byte-address) <- index-address (result string-address deref) (result-idx integer)) - ((out byte-address deref) <- copy (in byte)) +;? (print-primitive result-idx:integer) +;? (print-primitive "\n":literal) + (out:byte-address <- index-address result:string-address/deref result-idx:integer) + (out:byte-address/deref <- copy in:byte) ; ++i - ((i integer) <- add (i integer) (1 literal)) + (i:integer <- add i:integer 1:literal) ; ++result-idx - ((result-idx integer) <- add (result-idx integer) (1 literal)) + (result-idx:integer <- add result-idx:integer 1:literal) (loop) } - (reply (result string-address))) + (reply result:string-address)) ) ; section 100 for system software @@ -1363,6 +1377,7 @@ ))) (def freeze-functions () +;? (prn "freeze") (each (name body) canon.function* ;? (tr name) ;? (prn keys.before* " -- " keys.after*) @@ -1382,6 +1397,7 @@ (def tokenize-args (instrs) ;? (tr "tokenize-args " instrs) +;? (prn2 "@(tostring prn.instrs) => " (accum yield (each instr instrs (if atom.instr @@ -1390,6 +1406,11 @@ (yield `{begin ,@(tokenize-args cdr.instr)}) :else (yield (map tokenize-arg instr)))))) +;? ) + +(def prn2 (msg . args) + (pr msg) + (apply prn args)) ;; test helpers diff --git a/mu.arc.t b/mu.arc.t index 6b2a2a95..041c9560 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -846,7 +846,7 @@ '((function main [ (1:integer-address <- copy 34:literal) ; pointer to nowhere (2:tagged-value-address <- new-tagged-value integer-address:literal 1:integer-address) - (3:integer-address 4:boolean <- maybe-coerce (2 tagged-value-address deref) integer-address:literal) + (3:integer-address 4:boolean <- maybe-coerce 2:tagged-value-address/deref integer-address:literal) ]))) ;? (= dump-trace* (obj blacklist '("sz" "m" "setm" "addr" "cvt0" "cvt1" "sizeof"))) (run 'main) @@ -866,20 +866,20 @@ ; 1 points at first node: tagged-value (int 34) (1:list-address <- new list:literal) (2:tagged-value-address <- list-value-address 1:list-address) - (3:type-address <- get-address (2 tagged-value-address deref) 0:offset) - ((3 type-address deref) <- copy integer:literal) - (4:location <- get-address (2 tagged-value-address deref) 1:offset) - ((4 location deref) <- copy 34:literal) - (5:list-address-address <- get-address (1 list-address deref) 1:offset) - ((5 list-address-address deref) <- new list:literal) + (3:type-address <- get-address 2:tagged-value-address/deref 0:offset) + (3:type-address/deref <- copy integer:literal) + (4:location <- get-address 2:tagged-value-address/deref 1:offset) + (4:location/deref <- copy 34:literal) + (5:list-address-address <- get-address 1:list-address/deref 1:offset) + (5:list-address-address/deref <- new list:literal) ; 6 points at second node: tagged-value (boolean t) - (6:list-address <- copy (5 list-address-address deref)) + (6:list-address <- copy 5:list-address-address/deref) (7:tagged-value-address <- list-value-address 6:list-address) - (8:type-address <- get-address (7 tagged-value-address deref) 0:offset) - ((8 type-address deref) <- copy boolean:literal) - (9:location <- get-address (7 tagged-value-address deref) 1:offset) - ((9 location deref) <- copy t:literal) - (10:list-address <- get (6 list-address deref) 1:offset) + (8:type-address <- get-address 7:tagged-value-address/deref 0:offset) + (8:type-address/deref <- copy boolean:literal) + (9:location <- get-address 7:tagged-value-address/deref 1:offset) + (9:location/deref <- copy t:literal) + (10:list-address <- get 6:list-address/deref 1:offset) ]))) (let routine make-routine!main (enq routine running-routines*) @@ -1648,6 +1648,14 @@ (prn "F - convert-names never renames nil")) (reset) +(new-trace "convert-names-string") +;? (set dump-trace*) +(if (~iso (convert-names + '((((1 integer-address)) <- ((new)) "foo"))) + '((((1 integer-address)) <- ((new)) "foo"))) + (prn "convert-names passes through raw strings (just a convenience arg for 'new')")) + +(reset) (new-trace "convert-names-global") (= traces* (queue)) (if (~iso (convert-names @@ -1988,21 +1996,21 @@ ; if it's slightly too many -- memory is plentiful ; if it's too few -- mu will raise an error (default-scope:scope-address <- new scope:literal 20:literal) - ((first-arg-box tagged-value-address) <- next-input) + (first-arg-box:tagged-value-address <- next-input) ; if given integers, add them { begin - ((first-arg integer) (match? boolean) <- maybe-coerce (first-arg-box tagged-value-address deref) (integer literal)) - (break-unless (match? boolean)) - ((second-arg-box tagged-value-address) <- next-input) - ((second-arg integer) <- maybe-coerce (second-arg-box tagged-value-address deref) (integer literal)) - ((result integer) <- add (first-arg integer) (second-arg integer)) - (reply (result integer)) + (first-arg:integer match?:boolean <- maybe-coerce first-arg-box:tagged-value-address/deref integer:literal) + (break-unless match?:boolean) + (second-arg-box:tagged-value-address <- next-input) + (second-arg:integer <- maybe-coerce second-arg-box:tagged-value-address/deref integer:literal) + (result:integer <- add first-arg:integer second-arg:integer) + (reply result:integer) } - (reply (nil literal)) + (reply nil:literal) ]) (function main [ - (1:tagged-value-address <- new-tagged-value (integer literal) 34:literal) - (2:tagged-value-address <- new-tagged-value (integer literal) 3:literal) + (1:tagged-value-address <- new-tagged-value integer:literal 34:literal) + (2:tagged-value-address <- new-tagged-value integer:literal 3:literal) (3:integer <- test1 1:tagged-value-address 2:tagged-value-address) ]))) (run 'main) @@ -2019,30 +2027,30 @@ (add-code '((function test1 [ (default-scope:scope-address <- new scope:literal 20:literal) - ((first-arg-box tagged-value-address) <- next-input) + (first-arg-box:tagged-value-address <- next-input) ; if given integers, add them { begin - ((first-arg integer) (match? boolean) <- maybe-coerce (first-arg-box tagged-value-address deref) (integer literal)) - (break-unless (match? boolean)) - ((second-arg-box tagged-value-address) <- next-input) - ((second-arg integer) <- maybe-coerce (second-arg-box tagged-value-address deref) (integer literal)) - ((result integer) <- add (first-arg integer) (second-arg integer)) - (reply (result integer)) + (first-arg:integer match?:boolean <- maybe-coerce first-arg-box:tagged-value-address/deref integer:literal) + (break-unless match?:boolean) + (second-arg-box:tagged-value-address <- next-input) + (second-arg:integer <- maybe-coerce second-arg-box:tagged-value-address/deref integer:literal) + (result:integer <- add first-arg:integer second-arg:integer) + (reply result:integer) } ; if given booleans, or them (it's a silly kind of generic function) { begin - ((first-arg boolean) (match? boolean) <- maybe-coerce (first-arg-box tagged-value-address deref) (boolean literal)) - (break-unless (match? boolean)) - ((second-arg-box tagged-value-address) <- next-input) - ((second-arg boolean) <- maybe-coerce (second-arg-box tagged-value-address deref) (boolean literal)) - ((result boolean) <- or (first-arg boolean) (second-arg boolean)) - (reply (result integer)) + (first-arg:boolean match?:boolean <- maybe-coerce first-arg-box:tagged-value-address/deref boolean:literal) + (break-unless match?:boolean) + (second-arg-box:tagged-value-address <- next-input) + (second-arg:boolean <- maybe-coerce second-arg-box:tagged-value-address/deref boolean:literal) + (result:boolean <- or first-arg:boolean second-arg:boolean) + (reply result:integer) } - (reply (nil literal)) + (reply nil:literal) ]) (function main [ - (1:tagged-value-address <- new-tagged-value (boolean literal) (t literal)) - (2:tagged-value-address <- new-tagged-value (boolean literal) (nil literal)) + (1:tagged-value-address <- new-tagged-value boolean:literal t:literal) + (2:tagged-value-address <- new-tagged-value boolean:literal nil:literal) (3:boolean <- test1 1:tagged-value-address 2:tagged-value-address) ]))) ;? (each stmt function*!test-fn @@ -2059,33 +2067,33 @@ (add-code '((function test1 [ (default-scope:scope-address <- new scope:literal 20:literal) - ((first-arg-box tagged-value-address) <- next-input) + (first-arg-box:tagged-value-address <- next-input) ; if given integers, add them { begin - ((first-arg integer) (match? boolean) <- maybe-coerce (first-arg-box tagged-value-address deref) (integer literal)) - (break-unless (match? boolean)) - ((second-arg-box tagged-value-address) <- next-input) - ((second-arg integer) <- maybe-coerce (second-arg-box tagged-value-address deref) (integer literal)) - ((result integer) <- add (first-arg integer) (second-arg integer)) - (reply (result integer)) + (first-arg:integer match?:boolean <- maybe-coerce first-arg-box:tagged-value-address/deref integer:literal) + (break-unless match?:boolean) + (second-arg-box:tagged-value-address <- next-input) + (second-arg:integer <- maybe-coerce second-arg-box:tagged-value-address/deref integer:literal) + (result:integer <- add first-arg:integer second-arg:integer) + (reply result:integer) } ; if given booleans, or them (it's a silly kind of generic function) { begin - ((first-arg boolean) (match? boolean) <- maybe-coerce (first-arg-box tagged-value-address deref) (boolean literal)) - (break-unless (match? boolean)) - ((second-arg-box tagged-value-address) <- next-input) - ((second-arg boolean) <- maybe-coerce (second-arg-box tagged-value-address deref) (boolean literal)) - ((result boolean) <- or (first-arg boolean) (second-arg boolean)) - (reply (result integer)) + (first-arg:boolean match?:boolean <- maybe-coerce first-arg-box:tagged-value-address/deref boolean:literal) + (break-unless match?:boolean) + (second-arg-box:tagged-value-address <- next-input) + (second-arg:boolean <- maybe-coerce second-arg-box:tagged-value-address/deref boolean:literal) + (result:boolean <- or first-arg:boolean second-arg:boolean) + (reply result:integer) } - (reply (nil literal)) + (reply nil:literal) ]) (function main [ - (1:tagged-value-address <- new-tagged-value (boolean literal) (t literal)) - (2:tagged-value-address <- new-tagged-value (boolean literal) (nil literal)) + (1:tagged-value-address <- new-tagged-value boolean:literal t:literal) + (2:tagged-value-address <- new-tagged-value boolean:literal nil:literal) (3:boolean <- test1 1:tagged-value-address 2:tagged-value-address) - (10:tagged-value-address <- new-tagged-value (integer literal) 34:literal) - (11:tagged-value-address <- new-tagged-value (integer literal) 3:literal) + (10:tagged-value-address <- new-tagged-value integer:literal 34:literal) + (11:tagged-value-address <- new-tagged-value integer:literal 3:literal) (12:integer <- test1 10:tagged-value-address 11:tagged-value-address) ]))) (run 'main) @@ -2505,8 +2513,8 @@ (add-code '((function main [ (1:channel-address <- new-channel 3:literal) - (2:integer <- get (1 channel-address deref) (first-full offset)) - (3:integer <- get (1 channel-address deref) (first-free offset)) + (2:integer <- get 1:channel-address/deref first-full:offset) + (3:integer <- get 1:channel-address/deref first-free:offset) ]))) ;? (set dump-trace*) (run 'main) @@ -2520,12 +2528,12 @@ (add-code '((function main [ (1:channel-address <- new-channel 3:literal) - (2:integer-address <- new (integer literal)) - ((2 integer-address deref) <- copy 34:literal) + (2:integer-address <- new integer:literal) + (2:integer-address/deref <- copy 34:literal) (3:tagged-value <- save-type 2:integer-address) - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) - (5:integer <- get (1 channel-address deref) (first-full offset)) - (6:integer <- get (1 channel-address deref) (first-free offset)) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) + (5:integer <- get 1:channel-address/deref first-full:offset) + (6:integer <- get 1:channel-address/deref first-free:offset) ]))) ;? (set dump-trace*) ;? (= dump-trace* (obj blacklist '("sz" "m" "setm" "addr" "array-len" "cvt0" "cvt1"))) @@ -2542,14 +2550,14 @@ (add-code '((function main [ (1:channel-address <- new-channel 3:literal) - (2:integer-address <- new (integer literal)) - ((2 integer-address deref) <- copy 34:literal) + (2:integer-address <- new integer:literal) + (2:integer-address/deref <- copy 34:literal) (3:tagged-value <- save-type 2:integer-address) - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) - (5:tagged-value (1 channel-address deref) <- read 1:channel-address) - (7:integer-address <- maybe-coerce 5:tagged-value (integer-address literal)) - (8:integer <- get (1 channel-address deref) (first-full offset)) - (9:integer <- get (1 channel-address deref) (first-free offset)) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) + (5:tagged-value 1:channel-address/deref <- read 1:channel-address) + (7:integer-address <- maybe-coerce 5:tagged-value integer-address:literal) + (8:integer <- get 1:channel-address/deref first-full:offset) + (9:integer <- get 1:channel-address/deref first-free:offset) ]))) ;? (set dump-trace*) ;? (= dump-trace* (obj blacklist '("sz" "m" "setm" "addr" "array-len" "cvt0" "cvt1"))) @@ -2568,17 +2576,17 @@ ; channel with 1 slot (1:channel-address <- new-channel 1:literal) ; write a value - (2:integer-address <- new (integer literal)) - ((2 integer-address deref) <- copy 34:literal) + (2:integer-address <- new integer:literal) + (2:integer-address/deref <- copy 34:literal) (3:tagged-value <- save-type 2:integer-address) - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) ; first-free will now be 1 - (5:integer <- get (1 channel-address deref) (first-free offset)) + (5:integer <- get 1:channel-address/deref first-free:offset) ; read one value - (_ (1 channel-address deref) <- read 1:channel-address) + (_ 1:channel-address/deref <- read 1:channel-address) ; write a second value; verify that first-free wraps around to 0. - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) - (6:integer <- get (1 channel-address deref) (first-free offset)) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) + (6:integer <- get 1:channel-address/deref first-free:offset) ]))) ;? (set dump-trace*) ;? (= dump-trace* (obj blacklist '("sz" "m" "setm" "addr" "array-len" "cvt0" "cvt1"))) @@ -2595,19 +2603,19 @@ ; channel with 1 slot (1:channel-address <- new-channel 1:literal) ; write a value - (2:integer-address <- new (integer literal)) - ((2 integer-address deref) <- copy 34:literal) + (2:integer-address <- new integer:literal) + (2:integer-address/deref <- copy 34:literal) (3:tagged-value <- save-type 2:integer-address) - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) ; read one value - (_ (1 channel-address deref) <- read 1:channel-address) + (_ 1:channel-address/deref <- read 1:channel-address) ; first-full will now be 1 - (5:integer <- get (1 channel-address deref) (first-full offset)) + (5:integer <- get 1:channel-address/deref first-full:offset) ; write a second value - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) ; read second value; verify that first-full wraps around to 0. - (_ (1 channel-address deref) <- read 1:channel-address) - (6:integer <- get (1 channel-address deref) (first-full offset)) + (_ 1:channel-address/deref <- read 1:channel-address) + (6:integer <- get 1:channel-address/deref first-full:offset) ]))) ;? (set dump-trace*) ;? (= dump-trace* (obj blacklist '("sz" "m" "setm" "addr" "array-len" "cvt0" "cvt1"))) @@ -2622,8 +2630,8 @@ (add-code '((function main [ (1:channel-address <- new-channel 3:literal) - (2:boolean <- empty? (1 channel-address deref)) - (3:boolean <- full? (1 channel-address deref)) + (2:boolean <- empty? 1:channel-address/deref) + (3:boolean <- full? 1:channel-address/deref) ]))) ;? (set dump-trace*) (run 'main) @@ -2637,12 +2645,12 @@ (add-code '((function main [ (1:channel-address <- new-channel 3:literal) - (2:integer-address <- new (integer literal)) - ((2 integer-address deref) <- copy 34:literal) + (2:integer-address <- new integer:literal) + (2:integer-address/deref <- copy 34:literal) (3:tagged-value <- save-type 2:integer-address) - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) - (5:boolean <- empty? (1 channel-address deref)) - (6:boolean <- full? (1 channel-address deref)) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) + (5:boolean <- empty? 1:channel-address/deref) + (6:boolean <- full? 1:channel-address/deref) ]))) ;? (set dump-trace*) (run 'main) @@ -2656,12 +2664,12 @@ (add-code '((function main [ (1:channel-address <- new-channel 1:literal) - (2:integer-address <- new (integer literal)) - ((2 integer-address deref) <- copy 34:literal) + (2:integer-address <- new integer:literal) + (2:integer-address/deref <- copy 34:literal) (3:tagged-value <- save-type 2:integer-address) - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) - (5:boolean <- empty? (1 channel-address deref)) - (6:boolean <- full? (1 channel-address deref)) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) + (5:boolean <- empty? 1:channel-address/deref) + (6:boolean <- full? 1:channel-address/deref) ]))) ;? (set dump-trace*) (run 'main) @@ -2675,14 +2683,14 @@ (add-code '((function main [ (1:channel-address <- new-channel 3:literal) - (2:integer-address <- new (integer literal)) - ((2 integer-address deref) <- copy 34:literal) + (2:integer-address <- new integer:literal) + (2:integer-address/deref <- copy 34:literal) (3:tagged-value <- save-type 2:integer-address) - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) - (_ (1 channel-address deref) <- read 1:channel-address) - (5:boolean <- empty? (1 channel-address deref)) - (6:boolean <- full? (1 channel-address deref)) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) + (_ 1:channel-address/deref <- read 1:channel-address) + (5:boolean <- empty? 1:channel-address/deref) + (6:boolean <- full? 1:channel-address/deref) ]))) ;? (set dump-trace*) (run 'main) @@ -2696,13 +2704,13 @@ (add-code '((function main [ (1:channel-address <- new-channel 3:literal) - (2:integer-address <- new (integer literal)) - ((2 integer-address deref) <- copy 34:literal) + (2:integer-address <- new integer:literal) + (2:integer-address/deref <- copy 34:literal) (3:tagged-value <- save-type 2:integer-address) - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) - (_ (1 channel-address deref) <- read 1:channel-address) - (5:boolean <- empty? (1 channel-address deref)) - (6:boolean <- full? (1 channel-address deref)) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) + (_ 1:channel-address/deref <- read 1:channel-address) + (5:boolean <- empty? 1:channel-address/deref) + (6:boolean <- full? 1:channel-address/deref) ]))) ;? (set dump-trace*) (run 'main) @@ -2720,10 +2728,10 @@ '((function main [ (1:channel-address <- new-channel 3:literal) ; channel is empty, but receives a read - (2:tagged-value (1 channel-address deref) <- read 1:channel-address) + (2:tagged-value 1:channel-address/deref <- read 1:channel-address) ]))) ;? (set dump-trace*) -;? (= dump-trace* (obj whitelist '("run"))) +;? (= dump-trace* (obj whitelist '("run" "schedule"))) (run 'main) ;? (prn int-canon.memory*) ;? (prn sleeping-routines*) @@ -2742,12 +2750,12 @@ (add-code '((function main [ (1:channel-address <- new-channel 1:literal) - (2:integer-address <- new (integer literal)) - ((2 integer-address deref) <- copy 34:literal) + (2:integer-address <- new integer:literal) + (2:integer-address/deref <- copy 34:literal) (3:tagged-value <- save-type 2:integer-address) - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) ; channel has capacity 1, but receives a second write - ((1 channel-address deref) <- write 1:channel-address 3:tagged-value) + (1:channel-address/deref <- write 1:channel-address 3:tagged-value) ]))) ;? (set dump-trace*) ;? (= dump-trace* (obj whitelist '("run" "schedule" "addr"))) @@ -2770,17 +2778,17 @@ (add-code '((function f1 [ (default-scope:scope-address <- new scope:literal 30:literal) - ((chan channel-address) <- new-channel 3:literal) - (fork (f2 fn) (chan channel-address)) - ((1 tagged-value global) <- read (chan channel-address)) ; output + (chan:channel-address <- new-channel 3:literal) + (fork f2:fn chan:channel-address) + (1:tagged-value/global <- read chan:channel-address) ; output ]) (function f2 [ (default-scope:scope-address <- new scope:literal 30:literal) - ((n integer-address) <- new (integer literal)) - ((n integer-address deref) <- copy 24:literal) - ((ochan channel-address) <- next-input) - ((x tagged-value) <- save-type (n integer-address)) - ((ochan channel-address deref) <- write (ochan channel-address) (x tagged-value)) + (n:integer-address <- new integer:literal) + (n:integer-address/deref <- copy 24:literal) + (ochan:channel-address <- next-input) + (x:tagged-value <- save-type n:integer-address) + (ochan:channel-address/deref <- write ochan:channel-address x:tagged-value) ]))) ;? (set dump-trace*) ;? (= dump-trace* (obj whitelist '("schedule" "run" "addr"))) @@ -3203,7 +3211,7 @@ (reset) (new-trace "string-new") (add-code '((function main [ - (1:string-address <- new (string literal) 5:literal) + (1:string-address <- new string:literal 5:literal) ]))) (let routine make-routine!main (enq routine running-routines*) @@ -3221,6 +3229,8 @@ (let routine make-routine!main (enq routine running-routines*) (let before rep.routine!alloc +;? (set dump-trace*) +;? (= dump-trace* (obj whitelist '("schedule" "run" "addr"))) (run) (if (~iso rep.routine!alloc (+ before 5 1)) (prn "F - 'new' allocates arrays of bytes for string literals")) |