From: Ivan Maidanski Date: Mon, 18 Sep 2017 21:34:15 +0000 (+0300) Subject: Fix missing started_thread_while_stopped call from mark_some if GCC/Clang X-Git-Tag: v8.0.0~585 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b4e2df9080a21b9912269db8c74bec755e8a6223;p=platform%2Fupstream%2Flibgc.git Fix missing started_thread_while_stopped call from mark_some if GCC/Clang * 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__. --- diff --git a/mark.c b/mark.c index b79156d..e56d5f9 100644 --- a/mark.c +++ b/mark.c @@ -474,9 +474,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? */ @@ -510,7 +510,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 */ @@ -551,6 +551,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)); diff --git a/win32_threads.c b/win32_threads.c index 833d6d1..a99eec1 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -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. */