From fdf67dae2092e0d6fe460e16a939080493e00a3b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 9 Jan 2020 14:48:49 -0800 Subject: gc: consolidate top-of-stack and context handling. * gc.c (mark): Eliminate mach_context_t * argument; just gc_stack_top is passed. (gc): Specify the base address of the machine context as the top of the stack. Still, on aarch64, STACK_TOP_EXTRA_WORDS is required, otherwise we get prematurely freed objects. --- gc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/gc.c b/gc.c index 84fd5b3a..3029158c 100644 --- a/gc.c +++ b/gc.c @@ -494,7 +494,7 @@ static void mark_mem_region(val *low, val *high) mark_obj_maybe(*low); } -static void mark(mach_context_t *pmc, val *gc_stack_top) +static void mark(val *gc_stack_top) { val **rootloc; @@ -518,11 +518,6 @@ static void mark(mach_context_t *pmc, val *gc_stack_top) } #endif - /* - * Then the machine context - */ - mark_mem_region(coerce(val *, pmc), coerce(val *, (pmc + 1))); - /* * Finally, the stack. */ @@ -794,7 +789,6 @@ static void call_finals(void) void gc(void) { - val gc_stack_top = nil; #if CONFIG_GEN_GC int exhausted = (free_list == 0); int full_gc_next_time = 0; @@ -817,7 +811,7 @@ void gc(void) gc_enabled = 0; rcyc_empty(); iobuf_list_empty(); - mark(&mc, &gc_stack_top); + mark(coerce(val *, &mc)); hash_process_weak(); prepare_finals(); swept = sweep(); -- cgit v1.2.3