From: Ivan Maidanski Date: Mon, 29 Apr 2019 06:44:42 +0000 (+0300) Subject: Fix first_thread stack_base initialzation if custom GC_stackbottom (Win32) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=757fcad526d4d1520142c4ab60f86902a36d0caf;p=gc Fix first_thread stack_base initialzation if custom GC_stackbottom (Win32) Stack bottom value of the primordial thread should be obtained from GC_stackbottom. * win32_threads.c [GC_ASSERTIONS] (GC_thr_init): Remove sb_result local variable. * win32_threads.c (GC_thr_init): Initalize sb mem_base and reg_base fields with GC_stackbottom and GC_register_stackbottom, respectively; do not call GC_get_stack_base(). --- diff --git a/win32_threads.c b/win32_threads.c index 5c5877d3..2e9f37fb 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -315,7 +315,7 @@ STATIC volatile LONG GC_max_thread_index = 0; /* And now the version used if GC_win32_dll_threads is not set. */ /* This is a chained hash table, with much of the code borrowed */ -/* From the Posix implementation. */ +/* from the Posix implementation. */ #ifndef THREAD_TABLE_SZ # define THREAD_TABLE_SZ 256 /* Power of 2 (for speed). */ #endif @@ -2477,9 +2477,6 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, GC_INNER void GC_thr_init(void) { struct GC_stack_base sb; -# ifdef GC_ASSERTIONS - int sb_result; -# endif GC_ASSERT(I_HOLD_LOCK()); if (GC_thr_initialized) return; @@ -2522,11 +2519,11 @@ GC_INNER void GC_thr_init(void) # endif /* Add the initial thread, so we can stop it. */ -# ifdef GC_ASSERTIONS - sb_result = + sb.mem_base = GC_stackbottom; + GC_ASSERT(sb.mem_base != NULL); +# ifdef IA64 + sb.reg_base = GC_register_stackbottom; # endif - GC_get_stack_base(&sb); - GC_ASSERT(sb_result == GC_SUCCESS); # if defined(PARALLEL_MARK) {