about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--mu.arc4
-rw-r--r--mu.arc.t3
2 files changed, 7 insertions, 0 deletions
diff --git a/mu.arc b/mu.arc
index 6f214be1..397dd145 100644
--- a/mu.arc
+++ b/mu.arc
@@ -683,6 +683,10 @@
   (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)))))
diff --git a/mu.arc.t b/mu.arc.t
index 87926a9e..5deecb96 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -776,6 +776,9 @@
 (= memory*.4 23)
 (if (~is 24 (sizeof '(4 integer-array)))
   (prn "F - 'sizeof' reads array lengths from memory"))
+(= memory*.3 4)
+(if (~is 24 (sizeof '(3 integer-array-address deref)))
+  (prn "F - 'sizeof' handles pointers to arrays"))
 (= memory*.14 34)
 (= routine* make-routine!foo)
 (if (~is 24 (sizeof '(4 integer-array)))