From bf6a25faa94931b2c3ee6168403a5469773508cf Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 5 Oct 2014 15:02:28 -0700 Subject: 107 - 'get' can now take an address --- mu.arc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'mu.arc') diff --git a/mu.arc b/mu.arc index 3bade639..e80c1795 100644 --- a/mu.arc +++ b/mu.arc @@ -93,6 +93,20 @@ (def typeinfo (operand) (types* ty.operand)) +;? (def is-array (operand) +;? (if (pos 'deref metadata.operand) +;? (if typeinfo.operand!address +;? ((types* typeinfo.operand!elem) 'array) +;? (err "can't deref non-address @operand")) +;? typeinfo.operand!array)) +;? +;? (def is-record (operand) +;? (if (pos 'deref metadata.operand) +;? (if typeinfo.operand!address +;? ((types* typeinfo.operand!elem) 'record) +;? (err "can't deref non-address @operand")) +;? typeinfo.operand!record)) + (def sz (operand) ;? (prn "sz " operand) ; todo: override this for arrays @@ -287,6 +301,11 @@ get (with (base arg.0 ; integer (non-symbol) memory location including metadata idx (v arg.1)) ; literal integer +;? (prn base ": " (memory* v.base)) + (when typeinfo.base!address + (assert (pos 'deref metadata.base)) + (= base (list (memory* v.base) typeinfo.base!elem))) +;? (prn "after: " base) (if typeinfo.base!array (array-ref base idx) -- cgit 1.4.1-2-gfad0