summaryrefslogtreecommitdiff
path: root/mark.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-11-20 11:42:52 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-11-20 23:47:09 +0300
commit8d4ecdfc81edab312a9feef9b5985f327ec50bad (patch)
treea82708f3bf8ec83d025f319858a2801336a992ac /mark.c
parenta72365dad934afb78b1c670a8a86408aa8655b06 (diff)
downloadbdwgc-8d4ecdfc81edab312a9feef9b5985f327ec50bad.tar.gz
Fix deadlocks in write and suspend handlers if AO test-and-set is emulated
This could be tested with -D AO_USE_PTHREAD_DEFS passed to CFLAGS. * configure.ac (AO_TRYLINK_CFLAGS): New variable. * configure.ac [$with_libatomic_ops!=none && $need_atomic_ops_asm!=true] (BASE_ATOMIC_OPS_EMULATED): New AC_DEFINE (defined in case of failure of AC_TRY_LINK of a code snippet calling AO_test_and_set_acquire, AO_CLEAR, AO_compiler_barrier, AO_store, AO_load, AO_char_store, AO_char_load, AO_store_release, AO_load_acquire); use AO_TRYLINK_CFLAGS; add comment. * include/private/gcconfig.h [BASE_ATOMIC_OPS_EMULATED] (MPROTECT_VDB): Undefine. * mark.c [AO_CLEAR] (GC_noop6): Do not call AO_compiler_barrier() if BASE_ATOMIC_OPS_EMULATED. * misc.c [!GC_DISABLE_INCREMENTAL] (GC_init, GC_enable_incremental): Do not set GC_manual_vdb if BASE_ATOMIC_OPS_EMULATED. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (ao_load_acquire_async, ao_load_async, ao_store_release_async, ao_store_async): New macro; undefine it after the usage. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (GC_store_stack_ptr): Use ao_store_async() instead of AO_store(). * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (GC_suspend_handler_inner): Use ao_load[_acquire]_async() and ao_store_release_async() instead of AO_load[_acquire]() and AO_store_release(), respectively. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && GC_ENABLE_SUSPEND_THREAD] (suspend_self_inner): Use ao_load_acquire_async() instead of AO_load_acquire().
Diffstat (limited to 'mark.c')
-rw-r--r--mark.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mark.c b/mark.c
index 12d927fe..283aa2f1 100644
--- a/mark.c
+++ b/mark.c
@@ -40,7 +40,7 @@ void GC_noop6(word arg1 GC_ATTR_UNUSED, word arg2 GC_ATTR_UNUSED,
word arg5 GC_ATTR_UNUSED, word arg6 GC_ATTR_UNUSED)
{
/* Avoid GC_noop6 calls to be optimized away. */
-# ifdef AO_CLEAR
+# if defined(AO_CLEAR) && !defined(BASE_ATOMIC_OPS_EMULATED)
AO_compiler_barrier(); /* to serve as a special side-effect */
# else
GC_noop1(0);