>From f8a5d8a4a95182e91037d444d6d1f51f7dc7e467 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sun, 17 May 2020 13:23:59 +0100 Subject: [PATCH] * Fix Garbage Collector for missing calle safe registers content * src/alloc.c (SET_STACK_TOP_ADDRESS): Do not call __builtin_unwind_init. (flush_stack_call_func1): Rename from 'flush_stack_call_func'. (flush_stack_call_func): New function to spill all registers before calling 'flush_stack_call_func1'. This to make sure the top of the stack identified includes those registers. --- src/alloc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index f2b80fac88..1d2ee05481 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4952,12 +4952,10 @@ test_setjmp (void) #ifdef HAVE___BUILTIN_UNWIND_INIT # define SET_STACK_TOP_ADDRESS(p) \ stacktop_sentry sentry; \ - __builtin_unwind_init (); \ *(p) = NEAR_STACK_TOP (&sentry) #else # define SET_STACK_TOP_ADDRESS(p) \ stacktop_sentry sentry; \ - __builtin_unwind_init (); \ test_setjmp (); \ sys_setjmp (sentry.j); \ *(p) = NEAR_STACK_TOP (&sentry + (stack_bottom < &sentry.c)) @@ -5033,7 +5031,7 @@ mark_stack (char const *bottom, char const *end) from FUNC. */ NO_INLINE void -flush_stack_call_func (void (*func) (void *arg), void *arg) +flush_stack_call_func1 (void (*func) (void *arg), void *arg) { void *end; struct thread_state *self = current_thread; @@ -5043,6 +5041,13 @@ flush_stack_call_func (void (*func) (void *arg), void *arg) eassert (current_thread == self); } +void +flush_stack_call_func (void (*func) (void *arg), void *arg) +{ + __builtin_unwind_init (); + flush_stack_call_func1 (func, arg); +} + /* Determine whether it is safe to access memory at address P. */ static int valid_pointer_p (void *p) -- 2.17.1