server-skynet-source-3rd-je.../include/jemalloc/internal
David Goldblatt d4ac7582f3 Introduce a backport of C11 atomics
This introduces a backport of C11 atomics.  It has four implementations; ranked
in order of preference, they are:
- GCC/Clang __atomic builtins
- GCC/Clang __sync builtins
- MSVC _Interlocked builtins
- C11 atomics, from <stdatomic.h>

The primary advantages are:
- Close adherence to the standard API gives us a defined memory model.
- Type safety: atomic objects are now separate types from non-atomic ones, so
  that it's impossible to mix up atomic and non-atomic updates (which is
  undefined behavior that compilers are starting to take advantage of).
- Efficiency: we can specify ordering for operations, avoiding fences and
  atomic operations on strongly ordered architectures (example:
  `atomic_write_u32(ptr, val);` involves a CAS loop, whereas
  `atomic_store(ptr, val, ATOMIC_RELEASE);` is a plain store.

This diff leaves in the current atomics API (implementing them in terms of the
backport).  This lets us transition uses over piecemeal.

Testing:
This is by nature hard to test. I've manually tested the first three options on
Linux on gcc by futzing with the #defines manually, on freebsd with gcc and
clang, on MSVC, and on OS X with clang.  All of these were x86 machines though,
and we don't have any test infrastructure set up for non-x86 platforms.
2017-03-03 13:40:59 -08:00
..
arena_externs.h Immediately purge cached extents if decay_time is 0. 2017-03-02 19:43:06 -08:00
arena_inlines_a.h Convert arena->prof_accumbytes synchronization to atomics. 2017-02-16 09:39:46 -08:00
arena_inlines_b.h Synchronize arena->decay with arena->decay.mtx. 2017-02-16 09:39:46 -08:00
arena_structs_a.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
arena_structs_b.h Convert arena_decay_t's time to be atomically synchronized. 2017-03-02 19:43:06 -08:00
arena_types.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
assert.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
atomic_c11.h Introduce a backport of C11 atomics 2017-03-03 13:40:59 -08:00
atomic_gcc_atomic.h Introduce a backport of C11 atomics 2017-03-03 13:40:59 -08:00
atomic_gcc_sync.h Introduce a backport of C11 atomics 2017-03-03 13:40:59 -08:00
atomic_msvc.h Introduce a backport of C11 atomics 2017-03-03 13:40:59 -08:00
atomic.h Introduce a backport of C11 atomics 2017-03-03 13:40:59 -08:00
base_externs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
base_inlines.h Remove extraneous parens around return arguments. 2017-01-20 21:43:07 -08:00
base_structs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
base_types.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
bitmap_externs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
bitmap_inlines.h Remove extraneous parens around return arguments. 2017-01-20 21:43:07 -08:00
bitmap_structs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
bitmap_types.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
ckh_externs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
ckh_structs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
ckh_types.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
ctl_externs.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
ctl_structs.h Fix --disable-stats support. 2017-01-19 18:31:07 -08:00
ctl_types.h Fix --disable-stats support. 2017-01-19 18:31:07 -08:00
extent_dss_externs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
extent_dss_structs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
extent_dss_types.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
extent_externs.h Tidy up extent quantization. 2017-02-27 11:17:47 -08:00
extent_inlines.h Disentangle arena and extent locking. 2017-02-01 16:43:46 -08:00
extent_mmap_externs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
extent_structs.h Disable coalescing of cached extents. 2017-02-16 20:11:50 -08:00
extent_types.h Disentangle arena and extent locking. 2017-02-01 16:43:46 -08:00
hash_inlines.h Remove extraneous parens around return arguments. 2017-01-20 21:43:07 -08:00
jemalloc_internal_decls.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
jemalloc_internal_defs.h.in Introduce a backport of C11 atomics 2017-03-03 13:40:59 -08:00
jemalloc_internal_macros.h Stop #define-ining away 'inline' 2017-03-03 13:40:59 -08:00
jemalloc_internal.h.in Introduce a backport of C11 atomics 2017-03-03 13:40:59 -08:00
large_externs.h Disentangle arena and extent locking. 2017-02-01 16:43:46 -08:00
mutex_externs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
mutex_inlines.h Enable mutex witnesses even when !isthreaded. 2017-02-09 17:05:47 -08:00
mutex_structs.h Get rid of witness in malloc_mutex_t when !(configured w/ debug). 2017-02-24 09:41:29 -08:00
mutex_types.h Get rid of witness in malloc_mutex_t when !(configured w/ debug). 2017-02-24 09:41:29 -08:00
nstime_externs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
nstime_structs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
nstime_types.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
pages_externs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
pages_types.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
ph.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
private_namespace.sh Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
private_symbols.txt Introduce a backport of C11 atomics 2017-03-03 13:40:59 -08:00
private_unnamespace.sh Refactor to support more varied testing. 2013-12-03 22:06:59 -08:00
prng_inlines.h Remove extraneous parens around return arguments. 2017-01-20 21:43:07 -08:00
prng_types.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
prof_externs.h Convert arena->prof_accumbytes synchronization to atomics. 2017-02-16 09:39:46 -08:00
prof_inlines_a.h Convert arena->prof_accumbytes synchronization to atomics. 2017-02-16 09:39:46 -08:00
prof_inlines_b.h Convert arena->prof_accumbytes synchronization to atomics. 2017-02-16 09:39:46 -08:00
prof_structs.h Convert arena->prof_accumbytes synchronization to atomics. 2017-02-16 09:39:46 -08:00
prof_types.h Convert arena->prof_accumbytes synchronization to atomics. 2017-02-16 09:39:46 -08:00
public_namespace.sh Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
public_unnamespace.sh Fix name mangling for stress tests. 2014-01-16 17:38:01 -08:00
ql.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
qr.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
rb.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
rtree_externs.h Determine rtree levels at compile time. 2017-02-08 18:50:03 -08:00
rtree_inlines.h Fix rtree_subkey() regression. 2017-02-10 09:05:02 -08:00
rtree_structs.h Determine rtree levels at compile time. 2017-02-08 18:50:03 -08:00
rtree_types.h Determine rtree levels at compile time. 2017-02-08 18:50:03 -08:00
size_classes.sh Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
smoothstep.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
smoothstep.sh Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
spin_inlines.h Enhance spin_adaptive() to yield after several iterations. 2017-02-08 18:50:03 -08:00
spin_structs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
spin_types.h Replace spin_init() with SPIN_INITIALIZER. 2017-02-08 18:50:03 -08:00
stats_externs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
stats_structs.h Fix {allocated,nmalloc,ndalloc,nrequests}_large stats regression. 2017-02-27 11:18:07 -08:00
stats_types.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
tcache_externs.h Fix/refactor tcaches synchronization. 2017-02-01 16:43:46 -08:00
tcache_inlines.h Remove extraneous parens around return arguments. 2017-01-20 21:43:07 -08:00
tcache_structs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
tcache_types.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
ticker_inlines.h Remove extraneous parens around return arguments. 2017-01-20 21:43:07 -08:00
ticker_structs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
ticker_types.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
tsd_externs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
tsd_inlines.h Do not generate unused tsd_*_[gs]et() functions. 2017-02-13 10:47:16 -08:00
tsd_structs.h Do not generate unused tsd_*_[gs]et() functions. 2017-02-13 10:47:16 -08:00
tsd_types.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
util_externs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
util_inlines.h Remove extraneous parens around return arguments. 2017-01-20 21:43:07 -08:00
util_types.h Replace tabs following #define with spaces. 2017-01-20 21:45:53 -08:00
witness_externs.h Add witness_assert_depth[_to_rank](). 2017-02-01 16:43:46 -08:00
witness_inlines.h Add witness_assert_depth[_to_rank](). 2017-02-01 16:43:46 -08:00
witness_structs.h Break up headers into constituent parts 2017-01-12 15:43:51 -08:00
witness_types.h Update a comment. 2017-02-26 11:05:27 -08:00