about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-12-30 14:41:12 -0800
committerKartik K. Agaram <vc@akkartik.com>2014-12-30 14:41:12 -0800
commite17817c7e0bd6f8bff6d621641f6826fe3f8b68e (patch)
tree5ec3965bf4878e36f946d7d2ba0dea59ea46843a
parent1f00ad3730efb3c48126d13be6243ca3af8db804 (diff)
downloadmu-e17817c7e0bd6f8bff6d621641f6826fe3f8b68e.tar.gz
465
-rw-r--r--mu.arc11
1 files changed, 6 insertions, 5 deletions
diff --git a/mu.arc b/mu.arc
index 6299e054..32aa280d 100644
--- a/mu.arc
+++ b/mu.arc
@@ -76,9 +76,9 @@
 ; things that a future assembler will need separate memory for:
 ;   code; types; args channel
 (def clear ()
-  (= type* (table))
-  (= memory* (table))
-  (= function* (table))
+  (= type* (table))  ; name -> type info
+  (= memory* (table))  ; address -> value
+  (= function* (table))  ; name -> [instructions]
   )
 (enq clear initialization-fns*)
 
@@ -940,8 +940,8 @@
         (trace "cn0" instr " " canon.location " " canon.isa-field)
         (let (oargs op args)  (parse-instr instr)
 ;?           (tr "about to rename args")
-          ; rename args
           (if (in op 'get 'get-address)
+            ; special case: map field offset by looking up type table
             (with (basetype  (typeof args.0)
                    field  (v args.1))
               (assert type*.basetype!and-record "get on non-record @args.0")
@@ -958,13 +958,14 @@
                         (trace "cn0" "field location @idx")
                         (= location.field idx))
                     (assert nil "couldn't find field in @instr")))))
+            ; map args to location indices
             (each arg args
               (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 "about to rename oargs")
-          ; rename oargs
+          ; map oargs to location indices
           (each arg oargs
             (trace "cn0" "checking " arg)
             (when (and nondummy.arg not-raw-string.arg)