diff options
author | Qi Wang <interwq@gwu.edu> | 2019-03-08 00:01:55 (GMT) |
---|---|---|
committer | Qi Wang <interwq@gmail.com> | 2019-03-09 20:52:06 (GMT) |
commit | b804d0f019df87d8cc96e3c812e98793256cb418 (patch) | |
tree | aaab4006d73c8f3f4094f34abc746b07404e3559 /include/jemalloc | |
parent | 06f0850427e26cb24950de60bbe70bc192ffce6a (diff) | |
download | jemalloc-b804d0f019df87d8cc96e3c812e98793256cb418.zip jemalloc-b804d0f019df87d8cc96e3c812e98793256cb418.tar.gz jemalloc-b804d0f019df87d8cc96e3c812e98793256cb418.tar.bz2 |
Fallback to 32-bit when 8-bit atomics are missing for TSD.
When it happens, this might cause a slowdown on the fast path operations.
However such case is very rare.
Diffstat (limited to 'include/jemalloc')
-rw-r--r-- | include/jemalloc/internal/tsd.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/include/jemalloc/internal/tsd.h b/include/jemalloc/internal/tsd.h index 00a9500..9ba2600 100644 --- a/include/jemalloc/internal/tsd.h +++ b/include/jemalloc/internal/tsd.h @@ -169,6 +169,18 @@ enum { */ #define TSD_MANGLE(n) cant_access_tsd_items_directly_use_a_getter_or_setter_##n +#ifdef JEMALLOC_U8_ATOMICS +# define tsd_state_t atomic_u8_t +# define tsd_atomic_load atomic_load_u8 +# define tsd_atomic_store atomic_store_u8 +# define tsd_atomic_exchange atomic_exchange_u8 +#else +# define tsd_state_t atomic_u32_t +# define tsd_atomic_load atomic_load_u32 +# define tsd_atomic_store atomic_store_u32 +# define tsd_atomic_exchange atomic_exchange_u32 +#endif + /* The actual tsd. */ struct tsd_s { /* @@ -177,8 +189,11 @@ struct tsd_s { * setters below. */ - /* We manually limit the state to just a single byte. */ - atomic_u8_t state; + /* + * We manually limit the state to just a single byte. Unless the 8-bit + * atomics are unavailable (which is rare). + */ + tsd_state_t state; #define O(n, t, nt) \ t TSD_MANGLE(n); MALLOC_TSD |