(code refactoring of commits
272283d5b,
d6c7ee31d,
2178db2b6)
* include/private/gc_priv.h [THREADS && !NN_PLATFORM_CTR
&& !SN_TARGET_ORBIS && !SN_TARGET_PSP2 && !AO_HAVE_compiler_barrier]
(AO_HAVE_compiler_barrier): Define private macro (after include
gc_atomic_ops.h).
* mark.c [!BASE_ATOMIC_OPS_EMULATED] (GC_noop6): Call
AO_compiler_barrier() only if AO_HAVE_compiler_barrier.
* pthread_support.c [(USE_SPIN_LOCK || !NO_PTHREAD_TRYLOCK)
&& !BASE_ATOMIC_OPS_EMULATED] (GC_pause): Likewise.
* tests/test.c (AO_t): Define only if AO_HAVE_compiler_barrier is not
defined.
#if defined(THREADS) && !defined(NN_PLATFORM_CTR) \
&& !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2)
# include "gc_atomic_ops.h"
+# ifndef AO_HAVE_compiler_barrier
+# define AO_HAVE_compiler_barrier 1
+# endif
#endif
#include "gc_locks.h"
word arg5 GC_ATTR_UNUSED, word arg6 GC_ATTR_UNUSED)
{
/* Avoid GC_noop6 calls to be optimized away. */
-# if defined(AO_CLEAR) && !defined(BASE_ATOMIC_OPS_EMULATED)
+# if defined(AO_HAVE_compiler_barrier) && !defined(BASE_ATOMIC_OPS_EMULATED)
AO_compiler_barrier(); /* to serve as a special side-effect */
# else
GC_noop1(0);
for (i = 0; i < GC_PAUSE_SPIN_CYCLES; ++i) {
/* Something that's unlikely to be optimized away. */
-# if defined(AO_CLEAR) && !defined(BASE_ATOMIC_OPS_EMULATED)
+# if defined(AO_HAVE_compiler_barrier) \
+ && !defined(BASE_ATOMIC_OPS_EMULATED)
AO_compiler_barrier();
# else
GC_noop1(i);
}
/* Define AO primitives for a single-threaded mode. */
-#ifndef AO_CLEAR
+#ifndef AO_HAVE_compiler_barrier
/* AO_t not defined. */
# define AO_t GC_word
#endif