about summary refs log tree commit diff stats
path: root/mu.arc.t
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-01-26 02:42:30 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-26 02:42:30 -0800
commit1ea0b4e57922e5cb69193b5118b91a2a3da33d95 (patch)
treee8155fbb3b5fda2b22c1b4b1356feda4ca7a3776 /mu.arc.t
parentf9d8b661fb73281d3b8d844833134fcc8098fc2c (diff)
downloadmu-1ea0b4e57922e5cb69193b5118b91a2a3da33d95.tar.gz
627
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t25
1 files changed, 25 insertions, 0 deletions
diff --git a/mu.arc.t b/mu.arc.t
index 0bb64788..cc5be550 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -1902,6 +1902,31 @@
   (when (~is rep.routine!alloc-max 50)
     (prn "F - 'new' updates upper bound for routine memory @rep.routine!alloc-max")))
 
+(reset)
+(new-trace "new-skip")
+(add-code
+  '((function main [
+      (1:integer-boolean-pair-address <- new integer-boolean-pair:literal)
+     ])))
+; start allocating from address 30, in chunks of 10 locations each
+(= Memory-allocated-until 30
+   Allocation-chunk 10)
+(let routine make-routine!main
+  (assert:is rep.routine!alloc 30)
+  (assert:is rep.routine!alloc-max 40)
+  ; pretend the current chunk has just one location left
+  (= rep.routine!alloc 39)
+  (enq routine running-routines*)
+  ; request 2 locations
+  (run)
+  (each routine completed-routines*
+    (aif rep.routine!error (prn "error - " it)))
+  (when (or (~is memory*.1 40)
+            (~is rep.routine!alloc 42)
+            (~is rep.routine!alloc-max 50)
+            (~is Memory-allocated-until 50))
+    (prn "F - 'new' skips past current chunk if insufficient space")))
+
 ; Even though our memory locations can now have names, the names are all
 ; globals, accessible from any function. To isolate functions from their
 ; callers we need local variables, and mu provides them using a special