From e31b1509ebb518548780aa2544459337854af48e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 16 Aug 2017 21:17:26 -0700 Subject: Port to aarch64 (ARM 8). Continuations don't work yet. * gc.c (STACK_TOP_EXTRA_WORDS): New macro. (mark): On aarch64, we must include four words above the stack top. Some live root pointers sometimes hide there which are not in any of the callee-saved register that end up in the machine context via jmp_save. * jmp.S (jmp_save, jmp_restore): Implement for aarch64. --- gc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index d8f8b1ff..3ec20d76 100644 --- a/gc.c +++ b/gc.c @@ -52,6 +52,12 @@ #define FRESHOBJ_VEC_SIZE (8 * HEAP_SIZE) #define DFL_MALLOC_DELTA_THRESH (64L * 1024 * 1024) +#if __aarch64__ +#define STACK_TOP_EXTRA_WORDS 4 +#else +#define STACK_TOP_EXTRA_WORDS 0 +#endif + typedef struct heap { struct heap *next; obj_t block[HEAP_SIZE]; @@ -499,7 +505,7 @@ static void mark(mach_context_t *pmc, val *gc_stack_top) /* * Finally, the stack. */ - mark_mem_region(gc_stack_top, gc_stack_bottom); + mark_mem_region(gc_stack_top - STACK_TOP_EXTRA_WORDS, gc_stack_bottom); } static int sweep_one(obj_t *block) -- cgit v1.2.3