Implement EVAL for LISTs
[muddle-interpreter.git] / src / alloc.h
index 239a7e0c281ed6e248d122dd2970c84d5293abf5..594ee87087f442d14c6db82e536249b0e718edb3 100644 (file)
@@ -23,38 +23,18 @@ License along with this file. If not, see
 #include <stdbool.h>
 #include <stdint.h>
 
-/// 0, or a "pointer" to an object allocated in the pool and fully-initialized
+/// 0, or a "pointer" to an object allocated in the pool
 typedef uint32_t pool_ptr;
-/// 0, or a "pointer" to an object allocated in the heap and fully-initialized
+/// 0, or a "pointer" to an object allocated in the heap
 typedef int32_t heap_ptr;
 
 typedef union pool_object pool_object;
 typedef union object object;
 
-extern char *pool;             // pool_object
 extern char *vhp_base;         // object
 extern char *vhp;              // object
 
-static inline pool_object *
-POOL_OBJECT (pool_ptr p)
-{
-  return (pool_object *) (uintptr_t) p;
-}
-
-static inline bool
-IS_VALID_POOL_OBJECT (pool_object * p)
-{
-  pool_ptr pp = (pool_ptr) (uintptr_t) p;
-  return (uintptr_t) pp == (uintptr_t) p;
-}
-
-static inline pool_ptr
-POOL_PTR (pool_object * p)
-{
-  pool_ptr pp = (pool_ptr) (uintptr_t) p;
-  assert (IS_VALID_POOL_OBJECT (p));
-  return pp;
-}
+pool_object *POOL_OBJECT (pool_ptr p);
 
 // TODO make (heap_ptr)0 nullish
 static inline object *
@@ -64,13 +44,7 @@ OBJECT_OF_HEAP_PTR (heap_ptr p)
   return (object *) (vhp_base + (p << 4));
 }
 
-static inline pool_object *
-pool_alloc (uint32_t len)
-{
-  char *pp = pool;
-  pool += (len << 4);
-  return (pool_object *) pp;
-}
+pool_ptr pool_alloc (uint32_t len);
 
 static inline heap_ptr
 HEAP_PTR_OF_OBJECT (object * p)