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:43:14 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-26 02:43:14 -0800
commit0d8f88f7c2cd73a0c85d85907d20c0e37e4ea101 (patch)
tree012a392c03045a404f55af242aec18853be7a0d6 /mu.arc.t
parent1ea0b4e57922e5cb69193b5118b91a2a3da33d95 (diff)
downloadmu-0d8f88f7c2cd73a0c85d85907d20c0e37e4ea101.tar.gz
628
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t27
1 files changed, 27 insertions, 0 deletions
diff --git a/mu.arc.t b/mu.arc.t
index cc5be550..51316e1c 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -1927,6 +1927,33 @@
             (~is Memory-allocated-until 50))
     (prn "F - 'new' skips past current chunk if insufficient space")))
 
+(reset)
+(new-trace "new-skip-noncontiguous")
+(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)
+  ; pretend we allocated more memory since we created the routine
+  (= Memory-allocated-until 90)
+  (enq routine running-routines*)
+  ; request 2 locations
+  (run)
+  (each routine completed-routines*
+    (aif rep.routine!error (prn "error - " it)))
+  (when (or (~is memory*.1 90)
+            (~is rep.routine!alloc 92)
+            (~is rep.routine!alloc-max 100)
+            (~is Memory-allocated-until 100))
+    (prn "F - 'new' skips allocates a new 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