diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-08-21 00:29:55 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-08-21 00:31:50 -0700 |
commit | 0c57bf0a1bfababf3f4b661c500f9ef7aae56776 (patch) | |
tree | 25b09e34b3d8f31352610d78a5ca84151618b07e | |
parent | 8a93b211e4853fbe8e411767e7156d1c40f46f6d (diff) | |
download | mu-0c57bf0a1bfababf3f4b661c500f9ef7aae56776.tar.gz |
60
-rw-r--r-- | mu.arc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/mu.arc b/mu.arc index 992a8d9b..d5d1484f 100644 --- a/mu.arc +++ b/mu.arc @@ -45,8 +45,11 @@ operand.1) ; assume type is always first bit of metadata, and it's always present (def sz (operand) +;? (prn "sz " operand) ; todo: override this for vectors ((types* ty.operand) 'size)) +(defextend sz (typename) (isa typename 'sym) + types*.typename!size) (mac addr (loc) `(let loc@ ,loc @@ -69,11 +72,13 @@ (map memory* (addrs (addr loc@) sz.loc@)))))) (mac setm (loc val) ; set memory, respecting addressing-mode tags - `(let loc@ ,loc + `(with (loc@ ,loc + val@ ,val) +;? (prn "setm " loc@ " " val@) (if (is 1 sz.loc@) - (= (memory* (addr loc@)) ,val) + (= (memory* (addr loc@)) val@) (each (dest@ src@) (zip (addrs (addr loc@) sz.loc@) - (rep ,val)) + (rep val@)) (= (memory* dest@) src@))))) (def run (instrs (o fn-args) (o fn-oargs)) @@ -149,8 +154,8 @@ get (withs (idx (v arg.1) fields ((types* (ty arg.0)) 'elems) - offset (apply + (map [types*._ 'size] - (firstn idx fields)))) + offset (apply + + (map sz (firstn idx fields)))) (memory* (+ (v arg.0) offset))) reply (do (= result arg) @@ -159,7 +164,7 @@ (let-or new-body function*.op (prn "no definition for " op) ;? (prn "== " memory*) (let results (run new-body arg oarg) -;? (prn "=> " oarg) +;? (prn "=> " oarg " " results) (each o oarg ;? (prn o) (setm o (m pop.results)))) |