about summary refs log tree commit diff stats
path: root/mu.arc.t
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-08-26 12:20:08 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-08-26 21:55:21 -0700
commit230415b4e11e005f8ea999d207d6ba29ffc5ada7 (patch)
treeae94cf816a9bdffae9f0df4d953fed70063b6225 /mu.arc.t
parent91226d7c76e8139591a53e245a1fa94c7856ad6d (diff)
downloadmu-230415b4e11e005f8ea999d207d6ba29ffc5ada7.tar.gz
77 - 'new' in the interpreter
Next we'll try to reimplement it on the simulated machine. But for now,
sys.arc is extraneous.

Debugging this, the commented out prints started to become onerous enough I couldn't
bear to keep them.
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t24
1 files changed, 24 insertions, 0 deletions
diff --git a/mu.arc.t b/mu.arc.t
index 6dfb7824..3695b4c8 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -592,3 +592,27 @@
 ;? (prn memory*)
 (if (~iso memory* (obj 1 4  2 4  3 nil  4 34))
   (prn "F - continue might never trigger"))
+
+(reset)
+(let before Memory-in-use-until
+  (add-fns
+    '((main
+        ((1 integer-address) <- new (integer type)))))
+  (run function*!main)
+  ;? (prn memory*)
+  (if (~iso memory*.1 before)
+    (prn "F - 'new' returns current high-water mark"))
+  (if (~iso Memory-in-use-until (+ before 1))
+    (prn "F - 'new' on primitive types increments high-water mark by their size")))
+
+(reset)
+(let before Memory-in-use-until
+  (add-fns
+    '((main
+        ((1 type-array-address) <- new (type-array type) (5 literal)))))
+  (run function*!main)
+  ;? (prn memory*)
+  (if (~iso memory*.1 before)
+    (prn "F - 'new' returns current high-water mark"))
+  (if (~iso Memory-in-use-until (+ before 5))
+    (prn "F - 'new' on primitive arrays increments high-water mark by their size")))