120 - forgot to alloc space for array length

This commit is contained in:
Kartik K. Agaram 2014-10-07 14:01:58 -07:00
parent d43f0c54e2
commit fde987b54f
2 changed files with 3 additions and 3 deletions

2
mu.arc
View File

@ -452,7 +452,7 @@
(def new-array (type size)
;? (prn "new array: @type @size")
(ret result Memory-in-use-until
(++ Memory-in-use-until (* (sizeof types*.type!elem) size))))
(++ Memory-in-use-until (+ 1 (* (sizeof types*.type!elem) size)))))
(def sizeof (type)
(if (~or types*.type!record types*.type!array)

View File

@ -802,7 +802,7 @@
;? (prn memory*)
(if (~iso memory*.1 before)
(prn "F - 'new' on array with literal size returns current high-water mark"))
(if (~iso Memory-in-use-until (+ before 5))
(if (~iso Memory-in-use-until (+ before 6))
(prn "F - 'new' on primitive arrays increments high-water mark by their size")))
(reset)
@ -816,7 +816,7 @@
;? (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))
(if (~iso Memory-in-use-until (+ before 6))
(prn "F - 'new' on primitive arrays increments high-water mark by their (variable) size")))
(reset)