From: Jonathan Chambers Date: Wed, 31 Jan 2018 08:45:26 +0000 (+0300) Subject: New macro ALWAYS_SMALL_CLEAR_STACK to avoid clearing large stack sections X-Git-Tag: v8.0.0~386 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df23cfefa9dcf2da8223fe69c8c50a39d40be342;p=platform%2Fupstream%2Flibgc.git New macro ALWAYS_SMALL_CLEAR_STACK to avoid clearing large stack sections (a cherry-pick of commit 95f5767 from Unity-Technologies/bdwgc) Issue #173 (bdwgc). Avoid clearing large sections of the stack. It was clearing up to 16k which may not be available in cases of small stacks or stack overflow situations (for some targets). * misc.c [ALWAYS_SMALL_CLEAR_STACK] (GC_clear_stack): Do only BZERO for dummy where dummy is a local array of length SMALL_CLEAR_SIZE. --- diff --git a/misc.c b/misc.c index cf15284..66f1d97 100644 --- a/misc.c +++ b/misc.c @@ -262,9 +262,13 @@ STATIC void GC_init_size_map(void) # define SMALL_CLEAR_SIZE 256 /* Clear this much every time. */ #endif -#if defined(STACK_NOT_SCANNED) +#if defined(ALWAYS_SMALL_CLEAR_STACK) || defined(STACK_NOT_SCANNED) GC_API void * GC_CALL GC_clear_stack(void *arg) { +# ifndef STACK_NOT_SCANNED + word volatile dummy[SMALL_CLEAR_SIZE]; + BZERO((/* no volatile */ void *)dummy, sizeof(dummy)); +# endif return arg; } #else @@ -391,7 +395,7 @@ STATIC void GC_init_size_map(void) return arg; } -#endif /* !STACK_NOT_SCANNED */ +#endif /* !ALWAYS_SMALL_CLEAR_STACK && !STACK_NOT_SCANNED */ /* Return a pointer to the base address of p, given a pointer to a */ /* an address within an object. Return 0 o.w. */