diff options
| author | Keith Packard <keithp@keithp.com> | 2016-11-14 18:45:12 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-02-20 11:16:50 -0800 | 
| commit | ddb4b8d90478ae324aa207a7541352c1ac9451ee (patch) | |
| tree | 9f069fea8113178eedf9e4714bfea98538f818e5 /src/lisp/ao_lisp_eval.c | |
| parent | affcf6ffc08313151541993ee543bfe390165e81 (diff) | |
altos/lisp: Change GC to do moves in batches of 32
This should make it quite a bit faster than doing one at a time.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp_eval.c')
| -rw-r--r-- | src/lisp/ao_lisp_eval.c | 21 | 
1 files changed, 7 insertions, 14 deletions
diff --git a/src/lisp/ao_lisp_eval.c b/src/lisp/ao_lisp_eval.c index f945bc16..04d0e70a 100644 --- a/src/lisp/ao_lisp_eval.c +++ b/src/lisp/ao_lisp_eval.c @@ -16,6 +16,8 @@  #include "ao_lisp.h"  #include <assert.h> +const struct ao_lisp_type ao_lisp_stack_type; +  static int  stack_size(void *addr)  { @@ -34,13 +36,11 @@ stack_mark(void *addr)  		ao_lisp_poly_mark(stack->frame, 0);  		ao_lisp_poly_mark(stack->list, 0);  		stack = ao_lisp_poly_stack(stack->prev); -		if (ao_lisp_mark_memory(stack, sizeof (struct ao_lisp_stack))) +		if (ao_lisp_mark_memory(&ao_lisp_stack_type, stack))  			break;  	}  } -static const struct ao_lisp_type ao_lisp_stack_type; -  static void  stack_move(void *addr)  { @@ -57,8 +57,7 @@ stack_move(void *addr)  		prev = ao_lisp_poly_stack(stack->prev);  		if (!prev)  			break; -		ret = ao_lisp_move_memory((void **) &prev, -					  sizeof (struct ao_lisp_stack)); +		ret = ao_lisp_move_memory(&ao_lisp_stack_type, (void **) &prev);  		if (prev != ao_lisp_poly_stack(stack->prev))  			stack->prev = ao_lisp_stack_poly(prev);  		if (ret) @@ -67,10 +66,11 @@ stack_move(void *addr)  	}  } -static const struct ao_lisp_type ao_lisp_stack_type = { +const struct ao_lisp_type ao_lisp_stack_type = {  	.size = stack_size,  	.mark = stack_mark, -	.move = stack_move +	.move = stack_move, +	.name = "stack"  };  struct ao_lisp_stack		*ao_lisp_stack; @@ -567,14 +567,7 @@ ao_lisp_eval_restart(void)  ao_poly  ao_lisp_eval(ao_poly _v)  { -	static uint8_t been_here; -  	ao_lisp_v = _v; -	if (!been_here) { -		been_here = 1; -		ao_lisp_root_add(&ao_lisp_stack_type, &ao_lisp_stack); -		ao_lisp_root_poly_add(&ao_lisp_v); -	}  	if (!ao_lisp_stack_push())  		return AO_LISP_NIL;  | 
