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.
This commit is contained in:
David Goldblatt 2017-03-08 12:13:59 -08:00 committed by David Goldblatt
parent 01f47f11a6
commit dafadce622

View File

@ -44,6 +44,14 @@
#define ATOMIC_ACQ_REL atomic_memory_order_acq_rel, #define ATOMIC_ACQ_REL atomic_memory_order_acq_rel,
#define ATOMIC_SEQ_CST atomic_memory_order_seq_cst #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 * In order to let us transition atomics usage piecemeal (and reason locally
* about memory orders), we'll support the previous API for a while. * 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_INT_ATOMICS(uint32_t, u32, 2)
JEMALLOC_GENERATE_COMPATABILITY_INT_ATOMICS(uint32_t, u32) 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_INT_ATOMICS(uint64_t, u64, 3)
JEMALLOC_GENERATE_COMPATABILITY_INT_ATOMICS(uint64_t, u64) JEMALLOC_GENERATE_COMPATABILITY_INT_ATOMICS(uint64_t, u64)
# endif #endif
#undef ATOMIC_INLINE #undef ATOMIC_INLINE