]> granicus.if.org Git - gc/commitdiff
Fix missing started_thread_while_stopped call from mark_some if GCC/Clang
authorIvan Maidanski <ivmai@mail.ru>
Mon, 18 Sep 2017 21:34:15 +0000 (00:34 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 28 Sep 2017 21:36:42 +0000 (00:36 +0300)
* mark.c [WRAP_MARK_SOME && GC_WIN32_THREADS && !GC_PTHREADS]
(GC_started_thread_while_stopped): Declare even if __GNUC__.
* mark.c [WRAP_MARK_SOME && GC_WIN32_THREADS && (MSWIN32 || MSWINCE)]
(GC_mark_some): Invoke GC_started_thread_while_stopped (unless
GC_PTHREADS).
* win32_threads.c [WRAP_MARK_SOME && !GC_PTHREADS]
(GC_started_thread_while_stopped): Define even if __GNUC__.

mark.c
win32_threads.c

diff --git a/mark.c b/mark.c
index a77f9662a9433177f43651e5bc2e6bece98a6f63..5f46a801ca4f533edc47234725b6dceb246b4bf8 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -462,9 +462,9 @@ static void alloc_mark_stack(size_t);
             return ExceptionContinueSearch;
         }
     }
-# endif /* __GNUC__  && MSWIN32 */
+# endif /* __GNUC__ && MSWIN32 */
 
-#if defined(GC_WIN32_THREADS) && !defined(__GNUC__)
+#if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS)
   GC_INNER GC_bool GC_started_thread_while_stopped(void);
   /* In win32_threads.c.  Did we invalidate mark phase with an  */
   /* unexpected thread start?                                   */
@@ -498,7 +498,7 @@ static void alloc_mark_stack(size_t);
                 EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
           goto handle_ex;
       }
-#     ifdef GC_WIN32_THREADS
+#     if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS)
         /* With DllMain-based thread tracking, a thread may have        */
         /* started while we were marking.  This is logically equivalent */
         /* to the exception case; our results are invalid and we have   */
@@ -541,6 +541,10 @@ static void alloc_mark_stack(size_t);
       /* and thus eliminating it.                                    */
         if (er.alt_path == 0)
           goto handle_ex;
+#     if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS)
+        if (GC_started_thread_while_stopped())
+          goto handle_ex;
+#     endif
     rm_handler:
       /* Uninstall the exception handler */
       __asm__ __volatile__ ("mov %0, %%fs:0" : : "r" (er.ex_reg.prev));
index 5a41a7961a69820fe7c3ef9c26b869e6c182677d..cb6c1112e51e32d112016df8c4b9ee9108a4ceb2 100644 (file)
@@ -274,7 +274,7 @@ typedef volatile struct GC_Thread_Rep * GC_vthread;
   STATIC volatile AO_t GC_attached_thread = FALSE;
 #endif
 
-#if !defined(__GNUC__)
+#if defined(WRAP_MARK_SOME) && !defined(GC_PTHREADS)
   /* Return TRUE if an thread was attached since we last asked or */
   /* since GC_attached_thread was explicitly reset.               */
   GC_INNER GC_bool GC_started_thread_while_stopped(void)
@@ -296,7 +296,7 @@ typedef volatile struct GC_Thread_Rep * GC_vthread;
 #   endif
     return FALSE;
   }
-#endif /* !__GNUC__ */
+#endif /* WRAP_MARK_SOME */
 
 /* Thread table used if GC_win32_dll_threads is set.    */
 /* This is a fixed size array.                          */