summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-11-05 15:12:05 -0700
committerKeith Packard <keithp@keithp.com>2016-11-17 22:18:39 -0800
commit546e58b0a868662271553a15f2b1c1a8ea317582 (patch)
tree8d4e6f0c7d7ca0d3183cdf49f98a6f525e362d9f
parent8f57c0761eaf1f10493fd52118d309eb69491464 (diff)
altos/lisp: make sure stack->formals_last gets moved during GC
Failing this leads to broken formals chains Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/lisp/ao_lisp_eval.c6
-rw-r--r--src/lisp/ao_lisp_mem.c6
2 files changed, 7 insertions, 5 deletions
diff --git a/src/lisp/ao_lisp_eval.c b/src/lisp/ao_lisp_eval.c
index b7e7b972..0de3f190 100644
--- a/src/lisp/ao_lisp_eval.c
+++ b/src/lisp/ao_lisp_eval.c
@@ -14,7 +14,7 @@
#include "ao_lisp.h"
-#if 1
+#if 0
static int stack_depth;
#define DBG_INDENT() do { int _s; for(_s = 0; _s < stack_depth; _s++) printf(" "); } while(0)
#define DBG_IN() (++stack_depth)
@@ -80,6 +80,7 @@ stack_mark(void *addr)
for (;;) {
ao_lisp_poly_mark(stack->actuals);
ao_lisp_poly_mark(stack->formals);
+ /* no need to mark formals_tail */
ao_lisp_poly_mark(stack->frame);
stack = ao_lisp_poly_stack(stack->prev);
if (ao_lisp_mark_memory(stack, sizeof (struct ao_lisp_stack)))
@@ -99,6 +100,7 @@ stack_move(void *addr)
int ret;
(void) ao_lisp_poly_move(&stack->actuals);
(void) ao_lisp_poly_move(&stack->formals);
+ (void) ao_lisp_poly_move(&stack->formals_tail);
(void) ao_lisp_poly_move(&stack->frame);
prev = ao_lisp_poly_stack(stack->prev);
ret = ao_lisp_move(&ao_lisp_stack_type, &prev);
@@ -250,7 +252,7 @@ ao_lisp_lambda(struct ao_lisp_cons *cons)
if (args_wanted != args_provided)
return ao_lisp_error(AO_LISP_INVALID, "need %d args, not %d", args_wanted, args_provided);
next_frame = ao_lisp_frame_new(args_wanted);
- DBGI("new frame %d\n", OFFSET(next_frame));
+// DBGI("new frame %d\n", OFFSET(next_frame));
switch (type) {
case _ao_lisp_atom_lambda: {
int f;
diff --git a/src/lisp/ao_lisp_mem.c b/src/lisp/ao_lisp_mem.c
index 29d8dbf4..9e716da9 100644
--- a/src/lisp/ao_lisp_mem.c
+++ b/src/lisp/ao_lisp_mem.c
@@ -35,8 +35,8 @@ uint8_t ao_lisp_pool[AO_LISP_POOL] __attribute__((aligned(4)));
#define DBG_POOL
#endif
-#if 1
-#define DBG_DUMP
+#if 0
+#define DBG_DUMP 0
#define DBG_OFFSET(a) ((int) ((uint8_t *) (a) - ao_lisp_pool))
#define DBG(...) printf(__VA_ARGS__)
#define DBG_DO(a) a
@@ -194,7 +194,7 @@ move_object(void)
DBG_MOVE("move done\n");
}
-#ifdef DBG_DUMP
+#if DBG_DUMP
static void
dump_busy(void)
{