static struct ao_lisp_cons *save_cons[2];
static char *save_string[2];
+static struct ao_lisp_stack *save_stack[3];
static ao_poly save_poly[2];
static const struct ao_lisp_root ao_lisp_root[] = {
.type = &ao_lisp_cons_type,
.addr = (void **) &save_cons[1],
},
+ {
+ .type = &ao_lisp_stack_type,
+ .addr = (void **) &save_stack[0]
+ },
+ {
+ .type = &ao_lisp_stack_type,
+ .addr = (void **) &save_stack[1]
+ },
+ {
+ .type = &ao_lisp_stack_type,
+ .addr = (void **) &save_stack[2]
+ },
{
.type = &ao_lisp_string_type,
.addr = (void **) &save_string[0]
return ((uint8_t *) addr) - ao_lisp_pool;
}
-/*
- * Convert back and forth between 'poly's used
- * as short addresses in the pool and addresses.
- * These are used in the chunk code.
- */
-static inline ao_poly pool_poly(void *addr) {
-#if DBG_MEM
- if (!AO_LISP_IS_POOL(addr))
- ao_lisp_abort();
-#endif
- return ((uint8_t *) addr) - AO_LISP_POOL_BASE;
-}
-
-static inline void *pool_ref(ao_poly p) {
- return AO_LISP_POOL_BASE + p;
-}
-
static inline void mark(uint8_t *tag, int offset) {
int byte = offset >> 5;
int bit = (offset >> 2) & 7;
[AO_LISP_BUILTIN] = &ao_lisp_builtin_type,
[AO_LISP_FRAME] = &ao_lisp_frame_type,
[AO_LISP_LAMBDA] = &ao_lisp_lambda_type,
+ [AO_LISP_STACK] = &ao_lisp_stack_type,
};
static int
return cons;
}
+void
+ao_lisp_stack_stash(int id, struct ao_lisp_stack *stack)
+{
+ save_stack[id] = stack;
+}
+
+struct ao_lisp_stack *
+ao_lisp_stack_fetch(int id)
+{
+ struct ao_lisp_stack *stack = save_stack[id];
+ save_stack[id] = NULL;
+ return stack;
+}
+
void
ao_lisp_string_stash(int id, char *string)
{