summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2017-03-08 20:13:59 (GMT)
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2017-03-09 05:26:37 (GMT)
commitdafadce62205bddac7da1c595c956a69367810ec (patch)
treec591f7c37b046f7139e04afc703ca8ffd2a9f908
parent01f47f11a67d1a2505cc1f21851c466651eba431 (diff)
downloadjemalloc-dafadce62205bddac7da1c595c956a69367810ec.zip
jemalloc-dafadce62205bddac7da1c595c956a69367810ec.tar.gz
jemalloc-dafadce62205bddac7da1c595c956a69367810ec.tar.bz2
Reintroduce JEMALLOC_ATOMIC_U64
The C11 atomics backport removed this #define, which degraded atomic 64-bit reads to require a lock even on platforms that support them. This commit fixes that.
-rw-r--r--include/jemalloc/internal/atomic.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/jemalloc/internal/atomic.h b/include/jemalloc/internal/atomic.h
index 866adff..acbb621 100644
--- a/include/jemalloc/internal/atomic.h
+++ b/include/jemalloc/internal/atomic.h
@@ -45,6 +45,14 @@
#define ATOMIC_SEQ_CST atomic_memory_order_seq_cst
/*
+ * Not all platforms have 64-bit atomics. If we do, this #define exposes that
+ * fact.
+ */
+#if (LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
+# define JEMALLOC_ATOMIC_U64
+#endif
+
+/*
* In order to let us transition atomics usage piecemeal (and reason locally
* about memory orders), we'll support the previous API for a while.
*/
@@ -104,10 +112,10 @@ JEMALLOC_GENERATE_COMPATABILITY_INT_ATOMICS(ssize_t, zd)
JEMALLOC_GENERATE_INT_ATOMICS(uint32_t, u32, 2)
JEMALLOC_GENERATE_COMPATABILITY_INT_ATOMICS(uint32_t, u32)
-# if (LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
+#ifdef JEMALLOC_ATOMIC_U64
JEMALLOC_GENERATE_INT_ATOMICS(uint64_t, u64, 3)
JEMALLOC_GENERATE_COMPATABILITY_INT_ATOMICS(uint64_t, u64)
-# endif
+#endif
#undef ATOMIC_INLINE