From 980e1bf3caaef5d87f664a4aafb7a89f501be139 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 20 Aug 2014 17:43:15 -0700 Subject: 58 --- mu.arc | 20 +++++++++++--------- 1 file 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@))))) -- cgit 1.4.1-2-gfad0