summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/private/gc_atomic_ops.h4
-rw-r--r--include/private/gc_locks.h5
-rw-r--r--include/private/gc_priv.h22
-rw-r--r--include/private/specific.h2
-rw-r--r--mark.c3
-rw-r--r--pthread_stop_world.c2
-rw-r--r--tests/test.c6
-rw-r--r--tests/test_atomic_ops.c4
-rw-r--r--thread_local_alloc.c2
-rw-r--r--typd_mlc.c4
-rw-r--r--win32_threads.c1
11 files changed, 15 insertions, 40 deletions
diff --git a/include/private/gc_atomic_ops.h b/include/private/gc_atomic_ops.h
index 3bdf5647..9b585ec5 100644
--- a/include/private/gc_atomic_ops.h
+++ b/include/private/gc_atomic_ops.h
@@ -101,6 +101,10 @@
/* only if AO_REQUIRE_CAS is defined (or if the corresponding */
/* AO_HAVE_x macro is defined). x86/x64 targets have AO_nop_full, */
/* AO_load_acquire, AO_store_release, at least. */
+# if !defined(AO_HAVE_load) || !defined(AO_HAVE_store)
+# error AO_load or AO_store is missing; probably old version of atomic_ops
+# endif
+
#endif /* !GC_BUILTIN_ATOMIC */
#endif /* GC_ATOMIC_OPS_H */
diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h
index 5657606a..fad4ad2d 100644
--- a/include/private/gc_locks.h
+++ b/include/private/gc_locks.h
@@ -28,11 +28,6 @@
*/
# ifdef THREADS
-# if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) \
- && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2)
-# include "gc_atomic_ops.h"
-# endif
-
# ifdef PCR
# include <base/PCR_Base.h>
# include <th/PCR_Th.h>
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index a7a6bdf7..156bee5a 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -250,6 +250,10 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
# define GC_API_PRIV GC_API
#endif
+#if defined(THREADS) && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2)
+# include "gc_atomic_ops.h"
+#endif
+
#ifndef GC_LOCKS_H
# include "gc_locks.h"
#endif
@@ -754,17 +758,6 @@ GC_EXTERN GC_warn_proc GC_current_warn_proc;
# endif
#endif /* DARWIN */
-#ifdef PARALLEL_MARK
-# include "gc_atomic_ops.h"
-# define counter_t volatile AO_t
-#else
- typedef size_t counter_t;
-# if defined(THREADS) && (defined(MPROTECT_VDB) || defined(THREAD_SANITIZER) \
- || (defined(GC_ASSERTIONS) && defined(THREAD_LOCAL_ALLOC)))
-# include "gc_atomic_ops.h"
-# endif
-#endif /* !PARALLEL_MARK */
-
#include "../gc_tiny_fl.h"
#include <setjmp.h>
@@ -1090,7 +1083,8 @@ struct hblkhdr {
/* mod BYTES_TO_GRANULES(hb_sz), except */
/* for large blocks. See GC_obj_map. */
# endif
- counter_t hb_n_marks; /* Number of set mark bits, excluding */
+# ifdef PARALLEL_MARK
+ volatile AO_t hb_n_marks; /* Number of set mark bits, excluding */
/* the one always set at the end. */
/* Currently it is concurrently */
/* updated and hence only approximate. */
@@ -1108,8 +1102,10 @@ struct hblkhdr {
/* The count may also be too high if */
/* multiple mark threads mark the */
/* same object due to a race. */
- /* Without parallel marking, the count */
+# else
+ size_t hb_n_marks; /* Without parallel marking, the count */
/* is accurate. */
+# endif
# ifdef USE_MARK_BYTES
# define MARK_BITS_SZ (MARK_BITS_PER_HBLK + 1)
/* Unlike the other case, this is in units of bytes. */
diff --git a/include/private/specific.h b/include/private/specific.h
index ab864750..1367a252 100644
--- a/include/private/specific.h
+++ b/include/private/specific.h
@@ -14,8 +14,6 @@
#include <errno.h>
-#include "gc_atomic_ops.h"
-
/* Note: never put extern "C" around an #include. */
#ifdef __cplusplus
extern "C" {
diff --git a/mark.c b/mark.c
index b4f448b1..8347bfc5 100644
--- a/mark.c
+++ b/mark.c
@@ -40,8 +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. */
-# if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) \
- || defined(PARALLEL_MARK)
+# ifdef AO_CLEAR
AO_compiler_barrier(); /* to serve as a special side-effect */
# else
GC_noop1(0);
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index 45435aa0..35ca4b05 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -48,8 +48,6 @@
#include <time.h> /* for nanosleep() */
#include <unistd.h>
-#include "private/gc_atomic_ops.h"
-
#if (!defined(AO_HAVE_load_acquire) || !defined(AO_HAVE_store_release)) \
&& !defined(CPPCHECK)
# error AO_load_acquire and/or AO_store_release are missing;
diff --git a/tests/test.c b/tests/test.c
index 1240180c..452ad720 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -171,12 +171,6 @@
exit(1); \
}
-#if defined(THREADS) && (defined(GC_BUILTIN_ATOMIC) \
- || defined(PARALLEL_MARK) \
- || !defined(GC_WIN32_THREADS))
-# include "private/gc_atomic_ops.h" /* for counters */
-#endif
-
/* Define AO primitives for a single-threaded mode. */
#ifndef AO_CLEAR
/* AO_t not defined. */
diff --git a/tests/test_atomic_ops.c b/tests/test_atomic_ops.c
index c99da725..a70fe471 100644
--- a/tests/test_atomic_ops.c
+++ b/tests/test_atomic_ops.c
@@ -20,9 +20,7 @@
#include <stdio.h>
-#if defined(GC_BUILTIN_ATOMIC) || defined(PARALLEL_MARK) \
- || (defined(GC_THREADS) && !defined(_WIN32) && !defined(_MSC_VER) \
- && !defined(__CYGWIN__) && !defined(__MINGW32__))
+#if defined(GC_BUILTIN_ATOMIC) || defined(GC_THREADS)
# include <stdlib.h>
diff --git a/thread_local_alloc.c b/thread_local_alloc.c
index 545812a4..4a6624dd 100644
--- a/thread_local_alloc.c
+++ b/thread_local_alloc.c
@@ -196,8 +196,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_kind(size_t bytes, int knd)
#ifdef GC_GCJ_SUPPORT
-# include "private/gc_atomic_ops.h" /* for AO_compiler_barrier() */
-
# include "include/gc_gcj.h"
/* Gcj-style allocation without locks is extremely tricky. The */
diff --git a/typd_mlc.c b/typd_mlc.c
index a67671af..0092547f 100644
--- a/typd_mlc.c
+++ b/typd_mlc.c
@@ -106,10 +106,6 @@ STATIC size_t GC_avail_descr = 0; /* Next available slot. */
STATIC int GC_typed_mark_proc_index = 0; /* Indices of my mark */
STATIC int GC_array_mark_proc_index = 0; /* procedures. */
-#if defined(GC_FORCE_INCLUDE_ATOMIC_OPS) || defined(GC_BUILTIN_ATOMIC)
-# include "private/gc_atomic_ops.h"
-#endif
-
#ifdef AO_HAVE_load_acquire
STATIC volatile AO_t GC_explicit_typing_initialized = FALSE;
#else
diff --git a/win32_threads.c b/win32_threads.c
index 03eb6b5a..f8fa1449 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -79,7 +79,6 @@
#if (defined(GC_DLL) || defined(GC_INSIDE_DLL)) \
&& !defined(GC_NO_THREADS_DISCOVERY) && !defined(MSWINCE) \
&& !defined(THREAD_LOCAL_ALLOC) && !defined(GC_PTHREADS)
-# include "private/gc_atomic_ops.h"
/* This code operates in two distinct modes, depending on */
/* the setting of GC_win32_dll_threads. */