]> granicus.if.org Git - gc/commitdiff
Fix first_thread stack_base initialzation if custom GC_stackbottom (Win32)
authorIvan Maidanski <ivmai@mail.ru>
Mon, 29 Apr 2019 06:44:42 +0000 (09:44 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 29 Apr 2019 06:44:42 +0000 (09:44 +0300)
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().

win32_threads.c

index 5c5877d33de6ec0ae49baf01c2c8c9d162cbcb05..2e9f37fb1e32f579499416b88e633b35dc3456ed 100644 (file)
@@ -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)
     {