diff options
author | Qi Wang <interwq@gwu.edu> | 2019-03-07 15:58:26 -0800 |
---|---|---|
committer | Qi Wang <interwq@gmail.com> | 2019-03-09 12:52:06 -0800 |
commit | 06f0850427e26cb24950de60bbe70bc192ffce6a (patch) | |
tree | 6c78fae37a0be960732026fdba1330ed242d2458 /include | |
parent | 14d3686c9f3ed28f1ef4c9ec5f7bde945473194b (diff) |
Detect if 8-bit atomics are available.
In some rare cases (older compiler, e.g. gcc 4.2 w/ MIPS), 8-bit atomics might
be unavailable. Detect such cases so that we can workaround.
Diffstat (limited to 'include')
-rw-r--r-- | include/jemalloc/internal/atomic.h | 7 | ||||
-rw-r--r-- | include/jemalloc/internal/jemalloc_internal_defs.h.in | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/jemalloc/internal/atomic.h b/include/jemalloc/internal/atomic.h index bb751cfc..a76f54ce 100644 --- a/include/jemalloc/internal/atomic.h +++ b/include/jemalloc/internal/atomic.h @@ -3,10 +3,17 @@ #define ATOMIC_INLINE JEMALLOC_ALWAYS_INLINE +#define JEMALLOC_U8_ATOMICS #if defined(JEMALLOC_GCC_ATOMIC_ATOMICS) # include "jemalloc/internal/atomic_gcc_atomic.h" +# if !defined(JEMALLOC_GCC_U8_ATOMIC_ATOMICS) +# undef JEMALLOC_U8_ATOMICS +# endif #elif defined(JEMALLOC_GCC_SYNC_ATOMICS) # include "jemalloc/internal/atomic_gcc_sync.h" +# if !defined(JEMALLOC_GCC_U8_SYNC_ATOMICS) +# undef JEMALLOC_U8_ATOMICS +# endif #elif defined(_MSC_VER) # include "jemalloc/internal/atomic_msvc.h" #elif defined(JEMALLOC_C11_ATOMICS) diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in index 7914b2f6..05016b1e 100644 --- a/include/jemalloc/internal/jemalloc_internal_defs.h.in +++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in @@ -48,9 +48,16 @@ /* Defined if GCC __atomic atomics are available. */ #undef JEMALLOC_GCC_ATOMIC_ATOMICS +/* and the 8-bit variant support. */ +#undef JEMALLOC_GCC_U8_ATOMIC_ATOMICS /* Defined if GCC __sync atomics are available. */ #undef JEMALLOC_GCC_SYNC_ATOMICS +/* and the 8-bit variant support. */ +#undef JEMALLOC_GCC_U8_SYNC_ATOMICS + +/* Defined if 8-bit atomics are supported. */ + /* * Defined if __builtin_clz() and __builtin_clzl() are available. |