From 0c9f837918fd40395cda3efe6965ed7c9d980511 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 12 Oct 2014 14:27:26 -0700 Subject: 142 - helper for lists Amazing how easy it was to just dump the trace and diff, compared to my old approach of adding new traces and rerunning. --- mu.arc | 7 +++++++ mu.arc.t | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) 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)) -- cgit 1.4.1-2-gfad0