about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-10-30 17:24:51 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-10-30 17:29:14 -0700
commit3eb350738277cf7694136550cf3560415a3b0a08 (patch)
treee2c7cb07db300a851fca49982ed4bff8a7e2a659
parent0257f8daa829c4c6c09da9dc30e1b065fbab0481 (diff)
downloadmu-3eb350738277cf7694136550cf3560415a3b0a08.tar.gz
181 - fix inconsistent metadata
We have cases where 'type' is stored in memory, so it can't be a
literal type like 'offset'.
-rw-r--r--edit.mu4
-rw-r--r--mu.arc9
-rw-r--r--mu.arc.t16
3 files changed, 15 insertions, 14 deletions
diff --git a/edit.mu b/edit.mu
index 27dd3e68..be32f943 100644
--- a/edit.mu
+++ b/edit.mu
@@ -3,11 +3,11 @@
 (new-screen
   ((601 integer) <- arg)
   ((602 integer) <- arg)
-  ((603 screen-address) <- new (screen type) (601 integer))
+  ((603 screen-address) <- new (screen literal) (601 integer))
   ((604 integer) <- copy (0 literal))
   { begin
     ((606 line-address-address) <- index-address (603 screen-address deref) (604 integer))
-    ((606 line-address-address deref) <- new (line type) (602 integer))
+    ((606 line-address-address deref) <- new (line literal) (602 integer))
     ((605 line-address) <- copy (606 line-address-address deref))
     ((604 integer) <- add (604 integer) (1 literal))
     ((607 boolean) <- neq (604 integer) (601 integer))
diff --git a/mu.arc b/mu.arc
index 4e7a9f00..19c8946d 100644
--- a/mu.arc
+++ b/mu.arc
@@ -433,6 +433,7 @@
                       (assert nil "get-address on invalid type @arg.0 => @base")))
                 new
                   (let type (v arg.0)
+                    (assert (is 'literal (ty arg.0)))
                     (if (no types*.type)  (err "no such type @type"))
                     (if types*.type!array
                       (new-array type (m arg.1))
@@ -694,7 +695,7 @@
 ;; system software
 
 (init-fn maybe-coerce
-  ((101 tagged-value-address) <- new (tagged-value type))
+  ((101 tagged-value-address) <- new (tagged-value literal))
   ((101 tagged-value-address deref) <- arg)
   ((102 type) <- arg)
   ((103 type) <- get (101 tagged-value-address deref) (0 offset))
@@ -712,7 +713,7 @@
   ((203 boolean) <- eq (202 integer) (1 literal))
   (assert (203 boolean))
   ; todo: check that arg 0 matches the type? or is that for the future typechecker?
-  ((204 tagged-value-address) <- new (tagged-value type))
+  ((204 tagged-value-address) <- new (tagged-value literal))
   ((205 location) <- get-address (204 tagged-value-address deref) (0 offset))
   ((205 location deref) <- copy (201 type))
   ((206 location) <- get-address (204 tagged-value-address deref) (1 offset))
@@ -730,13 +731,13 @@
   (reply (402 tagged-value-address)))
 
 (init-fn new-list
-  ((501 list-address) <- new (list type))
+  ((501 list-address) <- new (list literal))
   ((502 list-address) <- copy (501 list-address))
   { begin
     ((503 integer) (504 boolean) <- arg)
     (break-unless (504 boolean))
     ((505 list-address-address) <- get-address (502 list-address deref) (1 offset))
-    ((505 list-address-address deref) <- new (list type))
+    ((505 list-address-address deref) <- new (list literal))
     ((502 list-address) <- list-next (502 list-address))
     ((506 tagged-value-address) <- list-value-address (502 list-address))
     ((506 tagged-value-address deref) <- save-type (503 integer))
diff --git a/mu.arc.t b/mu.arc.t
index 16fd72b8..96e7c866 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -670,14 +670,14 @@
 (add-fns
   '((test1
       ; 1 points at first node: tagged-value (int 34)
-      ((1 list-address) <- new (list type))
+      ((1 list-address) <- new (list literal))
       ((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))
       ((4 location deref) <- copy (34 literal))
       ((5 list-address-address) <- get-address (1 list-address deref) (1 offset))
-      ((5 list-address-address deref) <- new (list type))
+      ((5 list-address-address deref) <- new (list literal))
       ; 6 points at second node: tagged-value (boolean t)
       ((6 list-address) <- copy (5 list-address-address deref))
       ((7 tagged-value-address) <- list-value-address (6 list-address))
@@ -1265,7 +1265,7 @@
 (new-trace "new-primitive")
 (add-fns
   '((main
-      ((1 integer-address) <- new (integer type)))))
+      ((1 integer-address) <- new (integer literal)))))
 (let before Memory-in-use-until
   (run 'main)
 ;?   (prn memory*)
@@ -1278,7 +1278,7 @@
 (new-trace "new-array-literal")
 (add-fns
   '((main
-      ((1 type-array-address) <- new (type-array type) (5 literal)))))
+      ((1 type-array-address) <- new (type-array literal) (5 literal)))))
 (let before Memory-in-use-until
   (run 'main)
 ;?   (prn memory*)
@@ -1292,7 +1292,7 @@
 (add-fns
   '((main
       ((1 integer) <- copy (5 literal))
-      ((2 type-array-address) <- new (type-array type) (1 integer)))))
+      ((2 type-array-address) <- new (type-array literal) (1 integer)))))
 (let before Memory-in-use-until
   (run 'main)
 ;?   (prn memory*)
@@ -1384,7 +1384,7 @@
 (new-trace "set-default-scope")
 (add-fns
   '((main
-      ((default-scope scope-address) <- new (scope type) (2 literal))
+      ((default-scope scope-address) <- new (scope literal) (2 literal))
       ((1 integer) <- copy (23 literal)))))
 (let before Memory-in-use-until
 ;?   (set dump-trace*)
@@ -1398,7 +1398,7 @@
 (new-trace "set-default-scope-skips-offset")
 (add-fns
   '((main
-      ((default-scope scope-address) <- new (scope type) (2 literal))
+      ((default-scope scope-address) <- new (scope literal) (2 literal))
       ((1 integer) <- copy (23 offset)))))
 (let before Memory-in-use-until
 ;?   (set dump-trace*)
@@ -1412,7 +1412,7 @@
 (new-trace "default-scope-bounds-check")
 (add-fns
   '((main
-      ((default-scope scope-address) <- new (scope type) (2 literal))
+      ((default-scope scope-address) <- new (scope literal) (2 literal))
       ((2 integer) <- copy (23 literal)))))
 ;? (set dump-trace*)
 (run 'main)