diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-10-06 22:58:06 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-10-06 22:58:06 -0700 |
commit | ec690bf30d0a8ce57f3ce23f8a8b067b633ece1f (patch) | |
tree | eca65827331371bf94b2ec315bea77dce9d23d4c | |
parent | 62fc8a7b99f6dc5a9bc06cd682025e465c21ca02 (diff) | |
download | mu-ec690bf30d0a8ce57f3ce23f8a8b067b633ece1f.tar.gz |
112
-rw-r--r-- | mu.arc | 2 | ||||
-rw-r--r-- | mu.arc.t | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/mu.arc b/mu.arc index 9f6440ec..4aa71cf4 100644 --- a/mu.arc +++ b/mu.arc @@ -334,7 +334,7 @@ new (let type (v arg.0) (if types*.type!array - (new-array type (v arg.1)) + (new-array type (m arg.1)) (new-scalar type))) sizeof (sizeof (v arg.0)) diff --git a/mu.arc.t b/mu.arc.t index 868de132..e796010a 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -751,11 +751,24 @@ (run 'main) ;? (prn memory*) (if (~iso memory*.1 before) - (prn "F - 'new' returns current high-water mark")) + (prn "F - 'new' on array with literal size 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"))) (reset) +(let before Memory-in-use-until + (add-fns + '((main + ((1 integer) <- literal 5) + ((2 type-array-address) <- new (type-array type) (1 integer))))) + (run 'main) + ;? (prn memory*) + (if (~iso memory*.2 before) + (prn "F - 'new' on array with variable size 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 (variable) size"))) + +(reset) (add-fns '((f1 ((1 integer) <- literal 3)) |