@@ -15,7 +15,7 @@ bool arena_prof_accum(tsdn_t *tsdn, arena_t *arena, uint64_t accumbytes);
|
||||
|
||||
JEMALLOC_INLINE unsigned
|
||||
arena_ind_get(const arena_t *arena) {
|
||||
return (base_ind_get(arena->base));
|
||||
return base_ind_get(arena->base);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -30,7 +30,7 @@ arena_internal_sub(arena_t *arena, size_t size) {
|
||||
|
||||
JEMALLOC_INLINE size_t
|
||||
arena_internal_get(arena_t *arena) {
|
||||
return (atomic_read_zu(&arena->stats.internal));
|
||||
return atomic_read_zu(&arena->stats.internal);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
@@ -41,9 +41,9 @@ arena_prof_accum_impl(arena_t *arena, uint64_t accumbytes) {
|
||||
arena->prof_accumbytes += accumbytes;
|
||||
if (arena->prof_accumbytes >= prof_interval) {
|
||||
arena->prof_accumbytes %= prof_interval;
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
@@ -51,9 +51,9 @@ arena_prof_accum_locked(arena_t *arena, uint64_t accumbytes) {
|
||||
cassert(config_prof);
|
||||
|
||||
if (likely(prof_interval == 0)) {
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
return (arena_prof_accum_impl(arena, accumbytes));
|
||||
return arena_prof_accum_impl(arena, accumbytes);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
@@ -61,7 +61,7 @@ arena_prof_accum(tsdn_t *tsdn, arena_t *arena, uint64_t accumbytes) {
|
||||
cassert(config_prof);
|
||||
|
||||
if (likely(prof_interval == 0)) {
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -70,7 +70,7 @@ arena_prof_accum(tsdn_t *tsdn, arena_t *arena, uint64_t accumbytes) {
|
||||
malloc_mutex_lock(tsdn, &arena->lock);
|
||||
ret = arena_prof_accum_impl(arena, accumbytes);
|
||||
malloc_mutex_unlock(tsdn, &arena->lock);
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ JEMALLOC_INLINE szind_t
|
||||
arena_bin_index(arena_t *arena, arena_bin_t *bin) {
|
||||
szind_t binind = (szind_t)(bin - arena->bins);
|
||||
assert(binind < NBINS);
|
||||
return (binind);
|
||||
return binind;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE prof_tctx_t *
|
||||
@@ -35,9 +35,9 @@ arena_prof_tctx_get(tsdn_t *tsdn, const extent_t *extent, const void *ptr) {
|
||||
assert(ptr != NULL);
|
||||
|
||||
if (unlikely(!extent_slab_get(extent))) {
|
||||
return (large_prof_tctx_get(tsdn, extent));
|
||||
return large_prof_tctx_get(tsdn, extent);
|
||||
}
|
||||
return ((prof_tctx_t *)(uintptr_t)1U);
|
||||
return (prof_tctx_t *)(uintptr_t)1U;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -94,23 +94,23 @@ arena_malloc(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind, bool zero,
|
||||
|
||||
if (likely(tcache != NULL)) {
|
||||
if (likely(size <= SMALL_MAXCLASS)) {
|
||||
return (tcache_alloc_small(tsdn_tsd(tsdn), arena,
|
||||
tcache, size, ind, zero, slow_path));
|
||||
return tcache_alloc_small(tsdn_tsd(tsdn), arena,
|
||||
tcache, size, ind, zero, slow_path);
|
||||
}
|
||||
if (likely(size <= tcache_maxclass)) {
|
||||
return (tcache_alloc_large(tsdn_tsd(tsdn), arena,
|
||||
tcache, size, ind, zero, slow_path));
|
||||
return tcache_alloc_large(tsdn_tsd(tsdn), arena,
|
||||
tcache, size, ind, zero, slow_path);
|
||||
}
|
||||
/* (size > tcache_maxclass) case falls through. */
|
||||
assert(size > tcache_maxclass);
|
||||
}
|
||||
|
||||
return (arena_malloc_hard(tsdn, arena, size, ind, zero));
|
||||
return arena_malloc_hard(tsdn, arena, size, ind, zero);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE arena_t *
|
||||
arena_aalloc(tsdn_t *tsdn, const void *ptr) {
|
||||
return (extent_arena_get(iealloc(tsdn, ptr)));
|
||||
return extent_arena_get(iealloc(tsdn, ptr));
|
||||
}
|
||||
|
||||
/* Return the size of the allocation pointed to by ptr. */
|
||||
@@ -126,7 +126,7 @@ arena_salloc(tsdn_t *tsdn, const extent_t *extent, const void *ptr) {
|
||||
ret = large_salloc(tsdn, extent);
|
||||
}
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
|
@@ -9,15 +9,15 @@
|
||||
* operations can be optimized away if the return values aren't used by the
|
||||
* callers.
|
||||
*
|
||||
* <t> atomic_read_<t>(<t> *p) { return (*p); }
|
||||
* <t> atomic_add_<t>(<t> *p, <t> x) { return (*p += x); }
|
||||
* <t> atomic_sub_<t>(<t> *p, <t> x) { return (*p -= x); }
|
||||
* <t> atomic_read_<t>(<t> *p) { return *p; }
|
||||
* <t> atomic_add_<t>(<t> *p, <t> x) { return *p += x; }
|
||||
* <t> atomic_sub_<t>(<t> *p, <t> x) { return *p -= x; }
|
||||
* bool atomic_cas_<t>(<t> *p, <t> c, <t> s)
|
||||
* {
|
||||
* if (*p != c)
|
||||
* return (true);
|
||||
* return true;
|
||||
* *p = s;
|
||||
* return (false);
|
||||
* return false;
|
||||
* }
|
||||
* void atomic_write_<t>(<t> *p, <t> x) { *p = x; }
|
||||
*/
|
||||
@@ -62,7 +62,7 @@ atomic_add_u64(uint64_t *p, uint64_t x) {
|
||||
: "m" (*p) /* Inputs. */
|
||||
);
|
||||
|
||||
return (t + x);
|
||||
return t + x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint64_t
|
||||
@@ -77,7 +77,7 @@ atomic_sub_u64(uint64_t *p, uint64_t x) {
|
||||
: "m" (*p) /* Inputs. */
|
||||
);
|
||||
|
||||
return (t + x);
|
||||
return t + x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
@@ -92,7 +92,7 @@ atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s) {
|
||||
: "memory" /* Clobbers. */
|
||||
);
|
||||
|
||||
return (!(bool)success);
|
||||
return !(bool)success;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -108,19 +108,19 @@ atomic_write_u64(uint64_t *p, uint64_t x) {
|
||||
JEMALLOC_INLINE uint64_t
|
||||
atomic_add_u64(uint64_t *p, uint64_t x) {
|
||||
volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
|
||||
return (atomic_fetch_add(a, x) + x);
|
||||
return atomic_fetch_add(a, x) + x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint64_t
|
||||
atomic_sub_u64(uint64_t *p, uint64_t x) {
|
||||
volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
|
||||
return (atomic_fetch_sub(a, x) - x);
|
||||
return atomic_fetch_sub(a, x) - x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s) {
|
||||
volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
|
||||
return (!atomic_compare_exchange_strong(a, &c, s));
|
||||
return !atomic_compare_exchange_strong(a, &c, s);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -137,21 +137,21 @@ atomic_add_u64(uint64_t *p, uint64_t x) {
|
||||
*/
|
||||
assert(sizeof(uint64_t) == sizeof(unsigned long));
|
||||
|
||||
return (atomic_fetchadd_long(p, (unsigned long)x) + x);
|
||||
return atomic_fetchadd_long(p, (unsigned long)x) + x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint64_t
|
||||
atomic_sub_u64(uint64_t *p, uint64_t x) {
|
||||
assert(sizeof(uint64_t) == sizeof(unsigned long));
|
||||
|
||||
return (atomic_fetchadd_long(p, (unsigned long)(-(long)x)) - x);
|
||||
return atomic_fetchadd_long(p, (unsigned long)(-(long)x)) - x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s) {
|
||||
assert(sizeof(uint64_t) == sizeof(unsigned long));
|
||||
|
||||
return (!atomic_cmpset_long(p, (unsigned long)c, (unsigned long)s));
|
||||
return !atomic_cmpset_long(p, (unsigned long)c, (unsigned long)s);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -163,17 +163,17 @@ atomic_write_u64(uint64_t *p, uint64_t x) {
|
||||
# elif (defined(JEMALLOC_OSATOMIC))
|
||||
JEMALLOC_INLINE uint64_t
|
||||
atomic_add_u64(uint64_t *p, uint64_t x) {
|
||||
return (OSAtomicAdd64((int64_t)x, (int64_t *)p));
|
||||
return OSAtomicAdd64((int64_t)x, (int64_t *)p);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint64_t
|
||||
atomic_sub_u64(uint64_t *p, uint64_t x) {
|
||||
return (OSAtomicAdd64(-((int64_t)x), (int64_t *)p));
|
||||
return OSAtomicAdd64(-((int64_t)x), (int64_t *)p);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s) {
|
||||
return (!OSAtomicCompareAndSwap64(c, s, (int64_t *)p));
|
||||
return !OSAtomicCompareAndSwap64(c, s, (int64_t *)p);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -188,12 +188,12 @@ atomic_write_u64(uint64_t *p, uint64_t x) {
|
||||
# elif (defined(_MSC_VER))
|
||||
JEMALLOC_INLINE uint64_t
|
||||
atomic_add_u64(uint64_t *p, uint64_t x) {
|
||||
return (InterlockedExchangeAdd64(p, x) + x);
|
||||
return InterlockedExchangeAdd64(p, x) + x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint64_t
|
||||
atomic_sub_u64(uint64_t *p, uint64_t x) {
|
||||
return (InterlockedExchangeAdd64(p, -((int64_t)x)) - x);
|
||||
return InterlockedExchangeAdd64(p, -((int64_t)x)) - x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
@@ -201,7 +201,7 @@ atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s) {
|
||||
uint64_t o;
|
||||
|
||||
o = InterlockedCompareExchange64(p, s, c);
|
||||
return (o != c);
|
||||
return o != c;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -212,17 +212,17 @@ atomic_write_u64(uint64_t *p, uint64_t x) {
|
||||
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
|
||||
JEMALLOC_INLINE uint64_t
|
||||
atomic_add_u64(uint64_t *p, uint64_t x) {
|
||||
return (__sync_add_and_fetch(p, x));
|
||||
return __sync_add_and_fetch(p, x);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint64_t
|
||||
atomic_sub_u64(uint64_t *p, uint64_t x) {
|
||||
return (__sync_sub_and_fetch(p, x));
|
||||
return __sync_sub_and_fetch(p, x);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s) {
|
||||
return (!__sync_bool_compare_and_swap(p, c, s));
|
||||
return !__sync_bool_compare_and_swap(p, c, s);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -247,7 +247,7 @@ atomic_add_u32(uint32_t *p, uint32_t x) {
|
||||
: "m" (*p) /* Inputs. */
|
||||
);
|
||||
|
||||
return (t + x);
|
||||
return t + x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint32_t
|
||||
@@ -262,7 +262,7 @@ atomic_sub_u32(uint32_t *p, uint32_t x) {
|
||||
: "m" (*p) /* Inputs. */
|
||||
);
|
||||
|
||||
return (t + x);
|
||||
return t + x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
@@ -277,7 +277,7 @@ atomic_cas_u32(uint32_t *p, uint32_t c, uint32_t s) {
|
||||
: "memory"
|
||||
);
|
||||
|
||||
return (!(bool)success);
|
||||
return !(bool)success;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -293,19 +293,19 @@ atomic_write_u32(uint32_t *p, uint32_t x) {
|
||||
JEMALLOC_INLINE uint32_t
|
||||
atomic_add_u32(uint32_t *p, uint32_t x) {
|
||||
volatile atomic_uint_least32_t *a = (volatile atomic_uint_least32_t *)p;
|
||||
return (atomic_fetch_add(a, x) + x);
|
||||
return atomic_fetch_add(a, x) + x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint32_t
|
||||
atomic_sub_u32(uint32_t *p, uint32_t x) {
|
||||
volatile atomic_uint_least32_t *a = (volatile atomic_uint_least32_t *)p;
|
||||
return (atomic_fetch_sub(a, x) - x);
|
||||
return atomic_fetch_sub(a, x) - x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
atomic_cas_u32(uint32_t *p, uint32_t c, uint32_t s) {
|
||||
volatile atomic_uint_least32_t *a = (volatile atomic_uint_least32_t *)p;
|
||||
return (!atomic_compare_exchange_strong(a, &c, s));
|
||||
return !atomic_compare_exchange_strong(a, &c, s);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -316,17 +316,17 @@ atomic_write_u32(uint32_t *p, uint32_t x) {
|
||||
#elif (defined(JEMALLOC_ATOMIC9))
|
||||
JEMALLOC_INLINE uint32_t
|
||||
atomic_add_u32(uint32_t *p, uint32_t x) {
|
||||
return (atomic_fetchadd_32(p, x) + x);
|
||||
return atomic_fetchadd_32(p, x) + x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint32_t
|
||||
atomic_sub_u32(uint32_t *p, uint32_t x) {
|
||||
return (atomic_fetchadd_32(p, (uint32_t)(-(int32_t)x)) - x);
|
||||
return atomic_fetchadd_32(p, (uint32_t)(-(int32_t)x)) - x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
atomic_cas_u32(uint32_t *p, uint32_t c, uint32_t s) {
|
||||
return (!atomic_cmpset_32(p, c, s));
|
||||
return !atomic_cmpset_32(p, c, s);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -336,17 +336,17 @@ atomic_write_u32(uint32_t *p, uint32_t x) {
|
||||
#elif (defined(JEMALLOC_OSATOMIC))
|
||||
JEMALLOC_INLINE uint32_t
|
||||
atomic_add_u32(uint32_t *p, uint32_t x) {
|
||||
return (OSAtomicAdd32((int32_t)x, (int32_t *)p));
|
||||
return OSAtomicAdd32((int32_t)x, (int32_t *)p);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint32_t
|
||||
atomic_sub_u32(uint32_t *p, uint32_t x) {
|
||||
return (OSAtomicAdd32(-((int32_t)x), (int32_t *)p));
|
||||
return OSAtomicAdd32(-((int32_t)x), (int32_t *)p);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
atomic_cas_u32(uint32_t *p, uint32_t c, uint32_t s) {
|
||||
return (!OSAtomicCompareAndSwap32(c, s, (int32_t *)p));
|
||||
return !OSAtomicCompareAndSwap32(c, s, (int32_t *)p);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -361,12 +361,12 @@ atomic_write_u32(uint32_t *p, uint32_t x) {
|
||||
#elif (defined(_MSC_VER))
|
||||
JEMALLOC_INLINE uint32_t
|
||||
atomic_add_u32(uint32_t *p, uint32_t x) {
|
||||
return (InterlockedExchangeAdd(p, x) + x);
|
||||
return InterlockedExchangeAdd(p, x) + x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint32_t
|
||||
atomic_sub_u32(uint32_t *p, uint32_t x) {
|
||||
return (InterlockedExchangeAdd(p, -((int32_t)x)) - x);
|
||||
return InterlockedExchangeAdd(p, -((int32_t)x)) - x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
@@ -374,7 +374,7 @@ atomic_cas_u32(uint32_t *p, uint32_t c, uint32_t s) {
|
||||
uint32_t o;
|
||||
|
||||
o = InterlockedCompareExchange(p, s, c);
|
||||
return (o != c);
|
||||
return o != c;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -385,17 +385,17 @@ atomic_write_u32(uint32_t *p, uint32_t x) {
|
||||
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
|
||||
JEMALLOC_INLINE uint32_t
|
||||
atomic_add_u32(uint32_t *p, uint32_t x) {
|
||||
return (__sync_add_and_fetch(p, x));
|
||||
return __sync_add_and_fetch(p, x);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint32_t
|
||||
atomic_sub_u32(uint32_t *p, uint32_t x) {
|
||||
return (__sync_sub_and_fetch(p, x));
|
||||
return __sync_sub_and_fetch(p, x);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
atomic_cas_u32(uint32_t *p, uint32_t c, uint32_t s) {
|
||||
return (!__sync_bool_compare_and_swap(p, c, s));
|
||||
return !__sync_bool_compare_and_swap(p, c, s);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -411,27 +411,27 @@ atomic_write_u32(uint32_t *p, uint32_t x) {
|
||||
JEMALLOC_INLINE void *
|
||||
atomic_add_p(void **p, void *x) {
|
||||
#if (LG_SIZEOF_PTR == 3)
|
||||
return ((void *)atomic_add_u64((uint64_t *)p, (uint64_t)x));
|
||||
return (void *)atomic_add_u64((uint64_t *)p, (uint64_t)x);
|
||||
#elif (LG_SIZEOF_PTR == 2)
|
||||
return ((void *)atomic_add_u32((uint32_t *)p, (uint32_t)x));
|
||||
return (void *)atomic_add_u32((uint32_t *)p, (uint32_t)x);
|
||||
#endif
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void *
|
||||
atomic_sub_p(void **p, void *x) {
|
||||
#if (LG_SIZEOF_PTR == 3)
|
||||
return ((void *)atomic_add_u64((uint64_t *)p, (uint64_t)-((int64_t)x)));
|
||||
return (void *)atomic_add_u64((uint64_t *)p, (uint64_t)-((int64_t)x));
|
||||
#elif (LG_SIZEOF_PTR == 2)
|
||||
return ((void *)atomic_add_u32((uint32_t *)p, (uint32_t)-((int32_t)x)));
|
||||
return (void *)atomic_add_u32((uint32_t *)p, (uint32_t)-((int32_t)x));
|
||||
#endif
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
atomic_cas_p(void **p, void *c, void *s) {
|
||||
#if (LG_SIZEOF_PTR == 3)
|
||||
return (atomic_cas_u64((uint64_t *)p, (uint64_t)c, (uint64_t)s));
|
||||
return atomic_cas_u64((uint64_t *)p, (uint64_t)c, (uint64_t)s);
|
||||
#elif (LG_SIZEOF_PTR == 2)
|
||||
return (atomic_cas_u32((uint32_t *)p, (uint32_t)c, (uint32_t)s));
|
||||
return atomic_cas_u32((uint32_t *)p, (uint32_t)c, (uint32_t)s);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -449,27 +449,27 @@ atomic_write_p(void **p, const void *x) {
|
||||
JEMALLOC_INLINE size_t
|
||||
atomic_add_zu(size_t *p, size_t x) {
|
||||
#if (LG_SIZEOF_PTR == 3)
|
||||
return ((size_t)atomic_add_u64((uint64_t *)p, (uint64_t)x));
|
||||
return (size_t)atomic_add_u64((uint64_t *)p, (uint64_t)x);
|
||||
#elif (LG_SIZEOF_PTR == 2)
|
||||
return ((size_t)atomic_add_u32((uint32_t *)p, (uint32_t)x));
|
||||
return (size_t)atomic_add_u32((uint32_t *)p, (uint32_t)x);
|
||||
#endif
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE size_t
|
||||
atomic_sub_zu(size_t *p, size_t x) {
|
||||
#if (LG_SIZEOF_PTR == 3)
|
||||
return ((size_t)atomic_add_u64((uint64_t *)p, (uint64_t)-((int64_t)x)));
|
||||
return (size_t)atomic_add_u64((uint64_t *)p, (uint64_t)-((int64_t)x));
|
||||
#elif (LG_SIZEOF_PTR == 2)
|
||||
return ((size_t)atomic_add_u32((uint32_t *)p, (uint32_t)-((int32_t)x)));
|
||||
return (size_t)atomic_add_u32((uint32_t *)p, (uint32_t)-((int32_t)x));
|
||||
#endif
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
atomic_cas_zu(size_t *p, size_t c, size_t s) {
|
||||
#if (LG_SIZEOF_PTR == 3)
|
||||
return (atomic_cas_u64((uint64_t *)p, (uint64_t)c, (uint64_t)s));
|
||||
return atomic_cas_u64((uint64_t *)p, (uint64_t)c, (uint64_t)s);
|
||||
#elif (LG_SIZEOF_PTR == 2)
|
||||
return (atomic_cas_u32((uint32_t *)p, (uint32_t)c, (uint32_t)s));
|
||||
return atomic_cas_u32((uint32_t *)p, (uint32_t)c, (uint32_t)s);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -487,29 +487,27 @@ atomic_write_zu(size_t *p, size_t x) {
|
||||
JEMALLOC_INLINE unsigned
|
||||
atomic_add_u(unsigned *p, unsigned x) {
|
||||
#if (LG_SIZEOF_INT == 3)
|
||||
return ((unsigned)atomic_add_u64((uint64_t *)p, (uint64_t)x));
|
||||
return (unsigned)atomic_add_u64((uint64_t *)p, (uint64_t)x);
|
||||
#elif (LG_SIZEOF_INT == 2)
|
||||
return ((unsigned)atomic_add_u32((uint32_t *)p, (uint32_t)x));
|
||||
return (unsigned)atomic_add_u32((uint32_t *)p, (uint32_t)x);
|
||||
#endif
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE unsigned
|
||||
atomic_sub_u(unsigned *p, unsigned x) {
|
||||
#if (LG_SIZEOF_INT == 3)
|
||||
return ((unsigned)atomic_add_u64((uint64_t *)p,
|
||||
(uint64_t)-((int64_t)x)));
|
||||
return (unsigned)atomic_add_u64((uint64_t *)p, (uint64_t)-((int64_t)x));
|
||||
#elif (LG_SIZEOF_INT == 2)
|
||||
return ((unsigned)atomic_add_u32((uint32_t *)p,
|
||||
(uint32_t)-((int32_t)x)));
|
||||
return (unsigned)atomic_add_u32((uint32_t *)p, (uint32_t)-((int32_t)x));
|
||||
#endif
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
atomic_cas_u(unsigned *p, unsigned c, unsigned s) {
|
||||
#if (LG_SIZEOF_INT == 3)
|
||||
return (atomic_cas_u64((uint64_t *)p, (uint64_t)c, (uint64_t)s));
|
||||
return atomic_cas_u64((uint64_t *)p, (uint64_t)c, (uint64_t)s);
|
||||
#elif (LG_SIZEOF_INT == 2)
|
||||
return (atomic_cas_u32((uint32_t *)p, (uint32_t)c, (uint32_t)s));
|
||||
return atomic_cas_u32((uint32_t *)p, (uint32_t)c, (uint32_t)s);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@ unsigned base_ind_get(const base_t *base);
|
||||
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_BASE_C_))
|
||||
JEMALLOC_INLINE unsigned
|
||||
base_ind_get(const base_t *base) {
|
||||
return (base->ind);
|
||||
return base->ind;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -22,10 +22,10 @@ bitmap_full(bitmap_t *bitmap, const bitmap_info_t *binfo) {
|
||||
|
||||
for (i = 0; i < binfo->ngroups; i++) {
|
||||
if (bitmap[i] != 0) {
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (true);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ bitmap_get(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit) {
|
||||
assert(bit < binfo->nbits);
|
||||
goff = bit >> LG_BITMAP_GROUP_NBITS;
|
||||
g = bitmap[goff];
|
||||
return (!(g & (ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK))));
|
||||
return !(g & (ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK)));
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -103,7 +103,7 @@ bitmap_sfu(bitmap_t *bitmap, const bitmap_info_t *binfo) {
|
||||
bit = (i << LG_BITMAP_GROUP_NBITS) + (bit - 1);
|
||||
#endif
|
||||
bitmap_set(bitmap, binfo, bit);
|
||||
return (bit);
|
||||
return bit;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
|
@@ -47,65 +47,65 @@ extent_lookup(tsdn_t *tsdn, const void *ptr, bool dependent) {
|
||||
rtree_ctx_t rtree_ctx_fallback;
|
||||
rtree_ctx_t *rtree_ctx = tsdn_rtree_ctx(tsdn, &rtree_ctx_fallback);
|
||||
|
||||
return (rtree_read(tsdn, &extents_rtree, rtree_ctx, (uintptr_t)ptr,
|
||||
dependent));
|
||||
return rtree_read(tsdn, &extents_rtree, rtree_ctx, (uintptr_t)ptr,
|
||||
dependent);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE arena_t *
|
||||
extent_arena_get(const extent_t *extent) {
|
||||
return (extent->e_arena);
|
||||
return extent->e_arena;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void *
|
||||
extent_base_get(const extent_t *extent) {
|
||||
assert(extent->e_addr == PAGE_ADDR2BASE(extent->e_addr) ||
|
||||
!extent->e_slab);
|
||||
return (PAGE_ADDR2BASE(extent->e_addr));
|
||||
return PAGE_ADDR2BASE(extent->e_addr);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void *
|
||||
extent_addr_get(const extent_t *extent) {
|
||||
assert(extent->e_addr == PAGE_ADDR2BASE(extent->e_addr) ||
|
||||
!extent->e_slab);
|
||||
return (extent->e_addr);
|
||||
return extent->e_addr;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE size_t
|
||||
extent_size_get(const extent_t *extent) {
|
||||
return (extent->e_size);
|
||||
return extent->e_size;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE size_t
|
||||
extent_usize_get(const extent_t *extent) {
|
||||
assert(!extent->e_slab);
|
||||
return (extent->e_usize);
|
||||
return extent->e_usize;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void *
|
||||
extent_before_get(const extent_t *extent) {
|
||||
return ((void *)((uintptr_t)extent_base_get(extent) - PAGE));
|
||||
return (void *)((uintptr_t)extent_base_get(extent) - PAGE);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void *
|
||||
extent_last_get(const extent_t *extent) {
|
||||
return ((void *)((uintptr_t)extent_base_get(extent) +
|
||||
extent_size_get(extent) - PAGE));
|
||||
return (void *)((uintptr_t)extent_base_get(extent) +
|
||||
extent_size_get(extent) - PAGE);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void *
|
||||
extent_past_get(const extent_t *extent) {
|
||||
return ((void *)((uintptr_t)extent_base_get(extent) +
|
||||
extent_size_get(extent)));
|
||||
return (void *)((uintptr_t)extent_base_get(extent) +
|
||||
extent_size_get(extent));
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE size_t
|
||||
extent_sn_get(const extent_t *extent) {
|
||||
return (extent->e_sn);
|
||||
return extent->e_sn;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
extent_active_get(const extent_t *extent) {
|
||||
return (extent->e_active);
|
||||
return extent->e_active;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
@@ -115,35 +115,35 @@ extent_retained_get(const extent_t *extent) {
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
extent_zeroed_get(const extent_t *extent) {
|
||||
return (extent->e_zeroed);
|
||||
return extent->e_zeroed;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
extent_committed_get(const extent_t *extent) {
|
||||
return (extent->e_committed);
|
||||
return extent->e_committed;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
extent_slab_get(const extent_t *extent) {
|
||||
return (extent->e_slab);
|
||||
return extent->e_slab;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE arena_slab_data_t *
|
||||
extent_slab_data_get(extent_t *extent) {
|
||||
assert(extent->e_slab);
|
||||
return (&extent->e_slab_data);
|
||||
return &extent->e_slab_data;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE const arena_slab_data_t *
|
||||
extent_slab_data_get_const(const extent_t *extent) {
|
||||
assert(extent->e_slab);
|
||||
return (&extent->e_slab_data);
|
||||
return &extent->e_slab_data;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE prof_tctx_t *
|
||||
extent_prof_tctx_get(const extent_t *extent) {
|
||||
return ((prof_tctx_t *)atomic_read_p(
|
||||
&((extent_t *)extent)->e_prof_tctx_pun));
|
||||
return (prof_tctx_t *)atomic_read_p(
|
||||
&((extent_t *)extent)->e_prof_tctx_pun);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -251,7 +251,7 @@ extent_sn_comp(const extent_t *a, const extent_t *b) {
|
||||
size_t a_sn = extent_sn_get(a);
|
||||
size_t b_sn = extent_sn_get(b);
|
||||
|
||||
return ((a_sn > b_sn) - (a_sn < b_sn));
|
||||
return (a_sn > b_sn) - (a_sn < b_sn);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE int
|
||||
@@ -259,7 +259,7 @@ extent_ad_comp(const extent_t *a, const extent_t *b) {
|
||||
uintptr_t a_addr = (uintptr_t)extent_addr_get(a);
|
||||
uintptr_t b_addr = (uintptr_t)extent_addr_get(b);
|
||||
|
||||
return ((a_addr > b_addr) - (a_addr < b_addr));
|
||||
return (a_addr > b_addr) - (a_addr < b_addr);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE int
|
||||
@@ -268,11 +268,11 @@ extent_snad_comp(const extent_t *a, const extent_t *b) {
|
||||
|
||||
ret = extent_sn_comp(a, b);
|
||||
if (ret != 0) {
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = extent_ad_comp(a, b);
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -37,10 +37,10 @@ hash_get_block_32(const uint32_t *p, int i) {
|
||||
uint32_t ret;
|
||||
|
||||
memcpy(&ret, (uint8_t *)(p + i), sizeof(uint32_t));
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return (p[i]);
|
||||
return p[i];
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint64_t
|
||||
@@ -50,10 +50,10 @@ hash_get_block_64(const uint64_t *p, int i) {
|
||||
uint64_t ret;
|
||||
|
||||
memcpy(&ret, (uint8_t *)(p + i), sizeof(uint64_t));
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return (p[i]);
|
||||
return p[i];
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint32_t
|
||||
@@ -64,7 +64,7 @@ hash_fmix_32(uint32_t h) {
|
||||
h *= 0xc2b2ae35;
|
||||
h ^= h >> 16;
|
||||
|
||||
return (h);
|
||||
return h;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint64_t
|
||||
@@ -75,7 +75,7 @@ hash_fmix_64(uint64_t k) {
|
||||
k *= KQU(0xc4ceb9fe1a85ec53);
|
||||
k ^= k >> 33;
|
||||
|
||||
return (k);
|
||||
return k;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint32_t
|
||||
@@ -125,7 +125,7 @@ hash_x86_32(const void *key, int len, uint32_t seed) {
|
||||
|
||||
h1 = hash_fmix_32(h1);
|
||||
|
||||
return (h1);
|
||||
return h1;
|
||||
}
|
||||
|
||||
UNUSED JEMALLOC_INLINE void
|
||||
|
@@ -552,7 +552,7 @@ ticker_t *decay_ticker_get(tsd_t *tsd, unsigned ind);
|
||||
JEMALLOC_ALWAYS_INLINE pszind_t
|
||||
psz2ind(size_t psz) {
|
||||
if (unlikely(psz > LARGE_MAXCLASS)) {
|
||||
return (NPSIZES);
|
||||
return NPSIZES;
|
||||
}
|
||||
{
|
||||
pszind_t x = lg_floor((psz<<1)-1);
|
||||
@@ -568,14 +568,14 @@ psz2ind(size_t psz) {
|
||||
((ZU(1) << LG_SIZE_CLASS_GROUP) - 1);
|
||||
|
||||
pszind_t ind = grp + mod;
|
||||
return (ind);
|
||||
return ind;
|
||||
}
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE size_t
|
||||
pind2sz_compute(pszind_t pind) {
|
||||
if (unlikely(pind == NPSIZES)) {
|
||||
return (LARGE_MAXCLASS + PAGE);
|
||||
return LARGE_MAXCLASS + PAGE;
|
||||
}
|
||||
{
|
||||
size_t grp = pind >> LG_SIZE_CLASS_GROUP;
|
||||
@@ -590,7 +590,7 @@ pind2sz_compute(pszind_t pind) {
|
||||
size_t mod_size = (mod+1) << lg_delta;
|
||||
|
||||
size_t sz = grp_size + mod_size;
|
||||
return (sz);
|
||||
return sz;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,19 +598,19 @@ JEMALLOC_INLINE size_t
|
||||
pind2sz_lookup(pszind_t pind) {
|
||||
size_t ret = (size_t)pind2sz_tab[pind];
|
||||
assert(ret == pind2sz_compute(pind));
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE size_t
|
||||
pind2sz(pszind_t pind) {
|
||||
assert(pind < NPSIZES+1);
|
||||
return (pind2sz_lookup(pind));
|
||||
return pind2sz_lookup(pind);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE size_t
|
||||
psz2u(size_t psz) {
|
||||
if (unlikely(psz > LARGE_MAXCLASS)) {
|
||||
return (LARGE_MAXCLASS + PAGE);
|
||||
return LARGE_MAXCLASS + PAGE;
|
||||
}
|
||||
{
|
||||
size_t x = lg_floor((psz<<1)-1);
|
||||
@@ -619,14 +619,14 @@ psz2u(size_t psz) {
|
||||
size_t delta = ZU(1) << lg_delta;
|
||||
size_t delta_mask = delta - 1;
|
||||
size_t usize = (psz + delta_mask) & ~delta_mask;
|
||||
return (usize);
|
||||
return usize;
|
||||
}
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE szind_t
|
||||
size2index_compute(size_t size) {
|
||||
if (unlikely(size > LARGE_MAXCLASS)) {
|
||||
return (NSIZES);
|
||||
return NSIZES;
|
||||
}
|
||||
#if (NTBINS != 0)
|
||||
if (size <= (ZU(1) << LG_TINY_MAXCLASS)) {
|
||||
@@ -649,7 +649,7 @@ size2index_compute(size_t size) {
|
||||
((ZU(1) << LG_SIZE_CLASS_GROUP) - 1);
|
||||
|
||||
szind_t index = NTBINS + grp + mod;
|
||||
return (index);
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ size2index_lookup(size_t size) {
|
||||
{
|
||||
szind_t ret = (size2index_tab[(size-1) >> LG_TINY_MIN]);
|
||||
assert(ret == size2index_compute(size));
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,9 +667,9 @@ JEMALLOC_ALWAYS_INLINE szind_t
|
||||
size2index(size_t size) {
|
||||
assert(size > 0);
|
||||
if (likely(size <= LOOKUP_MAXCLASS)) {
|
||||
return (size2index_lookup(size));
|
||||
return size2index_lookup(size);
|
||||
}
|
||||
return (size2index_compute(size));
|
||||
return size2index_compute(size);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE size_t
|
||||
@@ -694,7 +694,7 @@ index2size_compute(szind_t index) {
|
||||
size_t mod_size = (mod+1) << lg_delta;
|
||||
|
||||
size_t usize = grp_size + mod_size;
|
||||
return (usize);
|
||||
return usize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,19 +702,19 @@ JEMALLOC_ALWAYS_INLINE size_t
|
||||
index2size_lookup(szind_t index) {
|
||||
size_t ret = (size_t)index2size_tab[index];
|
||||
assert(ret == index2size_compute(index));
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE size_t
|
||||
index2size(szind_t index) {
|
||||
assert(index < NSIZES);
|
||||
return (index2size_lookup(index));
|
||||
return index2size_lookup(index);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE size_t
|
||||
s2u_compute(size_t size) {
|
||||
if (unlikely(size > LARGE_MAXCLASS)) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
#if (NTBINS > 0)
|
||||
if (size <= (ZU(1) << LG_TINY_MAXCLASS)) {
|
||||
@@ -731,7 +731,7 @@ s2u_compute(size_t size) {
|
||||
size_t delta = ZU(1) << lg_delta;
|
||||
size_t delta_mask = delta - 1;
|
||||
size_t usize = (size + delta_mask) & ~delta_mask;
|
||||
return (usize);
|
||||
return usize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -740,7 +740,7 @@ s2u_lookup(size_t size) {
|
||||
size_t ret = index2size_lookup(size2index_lookup(size));
|
||||
|
||||
assert(ret == s2u_compute(size));
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -751,9 +751,9 @@ JEMALLOC_ALWAYS_INLINE size_t
|
||||
s2u(size_t size) {
|
||||
assert(size > 0);
|
||||
if (likely(size <= LOOKUP_MAXCLASS)) {
|
||||
return (s2u_lookup(size));
|
||||
return s2u_lookup(size);
|
||||
}
|
||||
return (s2u_compute(size));
|
||||
return s2u_compute(size);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -784,14 +784,14 @@ sa2u(size_t size, size_t alignment) {
|
||||
*/
|
||||
usize = s2u(ALIGNMENT_CEILING(size, alignment));
|
||||
if (usize < LARGE_MINCLASS) {
|
||||
return (usize);
|
||||
return usize;
|
||||
}
|
||||
}
|
||||
|
||||
/* Large size class. Beware of overflow. */
|
||||
|
||||
if (unlikely(alignment > LARGE_MAXCLASS)) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Make sure result is a large size class. */
|
||||
@@ -801,7 +801,7 @@ sa2u(size_t size, size_t alignment) {
|
||||
usize = s2u(size);
|
||||
if (usize < size) {
|
||||
/* size_t overflow. */
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -811,9 +811,9 @@ sa2u(size_t size, size_t alignment) {
|
||||
*/
|
||||
if (usize + large_pad + PAGE_CEILING(alignment) - PAGE < usize) {
|
||||
/* size_t overflow. */
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
return (usize);
|
||||
return usize;
|
||||
}
|
||||
|
||||
/* Choose an arena based on a per-thread value. */
|
||||
@@ -822,7 +822,7 @@ arena_choose_impl(tsd_t *tsd, arena_t *arena, bool internal) {
|
||||
arena_t *ret;
|
||||
|
||||
if (arena != NULL) {
|
||||
return (arena);
|
||||
return arena;
|
||||
}
|
||||
|
||||
ret = internal ? tsd_iarena_get(tsd) : tsd_arena_get(tsd);
|
||||
@@ -830,17 +830,17 @@ arena_choose_impl(tsd_t *tsd, arena_t *arena, bool internal) {
|
||||
ret = arena_choose_hard(tsd, internal);
|
||||
}
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE arena_t *
|
||||
arena_choose(tsd_t *tsd, arena_t *arena) {
|
||||
return (arena_choose_impl(tsd, arena, false));
|
||||
return arena_choose_impl(tsd, arena, false);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE arena_t *
|
||||
arena_ichoose(tsd_t *tsd, arena_t *arena) {
|
||||
return (arena_choose_impl(tsd, arena, true));
|
||||
return arena_choose_impl(tsd, arena, true);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE arena_tdata_t *
|
||||
@@ -850,7 +850,7 @@ arena_tdata_get(tsd_t *tsd, unsigned ind, bool refresh_if_missing) {
|
||||
|
||||
if (unlikely(arenas_tdata == NULL)) {
|
||||
/* arenas_tdata hasn't been initialized yet. */
|
||||
return (arena_tdata_get_hard(tsd, ind));
|
||||
return arena_tdata_get_hard(tsd, ind);
|
||||
}
|
||||
if (unlikely(ind >= tsd_narenas_tdata_get(tsd))) {
|
||||
/*
|
||||
@@ -863,9 +863,9 @@ arena_tdata_get(tsd_t *tsd, unsigned ind, bool refresh_if_missing) {
|
||||
|
||||
tdata = &arenas_tdata[ind];
|
||||
if (likely(tdata != NULL) || !refresh_if_missing) {
|
||||
return (tdata);
|
||||
return tdata;
|
||||
}
|
||||
return (arena_tdata_get_hard(tsd, ind));
|
||||
return arena_tdata_get_hard(tsd, ind);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE arena_t *
|
||||
@@ -882,7 +882,7 @@ arena_get(tsdn_t *tsdn, unsigned ind, bool init_if_missing) {
|
||||
(extent_hooks_t *)&extent_hooks_default);
|
||||
}
|
||||
}
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE ticker_t *
|
||||
@@ -891,9 +891,9 @@ decay_ticker_get(tsd_t *tsd, unsigned ind) {
|
||||
|
||||
tdata = arena_tdata_get(tsd, ind, true);
|
||||
if (unlikely(tdata == NULL)) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
return (&tdata->decay_ticker);
|
||||
return &tdata->decay_ticker;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -911,7 +911,7 @@ extent_t *iealloc(tsdn_t *tsdn, const void *ptr);
|
||||
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_))
|
||||
JEMALLOC_ALWAYS_INLINE extent_t *
|
||||
iealloc(tsdn_t *tsdn, const void *ptr) {
|
||||
return (extent_lookup(tsdn, ptr, true));
|
||||
return extent_lookup(tsdn, ptr, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -953,7 +953,7 @@ JEMALLOC_ALWAYS_INLINE arena_t *
|
||||
iaalloc(tsdn_t *tsdn, const void *ptr) {
|
||||
assert(ptr != NULL);
|
||||
|
||||
return (arena_aalloc(tsdn, ptr));
|
||||
return arena_aalloc(tsdn, ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -967,7 +967,7 @@ JEMALLOC_ALWAYS_INLINE size_t
|
||||
isalloc(tsdn_t *tsdn, const extent_t *extent, const void *ptr) {
|
||||
assert(ptr != NULL);
|
||||
|
||||
return (arena_salloc(tsdn, extent, ptr));
|
||||
return arena_salloc(tsdn, extent, ptr);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void *
|
||||
@@ -985,13 +985,13 @@ iallocztm(tsdn_t *tsdn, size_t size, szind_t ind, bool zero, tcache_t *tcache,
|
||||
arena_internal_add(iaalloc(tsdn, ret), isalloc(tsdn,
|
||||
iealloc(tsdn, ret), ret));
|
||||
}
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void *
|
||||
ialloc(tsd_t *tsd, size_t size, szind_t ind, bool zero, bool slow_path) {
|
||||
return (iallocztm(tsd_tsdn(tsd), size, ind, zero, tcache_get(tsd, true),
|
||||
false, NULL, slow_path));
|
||||
return iallocztm(tsd_tsdn(tsd), size, ind, zero, tcache_get(tsd, true),
|
||||
false, NULL, slow_path);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void *
|
||||
@@ -1011,19 +1011,19 @@ ipallocztm(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
|
||||
arena_internal_add(iaalloc(tsdn, ret), isalloc(tsdn,
|
||||
iealloc(tsdn, ret), ret));
|
||||
}
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void *
|
||||
ipalloct(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
|
||||
tcache_t *tcache, arena_t *arena) {
|
||||
return (ipallocztm(tsdn, usize, alignment, zero, tcache, false, arena));
|
||||
return ipallocztm(tsdn, usize, alignment, zero, tcache, false, arena);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void *
|
||||
ipalloc(tsd_t *tsd, size_t usize, size_t alignment, bool zero) {
|
||||
return (ipallocztm(tsd_tsdn(tsd), usize, alignment, zero,
|
||||
tcache_get(tsd, true), false, NULL));
|
||||
return ipallocztm(tsd_tsdn(tsd), usize, alignment, zero,
|
||||
tcache_get(tsd, true), false, NULL);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE size_t
|
||||
@@ -1040,13 +1040,13 @@ ivsalloc(tsdn_t *tsdn, const void *ptr) {
|
||||
* */
|
||||
extent = extent_lookup(tsdn, ptr, false);
|
||||
if (extent == NULL) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
assert(extent_active_get(extent));
|
||||
/* Only slab members should be looked up via interior pointers. */
|
||||
assert(extent_addr_get(extent) == ptr || extent_slab_get(extent));
|
||||
|
||||
return (isalloc(tsdn, extent, ptr));
|
||||
return isalloc(tsdn, extent, ptr);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
@@ -1085,21 +1085,21 @@ iralloct_realign(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t oldsize,
|
||||
|
||||
usize = sa2u(size + extra, alignment);
|
||||
if (unlikely(usize == 0 || usize > LARGE_MAXCLASS)) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
p = ipalloct(tsdn, usize, alignment, zero, tcache, arena);
|
||||
if (p == NULL) {
|
||||
if (extra == 0) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
/* Try again, without extra this time. */
|
||||
usize = sa2u(size, alignment);
|
||||
if (unlikely(usize == 0 || usize > LARGE_MAXCLASS)) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
p = ipalloct(tsdn, usize, alignment, zero, tcache, arena);
|
||||
if (p == NULL) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -1109,7 +1109,7 @@ iralloct_realign(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t oldsize,
|
||||
copysize = (size < oldsize) ? size : oldsize;
|
||||
memcpy(p, ptr, copysize);
|
||||
isdalloct(tsdn, extent, ptr, oldsize, tcache, true);
|
||||
return (p);
|
||||
return p;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void *
|
||||
@@ -1124,19 +1124,19 @@ iralloct(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t oldsize, size_t size,
|
||||
* Existing object alignment is inadequate; allocate new space
|
||||
* and copy.
|
||||
*/
|
||||
return (iralloct_realign(tsdn, extent, ptr, oldsize, size, 0,
|
||||
alignment, zero, tcache, arena));
|
||||
return iralloct_realign(tsdn, extent, ptr, oldsize, size, 0,
|
||||
alignment, zero, tcache, arena);
|
||||
}
|
||||
|
||||
return (arena_ralloc(tsdn, arena, extent, ptr, oldsize, size, alignment,
|
||||
zero, tcache));
|
||||
return arena_ralloc(tsdn, arena, extent, ptr, oldsize, size, alignment,
|
||||
zero, tcache);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void *
|
||||
iralloc(tsd_t *tsd, extent_t *extent, void *ptr, size_t oldsize, size_t size,
|
||||
size_t alignment, bool zero) {
|
||||
return (iralloct(tsd_tsdn(tsd), extent, ptr, oldsize, size, alignment,
|
||||
zero, tcache_get(tsd, true), NULL));
|
||||
return iralloct(tsd_tsdn(tsd), extent, ptr, oldsize, size, alignment,
|
||||
zero, tcache_get(tsd, true), NULL);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE bool
|
||||
@@ -1148,11 +1148,11 @@ ixalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t oldsize, size_t size,
|
||||
if (alignment != 0 && ((uintptr_t)ptr & ((uintptr_t)alignment-1))
|
||||
!= 0) {
|
||||
/* Existing object alignment is inadequate. */
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return (arena_ralloc_no_move(tsdn, extent, ptr, oldsize, size, extra,
|
||||
zero));
|
||||
return arena_ralloc_no_move(tsdn, extent, ptr, oldsize, size, extra,
|
||||
zero);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -218,10 +218,10 @@ a_prefix##empty(a_ph_type *ph) { \
|
||||
a_attr a_type * \
|
||||
a_prefix##first(a_ph_type *ph) { \
|
||||
if (ph->ph_root == NULL) { \
|
||||
return (NULL); \
|
||||
return NULL; \
|
||||
} \
|
||||
ph_merge_aux(a_type, a_field, ph, a_cmp); \
|
||||
return (ph->ph_root); \
|
||||
return ph->ph_root; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_prefix##insert(a_ph_type *ph, a_type *phn) { \
|
||||
@@ -255,7 +255,7 @@ a_prefix##remove_first(a_ph_type *ph) { \
|
||||
a_type *ret; \
|
||||
\
|
||||
if (ph->ph_root == NULL) { \
|
||||
return (NULL); \
|
||||
return NULL; \
|
||||
} \
|
||||
ph_merge_aux(a_type, a_field, ph, a_cmp); \
|
||||
\
|
||||
@@ -264,7 +264,7 @@ a_prefix##remove_first(a_ph_type *ph) { \
|
||||
ph_merge_children(a_type, a_field, ph->ph_root, a_cmp, \
|
||||
ph->ph_root); \
|
||||
\
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_prefix##remove(a_ph_type *ph, a_type *phn) { \
|
||||
|
@@ -19,20 +19,20 @@ size_t prng_range_zu(size_t *state, size_t range, bool atomic);
|
||||
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_PRNG_C_))
|
||||
JEMALLOC_ALWAYS_INLINE uint32_t
|
||||
prng_state_next_u32(uint32_t state) {
|
||||
return ((state * PRNG_A_32) + PRNG_C_32);
|
||||
return (state * PRNG_A_32) + PRNG_C_32;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE uint64_t
|
||||
prng_state_next_u64(uint64_t state) {
|
||||
return ((state * PRNG_A_64) + PRNG_C_64);
|
||||
return (state * PRNG_A_64) + PRNG_C_64;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE size_t
|
||||
prng_state_next_zu(size_t state) {
|
||||
#if LG_SIZEOF_PTR == 2
|
||||
return ((state * PRNG_A_32) + PRNG_C_32);
|
||||
return (state * PRNG_A_32) + PRNG_C_32;
|
||||
#elif LG_SIZEOF_PTR == 3
|
||||
return ((state * PRNG_A_64) + PRNG_C_64);
|
||||
return (state * PRNG_A_64) + PRNG_C_64;
|
||||
#else
|
||||
#error Unsupported pointer size
|
||||
#endif
|
||||
@@ -58,7 +58,7 @@ prng_lg_range_u32(uint32_t *state, unsigned lg_range, bool atomic) {
|
||||
}
|
||||
ret = state1 >> (32 - lg_range);
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 64-bit atomic operations cannot be supported on all relevant platforms. */
|
||||
@@ -73,7 +73,7 @@ prng_lg_range_u64(uint64_t *state, unsigned lg_range) {
|
||||
*state = state1;
|
||||
ret = state1 >> (64 - lg_range);
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE size_t
|
||||
@@ -96,7 +96,7 @@ prng_lg_range_zu(size_t *state, unsigned lg_range, bool atomic) {
|
||||
}
|
||||
ret = state1 >> ((ZU(1) << (3 + LG_SIZEOF_PTR)) - lg_range);
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE uint32_t
|
||||
@@ -114,7 +114,7 @@ prng_range_u32(uint32_t *state, uint32_t range, bool atomic) {
|
||||
ret = prng_lg_range_u32(state, lg_range, atomic);
|
||||
} while (ret >= range);
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE uint64_t
|
||||
@@ -132,7 +132,7 @@ prng_range_u64(uint64_t *state, uint64_t range) {
|
||||
ret = prng_lg_range_u64(state, lg_range);
|
||||
} while (ret >= range);
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE size_t
|
||||
@@ -150,7 +150,7 @@ prng_range_zu(size_t *state, size_t range, bool atomic) {
|
||||
ret = prng_lg_range_zu(state, lg_range, atomic);
|
||||
} while (ret >= range);
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -34,7 +34,7 @@ prof_active_get_unlocked(void) {
|
||||
* prof_active in the fast path, so there are no guarantees regarding
|
||||
* how long it will take for all threads to notice state changes.
|
||||
*/
|
||||
return (prof_active);
|
||||
return prof_active;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE bool
|
||||
@@ -44,7 +44,7 @@ prof_gdump_get_unlocked(void) {
|
||||
* there are no guarantees regarding how long it will take for all
|
||||
* threads to notice state changes.
|
||||
*/
|
||||
return (prof_gdump_val);
|
||||
return prof_gdump_val;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE prof_tdata_t *
|
||||
@@ -67,7 +67,7 @@ prof_tdata_get(tsd_t *tsd, bool create) {
|
||||
assert(tdata == NULL || tdata->attached);
|
||||
}
|
||||
|
||||
return (tdata);
|
||||
return tdata;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE prof_tctx_t *
|
||||
@@ -75,7 +75,7 @@ prof_tctx_get(tsdn_t *tsdn, const extent_t *extent, const void *ptr) {
|
||||
cassert(config_prof);
|
||||
assert(ptr != NULL);
|
||||
|
||||
return (arena_prof_tctx_get(tsdn, extent, ptr));
|
||||
return arena_prof_tctx_get(tsdn, extent, ptr);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
@@ -113,20 +113,20 @@ prof_sample_accum_update(tsd_t *tsd, size_t usize, bool update,
|
||||
}
|
||||
|
||||
if (unlikely(tdata == NULL)) {
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (likely(tdata->bytes_until_sample >= usize)) {
|
||||
if (update) {
|
||||
tdata->bytes_until_sample -= usize;
|
||||
}
|
||||
return (true);
|
||||
return true;
|
||||
} else {
|
||||
/* Compute new sample threshold. */
|
||||
if (update) {
|
||||
prof_sample_threshold_update(tdata);
|
||||
}
|
||||
return (!tdata->active);
|
||||
return !tdata->active;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ prof_alloc_prep(tsd_t *tsd, size_t usize, bool prof_active, bool update) {
|
||||
ret = prof_lookup(tsd, &bt);
|
||||
}
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
|
@@ -348,13 +348,13 @@ a_attr a_type * \
|
||||
a_prefix##first(a_rbt_type *rbtree) { \
|
||||
a_type *ret; \
|
||||
rbtn_first(a_type, a_field, rbtree, rbtree->rbt_root, ret); \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
a_attr a_type * \
|
||||
a_prefix##last(a_rbt_type *rbtree) { \
|
||||
a_type *ret; \
|
||||
rbtn_last(a_type, a_field, rbtree, rbtree->rbt_root, ret); \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
a_attr a_type * \
|
||||
a_prefix##next(a_rbt_type *rbtree, a_type *node) { \
|
||||
@@ -379,7 +379,7 @@ a_prefix##next(a_rbt_type *rbtree, a_type *node) { \
|
||||
assert(tnode != NULL); \
|
||||
} \
|
||||
} \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
a_attr a_type * \
|
||||
a_prefix##prev(a_rbt_type *rbtree, a_type *node) { \
|
||||
@@ -404,7 +404,7 @@ a_prefix##prev(a_rbt_type *rbtree, a_type *node) { \
|
||||
assert(tnode != NULL); \
|
||||
} \
|
||||
} \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
a_attr a_type * \
|
||||
a_prefix##search(a_rbt_type *rbtree, const a_type *key) { \
|
||||
@@ -419,7 +419,7 @@ a_prefix##search(a_rbt_type *rbtree, const a_type *key) { \
|
||||
ret = rbtn_right_get(a_type, a_field, ret); \
|
||||
} \
|
||||
} \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
a_attr a_type * \
|
||||
a_prefix##nsearch(a_rbt_type *rbtree, const a_type *key) { \
|
||||
@@ -438,7 +438,7 @@ a_prefix##nsearch(a_rbt_type *rbtree, const a_type *key) { \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
a_attr a_type * \
|
||||
a_prefix##psearch(a_rbt_type *rbtree, const a_type *key) { \
|
||||
@@ -457,7 +457,7 @@ a_prefix##psearch(a_rbt_type *rbtree, const a_type *key) { \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_prefix##insert(a_rbt_type *rbtree, a_type *node) { \
|
||||
@@ -872,16 +872,16 @@ a_attr a_type * \
|
||||
a_prefix##iter_recurse(a_rbt_type *rbtree, a_type *node, \
|
||||
a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg) { \
|
||||
if (node == NULL) { \
|
||||
return (NULL); \
|
||||
return NULL; \
|
||||
} else { \
|
||||
a_type *ret; \
|
||||
if ((ret = a_prefix##iter_recurse(rbtree, rbtn_left_get(a_type, \
|
||||
a_field, node), cb, arg)) != NULL || (ret = cb(rbtree, node, \
|
||||
arg)) != NULL) { \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
return (a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \
|
||||
a_field, node), cb, arg)); \
|
||||
return a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \
|
||||
a_field, node), cb, arg); \
|
||||
} \
|
||||
} \
|
||||
a_attr a_type * \
|
||||
@@ -893,20 +893,20 @@ a_prefix##iter_start(a_rbt_type *rbtree, a_type *start, a_type *node, \
|
||||
if ((ret = a_prefix##iter_start(rbtree, start, \
|
||||
rbtn_left_get(a_type, a_field, node), cb, arg)) != NULL || \
|
||||
(ret = cb(rbtree, node, arg)) != NULL) { \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
return (a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \
|
||||
a_field, node), cb, arg)); \
|
||||
return a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \
|
||||
a_field, node), cb, arg); \
|
||||
} else if (cmp > 0) { \
|
||||
return (a_prefix##iter_start(rbtree, start, \
|
||||
rbtn_right_get(a_type, a_field, node), cb, arg)); \
|
||||
return a_prefix##iter_start(rbtree, start, \
|
||||
rbtn_right_get(a_type, a_field, node), cb, arg); \
|
||||
} else { \
|
||||
a_type *ret; \
|
||||
if ((ret = cb(rbtree, node, arg)) != NULL) { \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
return (a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \
|
||||
a_field, node), cb, arg)); \
|
||||
return a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \
|
||||
a_field, node), cb, arg); \
|
||||
} \
|
||||
} \
|
||||
a_attr a_type * \
|
||||
@@ -919,22 +919,22 @@ a_prefix##iter(a_rbt_type *rbtree, a_type *start, a_type *(*cb)( \
|
||||
} else { \
|
||||
ret = a_prefix##iter_recurse(rbtree, rbtree->rbt_root, cb, arg);\
|
||||
} \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
a_attr a_type * \
|
||||
a_prefix##reverse_iter_recurse(a_rbt_type *rbtree, a_type *node, \
|
||||
a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg) { \
|
||||
if (node == NULL) { \
|
||||
return (NULL); \
|
||||
return NULL; \
|
||||
} else { \
|
||||
a_type *ret; \
|
||||
if ((ret = a_prefix##reverse_iter_recurse(rbtree, \
|
||||
rbtn_right_get(a_type, a_field, node), cb, arg)) != NULL || \
|
||||
(ret = cb(rbtree, node, arg)) != NULL) { \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
return (a_prefix##reverse_iter_recurse(rbtree, \
|
||||
rbtn_left_get(a_type, a_field, node), cb, arg)); \
|
||||
return a_prefix##reverse_iter_recurse(rbtree, \
|
||||
rbtn_left_get(a_type, a_field, node), cb, arg); \
|
||||
} \
|
||||
} \
|
||||
a_attr a_type * \
|
||||
@@ -947,20 +947,20 @@ a_prefix##reverse_iter_start(a_rbt_type *rbtree, a_type *start, \
|
||||
if ((ret = a_prefix##reverse_iter_start(rbtree, start, \
|
||||
rbtn_right_get(a_type, a_field, node), cb, arg)) != NULL || \
|
||||
(ret = cb(rbtree, node, arg)) != NULL) { \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
return (a_prefix##reverse_iter_recurse(rbtree, \
|
||||
rbtn_left_get(a_type, a_field, node), cb, arg)); \
|
||||
return a_prefix##reverse_iter_recurse(rbtree, \
|
||||
rbtn_left_get(a_type, a_field, node), cb, arg); \
|
||||
} else if (cmp < 0) { \
|
||||
return (a_prefix##reverse_iter_start(rbtree, start, \
|
||||
rbtn_left_get(a_type, a_field, node), cb, arg)); \
|
||||
return a_prefix##reverse_iter_start(rbtree, start, \
|
||||
rbtn_left_get(a_type, a_field, node), cb, arg); \
|
||||
} else { \
|
||||
a_type *ret; \
|
||||
if ((ret = cb(rbtree, node, arg)) != NULL) { \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
return (a_prefix##reverse_iter_recurse(rbtree, \
|
||||
rbtn_left_get(a_type, a_field, node), cb, arg)); \
|
||||
return a_prefix##reverse_iter_recurse(rbtree, \
|
||||
rbtn_left_get(a_type, a_field, node), cb, arg); \
|
||||
} \
|
||||
} \
|
||||
a_attr a_type * \
|
||||
@@ -974,7 +974,7 @@ a_prefix##reverse_iter(a_rbt_type *rbtree, a_type *start, \
|
||||
ret = a_prefix##reverse_iter_recurse(rbtree, rbtree->rbt_root, \
|
||||
cb, arg); \
|
||||
} \
|
||||
return (ret); \
|
||||
return ret; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_prefix##destroy_recurse(a_rbt_type *rbtree, a_type *node, void (*cb)( \
|
||||
|
@@ -41,13 +41,13 @@ rtree_start_level(const rtree_t *rtree, uintptr_t key) {
|
||||
unsigned start_level;
|
||||
|
||||
if (unlikely(key == 0)) {
|
||||
return (rtree->height - 1);
|
||||
return rtree->height - 1;
|
||||
}
|
||||
|
||||
start_level = rtree->start_level[(lg_floor(key) + 1) >>
|
||||
LG_RTREE_BITS_PER_LEVEL];
|
||||
assert(start_level < rtree->height);
|
||||
return (start_level);
|
||||
return start_level;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE unsigned
|
||||
@@ -67,7 +67,7 @@ rtree_ctx_start_level(const rtree_t *rtree, const rtree_ctx_t *rtree_ctx,
|
||||
start_level = rtree->start_level[(lg_floor(key_diff) + 1) >>
|
||||
LG_RTREE_BITS_PER_LEVEL];
|
||||
assert(start_level < rtree->height);
|
||||
return (start_level);
|
||||
return start_level;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE uintptr_t
|
||||
@@ -92,7 +92,7 @@ rtree_child_tryread(rtree_elm_t *elm, bool dependent) {
|
||||
child = (rtree_elm_t *)atomic_read_p(&elm->pun);
|
||||
}
|
||||
assert(!dependent || child != NULL);
|
||||
return (child);
|
||||
return child;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE rtree_elm_t *
|
||||
@@ -105,7 +105,7 @@ rtree_child_read(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *elm, unsigned level,
|
||||
child = rtree_child_read_hard(tsdn, rtree, elm, level);
|
||||
}
|
||||
assert(!dependent || child != NULL);
|
||||
return (child);
|
||||
return child;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE extent_t *
|
||||
@@ -132,7 +132,7 @@ rtree_elm_read(rtree_elm_t *elm, bool dependent) {
|
||||
/* Mask the lock bit. */
|
||||
extent = (extent_t *)((uintptr_t)extent & ~((uintptr_t)0x1));
|
||||
|
||||
return (extent);
|
||||
return extent;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -151,7 +151,7 @@ rtree_subtree_tryread(rtree_t *rtree, unsigned level, bool dependent) {
|
||||
&rtree->levels[level].subtree_pun);
|
||||
}
|
||||
assert(!dependent || subtree != NULL);
|
||||
return (subtree);
|
||||
return subtree;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE rtree_elm_t *
|
||||
@@ -164,7 +164,7 @@ rtree_subtree_read(tsdn_t *tsdn, rtree_t *rtree, unsigned level,
|
||||
subtree = rtree_subtree_read_hard(tsdn, rtree, level);
|
||||
}
|
||||
assert(!dependent || subtree != NULL);
|
||||
return (subtree);
|
||||
return subtree;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE rtree_elm_t *
|
||||
@@ -179,7 +179,7 @@ rtree_elm_lookup(tsdn_t *tsdn, rtree_t *rtree, rtree_ctx_t *rtree_ctx,
|
||||
if (dependent || init_missing) {
|
||||
if (likely(rtree_ctx->valid)) {
|
||||
if (key == rtree_ctx->key) {
|
||||
return (rtree_ctx->elms[rtree->height]);
|
||||
return rtree_ctx->elms[rtree->height];
|
||||
} else {
|
||||
unsigned no_ctx_start_level =
|
||||
rtree_start_level(rtree, key);
|
||||
@@ -234,7 +234,7 @@ rtree_elm_lookup(tsdn_t *tsdn, rtree_t *rtree, rtree_ctx_t *rtree_ctx,
|
||||
if (init_missing) { \
|
||||
rtree_ctx->valid = false; \
|
||||
} \
|
||||
return (NULL); \
|
||||
return NULL; \
|
||||
} \
|
||||
subkey = rtree_subkey(rtree, key, level - \
|
||||
RTREE_GET_BIAS); \
|
||||
@@ -253,7 +253,7 @@ rtree_elm_lookup(tsdn_t *tsdn, rtree_t *rtree, rtree_ctx_t *rtree_ctx,
|
||||
if (init_missing) { \
|
||||
rtree_ctx->valid = false; \
|
||||
} \
|
||||
return (NULL); \
|
||||
return NULL; \
|
||||
} \
|
||||
subkey = rtree_subkey(rtree, key, level - \
|
||||
RTREE_GET_BIAS); \
|
||||
@@ -266,7 +266,7 @@ rtree_elm_lookup(tsdn_t *tsdn, rtree_t *rtree, rtree_ctx_t *rtree_ctx,
|
||||
rtree_ctx->elms[level - RTREE_GET_BIAS + 1] = \
|
||||
node; \
|
||||
} \
|
||||
return (node);
|
||||
return node;
|
||||
#if RTREE_HEIGHT_MAX > 1
|
||||
RTREE_GET_SUBTREE(0)
|
||||
#endif
|
||||
@@ -334,12 +334,12 @@ rtree_write(tsdn_t *tsdn, rtree_t *rtree, rtree_ctx_t *rtree_ctx, uintptr_t key,
|
||||
|
||||
elm = rtree_elm_lookup(tsdn, rtree, rtree_ctx, key, false, true);
|
||||
if (elm == NULL) {
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
assert(rtree_elm_read(elm, false) == NULL);
|
||||
rtree_elm_write(elm, extent);
|
||||
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE extent_t *
|
||||
@@ -349,10 +349,10 @@ rtree_read(tsdn_t *tsdn, rtree_t *rtree, rtree_ctx_t *rtree_ctx, uintptr_t key,
|
||||
|
||||
elm = rtree_elm_lookup(tsdn, rtree, rtree_ctx, key, dependent, false);
|
||||
if (elm == NULL) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (rtree_elm_read(elm, dependent));
|
||||
return rtree_elm_read(elm, dependent);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE rtree_elm_t *
|
||||
@@ -363,7 +363,7 @@ rtree_elm_acquire(tsdn_t *tsdn, rtree_t *rtree, rtree_ctx_t *rtree_ctx,
|
||||
elm = rtree_elm_lookup(tsdn, rtree, rtree_ctx, key, dependent,
|
||||
init_missing);
|
||||
if (!dependent && elm == NULL) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
extent_t *extent;
|
||||
@@ -380,7 +380,7 @@ rtree_elm_acquire(tsdn_t *tsdn, rtree_t *rtree, rtree_ctx_t *rtree_ctx,
|
||||
rtree_elm_witness_acquire(tsdn, rtree, key, elm);
|
||||
}
|
||||
|
||||
return (elm);
|
||||
return elm;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE extent_t *
|
||||
@@ -395,7 +395,7 @@ rtree_elm_read_acquired(tsdn_t *tsdn, const rtree_t *rtree, rtree_elm_t *elm) {
|
||||
rtree_elm_witness_access(tsdn, rtree, elm);
|
||||
}
|
||||
|
||||
return (extent);
|
||||
return extent;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
|
@@ -44,7 +44,7 @@ tcache_enabled_get(void) {
|
||||
tsd_tcache_enabled_set(tsd, tcache_enabled);
|
||||
}
|
||||
|
||||
return ((bool)tcache_enabled);
|
||||
return (bool)tcache_enabled;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
@@ -69,19 +69,19 @@ tcache_get(tsd_t *tsd, bool create) {
|
||||
tcache_t *tcache;
|
||||
|
||||
if (!config_tcache) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tcache = tsd_tcache_get(tsd);
|
||||
if (!create) {
|
||||
return (tcache);
|
||||
return tcache;
|
||||
}
|
||||
if (unlikely(tcache == NULL) && tsd_nominal(tsd)) {
|
||||
tcache = tcache_get_hard(tsd);
|
||||
tsd_tcache_set(tsd, tcache);
|
||||
}
|
||||
|
||||
return (tcache);
|
||||
return tcache;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
@@ -102,7 +102,7 @@ tcache_alloc_easy(tcache_bin_t *tbin, bool *tcache_success) {
|
||||
if (unlikely(tbin->ncached == 0)) {
|
||||
tbin->low_water = -1;
|
||||
*tcache_success = false;
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
/*
|
||||
* tcache_success (instead of ret) should be checked upon the return of
|
||||
@@ -119,7 +119,7 @@ tcache_alloc_easy(tcache_bin_t *tbin, bool *tcache_success) {
|
||||
tbin->low_water = tbin->ncached;
|
||||
}
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void *
|
||||
@@ -138,13 +138,13 @@ tcache_alloc_small(tsd_t *tsd, arena_t *arena, tcache_t *tcache, size_t size,
|
||||
bool tcache_hard_success;
|
||||
arena = arena_choose(tsd, arena);
|
||||
if (unlikely(arena == NULL)) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = tcache_alloc_small_hard(tsd_tsdn(tsd), arena, tcache,
|
||||
tbin, binind, &tcache_hard_success);
|
||||
if (tcache_hard_success == false) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ tcache_alloc_small(tsd_t *tsd, arena_t *arena, tcache_t *tcache, size_t size,
|
||||
tcache->prof_accumbytes += usize;
|
||||
}
|
||||
tcache_event(tsd, tcache);
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void *
|
||||
@@ -203,12 +203,12 @@ tcache_alloc_large(tsd_t *tsd, arena_t *arena, tcache_t *tcache, size_t size,
|
||||
*/
|
||||
arena = arena_choose(tsd, arena);
|
||||
if (unlikely(arena == NULL)) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = large_malloc(tsd_tsdn(tsd), arena, s2u(size), zero);
|
||||
if (ret == NULL) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
size_t usize JEMALLOC_CC_SILENCE_INIT(0);
|
||||
@@ -242,7 +242,7 @@ tcache_alloc_large(tsd_t *tsd, arena_t *arena, tcache_t *tcache, size_t size,
|
||||
}
|
||||
|
||||
tcache_event(tsd, tcache);
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
@@ -306,7 +306,7 @@ tcaches_get(tsd_t *tsd, unsigned ind) {
|
||||
elm->tcache = tcache_create(tsd_tsdn(tsd), arena_choose(tsd,
|
||||
NULL));
|
||||
}
|
||||
return (elm->tcache);
|
||||
return elm->tcache;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -23,14 +23,14 @@ ticker_copy(ticker_t *ticker, const ticker_t *other) {
|
||||
|
||||
JEMALLOC_INLINE int32_t
|
||||
ticker_read(const ticker_t *ticker) {
|
||||
return (ticker->tick);
|
||||
return ticker->tick;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
ticker_ticks(ticker_t *ticker, int32_t nticks) {
|
||||
if (unlikely(ticker->tick < nticks)) {
|
||||
ticker->tick = ticker->nticks;
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
ticker->tick -= nticks;
|
||||
return(false);
|
||||
@@ -38,7 +38,7 @@ ticker_ticks(ticker_t *ticker, int32_t nticks) {
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
ticker_tick(ticker_t *ticker) {
|
||||
return (ticker_ticks(ticker, 1));
|
||||
return ticker_ticks(ticker, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -29,7 +29,7 @@ tsd_fetch_impl(bool init) {
|
||||
tsd_t *tsd = tsd_get(init);
|
||||
|
||||
if (!init && tsd_get_allocates() && tsd == NULL) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
assert(tsd != NULL);
|
||||
|
||||
@@ -46,17 +46,17 @@ tsd_fetch_impl(bool init) {
|
||||
}
|
||||
}
|
||||
|
||||
return (tsd);
|
||||
return tsd;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE tsd_t *
|
||||
tsd_fetch(void) {
|
||||
return (tsd_fetch_impl(true));
|
||||
return tsd_fetch_impl(true);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE tsdn_t *
|
||||
tsd_tsdn(tsd_t *tsd) {
|
||||
return ((tsdn_t *)tsd);
|
||||
return (tsdn_t *)tsd;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE bool
|
||||
@@ -67,12 +67,12 @@ tsd_nominal(tsd_t *tsd) {
|
||||
#define O(n, t, c) \
|
||||
JEMALLOC_ALWAYS_INLINE t * \
|
||||
tsd_##n##p_get(tsd_t *tsd) { \
|
||||
return (&tsd->n); \
|
||||
return &tsd->n; \
|
||||
} \
|
||||
\
|
||||
JEMALLOC_ALWAYS_INLINE t \
|
||||
tsd_##n##_get(tsd_t *tsd) { \
|
||||
return (*tsd_##n##p_get(tsd)); \
|
||||
return *tsd_##n##p_get(tsd); \
|
||||
} \
|
||||
\
|
||||
JEMALLOC_ALWAYS_INLINE void \
|
||||
@@ -86,22 +86,22 @@ MALLOC_TSD
|
||||
JEMALLOC_ALWAYS_INLINE tsdn_t *
|
||||
tsdn_fetch(void) {
|
||||
if (!tsd_booted_get()) {
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (tsd_tsdn(tsd_fetch_impl(false)));
|
||||
return tsd_tsdn(tsd_fetch_impl(false));
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE bool
|
||||
tsdn_null(const tsdn_t *tsdn) {
|
||||
return (tsdn == NULL);
|
||||
return tsdn == NULL;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE tsd_t *
|
||||
tsdn_tsd(tsdn_t *tsdn) {
|
||||
assert(!tsdn_null(tsdn));
|
||||
|
||||
return (&tsdn->tsd);
|
||||
return &tsdn->tsd;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE rtree_ctx_t *
|
||||
@@ -113,9 +113,9 @@ tsdn_rtree_ctx(tsdn_t *tsdn, rtree_ctx_t *fallback) {
|
||||
if (unlikely(tsdn_null(tsdn))) {
|
||||
static const rtree_ctx_t rtree_ctx = RTREE_CTX_INITIALIZER;
|
||||
memcpy(fallback, &rtree_ctx, sizeof(rtree_ctx_t));
|
||||
return (fallback);
|
||||
return fallback;
|
||||
}
|
||||
return (tsd_rtree_ctxp_get(tsdn_tsd(tsdn)));
|
||||
return tsd_rtree_ctxp_get(tsdn_tsd(tsdn));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -180,7 +180,7 @@ a_name##tsd_cleanup_wrapper(void) { \
|
||||
a_name##tsd_initialized = false; \
|
||||
a_cleanup(&a_name##tsd_tls); \
|
||||
} \
|
||||
return (a_name##tsd_initialized); \
|
||||
return a_name##tsd_initialized; \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_boot0(void) { \
|
||||
@@ -189,7 +189,7 @@ a_name##tsd_boot0(void) { \
|
||||
&a_name##tsd_cleanup_wrapper); \
|
||||
} \
|
||||
a_name##tsd_booted = true; \
|
||||
return (false); \
|
||||
return false; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_name##tsd_boot1(void) { \
|
||||
@@ -197,21 +197,21 @@ a_name##tsd_boot1(void) { \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_boot(void) { \
|
||||
return (a_name##tsd_boot0()); \
|
||||
return a_name##tsd_boot0(); \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_booted_get(void) { \
|
||||
return (a_name##tsd_booted); \
|
||||
return a_name##tsd_booted; \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_get_allocates(void) { \
|
||||
return (false); \
|
||||
return false; \
|
||||
} \
|
||||
/* Get/set. */ \
|
||||
a_attr a_type * \
|
||||
a_name##tsd_get(bool init) { \
|
||||
assert(a_name##tsd_booted); \
|
||||
return (&a_name##tsd_tls); \
|
||||
return &a_name##tsd_tls; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_name##tsd_set(a_type *val) { \
|
||||
@@ -232,11 +232,11 @@ a_name##tsd_boot0(void) { \
|
||||
if (a_cleanup != malloc_tsd_no_cleanup) { \
|
||||
if (pthread_key_create(&a_name##tsd_tsd, a_cleanup) != \
|
||||
0) { \
|
||||
return (true); \
|
||||
return true; \
|
||||
} \
|
||||
} \
|
||||
a_name##tsd_booted = true; \
|
||||
return (false); \
|
||||
return false; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_name##tsd_boot1(void) { \
|
||||
@@ -244,21 +244,21 @@ a_name##tsd_boot1(void) { \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_boot(void) { \
|
||||
return (a_name##tsd_boot0()); \
|
||||
return a_name##tsd_boot0(); \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_booted_get(void) { \
|
||||
return (a_name##tsd_booted); \
|
||||
return a_name##tsd_booted; \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_get_allocates(void) { \
|
||||
return (false); \
|
||||
return false; \
|
||||
} \
|
||||
/* Get/set. */ \
|
||||
a_attr a_type * \
|
||||
a_name##tsd_get(bool init) { \
|
||||
assert(a_name##tsd_booted); \
|
||||
return (&a_name##tsd_tls); \
|
||||
return &a_name##tsd_tls; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_name##tsd_set(a_type *val) { \
|
||||
@@ -289,7 +289,7 @@ a_name##tsd_cleanup_wrapper(void) { \
|
||||
SetLastError(error); \
|
||||
\
|
||||
if (wrapper == NULL) { \
|
||||
return (false); \
|
||||
return false; \
|
||||
} \
|
||||
if (a_cleanup != malloc_tsd_no_cleanup && \
|
||||
wrapper->initialized) { \
|
||||
@@ -297,11 +297,11 @@ a_name##tsd_cleanup_wrapper(void) { \
|
||||
a_cleanup(&wrapper->val); \
|
||||
if (wrapper->initialized) { \
|
||||
/* Trigger another cleanup round. */ \
|
||||
return (true); \
|
||||
return true; \
|
||||
} \
|
||||
} \
|
||||
malloc_tsd_dalloc(wrapper); \
|
||||
return (false); \
|
||||
return false; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_name##tsd_wrapper_set(a_name##tsd_wrapper_t *wrapper) { \
|
||||
@@ -331,13 +331,13 @@ a_name##tsd_wrapper_get(bool init) { \
|
||||
} \
|
||||
a_name##tsd_wrapper_set(wrapper); \
|
||||
} \
|
||||
return (wrapper); \
|
||||
return wrapper; \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_boot0(void) { \
|
||||
a_name##tsd_tsd = TlsAlloc(); \
|
||||
if (a_name##tsd_tsd == TLS_OUT_OF_INDEXES) { \
|
||||
return (true); \
|
||||
return true; \
|
||||
} \
|
||||
if (a_cleanup != malloc_tsd_no_cleanup) { \
|
||||
malloc_tsd_cleanup_register( \
|
||||
@@ -345,7 +345,7 @@ a_name##tsd_boot0(void) { \
|
||||
} \
|
||||
a_name##tsd_wrapper_set(&a_name##tsd_boot_wrapper); \
|
||||
a_name##tsd_booted = true; \
|
||||
return (false); \
|
||||
return false; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_name##tsd_boot1(void) { \
|
||||
@@ -364,18 +364,18 @@ a_name##tsd_boot1(void) { \
|
||||
a_attr bool \
|
||||
a_name##tsd_boot(void) { \
|
||||
if (a_name##tsd_boot0()) { \
|
||||
return (true); \
|
||||
return true; \
|
||||
} \
|
||||
a_name##tsd_boot1(); \
|
||||
return (false); \
|
||||
return false; \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_booted_get(void) { \
|
||||
return (a_name##tsd_booted); \
|
||||
return a_name##tsd_booted; \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_get_allocates(void) { \
|
||||
return (true); \
|
||||
return true; \
|
||||
} \
|
||||
/* Get/set. */ \
|
||||
a_attr a_type * \
|
||||
@@ -385,9 +385,9 @@ a_name##tsd_get(bool init) { \
|
||||
assert(a_name##tsd_booted); \
|
||||
wrapper = a_name##tsd_wrapper_get(init); \
|
||||
if (a_name##tsd_get_allocates() && !init && wrapper == NULL) { \
|
||||
return (NULL); \
|
||||
return NULL; \
|
||||
} \
|
||||
return (&wrapper->val); \
|
||||
return &wrapper->val; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_name##tsd_set(a_type *val) { \
|
||||
@@ -449,7 +449,7 @@ a_name##tsd_wrapper_get(bool init) { \
|
||||
tsd_init_check_recursion(&a_name##tsd_init_head, \
|
||||
&block); \
|
||||
if (wrapper) { \
|
||||
return (wrapper); \
|
||||
return wrapper; \
|
||||
} \
|
||||
wrapper = (a_name##tsd_wrapper_t *) \
|
||||
malloc_tsd_malloc(sizeof(a_name##tsd_wrapper_t)); \
|
||||
@@ -465,17 +465,17 @@ a_name##tsd_wrapper_get(bool init) { \
|
||||
a_name##tsd_wrapper_set(wrapper); \
|
||||
tsd_init_finish(&a_name##tsd_init_head, &block); \
|
||||
} \
|
||||
return (wrapper); \
|
||||
return wrapper; \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_boot0(void) { \
|
||||
if (pthread_key_create(&a_name##tsd_tsd, \
|
||||
a_name##tsd_cleanup_wrapper) != 0) { \
|
||||
return (true); \
|
||||
return true; \
|
||||
} \
|
||||
a_name##tsd_wrapper_set(&a_name##tsd_boot_wrapper); \
|
||||
a_name##tsd_booted = true; \
|
||||
return (false); \
|
||||
return false; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_name##tsd_boot1(void) { \
|
||||
@@ -494,18 +494,18 @@ a_name##tsd_boot1(void) { \
|
||||
a_attr bool \
|
||||
a_name##tsd_boot(void) { \
|
||||
if (a_name##tsd_boot0()) { \
|
||||
return (true); \
|
||||
return true; \
|
||||
} \
|
||||
a_name##tsd_boot1(); \
|
||||
return (false); \
|
||||
return false; \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_booted_get(void) { \
|
||||
return (a_name##tsd_booted); \
|
||||
return a_name##tsd_booted; \
|
||||
} \
|
||||
a_attr bool \
|
||||
a_name##tsd_get_allocates(void) { \
|
||||
return (true); \
|
||||
return true; \
|
||||
} \
|
||||
/* Get/set. */ \
|
||||
a_attr a_type * \
|
||||
@@ -515,9 +515,9 @@ a_name##tsd_get(bool init) { \
|
||||
assert(a_name##tsd_booted); \
|
||||
wrapper = a_name##tsd_wrapper_get(init); \
|
||||
if (a_name##tsd_get_allocates() && !init && wrapper == NULL) { \
|
||||
return (NULL); \
|
||||
return NULL; \
|
||||
} \
|
||||
return (&wrapper->val); \
|
||||
return &wrapper->val; \
|
||||
} \
|
||||
a_attr void \
|
||||
a_name##tsd_set(a_type *val) { \
|
||||
|
@@ -26,27 +26,27 @@ int get_errno(void);
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE unsigned
|
||||
ffs_llu(unsigned long long bitmap) {
|
||||
return (JEMALLOC_INTERNAL_FFSLL(bitmap));
|
||||
return JEMALLOC_INTERNAL_FFSLL(bitmap);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE unsigned
|
||||
ffs_lu(unsigned long bitmap) {
|
||||
return (JEMALLOC_INTERNAL_FFSL(bitmap));
|
||||
return JEMALLOC_INTERNAL_FFSL(bitmap);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE unsigned
|
||||
ffs_u(unsigned bitmap) {
|
||||
return (JEMALLOC_INTERNAL_FFS(bitmap));
|
||||
return JEMALLOC_INTERNAL_FFS(bitmap);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE unsigned
|
||||
ffs_zu(size_t bitmap) {
|
||||
#if LG_SIZEOF_PTR == LG_SIZEOF_INT
|
||||
return (ffs_u(bitmap));
|
||||
return ffs_u(bitmap);
|
||||
#elif LG_SIZEOF_PTR == LG_SIZEOF_LONG
|
||||
return (ffs_lu(bitmap));
|
||||
return ffs_lu(bitmap);
|
||||
#elif LG_SIZEOF_PTR == LG_SIZEOF_LONG_LONG
|
||||
return (ffs_llu(bitmap));
|
||||
return ffs_llu(bitmap);
|
||||
#else
|
||||
#error No implementation for size_t ffs()
|
||||
#endif
|
||||
@@ -55,9 +55,9 @@ ffs_zu(size_t bitmap) {
|
||||
JEMALLOC_ALWAYS_INLINE unsigned
|
||||
ffs_u64(uint64_t bitmap) {
|
||||
#if LG_SIZEOF_LONG == 3
|
||||
return (ffs_lu(bitmap));
|
||||
return ffs_lu(bitmap);
|
||||
#elif LG_SIZEOF_LONG_LONG == 3
|
||||
return (ffs_llu(bitmap));
|
||||
return ffs_llu(bitmap);
|
||||
#else
|
||||
#error No implementation for 64-bit ffs()
|
||||
#endif
|
||||
@@ -66,11 +66,11 @@ ffs_u64(uint64_t bitmap) {
|
||||
JEMALLOC_ALWAYS_INLINE unsigned
|
||||
ffs_u32(uint32_t bitmap) {
|
||||
#if LG_SIZEOF_INT == 2
|
||||
return (ffs_u(bitmap));
|
||||
return ffs_u(bitmap);
|
||||
#else
|
||||
#error No implementation for 32-bit ffs()
|
||||
#endif
|
||||
return (ffs_u(bitmap));
|
||||
return ffs_u(bitmap);
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint64_t
|
||||
@@ -83,7 +83,7 @@ pow2_ceil_u64(uint64_t x) {
|
||||
x |= x >> 16;
|
||||
x |= x >> 32;
|
||||
x++;
|
||||
return (x);
|
||||
return x;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE uint32_t
|
||||
@@ -95,16 +95,16 @@ pow2_ceil_u32(uint32_t x) {
|
||||
x |= x >> 8;
|
||||
x |= x >> 16;
|
||||
x++;
|
||||
return (x);
|
||||
return x;
|
||||
}
|
||||
|
||||
/* Compute the smallest power of 2 that is >= x. */
|
||||
JEMALLOC_INLINE size_t
|
||||
pow2_ceil_zu(size_t x) {
|
||||
#if (LG_SIZEOF_PTR == 3)
|
||||
return (pow2_ceil_u64(x));
|
||||
return pow2_ceil_u64(x);
|
||||
#else
|
||||
return (pow2_ceil_u32(x));
|
||||
return pow2_ceil_u32(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ lg_floor(size_t x) {
|
||||
: "r"(x) // Inputs.
|
||||
);
|
||||
assert(ret < UINT_MAX);
|
||||
return ((unsigned)ret);
|
||||
return (unsigned)ret;
|
||||
}
|
||||
#elif (defined(_MSC_VER))
|
||||
JEMALLOC_INLINE unsigned
|
||||
@@ -137,7 +137,7 @@ lg_floor(size_t x) {
|
||||
# error "Unsupported type size for lg_floor()"
|
||||
#endif
|
||||
assert(ret < UINT_MAX);
|
||||
return ((unsigned)ret);
|
||||
return (unsigned)ret;
|
||||
}
|
||||
#elif (defined(JEMALLOC_HAVE_BUILTIN_CLZ))
|
||||
JEMALLOC_INLINE unsigned
|
||||
@@ -145,9 +145,9 @@ lg_floor(size_t x) {
|
||||
assert(x != 0);
|
||||
|
||||
#if (LG_SIZEOF_PTR == LG_SIZEOF_INT)
|
||||
return (((8 << LG_SIZEOF_PTR) - 1) - __builtin_clz(x));
|
||||
return ((8 << LG_SIZEOF_PTR) - 1) - __builtin_clz(x);
|
||||
#elif (LG_SIZEOF_PTR == LG_SIZEOF_LONG)
|
||||
return (((8 << LG_SIZEOF_PTR) - 1) - __builtin_clzl(x));
|
||||
return ((8 << LG_SIZEOF_PTR) - 1) - __builtin_clzl(x);
|
||||
#else
|
||||
# error "Unsupported type size for lg_floor()"
|
||||
#endif
|
||||
@@ -166,10 +166,10 @@ lg_floor(size_t x) {
|
||||
x |= (x >> 32);
|
||||
#endif
|
||||
if (x == SIZE_T_MAX) {
|
||||
return ((8 << LG_SIZEOF_PTR) - 1);
|
||||
return (8 << LG_SIZEOF_PTR) - 1;
|
||||
}
|
||||
x++;
|
||||
return (ffs_zu(x) - 2);
|
||||
return ffs_zu(x) - 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -187,9 +187,9 @@ set_errno(int errnum) {
|
||||
JEMALLOC_INLINE int
|
||||
get_errno(void) {
|
||||
#ifdef _WIN32
|
||||
return (GetLastError());
|
||||
return GetLastError();
|
||||
#else
|
||||
return (errno);
|
||||
return errno;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@@ -22,11 +22,11 @@ witness_owner(tsd_t *tsd, const witness_t *witness) {
|
||||
witnesses = tsd_witnessesp_get(tsd);
|
||||
ql_foreach(w, witnesses, link) {
|
||||
if (w == witness) {
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
JEMALLOC_INLINE void
|
||||
|
Reference in New Issue
Block a user