about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-08-20 17:43:15 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-08-20 17:44:20 -0700
commit980e1bf3caaef5d87f664a4aafb7a89f501be139 (patch)
treebc7740e381cd79eb8cc0806f92accd0131ba9735
parentb9fef0471dd11b63353d20fa57358acf477cf534 (diff)
downloadmu-980e1bf3caaef5d87f664a4aafb7a89f501be139.tar.gz
58
-rw-r--r--mu.arc20
1 files changed, 11 insertions, 9 deletions
diff --git a/mu.arc b/mu.arc
index fc0d3e78..bb3788cc 100644
--- a/mu.arc
+++ b/mu.arc
@@ -44,6 +44,10 @@
 (mac ty (operand)
   `(,operand 1))  ; assume type is always first bit of metadata, and it's always present
 
+(mac sz (operand)
+  ; todo: override this for vectors
+  `((types* (ty ,operand)) 'size))
+
 (mac addr (loc)
   `(let loc@ ,loc
      (if (pos 'deref (metadata loc@))
@@ -57,20 +61,18 @@
       (++ n))))
 
 (mac m (loc)  ; for memory
-  `(withs (loc@ ,loc
-           sz@  ((types* (ty loc@)) 'size))
-;?      (prn "m " loc@ sz@)
-     (if (is 1 sz@)
+  `(let loc@ ,loc
+;?      (prn "m " loc@ sz.loc@)
+     (if (is 1 sz.loc@)
        (memory* (addr loc@))
        (annotate 'record
-                 (map memory* (addrs (addr loc@) sz@))))))
+                 (map memory* (addrs (addr loc@) sz.loc@))))))
 
 (mac setm (loc val)  ; set memory, respecting addressing-mode tags
-  `(withs (loc@ ,loc
-           sz@ ((types* (ty loc@)) 'size))
-     (if (is 1 sz@)
+  `(let loc@ ,loc
+     (if (is 1 sz.loc@)
        (= (memory* (addr loc@)) ,val)
-       (each (dest@ src@) (zip (addrs (addr loc@) sz@)
+       (each (dest@ src@) (zip (addrs (addr loc@) sz.loc@)
                                (rep ,val))
          (= (memory* dest@) src@)))))