about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--mu.arc7
-rw-r--r--mu.arc.t2
2 files changed, 8 insertions, 1 deletions
diff --git a/mu.arc b/mu.arc
index 0e80fff7..975c23f8 100644
--- a/mu.arc
+++ b/mu.arc
@@ -321,9 +321,11 @@
                 get-address
                   (with (base arg.0
                          idx (v arg.1))
+                    (trace "get-address" base "." idx)
                     (when typeinfo.base!address
                       (assert (pos 'deref metadata.base))
                       (= base (list (memory* v.base) typeinfo.base!elem)))
+                    (trace "get-address" "after: " base)
                     (if typeinfo.base!record
                       (do (assert (< -1 idx (len typeinfo.base!elems)))
                           (+ v.base
@@ -581,6 +583,11 @@
   ((locaddr location deref) <- arg)
   (reply (result tagged-value-address)))
 
+(init-fn list-value-address
+  ((base list-address) <- arg)
+  ((result tagged-value-address) <- get-address (base list-address deref) (0 offset))
+  (reply (result tagged-value-address)))
+
 ; drop all traces while processing above functions
 (on-init
   (= traces* (queue)))
diff --git a/mu.arc.t b/mu.arc.t
index 4aff9b4f..b4f9cf3f 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -689,7 +689,7 @@
   '((test1
       ; 1 points at first node: tagged-value (int 34)
       ((1 list-address) <- new (list type))
-      ((2 tagged-value-address) <- get-address (1 list-address deref) (0 offset))
+      ((2 tagged-value-address) <- list-value-address (1 list-address))
       ((3 type-address) <- get-address (2 tagged-value-address deref) (0 offset))
       ((3 type-address deref) <- copy (integer literal))
       ((4 location) <- get-address (2 tagged-value-address deref) (1 offset))