This commit is contained in:
parent
889e4b958e
commit
624b9e86a1
8
new.arc
8
new.arc
|
@ -1,9 +1,11 @@
|
|||
;; simple slab allocator. Intended only to carve out isolated memory for
|
||||
;; different threads/routines as they request.
|
||||
|
||||
(on-init
|
||||
((Root_allocator_pointer location) <- literal 1000) ; 1-1000 reserved
|
||||
)
|
||||
(= Allocator_start 1000) ; lower locations reserved
|
||||
|
||||
(enq (fn ()
|
||||
(run `(((Root_allocator_pointer location) <- literal ,Allocator_start))))
|
||||
initialization-fns*)
|
||||
|
||||
(init-fn new
|
||||
((2 integer-address) <- copy (Root_allocator_pointer integer))
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
(add-fns
|
||||
'((main)))
|
||||
(run function*!main)
|
||||
(if (~iso memory* (obj Root_allocator_pointer 1000))
|
||||
(if (~iso memory*!Root_allocator_pointer Allocator_start)
|
||||
(prn "F - allocator initialized"))
|
||||
|
||||
(reset)
|
||||
|
@ -15,5 +15,7 @@
|
|||
((x integer-address deref) <- literal 34))))
|
||||
(run function*!main)
|
||||
;? (prn memory*)
|
||||
(if (~iso memory*!Root_allocator_pointer 1001)
|
||||
(if (~iso memory*!Root_allocator_pointer (+ Allocator_start 1))
|
||||
(prn "F - 'new' increments allocator pointer"))
|
||||
(if (~iso memory*.Allocator_start 34)
|
||||
(prn "F - 'new' returns old location"))
|
||||
|
|
Loading…
Reference in New Issue