about summary refs log tree commit diff stats
path: root/new.arc
diff options
context:
space:
mode:
Diffstat (limited to 'new.arc')
-rw-r--r--new.arc17
1 files changed, 17 insertions, 0 deletions
diff --git a/new.arc b/new.arc
new file mode 100644
index 00000000..0f0b4b71
--- /dev/null
+++ b/new.arc
@@ -0,0 +1,17 @@
+;; 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
+)
+
+(init-fn new
+  ((2 integer-address) <- copy (Root_allocator_pointer integer))
+  ((3 integer) <- literal 1)
+  ((Root_allocator_pointer integer) <- add (Root_allocator_pointer integer) (3 integer))
+  (reply (2 integer-address)))
+; tests to express:
+; every call increments the pointer
+; no other function can increment the pointer
+; no later clause can increment the pointer after this base clause
+; multiple threads/routines can't call the allocator at once