diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-11-29 00:57:06 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-11-29 00:57:06 -0800 |
commit | ba7e56926df02be575ba772c33c8e1614f13f1f8 (patch) | |
tree | f814e3aa824a8b1ac47ed51bd6f9673099b0bbf0 /mu.arc | |
parent | c00202cc5eeeea9b2ea5c7c7b0180f168c9ac570 (diff) | |
download | mu-ba7e56926df02be575ba772c33c8e1614f13f1f8.tar.gz |
379
Diffstat (limited to 'mu.arc')
-rw-r--r-- | mu.arc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/mu.arc b/mu.arc index ec681c08..d278fee6 100644 --- a/mu.arc +++ b/mu.arc @@ -599,7 +599,9 @@ (= memory*.addr val)) (do (if ((types* typeof.loc) 'array) ; size check for arrays - (when (~is rep.val.0 (- n 1)) + (when (~is n + (+ 1 ; array length + (* rep.val.0 (sizeof ((types* typeof.loc) 'elem))))) (die "writing invalid array @(tostring prn.val)")) ; size check for non-arrays (when (~is sizeof.loc n) @@ -646,14 +648,18 @@ (def sizeof (x) (trace "sizeof" x) (point return - (when (and (acons x) - (pos 'deref metadata.x)) - (assert typeinfo.x!address) - (return (sizeof deref.x))) - (when (and (acons x) - typeinfo.x!array) - (return (+ 1 (* (m `(,v.x integer)) - (sizeof typeinfo.x!elem))))) + (when (acons x) +;? (tr "aa " x) + (zap absolutize x) +;? (tr "bb " x) + (while (pos 'deref metadata.x) +;? (tr "cc " x) + (zap deref x)) +;? (tr "dd " x) +;? (trace "sizeof" "after canonizing: " x) + (when typeinfo.x!array + (return (+ 1 (* (m `(,v.x integer ,@(cut x 2))) + (sizeof typeinfo.x!elem)))))) (let type (if (and acons.x (pos 'deref metadata.x)) typeinfo.x!elem ; deref pointer acons.x |