Remove leading blank lines from function bodies.

This resolves #535.
This commit is contained in:
Jason Evans 2017-01-13 10:35:35 -08:00
parent 87e81e609b
commit ffbb7dac3d
103 changed files with 0 additions and 611 deletions

View File

@ -16,35 +16,30 @@ bool arena_prof_accum(tsdn_t *tsdn, arena_t *arena, uint64_t accumbytes);
JEMALLOC_INLINE unsigned JEMALLOC_INLINE unsigned
arena_ind_get(const arena_t *arena) arena_ind_get(const arena_t *arena)
{ {
return (base_ind_get(arena->base)); return (base_ind_get(arena->base));
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
arena_internal_add(arena_t *arena, size_t size) arena_internal_add(arena_t *arena, size_t size)
{ {
atomic_add_zu(&arena->stats.internal, size); atomic_add_zu(&arena->stats.internal, size);
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
arena_internal_sub(arena_t *arena, size_t size) arena_internal_sub(arena_t *arena, size_t size)
{ {
atomic_sub_zu(&arena->stats.internal, size); atomic_sub_zu(&arena->stats.internal, size);
} }
JEMALLOC_INLINE size_t JEMALLOC_INLINE size_t
arena_internal_get(arena_t *arena) arena_internal_get(arena_t *arena)
{ {
return (atomic_read_zu(&arena->stats.internal)); return (atomic_read_zu(&arena->stats.internal));
} }
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
arena_prof_accum_impl(arena_t *arena, uint64_t accumbytes) arena_prof_accum_impl(arena_t *arena, uint64_t accumbytes)
{ {
cassert(config_prof); cassert(config_prof);
assert(prof_interval != 0); assert(prof_interval != 0);
@ -59,7 +54,6 @@ arena_prof_accum_impl(arena_t *arena, uint64_t accumbytes)
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
arena_prof_accum_locked(arena_t *arena, uint64_t accumbytes) arena_prof_accum_locked(arena_t *arena, uint64_t accumbytes)
{ {
cassert(config_prof); cassert(config_prof);
if (likely(prof_interval == 0)) if (likely(prof_interval == 0))
@ -70,7 +64,6 @@ arena_prof_accum_locked(arena_t *arena, uint64_t accumbytes)
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
arena_prof_accum(tsdn_t *tsdn, arena_t *arena, uint64_t accumbytes) arena_prof_accum(tsdn_t *tsdn, arena_t *arena, uint64_t accumbytes)
{ {
cassert(config_prof); cassert(config_prof);
if (likely(prof_interval == 0)) if (likely(prof_interval == 0))

View File

@ -33,7 +33,6 @@ arena_bin_index(arena_t *arena, arena_bin_t *bin)
JEMALLOC_INLINE prof_tctx_t * JEMALLOC_INLINE prof_tctx_t *
arena_prof_tctx_get(tsdn_t *tsdn, const extent_t *extent, const void *ptr) arena_prof_tctx_get(tsdn_t *tsdn, const extent_t *extent, const void *ptr)
{ {
cassert(config_prof); cassert(config_prof);
assert(ptr != NULL); assert(ptr != NULL);
@ -46,7 +45,6 @@ JEMALLOC_INLINE void
arena_prof_tctx_set(tsdn_t *tsdn, extent_t *extent, const void *ptr, arena_prof_tctx_set(tsdn_t *tsdn, extent_t *extent, const void *ptr,
size_t usize, prof_tctx_t *tctx) size_t usize, prof_tctx_t *tctx)
{ {
cassert(config_prof); cassert(config_prof);
assert(ptr != NULL); assert(ptr != NULL);
@ -58,7 +56,6 @@ JEMALLOC_INLINE void
arena_prof_tctx_reset(tsdn_t *tsdn, extent_t *extent, const void *ptr, arena_prof_tctx_reset(tsdn_t *tsdn, extent_t *extent, const void *ptr,
prof_tctx_t *tctx) prof_tctx_t *tctx)
{ {
cassert(config_prof); cassert(config_prof);
assert(ptr != NULL); assert(ptr != NULL);
assert(!extent_slab_get(extent)); assert(!extent_slab_get(extent));
@ -85,7 +82,6 @@ arena_decay_ticks(tsdn_t *tsdn, arena_t *arena, unsigned nticks)
JEMALLOC_ALWAYS_INLINE void JEMALLOC_ALWAYS_INLINE void
arena_decay_tick(tsdn_t *tsdn, arena_t *arena) arena_decay_tick(tsdn_t *tsdn, arena_t *arena)
{ {
malloc_mutex_assert_not_owner(tsdn, &arena->lock); malloc_mutex_assert_not_owner(tsdn, &arena->lock);
arena_decay_ticks(tsdn, arena, 1); arena_decay_ticks(tsdn, arena, 1);
@ -95,7 +91,6 @@ JEMALLOC_ALWAYS_INLINE void *
arena_malloc(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind, bool zero, arena_malloc(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind, bool zero,
tcache_t *tcache, bool slow_path) tcache_t *tcache, bool slow_path)
{ {
assert(!tsdn_null(tsdn) || tcache == NULL); assert(!tsdn_null(tsdn) || tcache == NULL);
assert(size != 0); assert(size != 0);
@ -118,7 +113,6 @@ arena_malloc(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind, bool zero,
JEMALLOC_ALWAYS_INLINE arena_t * JEMALLOC_ALWAYS_INLINE arena_t *
arena_aalloc(tsdn_t *tsdn, const void *ptr) arena_aalloc(tsdn_t *tsdn, const void *ptr)
{ {
return (extent_arena_get(iealloc(tsdn, ptr))); return (extent_arena_get(iealloc(tsdn, ptr)));
} }
@ -142,7 +136,6 @@ JEMALLOC_ALWAYS_INLINE void
arena_dalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, tcache_t *tcache, arena_dalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, tcache_t *tcache,
bool slow_path) bool slow_path)
{ {
assert(!tsdn_null(tsdn) || tcache == NULL); assert(!tsdn_null(tsdn) || tcache == NULL);
assert(ptr != NULL); assert(ptr != NULL);
@ -176,7 +169,6 @@ JEMALLOC_ALWAYS_INLINE void
arena_sdalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t size, arena_sdalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t size,
tcache_t *tcache, bool slow_path) tcache_t *tcache, bool slow_path)
{ {
assert(!tsdn_null(tsdn) || tcache == NULL); assert(!tsdn_null(tsdn) || tcache == NULL);
assert(ptr != NULL); assert(ptr != NULL);

View File

@ -101,7 +101,6 @@ atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s)
JEMALLOC_INLINE void JEMALLOC_INLINE void
atomic_write_u64(uint64_t *p, uint64_t x) atomic_write_u64(uint64_t *p, uint64_t x)
{ {
asm volatile ( asm volatile (
"xchgq %1, %0;" /* Lock is implied by xchgq. */ "xchgq %1, %0;" /* Lock is implied by xchgq. */
: "=m" (*p), "+r" (x) /* Outputs. */ : "=m" (*p), "+r" (x) /* Outputs. */
@ -141,7 +140,6 @@ atomic_write_u64(uint64_t *p, uint64_t x)
JEMALLOC_INLINE uint64_t JEMALLOC_INLINE uint64_t
atomic_add_u64(uint64_t *p, uint64_t x) atomic_add_u64(uint64_t *p, uint64_t x)
{ {
/* /*
* atomic_fetchadd_64() doesn't exist, but we only ever use this * atomic_fetchadd_64() doesn't exist, but we only ever use this
* function on LP64 systems, so atomic_fetchadd_long() will do. * function on LP64 systems, so atomic_fetchadd_long() will do.
@ -154,7 +152,6 @@ atomic_add_u64(uint64_t *p, uint64_t x)
JEMALLOC_INLINE uint64_t JEMALLOC_INLINE uint64_t
atomic_sub_u64(uint64_t *p, uint64_t x) atomic_sub_u64(uint64_t *p, uint64_t x)
{ {
assert(sizeof(uint64_t) == sizeof(unsigned long)); 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);
@ -163,7 +160,6 @@ atomic_sub_u64(uint64_t *p, uint64_t x)
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s) atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s)
{ {
assert(sizeof(uint64_t) == sizeof(unsigned long)); 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));
@ -172,7 +168,6 @@ atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s)
JEMALLOC_INLINE void JEMALLOC_INLINE void
atomic_write_u64(uint64_t *p, uint64_t x) atomic_write_u64(uint64_t *p, uint64_t x)
{ {
assert(sizeof(uint64_t) == sizeof(unsigned long)); assert(sizeof(uint64_t) == sizeof(unsigned long));
atomic_store_rel_long(p, x); atomic_store_rel_long(p, x);
@ -181,21 +176,18 @@ atomic_write_u64(uint64_t *p, uint64_t x)
JEMALLOC_INLINE uint64_t JEMALLOC_INLINE uint64_t
atomic_add_u64(uint64_t *p, uint64_t x) 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 JEMALLOC_INLINE uint64_t
atomic_sub_u64(uint64_t *p, uint64_t x) 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 JEMALLOC_INLINE bool
atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s) 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));
} }
@ -213,14 +205,12 @@ atomic_write_u64(uint64_t *p, uint64_t x)
JEMALLOC_INLINE uint64_t JEMALLOC_INLINE uint64_t
atomic_add_u64(uint64_t *p, uint64_t x) atomic_add_u64(uint64_t *p, uint64_t x)
{ {
return (InterlockedExchangeAdd64(p, x) + x); return (InterlockedExchangeAdd64(p, x) + x);
} }
JEMALLOC_INLINE uint64_t JEMALLOC_INLINE uint64_t
atomic_sub_u64(uint64_t *p, uint64_t x) atomic_sub_u64(uint64_t *p, uint64_t x)
{ {
return (InterlockedExchangeAdd64(p, -((int64_t)x)) - x); return (InterlockedExchangeAdd64(p, -((int64_t)x)) - x);
} }
@ -236,7 +226,6 @@ atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s)
JEMALLOC_INLINE void JEMALLOC_INLINE void
atomic_write_u64(uint64_t *p, uint64_t x) atomic_write_u64(uint64_t *p, uint64_t x)
{ {
InterlockedExchange64(p, x); InterlockedExchange64(p, x);
} }
# elif (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || \ # elif (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || \
@ -244,28 +233,24 @@ atomic_write_u64(uint64_t *p, uint64_t x)
JEMALLOC_INLINE uint64_t JEMALLOC_INLINE uint64_t
atomic_add_u64(uint64_t *p, uint64_t x) 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 JEMALLOC_INLINE uint64_t
atomic_sub_u64(uint64_t *p, uint64_t x) 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 JEMALLOC_INLINE bool
atomic_cas_u64(uint64_t *p, uint64_t c, uint64_t s) 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 JEMALLOC_INLINE void
atomic_write_u64(uint64_t *p, uint64_t x) atomic_write_u64(uint64_t *p, uint64_t x)
{ {
__sync_lock_test_and_set(p, x); __sync_lock_test_and_set(p, x);
} }
# else # else
@ -325,7 +310,6 @@ atomic_cas_u32(uint32_t *p, uint32_t c, uint32_t s)
JEMALLOC_INLINE void JEMALLOC_INLINE void
atomic_write_u32(uint32_t *p, uint32_t x) atomic_write_u32(uint32_t *p, uint32_t x)
{ {
asm volatile ( asm volatile (
"xchgl %1, %0;" /* Lock is implied by xchgl. */ "xchgl %1, %0;" /* Lock is implied by xchgl. */
: "=m" (*p), "+r" (x) /* Outputs. */ : "=m" (*p), "+r" (x) /* Outputs. */
@ -365,49 +349,42 @@ atomic_write_u32(uint32_t *p, uint32_t x)
JEMALLOC_INLINE uint32_t JEMALLOC_INLINE uint32_t
atomic_add_u32(uint32_t *p, uint32_t x) 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 JEMALLOC_INLINE uint32_t
atomic_sub_u32(uint32_t *p, uint32_t x) 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 JEMALLOC_INLINE bool
atomic_cas_u32(uint32_t *p, uint32_t c, uint32_t s) 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 JEMALLOC_INLINE void
atomic_write_u32(uint32_t *p, uint32_t x) atomic_write_u32(uint32_t *p, uint32_t x)
{ {
atomic_store_rel_32(p, x); atomic_store_rel_32(p, x);
} }
#elif (defined(JEMALLOC_OSATOMIC)) #elif (defined(JEMALLOC_OSATOMIC))
JEMALLOC_INLINE uint32_t JEMALLOC_INLINE uint32_t
atomic_add_u32(uint32_t *p, uint32_t x) 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 JEMALLOC_INLINE uint32_t
atomic_sub_u32(uint32_t *p, uint32_t x) 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 JEMALLOC_INLINE bool
atomic_cas_u32(uint32_t *p, uint32_t c, uint32_t s) 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));
} }
@ -425,14 +402,12 @@ atomic_write_u32(uint32_t *p, uint32_t x)
JEMALLOC_INLINE uint32_t JEMALLOC_INLINE uint32_t
atomic_add_u32(uint32_t *p, uint32_t x) atomic_add_u32(uint32_t *p, uint32_t x)
{ {
return (InterlockedExchangeAdd(p, x) + x); return (InterlockedExchangeAdd(p, x) + x);
} }
JEMALLOC_INLINE uint32_t JEMALLOC_INLINE uint32_t
atomic_sub_u32(uint32_t *p, uint32_t x) atomic_sub_u32(uint32_t *p, uint32_t x)
{ {
return (InterlockedExchangeAdd(p, -((int32_t)x)) - x); return (InterlockedExchangeAdd(p, -((int32_t)x)) - x);
} }
@ -448,7 +423,6 @@ atomic_cas_u32(uint32_t *p, uint32_t c, uint32_t s)
JEMALLOC_INLINE void JEMALLOC_INLINE void
atomic_write_u32(uint32_t *p, uint32_t x) atomic_write_u32(uint32_t *p, uint32_t x)
{ {
InterlockedExchange(p, x); InterlockedExchange(p, x);
} }
#elif (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || \ #elif (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || \
@ -456,28 +430,24 @@ atomic_write_u32(uint32_t *p, uint32_t x)
JEMALLOC_INLINE uint32_t JEMALLOC_INLINE uint32_t
atomic_add_u32(uint32_t *p, uint32_t x) 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 JEMALLOC_INLINE uint32_t
atomic_sub_u32(uint32_t *p, uint32_t x) 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 JEMALLOC_INLINE bool
atomic_cas_u32(uint32_t *p, uint32_t c, uint32_t s) 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 JEMALLOC_INLINE void
atomic_write_u32(uint32_t *p, uint32_t x) atomic_write_u32(uint32_t *p, uint32_t x)
{ {
__sync_lock_test_and_set(p, x); __sync_lock_test_and_set(p, x);
} }
#else #else
@ -489,7 +459,6 @@ atomic_write_u32(uint32_t *p, uint32_t x)
JEMALLOC_INLINE void * JEMALLOC_INLINE void *
atomic_add_p(void **p, void *x) atomic_add_p(void **p, void *x)
{ {
#if (LG_SIZEOF_PTR == 3) #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) #elif (LG_SIZEOF_PTR == 2)
@ -500,7 +469,6 @@ atomic_add_p(void **p, void *x)
JEMALLOC_INLINE void * JEMALLOC_INLINE void *
atomic_sub_p(void **p, void *x) atomic_sub_p(void **p, void *x)
{ {
#if (LG_SIZEOF_PTR == 3) #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) #elif (LG_SIZEOF_PTR == 2)
@ -511,7 +479,6 @@ atomic_sub_p(void **p, void *x)
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
atomic_cas_p(void **p, void *c, void *s) atomic_cas_p(void **p, void *c, void *s)
{ {
#if (LG_SIZEOF_PTR == 3) #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) #elif (LG_SIZEOF_PTR == 2)
@ -522,7 +489,6 @@ atomic_cas_p(void **p, void *c, void *s)
JEMALLOC_INLINE void JEMALLOC_INLINE void
atomic_write_p(void **p, const void *x) atomic_write_p(void **p, const void *x)
{ {
#if (LG_SIZEOF_PTR == 3) #if (LG_SIZEOF_PTR == 3)
atomic_write_u64((uint64_t *)p, (uint64_t)x); atomic_write_u64((uint64_t *)p, (uint64_t)x);
#elif (LG_SIZEOF_PTR == 2) #elif (LG_SIZEOF_PTR == 2)
@ -535,7 +501,6 @@ atomic_write_p(void **p, const void *x)
JEMALLOC_INLINE size_t JEMALLOC_INLINE size_t
atomic_add_zu(size_t *p, size_t x) atomic_add_zu(size_t *p, size_t x)
{ {
#if (LG_SIZEOF_PTR == 3) #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) #elif (LG_SIZEOF_PTR == 2)
@ -546,7 +511,6 @@ atomic_add_zu(size_t *p, size_t x)
JEMALLOC_INLINE size_t JEMALLOC_INLINE size_t
atomic_sub_zu(size_t *p, size_t x) atomic_sub_zu(size_t *p, size_t x)
{ {
#if (LG_SIZEOF_PTR == 3) #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) #elif (LG_SIZEOF_PTR == 2)
@ -557,7 +521,6 @@ atomic_sub_zu(size_t *p, size_t x)
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
atomic_cas_zu(size_t *p, size_t c, size_t s) atomic_cas_zu(size_t *p, size_t c, size_t s)
{ {
#if (LG_SIZEOF_PTR == 3) #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) #elif (LG_SIZEOF_PTR == 2)
@ -568,7 +531,6 @@ atomic_cas_zu(size_t *p, size_t c, size_t s)
JEMALLOC_INLINE void JEMALLOC_INLINE void
atomic_write_zu(size_t *p, size_t x) atomic_write_zu(size_t *p, size_t x)
{ {
#if (LG_SIZEOF_PTR == 3) #if (LG_SIZEOF_PTR == 3)
atomic_write_u64((uint64_t *)p, (uint64_t)x); atomic_write_u64((uint64_t *)p, (uint64_t)x);
#elif (LG_SIZEOF_PTR == 2) #elif (LG_SIZEOF_PTR == 2)
@ -581,7 +543,6 @@ atomic_write_zu(size_t *p, size_t x)
JEMALLOC_INLINE unsigned JEMALLOC_INLINE unsigned
atomic_add_u(unsigned *p, unsigned x) atomic_add_u(unsigned *p, unsigned x)
{ {
#if (LG_SIZEOF_INT == 3) #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) #elif (LG_SIZEOF_INT == 2)
@ -592,7 +553,6 @@ atomic_add_u(unsigned *p, unsigned x)
JEMALLOC_INLINE unsigned JEMALLOC_INLINE unsigned
atomic_sub_u(unsigned *p, unsigned x) atomic_sub_u(unsigned *p, unsigned x)
{ {
#if (LG_SIZEOF_INT == 3) #if (LG_SIZEOF_INT == 3)
return ((unsigned)atomic_add_u64((uint64_t *)p, return ((unsigned)atomic_add_u64((uint64_t *)p,
(uint64_t)-((int64_t)x))); (uint64_t)-((int64_t)x)));
@ -605,7 +565,6 @@ atomic_sub_u(unsigned *p, unsigned x)
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
atomic_cas_u(unsigned *p, unsigned c, unsigned s) atomic_cas_u(unsigned *p, unsigned c, unsigned s)
{ {
#if (LG_SIZEOF_INT == 3) #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) #elif (LG_SIZEOF_INT == 2)
@ -616,7 +575,6 @@ atomic_cas_u(unsigned *p, unsigned c, unsigned s)
JEMALLOC_INLINE void JEMALLOC_INLINE void
atomic_write_u(unsigned *p, unsigned x) atomic_write_u(unsigned *p, unsigned x)
{ {
#if (LG_SIZEOF_INT == 3) #if (LG_SIZEOF_INT == 3)
atomic_write_u64((uint64_t *)p, (uint64_t)x); atomic_write_u64((uint64_t *)p, (uint64_t)x);
#elif (LG_SIZEOF_INT == 2) #elif (LG_SIZEOF_INT == 2)

View File

@ -9,7 +9,6 @@ unsigned base_ind_get(const base_t *base);
JEMALLOC_INLINE unsigned JEMALLOC_INLINE unsigned
base_ind_get(const base_t *base) base_ind_get(const base_t *base)
{ {
return (base->ind); return (base->ind);
} }
#endif #endif

View File

@ -55,14 +55,12 @@ extent_lookup(tsdn_t *tsdn, const void *ptr, bool dependent)
JEMALLOC_INLINE arena_t * JEMALLOC_INLINE arena_t *
extent_arena_get(const extent_t *extent) extent_arena_get(const extent_t *extent)
{ {
return (extent->e_arena); return (extent->e_arena);
} }
JEMALLOC_INLINE void * JEMALLOC_INLINE void *
extent_base_get(const extent_t *extent) extent_base_get(const extent_t *extent)
{ {
assert(extent->e_addr == PAGE_ADDR2BASE(extent->e_addr) || assert(extent->e_addr == PAGE_ADDR2BASE(extent->e_addr) ||
!extent->e_slab); !extent->e_slab);
return (PAGE_ADDR2BASE(extent->e_addr)); return (PAGE_ADDR2BASE(extent->e_addr));
@ -71,7 +69,6 @@ extent_base_get(const extent_t *extent)
JEMALLOC_INLINE void * JEMALLOC_INLINE void *
extent_addr_get(const extent_t *extent) extent_addr_get(const extent_t *extent)
{ {
assert(extent->e_addr == PAGE_ADDR2BASE(extent->e_addr) || assert(extent->e_addr == PAGE_ADDR2BASE(extent->e_addr) ||
!extent->e_slab); !extent->e_slab);
return (extent->e_addr); return (extent->e_addr);
@ -80,14 +77,12 @@ extent_addr_get(const extent_t *extent)
JEMALLOC_INLINE size_t JEMALLOC_INLINE size_t
extent_size_get(const extent_t *extent) extent_size_get(const extent_t *extent)
{ {
return (extent->e_size); return (extent->e_size);
} }
JEMALLOC_INLINE size_t JEMALLOC_INLINE size_t
extent_usize_get(const extent_t *extent) extent_usize_get(const extent_t *extent)
{ {
assert(!extent->e_slab); assert(!extent->e_slab);
return (extent->e_usize); return (extent->e_usize);
} }
@ -95,14 +90,12 @@ extent_usize_get(const extent_t *extent)
JEMALLOC_INLINE void * JEMALLOC_INLINE void *
extent_before_get(const extent_t *extent) 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 * JEMALLOC_INLINE void *
extent_last_get(const extent_t *extent) extent_last_get(const extent_t *extent)
{ {
return ((void *)((uintptr_t)extent_base_get(extent) + return ((void *)((uintptr_t)extent_base_get(extent) +
extent_size_get(extent) - PAGE)); extent_size_get(extent) - PAGE));
} }
@ -110,7 +103,6 @@ extent_last_get(const extent_t *extent)
JEMALLOC_INLINE void * JEMALLOC_INLINE void *
extent_past_get(const extent_t *extent) extent_past_get(const extent_t *extent)
{ {
return ((void *)((uintptr_t)extent_base_get(extent) + return ((void *)((uintptr_t)extent_base_get(extent) +
extent_size_get(extent))); extent_size_get(extent)));
} }
@ -118,49 +110,42 @@ extent_past_get(const extent_t *extent)
JEMALLOC_INLINE size_t JEMALLOC_INLINE size_t
extent_sn_get(const extent_t *extent) extent_sn_get(const extent_t *extent)
{ {
return (extent->e_sn); return (extent->e_sn);
} }
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
extent_active_get(const extent_t *extent) extent_active_get(const extent_t *extent)
{ {
return (extent->e_active); return (extent->e_active);
} }
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
extent_retained_get(const extent_t *extent) extent_retained_get(const extent_t *extent)
{ {
return (qr_next(extent, qr_link) == extent); return (qr_next(extent, qr_link) == extent);
} }
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
extent_zeroed_get(const extent_t *extent) extent_zeroed_get(const extent_t *extent)
{ {
return (extent->e_zeroed); return (extent->e_zeroed);
} }
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
extent_committed_get(const extent_t *extent) extent_committed_get(const extent_t *extent)
{ {
return (extent->e_committed); return (extent->e_committed);
} }
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
extent_slab_get(const extent_t *extent) extent_slab_get(const extent_t *extent)
{ {
return (extent->e_slab); return (extent->e_slab);
} }
JEMALLOC_INLINE arena_slab_data_t * JEMALLOC_INLINE arena_slab_data_t *
extent_slab_data_get(extent_t *extent) extent_slab_data_get(extent_t *extent)
{ {
assert(extent->e_slab); assert(extent->e_slab);
return (&extent->e_slab_data); return (&extent->e_slab_data);
} }
@ -168,7 +153,6 @@ extent_slab_data_get(extent_t *extent)
JEMALLOC_INLINE const arena_slab_data_t * JEMALLOC_INLINE const arena_slab_data_t *
extent_slab_data_get_const(const extent_t *extent) extent_slab_data_get_const(const extent_t *extent)
{ {
assert(extent->e_slab); assert(extent->e_slab);
return (&extent->e_slab_data); return (&extent->e_slab_data);
} }
@ -176,7 +160,6 @@ extent_slab_data_get_const(const extent_t *extent)
JEMALLOC_INLINE prof_tctx_t * JEMALLOC_INLINE prof_tctx_t *
extent_prof_tctx_get(const extent_t *extent) extent_prof_tctx_get(const extent_t *extent)
{ {
return ((prof_tctx_t *)atomic_read_p( return ((prof_tctx_t *)atomic_read_p(
&((extent_t *)extent)->e_prof_tctx_pun)); &((extent_t *)extent)->e_prof_tctx_pun));
} }
@ -184,21 +167,18 @@ extent_prof_tctx_get(const extent_t *extent)
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_arena_set(extent_t *extent, arena_t *arena) extent_arena_set(extent_t *extent, arena_t *arena)
{ {
extent->e_arena = arena; extent->e_arena = arena;
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_addr_set(extent_t *extent, void *addr) extent_addr_set(extent_t *extent, void *addr)
{ {
extent->e_addr = addr; extent->e_addr = addr;
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_addr_randomize(tsdn_t *tsdn, extent_t *extent, size_t alignment) extent_addr_randomize(tsdn_t *tsdn, extent_t *extent, size_t alignment)
{ {
assert(extent_base_get(extent) == extent_addr_get(extent)); assert(extent_base_get(extent) == extent_addr_get(extent));
if (alignment < PAGE) { if (alignment < PAGE) {
@ -219,56 +199,48 @@ extent_addr_randomize(tsdn_t *tsdn, extent_t *extent, size_t alignment)
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_size_set(extent_t *extent, size_t size) extent_size_set(extent_t *extent, size_t size)
{ {
extent->e_size = size; extent->e_size = size;
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_usize_set(extent_t *extent, size_t usize) extent_usize_set(extent_t *extent, size_t usize)
{ {
extent->e_usize = usize; extent->e_usize = usize;
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_sn_set(extent_t *extent, size_t sn) extent_sn_set(extent_t *extent, size_t sn)
{ {
extent->e_sn = sn; extent->e_sn = sn;
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_active_set(extent_t *extent, bool active) extent_active_set(extent_t *extent, bool active)
{ {
extent->e_active = active; extent->e_active = active;
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_zeroed_set(extent_t *extent, bool zeroed) extent_zeroed_set(extent_t *extent, bool zeroed)
{ {
extent->e_zeroed = zeroed; extent->e_zeroed = zeroed;
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_committed_set(extent_t *extent, bool committed) extent_committed_set(extent_t *extent, bool committed)
{ {
extent->e_committed = committed; extent->e_committed = committed;
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_slab_set(extent_t *extent, bool slab) extent_slab_set(extent_t *extent, bool slab)
{ {
extent->e_slab = slab; extent->e_slab = slab;
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_prof_tctx_set(extent_t *extent, prof_tctx_t *tctx) extent_prof_tctx_set(extent_t *extent, prof_tctx_t *tctx)
{ {
atomic_write_p(&extent->e_prof_tctx_pun, tctx); atomic_write_p(&extent->e_prof_tctx_pun, tctx);
} }
@ -277,7 +249,6 @@ extent_init(extent_t *extent, arena_t *arena, void *addr, size_t size,
size_t usize, size_t sn, bool active, bool zeroed, bool committed, size_t usize, size_t sn, bool active, bool zeroed, bool committed,
bool slab) bool slab)
{ {
assert(addr == PAGE_ADDR2BASE(addr) || !slab); assert(addr == PAGE_ADDR2BASE(addr) || !slab);
extent_arena_set(extent, arena); extent_arena_set(extent, arena);
@ -297,14 +268,12 @@ extent_init(extent_t *extent, arena_t *arena, void *addr, size_t size,
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_ring_insert(extent_t *sentinel, extent_t *extent) extent_ring_insert(extent_t *sentinel, extent_t *extent)
{ {
qr_meld(sentinel, extent, extent_t, qr_link); qr_meld(sentinel, extent, extent_t, qr_link);
} }
JEMALLOC_INLINE void JEMALLOC_INLINE void
extent_ring_remove(extent_t *extent) extent_ring_remove(extent_t *extent)
{ {
qr_remove(extent, qr_link); qr_remove(extent, qr_link);
} }

View File

@ -23,21 +23,18 @@ void hash(const void *key, size_t len, const uint32_t seed,
JEMALLOC_INLINE uint32_t JEMALLOC_INLINE uint32_t
hash_rotl_32(uint32_t x, int8_t r) hash_rotl_32(uint32_t x, int8_t r)
{ {
return ((x << r) | (x >> (32 - r))); return ((x << r) | (x >> (32 - r)));
} }
JEMALLOC_INLINE uint64_t JEMALLOC_INLINE uint64_t
hash_rotl_64(uint64_t x, int8_t r) hash_rotl_64(uint64_t x, int8_t r)
{ {
return ((x << r) | (x >> (64 - r))); return ((x << r) | (x >> (64 - r)));
} }
JEMALLOC_INLINE uint32_t JEMALLOC_INLINE uint32_t
hash_get_block_32(const uint32_t *p, int i) hash_get_block_32(const uint32_t *p, int i)
{ {
/* Handle unaligned read. */ /* Handle unaligned read. */
if (unlikely((uintptr_t)p & (sizeof(uint32_t)-1)) != 0) { if (unlikely((uintptr_t)p & (sizeof(uint32_t)-1)) != 0) {
uint32_t ret; uint32_t ret;
@ -52,7 +49,6 @@ hash_get_block_32(const uint32_t *p, int i)
JEMALLOC_INLINE uint64_t JEMALLOC_INLINE uint64_t
hash_get_block_64(const uint64_t *p, int i) hash_get_block_64(const uint64_t *p, int i)
{ {
/* Handle unaligned read. */ /* Handle unaligned read. */
if (unlikely((uintptr_t)p & (sizeof(uint64_t)-1)) != 0) { if (unlikely((uintptr_t)p & (sizeof(uint64_t)-1)) != 0) {
uint64_t ret; uint64_t ret;
@ -67,7 +63,6 @@ hash_get_block_64(const uint64_t *p, int i)
JEMALLOC_INLINE uint32_t JEMALLOC_INLINE uint32_t
hash_fmix_32(uint32_t h) hash_fmix_32(uint32_t h)
{ {
h ^= h >> 16; h ^= h >> 16;
h *= 0x85ebca6b; h *= 0x85ebca6b;
h ^= h >> 13; h ^= h >> 13;
@ -80,7 +75,6 @@ hash_fmix_32(uint32_t h)
JEMALLOC_INLINE uint64_t JEMALLOC_INLINE uint64_t
hash_fmix_64(uint64_t k) hash_fmix_64(uint64_t k)
{ {
k ^= k >> 33; k ^= k >> 33;
k *= KQU(0xff51afd7ed558ccd); k *= KQU(0xff51afd7ed558ccd);
k ^= k >> 33; k ^= k >> 33;
@ -326,7 +320,6 @@ hash_x64_128(const void *key, const int len, const uint32_t seed,
JEMALLOC_INLINE void JEMALLOC_INLINE void
hash(const void *key, size_t len, const uint32_t seed, size_t r_hash[2]) hash(const void *key, size_t len, const uint32_t seed, size_t r_hash[2])
{ {
assert(len <= INT_MAX); /* Unfortunate implementation limitation. */ assert(len <= INT_MAX); /* Unfortunate implementation limitation. */
#if (LG_SIZEOF_PTR == 3 && !defined(JEMALLOC_BIG_ENDIAN)) #if (LG_SIZEOF_PTR == 3 && !defined(JEMALLOC_BIG_ENDIAN))

View File

@ -553,7 +553,6 @@ ticker_t *decay_ticker_get(tsd_t *tsd, unsigned ind);
JEMALLOC_ALWAYS_INLINE pszind_t JEMALLOC_ALWAYS_INLINE pszind_t
psz2ind(size_t psz) psz2ind(size_t psz)
{ {
if (unlikely(psz > LARGE_MAXCLASS)) if (unlikely(psz > LARGE_MAXCLASS))
return (NPSIZES); return (NPSIZES);
{ {
@ -577,7 +576,6 @@ psz2ind(size_t psz)
JEMALLOC_INLINE size_t JEMALLOC_INLINE size_t
pind2sz_compute(pszind_t pind) pind2sz_compute(pszind_t pind)
{ {
if (unlikely(pind == NPSIZES)) if (unlikely(pind == NPSIZES))
return (LARGE_MAXCLASS + PAGE); return (LARGE_MAXCLASS + PAGE);
{ {
@ -608,7 +606,6 @@ pind2sz_lookup(pszind_t pind)
JEMALLOC_INLINE size_t JEMALLOC_INLINE size_t
pind2sz(pszind_t pind) pind2sz(pszind_t pind)
{ {
assert(pind < NPSIZES+1); assert(pind < NPSIZES+1);
return (pind2sz_lookup(pind)); return (pind2sz_lookup(pind));
} }
@ -616,7 +613,6 @@ pind2sz(pszind_t pind)
JEMALLOC_INLINE size_t JEMALLOC_INLINE size_t
psz2u(size_t psz) psz2u(size_t psz)
{ {
if (unlikely(psz > LARGE_MAXCLASS)) if (unlikely(psz > LARGE_MAXCLASS))
return (LARGE_MAXCLASS + PAGE); return (LARGE_MAXCLASS + PAGE);
{ {
@ -633,7 +629,6 @@ psz2u(size_t psz)
JEMALLOC_INLINE szind_t JEMALLOC_INLINE szind_t
size2index_compute(size_t size) size2index_compute(size_t size)
{ {
if (unlikely(size > LARGE_MAXCLASS)) if (unlikely(size > LARGE_MAXCLASS))
return (NSIZES); return (NSIZES);
#if (NTBINS != 0) #if (NTBINS != 0)
@ -664,7 +659,6 @@ size2index_compute(size_t size)
JEMALLOC_ALWAYS_INLINE szind_t JEMALLOC_ALWAYS_INLINE szind_t
size2index_lookup(size_t size) size2index_lookup(size_t size)
{ {
assert(size <= LOOKUP_MAXCLASS); assert(size <= LOOKUP_MAXCLASS);
{ {
szind_t ret = (size2index_tab[(size-1) >> LG_TINY_MIN]); szind_t ret = (size2index_tab[(size-1) >> LG_TINY_MIN]);
@ -676,7 +670,6 @@ size2index_lookup(size_t size)
JEMALLOC_ALWAYS_INLINE szind_t JEMALLOC_ALWAYS_INLINE szind_t
size2index(size_t size) size2index(size_t size)
{ {
assert(size > 0); assert(size > 0);
if (likely(size <= LOOKUP_MAXCLASS)) if (likely(size <= LOOKUP_MAXCLASS))
return (size2index_lookup(size)); return (size2index_lookup(size));
@ -686,7 +679,6 @@ size2index(size_t size)
JEMALLOC_INLINE size_t JEMALLOC_INLINE size_t
index2size_compute(szind_t index) index2size_compute(szind_t index)
{ {
#if (NTBINS > 0) #if (NTBINS > 0)
if (index < NTBINS) if (index < NTBINS)
return (ZU(1) << (LG_TINY_MAXCLASS - NTBINS + 1 + index)); return (ZU(1) << (LG_TINY_MAXCLASS - NTBINS + 1 + index));
@ -721,7 +713,6 @@ index2size_lookup(szind_t index)
JEMALLOC_ALWAYS_INLINE size_t JEMALLOC_ALWAYS_INLINE size_t
index2size(szind_t index) index2size(szind_t index)
{ {
assert(index < NSIZES); assert(index < NSIZES);
return (index2size_lookup(index)); return (index2size_lookup(index));
} }
@ -729,7 +720,6 @@ index2size(szind_t index)
JEMALLOC_ALWAYS_INLINE size_t JEMALLOC_ALWAYS_INLINE size_t
s2u_compute(size_t size) s2u_compute(size_t size)
{ {
if (unlikely(size > LARGE_MAXCLASS)) if (unlikely(size > LARGE_MAXCLASS))
return (0); return (0);
#if (NTBINS > 0) #if (NTBINS > 0)
@ -767,7 +757,6 @@ s2u_lookup(size_t size)
JEMALLOC_ALWAYS_INLINE size_t JEMALLOC_ALWAYS_INLINE size_t
s2u(size_t size) s2u(size_t size)
{ {
assert(size > 0); assert(size > 0);
if (likely(size <= LOOKUP_MAXCLASS)) if (likely(size <= LOOKUP_MAXCLASS))
return (s2u_lookup(size)); return (s2u_lookup(size));
@ -852,14 +841,12 @@ arena_choose_impl(tsd_t *tsd, arena_t *arena, bool internal)
JEMALLOC_INLINE arena_t * JEMALLOC_INLINE arena_t *
arena_choose(tsd_t *tsd, arena_t *arena) 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 * JEMALLOC_INLINE arena_t *
arena_ichoose(tsd_t *tsd, arena_t *arena) arena_ichoose(tsd_t *tsd, arena_t *arena)
{ {
return (arena_choose_impl(tsd, arena, true)); return (arena_choose_impl(tsd, arena, true));
} }
@ -933,7 +920,6 @@ extent_t *iealloc(tsdn_t *tsdn, const void *ptr);
JEMALLOC_ALWAYS_INLINE extent_t * JEMALLOC_ALWAYS_INLINE extent_t *
iealloc(tsdn_t *tsdn, const void *ptr) iealloc(tsdn_t *tsdn, const void *ptr)
{ {
return (extent_lookup(tsdn, ptr, true)); return (extent_lookup(tsdn, ptr, true));
} }
#endif #endif
@ -975,7 +961,6 @@ bool ixalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t oldsize,
JEMALLOC_ALWAYS_INLINE arena_t * JEMALLOC_ALWAYS_INLINE arena_t *
iaalloc(tsdn_t *tsdn, const void *ptr) iaalloc(tsdn_t *tsdn, const void *ptr)
{ {
assert(ptr != NULL); assert(ptr != NULL);
return (arena_aalloc(tsdn, ptr)); return (arena_aalloc(tsdn, ptr));
@ -991,7 +976,6 @@ iaalloc(tsdn_t *tsdn, const void *ptr)
JEMALLOC_ALWAYS_INLINE size_t JEMALLOC_ALWAYS_INLINE size_t
isalloc(tsdn_t *tsdn, const extent_t *extent, const void *ptr) isalloc(tsdn_t *tsdn, const extent_t *extent, const void *ptr)
{ {
assert(ptr != NULL); assert(ptr != NULL);
return (arena_salloc(tsdn, extent, ptr)); return (arena_salloc(tsdn, extent, ptr));
@ -1019,7 +1003,6 @@ iallocztm(tsdn_t *tsdn, size_t size, szind_t ind, bool zero, tcache_t *tcache,
JEMALLOC_ALWAYS_INLINE void * JEMALLOC_ALWAYS_INLINE void *
ialloc(tsd_t *tsd, size_t size, szind_t ind, bool zero, bool slow_path) 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), return (iallocztm(tsd_tsdn(tsd), size, ind, zero, tcache_get(tsd, true),
false, NULL, slow_path)); false, NULL, slow_path));
} }
@ -1049,14 +1032,12 @@ JEMALLOC_ALWAYS_INLINE void *
ipalloct(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero, ipalloct(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
tcache_t *tcache, arena_t *arena) 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 * JEMALLOC_ALWAYS_INLINE void *
ipalloc(tsd_t *tsd, size_t usize, size_t alignment, bool zero) ipalloc(tsd_t *tsd, size_t usize, size_t alignment, bool zero)
{ {
return (ipallocztm(tsd_tsdn(tsd), usize, alignment, zero, return (ipallocztm(tsd_tsdn(tsd), usize, alignment, zero,
tcache_get(tsd, true), false, NULL)); tcache_get(tsd, true), false, NULL));
} }
@ -1088,7 +1069,6 @@ JEMALLOC_ALWAYS_INLINE void
idalloctm(tsdn_t *tsdn, extent_t *extent, void *ptr, tcache_t *tcache, idalloctm(tsdn_t *tsdn, extent_t *extent, void *ptr, tcache_t *tcache,
bool is_internal, bool slow_path) bool is_internal, bool slow_path)
{ {
assert(ptr != NULL); assert(ptr != NULL);
assert(!is_internal || tcache == NULL); assert(!is_internal || tcache == NULL);
assert(!is_internal || arena_ind_get(iaalloc(tsdn, ptr)) < assert(!is_internal || arena_ind_get(iaalloc(tsdn, ptr)) <
@ -1104,7 +1084,6 @@ idalloctm(tsdn_t *tsdn, extent_t *extent, void *ptr, tcache_t *tcache,
JEMALLOC_ALWAYS_INLINE void JEMALLOC_ALWAYS_INLINE void
idalloc(tsd_t *tsd, extent_t *extent, void *ptr) idalloc(tsd_t *tsd, extent_t *extent, void *ptr)
{ {
idalloctm(tsd_tsdn(tsd), extent, ptr, tcache_get(tsd, false), false, idalloctm(tsd_tsdn(tsd), extent, ptr, tcache_get(tsd, false), false,
true); true);
} }
@ -1113,7 +1092,6 @@ JEMALLOC_ALWAYS_INLINE void
isdalloct(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t size, isdalloct(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t size,
tcache_t *tcache, bool slow_path) tcache_t *tcache, bool slow_path)
{ {
arena_sdalloc(tsdn, extent, ptr, size, tcache, slow_path); arena_sdalloc(tsdn, extent, ptr, size, tcache, slow_path);
} }
@ -1154,7 +1132,6 @@ JEMALLOC_ALWAYS_INLINE void *
iralloct(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t oldsize, size_t size, iralloct(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t oldsize, size_t size,
size_t alignment, bool zero, tcache_t *tcache, arena_t *arena) size_t alignment, bool zero, tcache_t *tcache, arena_t *arena)
{ {
assert(ptr != NULL); assert(ptr != NULL);
assert(size != 0); assert(size != 0);
@ -1176,7 +1153,6 @@ JEMALLOC_ALWAYS_INLINE void *
iralloc(tsd_t *tsd, extent_t *extent, void *ptr, size_t oldsize, size_t size, iralloc(tsd_t *tsd, extent_t *extent, void *ptr, size_t oldsize, size_t size,
size_t alignment, bool zero) size_t alignment, bool zero)
{ {
return (iralloct(tsd_tsdn(tsd), extent, ptr, oldsize, size, alignment, return (iralloct(tsd_tsdn(tsd), extent, ptr, oldsize, size, alignment,
zero, tcache_get(tsd, true), NULL)); zero, tcache_get(tsd, true), NULL));
} }
@ -1185,7 +1161,6 @@ JEMALLOC_ALWAYS_INLINE bool
ixalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t oldsize, size_t size, ixalloc(tsdn_t *tsdn, extent_t *extent, void *ptr, size_t oldsize, size_t size,
size_t extra, size_t alignment, bool zero) size_t extra, size_t alignment, bool zero)
{ {
assert(ptr != NULL); assert(ptr != NULL);
assert(size != 0); assert(size != 0);

View File

@ -63,7 +63,6 @@ typedef intptr_t ssize_t;
static int static int
isblank(int c) isblank(int c)
{ {
return (c == '\t' || c == ' '); return (c == '\t' || c == ' ');
} }
#endif #endif

View File

@ -12,7 +12,6 @@ void malloc_mutex_assert_not_owner(tsdn_t *tsdn, malloc_mutex_t *mutex);
JEMALLOC_INLINE void JEMALLOC_INLINE void
malloc_mutex_lock(tsdn_t *tsdn, malloc_mutex_t *mutex) malloc_mutex_lock(tsdn_t *tsdn, malloc_mutex_t *mutex)
{ {
if (isthreaded) { if (isthreaded) {
witness_assert_not_owner(tsdn, &mutex->witness); witness_assert_not_owner(tsdn, &mutex->witness);
#ifdef _WIN32 #ifdef _WIN32
@ -35,7 +34,6 @@ malloc_mutex_lock(tsdn_t *tsdn, malloc_mutex_t *mutex)
JEMALLOC_INLINE void JEMALLOC_INLINE void
malloc_mutex_unlock(tsdn_t *tsdn, malloc_mutex_t *mutex) malloc_mutex_unlock(tsdn_t *tsdn, malloc_mutex_t *mutex)
{ {
if (isthreaded) { if (isthreaded) {
witness_unlock(tsdn, &mutex->witness); witness_unlock(tsdn, &mutex->witness);
#ifdef _WIN32 #ifdef _WIN32
@ -57,7 +55,6 @@ malloc_mutex_unlock(tsdn_t *tsdn, malloc_mutex_t *mutex)
JEMALLOC_INLINE void JEMALLOC_INLINE void
malloc_mutex_assert_owner(tsdn_t *tsdn, malloc_mutex_t *mutex) malloc_mutex_assert_owner(tsdn_t *tsdn, malloc_mutex_t *mutex)
{ {
if (isthreaded) if (isthreaded)
witness_assert_owner(tsdn, &mutex->witness); witness_assert_owner(tsdn, &mutex->witness);
} }
@ -65,7 +62,6 @@ malloc_mutex_assert_owner(tsdn_t *tsdn, malloc_mutex_t *mutex)
JEMALLOC_INLINE void JEMALLOC_INLINE void
malloc_mutex_assert_not_owner(tsdn_t *tsdn, malloc_mutex_t *mutex) malloc_mutex_assert_not_owner(tsdn_t *tsdn, malloc_mutex_t *mutex)
{ {
if (isthreaded) if (isthreaded)
witness_assert_not_owner(tsdn, &mutex->witness); witness_assert_not_owner(tsdn, &mutex->witness);
} }

View File

@ -207,19 +207,16 @@ a_attr void a_prefix##remove(a_ph_type *ph, a_type *phn);
a_attr void \ a_attr void \
a_prefix##new(a_ph_type *ph) \ a_prefix##new(a_ph_type *ph) \
{ \ { \
\
memset(ph, 0, sizeof(ph(a_type))); \ memset(ph, 0, sizeof(ph(a_type))); \
} \ } \
a_attr bool \ a_attr bool \
a_prefix##empty(a_ph_type *ph) \ a_prefix##empty(a_ph_type *ph) \
{ \ { \
\
return (ph->ph_root == NULL); \ return (ph->ph_root == NULL); \
} \ } \
a_attr a_type * \ a_attr a_type * \
a_prefix##first(a_ph_type *ph) \ a_prefix##first(a_ph_type *ph) \
{ \ { \
\
if (ph->ph_root == NULL) \ if (ph->ph_root == NULL) \
return (NULL); \ return (NULL); \
ph_merge_aux(a_type, a_field, ph, a_cmp); \ ph_merge_aux(a_type, a_field, ph, a_cmp); \
@ -228,7 +225,6 @@ a_prefix##first(a_ph_type *ph) \
a_attr void \ a_attr void \
a_prefix##insert(a_ph_type *ph, a_type *phn) \ a_prefix##insert(a_ph_type *ph, a_type *phn) \
{ \ { \
\
memset(&phn->a_field, 0, sizeof(phn(a_type))); \ memset(&phn->a_field, 0, sizeof(phn(a_type))); \
\ \
/* \ /* \

View File

@ -20,21 +20,18 @@ size_t prng_range_zu(size_t *state, size_t range, bool atomic);
JEMALLOC_ALWAYS_INLINE uint32_t JEMALLOC_ALWAYS_INLINE uint32_t
prng_state_next_u32(uint32_t state) 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 JEMALLOC_ALWAYS_INLINE uint64_t
prng_state_next_u64(uint64_t state) 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 JEMALLOC_ALWAYS_INLINE size_t
prng_state_next_zu(size_t state) prng_state_next_zu(size_t state)
{ {
#if LG_SIZEOF_PTR == 2 #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 #elif LG_SIZEOF_PTR == 3

View File

@ -29,7 +29,6 @@ void prof_free(tsd_t *tsd, const extent_t *extent, const void *ptr,
JEMALLOC_ALWAYS_INLINE bool JEMALLOC_ALWAYS_INLINE bool
prof_active_get_unlocked(void) prof_active_get_unlocked(void)
{ {
/* /*
* Even if opt_prof is true, sampling can be temporarily disabled by * Even if opt_prof is true, sampling can be temporarily disabled by
* setting prof_active to false. No locking is used when reading * setting prof_active to false. No locking is used when reading
@ -42,7 +41,6 @@ prof_active_get_unlocked(void)
JEMALLOC_ALWAYS_INLINE bool JEMALLOC_ALWAYS_INLINE bool
prof_gdump_get_unlocked(void) prof_gdump_get_unlocked(void)
{ {
/* /*
* No locking is used when reading prof_gdump_val in the fast path, so * No locking is used when reading prof_gdump_val in the fast path, so
* there are no guarantees regarding how long it will take for all * there are no guarantees regarding how long it will take for all
@ -78,7 +76,6 @@ prof_tdata_get(tsd_t *tsd, bool create)
JEMALLOC_ALWAYS_INLINE prof_tctx_t * JEMALLOC_ALWAYS_INLINE prof_tctx_t *
prof_tctx_get(tsdn_t *tsdn, const extent_t *extent, const void *ptr) prof_tctx_get(tsdn_t *tsdn, const extent_t *extent, const void *ptr)
{ {
cassert(config_prof); cassert(config_prof);
assert(ptr != NULL); assert(ptr != NULL);
@ -89,7 +86,6 @@ JEMALLOC_ALWAYS_INLINE void
prof_tctx_set(tsdn_t *tsdn, extent_t *extent, const void *ptr, size_t usize, prof_tctx_set(tsdn_t *tsdn, extent_t *extent, const void *ptr, size_t usize,
prof_tctx_t *tctx) prof_tctx_t *tctx)
{ {
cassert(config_prof); cassert(config_prof);
assert(ptr != NULL); assert(ptr != NULL);
@ -100,7 +96,6 @@ JEMALLOC_ALWAYS_INLINE void
prof_tctx_reset(tsdn_t *tsdn, extent_t *extent, const void *ptr, prof_tctx_reset(tsdn_t *tsdn, extent_t *extent, const void *ptr,
prof_tctx_t *tctx) prof_tctx_t *tctx)
{ {
cassert(config_prof); cassert(config_prof);
assert(ptr != NULL); assert(ptr != NULL);
@ -162,7 +157,6 @@ JEMALLOC_ALWAYS_INLINE void
prof_malloc(tsdn_t *tsdn, extent_t *extent, const void *ptr, size_t usize, prof_malloc(tsdn_t *tsdn, extent_t *extent, const void *ptr, size_t usize,
prof_tctx_t *tctx) prof_tctx_t *tctx)
{ {
cassert(config_prof); cassert(config_prof);
assert(ptr != NULL); assert(ptr != NULL);
assert(usize == isalloc(tsdn, extent, ptr)); assert(usize == isalloc(tsdn, extent, ptr));

View File

@ -74,7 +74,6 @@ rtree_ctx_start_level(const rtree_t *rtree, const rtree_ctx_t *rtree_ctx,
JEMALLOC_ALWAYS_INLINE uintptr_t JEMALLOC_ALWAYS_INLINE uintptr_t
rtree_subkey(rtree_t *rtree, uintptr_t key, unsigned level) rtree_subkey(rtree_t *rtree, uintptr_t key, unsigned level)
{ {
return ((key >> ((ZU(1) << (LG_SIZEOF_PTR+3)) - return ((key >> ((ZU(1) << (LG_SIZEOF_PTR+3)) -
rtree->levels[level].cumbits)) & ((ZU(1) << rtree->levels[level].cumbits)) & ((ZU(1) <<
rtree->levels[level].bits) - 1)); rtree->levels[level].bits) - 1));
@ -83,7 +82,6 @@ rtree_subkey(rtree_t *rtree, uintptr_t key, unsigned level)
JEMALLOC_ALWAYS_INLINE bool JEMALLOC_ALWAYS_INLINE bool
rtree_node_valid(rtree_elm_t *node) rtree_node_valid(rtree_elm_t *node)
{ {
return ((uintptr_t)node != (uintptr_t)0); return ((uintptr_t)node != (uintptr_t)0);
} }
@ -144,7 +142,6 @@ rtree_elm_read(rtree_elm_t *elm, bool dependent)
JEMALLOC_INLINE void JEMALLOC_INLINE void
rtree_elm_write(rtree_elm_t *elm, const extent_t *extent) rtree_elm_write(rtree_elm_t *elm, const extent_t *extent)
{ {
atomic_write_p(&elm->pun, extent); atomic_write_p(&elm->pun, extent);
} }
@ -408,7 +405,6 @@ JEMALLOC_INLINE void
rtree_elm_write_acquired(tsdn_t *tsdn, const rtree_t *rtree, rtree_elm_t *elm, rtree_elm_write_acquired(tsdn_t *tsdn, const rtree_t *rtree, rtree_elm_t *elm,
const extent_t *extent) const extent_t *extent)
{ {
assert(((uintptr_t)extent & (uintptr_t)0x1) == (uintptr_t)0x0); assert(((uintptr_t)extent & (uintptr_t)0x1) == (uintptr_t)0x0);
assert(((uintptr_t)elm->pun & (uintptr_t)0x1) == (uintptr_t)0x1); assert(((uintptr_t)elm->pun & (uintptr_t)0x1) == (uintptr_t)0x1);
@ -422,7 +418,6 @@ rtree_elm_write_acquired(tsdn_t *tsdn, const rtree_t *rtree, rtree_elm_t *elm,
JEMALLOC_INLINE void JEMALLOC_INLINE void
rtree_elm_release(tsdn_t *tsdn, const rtree_t *rtree, rtree_elm_t *elm) rtree_elm_release(tsdn_t *tsdn, const rtree_t *rtree, rtree_elm_t *elm)
{ {
rtree_elm_write(elm, rtree_elm_read_acquired(tsdn, rtree, elm)); rtree_elm_write(elm, rtree_elm_read_acquired(tsdn, rtree, elm));
if (config_debug) if (config_debug)
rtree_elm_witness_release(tsdn, rtree, elm); rtree_elm_witness_release(tsdn, rtree, elm);

View File

@ -10,7 +10,6 @@ void spin_adaptive(spin_t *spin);
JEMALLOC_INLINE void JEMALLOC_INLINE void
spin_init(spin_t *spin) spin_init(spin_t *spin)
{ {
spin->iteration = 0; spin->iteration = 0;
} }

View File

@ -88,7 +88,6 @@ tcache_get(tsd_t *tsd, bool create)
JEMALLOC_ALWAYS_INLINE void JEMALLOC_ALWAYS_INLINE void
tcache_event(tsd_t *tsd, tcache_t *tcache) tcache_event(tsd_t *tsd, tcache_t *tcache)
{ {
if (TCACHE_GC_INCR == 0) if (TCACHE_GC_INCR == 0)
return; return;

View File

@ -13,7 +13,6 @@ bool ticker_tick(ticker_t *ticker);
JEMALLOC_INLINE void JEMALLOC_INLINE void
ticker_init(ticker_t *ticker, int32_t nticks) ticker_init(ticker_t *ticker, int32_t nticks)
{ {
ticker->tick = nticks; ticker->tick = nticks;
ticker->nticks = nticks; ticker->nticks = nticks;
} }
@ -21,21 +20,18 @@ ticker_init(ticker_t *ticker, int32_t nticks)
JEMALLOC_INLINE void JEMALLOC_INLINE void
ticker_copy(ticker_t *ticker, const ticker_t *other) ticker_copy(ticker_t *ticker, const ticker_t *other)
{ {
*ticker = *other; *ticker = *other;
} }
JEMALLOC_INLINE int32_t JEMALLOC_INLINE int32_t
ticker_read(const ticker_t *ticker) ticker_read(const ticker_t *ticker)
{ {
return (ticker->tick); return (ticker->tick);
} }
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
ticker_ticks(ticker_t *ticker, int32_t nticks) ticker_ticks(ticker_t *ticker, int32_t nticks)
{ {
if (unlikely(ticker->tick < nticks)) { if (unlikely(ticker->tick < nticks)) {
ticker->tick = ticker->nticks; ticker->tick = ticker->nticks;
return (true); return (true);
@ -47,7 +43,6 @@ ticker_ticks(ticker_t *ticker, int32_t nticks)
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
ticker_tick(ticker_t *ticker) ticker_tick(ticker_t *ticker)
{ {
return (ticker_ticks(ticker, 1)); return (ticker_ticks(ticker, 1));
} }
#endif #endif

View File

@ -51,21 +51,18 @@ tsd_fetch_impl(bool init)
JEMALLOC_ALWAYS_INLINE tsd_t * JEMALLOC_ALWAYS_INLINE tsd_t *
tsd_fetch(void) tsd_fetch(void)
{ {
return (tsd_fetch_impl(true)); return (tsd_fetch_impl(true));
} }
JEMALLOC_ALWAYS_INLINE tsdn_t * JEMALLOC_ALWAYS_INLINE tsdn_t *
tsd_tsdn(tsd_t *tsd) tsd_tsdn(tsd_t *tsd)
{ {
return ((tsdn_t *)tsd); return ((tsdn_t *)tsd);
} }
JEMALLOC_INLINE bool JEMALLOC_INLINE bool
tsd_nominal(tsd_t *tsd) tsd_nominal(tsd_t *tsd)
{ {
return (tsd->state == tsd_state_nominal); return (tsd->state == tsd_state_nominal);
} }
@ -73,21 +70,18 @@ tsd_nominal(tsd_t *tsd)
JEMALLOC_ALWAYS_INLINE t * \ JEMALLOC_ALWAYS_INLINE t * \
tsd_##n##p_get(tsd_t *tsd) \ tsd_##n##p_get(tsd_t *tsd) \
{ \ { \
\
return (&tsd->n); \ return (&tsd->n); \
} \ } \
\ \
JEMALLOC_ALWAYS_INLINE t \ JEMALLOC_ALWAYS_INLINE t \
tsd_##n##_get(tsd_t *tsd) \ tsd_##n##_get(tsd_t *tsd) \
{ \ { \
\
return (*tsd_##n##p_get(tsd)); \ return (*tsd_##n##p_get(tsd)); \
} \ } \
\ \
JEMALLOC_ALWAYS_INLINE void \ JEMALLOC_ALWAYS_INLINE void \
tsd_##n##_set(tsd_t *tsd, t n) \ tsd_##n##_set(tsd_t *tsd, t n) \
{ \ { \
\
assert(tsd->state == tsd_state_nominal); \ assert(tsd->state == tsd_state_nominal); \
tsd->n = n; \ tsd->n = n; \
} }
@ -97,7 +91,6 @@ MALLOC_TSD
JEMALLOC_ALWAYS_INLINE tsdn_t * JEMALLOC_ALWAYS_INLINE tsdn_t *
tsdn_fetch(void) tsdn_fetch(void)
{ {
if (!tsd_booted_get()) if (!tsd_booted_get())
return (NULL); return (NULL);
@ -107,14 +100,12 @@ tsdn_fetch(void)
JEMALLOC_ALWAYS_INLINE bool JEMALLOC_ALWAYS_INLINE bool
tsdn_null(const tsdn_t *tsdn) tsdn_null(const tsdn_t *tsdn)
{ {
return (tsdn == NULL); return (tsdn == NULL);
} }
JEMALLOC_ALWAYS_INLINE tsd_t * JEMALLOC_ALWAYS_INLINE tsd_t *
tsdn_tsd(tsdn_t *tsdn) tsdn_tsd(tsdn_t *tsdn)
{ {
assert(!tsdn_null(tsdn)); assert(!tsdn_null(tsdn));
return (&tsdn->tsd); return (&tsdn->tsd);
@ -123,7 +114,6 @@ tsdn_tsd(tsdn_t *tsdn)
JEMALLOC_ALWAYS_INLINE rtree_ctx_t * JEMALLOC_ALWAYS_INLINE rtree_ctx_t *
tsdn_rtree_ctx(tsdn_t *tsdn, rtree_ctx_t *fallback) tsdn_rtree_ctx(tsdn_t *tsdn, rtree_ctx_t *fallback)
{ {
/* /*
* If tsd cannot be accessed, initialize the fallback rtree_ctx and * If tsd cannot be accessed, initialize the fallback rtree_ctx and
* return a pointer to it. * return a pointer to it.

View File

@ -177,7 +177,6 @@ a_attr bool a_name##tsd_booted = false;
a_attr bool \ a_attr bool \
a_name##tsd_cleanup_wrapper(void) \ a_name##tsd_cleanup_wrapper(void) \
{ \ { \
\
if (a_name##tsd_initialized) { \ if (a_name##tsd_initialized) { \
a_name##tsd_initialized = false; \ a_name##tsd_initialized = false; \
a_cleanup(&a_name##tsd_tls); \ a_cleanup(&a_name##tsd_tls); \
@ -187,7 +186,6 @@ a_name##tsd_cleanup_wrapper(void) \
a_attr bool \ a_attr bool \
a_name##tsd_boot0(void) \ a_name##tsd_boot0(void) \
{ \ { \
\
if (a_cleanup != malloc_tsd_no_cleanup) { \ if (a_cleanup != malloc_tsd_no_cleanup) { \
malloc_tsd_cleanup_register( \ malloc_tsd_cleanup_register( \
&a_name##tsd_cleanup_wrapper); \ &a_name##tsd_cleanup_wrapper); \
@ -198,39 +196,33 @@ a_name##tsd_boot0(void) \
a_attr void \ a_attr void \
a_name##tsd_boot1(void) \ a_name##tsd_boot1(void) \
{ \ { \
\
/* Do nothing. */ \ /* Do nothing. */ \
} \ } \
a_attr bool \ a_attr bool \
a_name##tsd_boot(void) \ a_name##tsd_boot(void) \
{ \ { \
\
return (a_name##tsd_boot0()); \ return (a_name##tsd_boot0()); \
} \ } \
a_attr bool \ a_attr bool \
a_name##tsd_booted_get(void) \ a_name##tsd_booted_get(void) \
{ \ { \
\
return (a_name##tsd_booted); \ return (a_name##tsd_booted); \
} \ } \
a_attr bool \ a_attr bool \
a_name##tsd_get_allocates(void) \ a_name##tsd_get_allocates(void) \
{ \ { \
\
return (false); \ return (false); \
} \ } \
/* Get/set. */ \ /* Get/set. */ \
a_attr a_type * \ a_attr a_type * \
a_name##tsd_get(bool init) \ a_name##tsd_get(bool init) \
{ \ { \
\
assert(a_name##tsd_booted); \ assert(a_name##tsd_booted); \
return (&a_name##tsd_tls); \ return (&a_name##tsd_tls); \
} \ } \
a_attr void \ a_attr void \
a_name##tsd_set(a_type *val) \ a_name##tsd_set(a_type *val) \
{ \ { \
\
assert(a_name##tsd_booted); \ assert(a_name##tsd_booted); \
if (likely(&a_name##tsd_tls != val)) \ if (likely(&a_name##tsd_tls != val)) \
a_name##tsd_tls = (*val); \ a_name##tsd_tls = (*val); \
@ -244,7 +236,6 @@ a_name##tsd_set(a_type *val) \
a_attr bool \ a_attr bool \
a_name##tsd_boot0(void) \ a_name##tsd_boot0(void) \
{ \ { \
\
if (a_cleanup != malloc_tsd_no_cleanup) { \ if (a_cleanup != malloc_tsd_no_cleanup) { \
if (pthread_key_create(&a_name##tsd_tsd, a_cleanup) != \ if (pthread_key_create(&a_name##tsd_tsd, a_cleanup) != \
0) \ 0) \
@ -256,39 +247,33 @@ a_name##tsd_boot0(void) \
a_attr void \ a_attr void \
a_name##tsd_boot1(void) \ a_name##tsd_boot1(void) \
{ \ { \
\
/* Do nothing. */ \ /* Do nothing. */ \
} \ } \
a_attr bool \ a_attr bool \
a_name##tsd_boot(void) \ a_name##tsd_boot(void) \
{ \ { \
\
return (a_name##tsd_boot0()); \ return (a_name##tsd_boot0()); \
} \ } \
a_attr bool \ a_attr bool \
a_name##tsd_booted_get(void) \ a_name##tsd_booted_get(void) \
{ \ { \
\
return (a_name##tsd_booted); \ return (a_name##tsd_booted); \
} \ } \
a_attr bool \ a_attr bool \
a_name##tsd_get_allocates(void) \ a_name##tsd_get_allocates(void) \
{ \ { \
\
return (false); \ return (false); \
} \ } \
/* Get/set. */ \ /* Get/set. */ \
a_attr a_type * \ a_attr a_type * \
a_name##tsd_get(bool init) \ a_name##tsd_get(bool init) \
{ \ { \
\
assert(a_name##tsd_booted); \ assert(a_name##tsd_booted); \
return (&a_name##tsd_tls); \ return (&a_name##tsd_tls); \
} \ } \
a_attr void \ a_attr void \
a_name##tsd_set(a_type *val) \ a_name##tsd_set(a_type *val) \
{ \ { \
\
assert(a_name##tsd_booted); \ assert(a_name##tsd_booted); \
if (likely(&a_name##tsd_tls != val)) \ if (likely(&a_name##tsd_tls != val)) \
a_name##tsd_tls = (*val); \ a_name##tsd_tls = (*val); \
@ -331,7 +316,6 @@ a_name##tsd_cleanup_wrapper(void) \
a_attr void \ a_attr void \
a_name##tsd_wrapper_set(a_name##tsd_wrapper_t *wrapper) \ a_name##tsd_wrapper_set(a_name##tsd_wrapper_t *wrapper) \
{ \ { \
\
if (!TlsSetValue(a_name##tsd_tsd, (void *)wrapper)) { \ if (!TlsSetValue(a_name##tsd_tsd, (void *)wrapper)) { \
malloc_write("<jemalloc>: Error setting" \ malloc_write("<jemalloc>: Error setting" \
" TSD for "#a_name"\n"); \ " TSD for "#a_name"\n"); \
@ -364,7 +348,6 @@ a_name##tsd_wrapper_get(bool init) \
a_attr bool \ a_attr bool \
a_name##tsd_boot0(void) \ a_name##tsd_boot0(void) \
{ \ { \
\
a_name##tsd_tsd = TlsAlloc(); \ a_name##tsd_tsd = TlsAlloc(); \
if (a_name##tsd_tsd == TLS_OUT_OF_INDEXES) \ if (a_name##tsd_tsd == TLS_OUT_OF_INDEXES) \
return (true); \ return (true); \
@ -394,7 +377,6 @@ a_name##tsd_boot1(void) \
a_attr bool \ a_attr bool \
a_name##tsd_boot(void) \ a_name##tsd_boot(void) \
{ \ { \
\
if (a_name##tsd_boot0()) \ if (a_name##tsd_boot0()) \
return (true); \ return (true); \
a_name##tsd_boot1(); \ a_name##tsd_boot1(); \
@ -403,13 +385,11 @@ a_name##tsd_boot(void) \
a_attr bool \ a_attr bool \
a_name##tsd_booted_get(void) \ a_name##tsd_booted_get(void) \
{ \ { \
\
return (a_name##tsd_booted); \ return (a_name##tsd_booted); \
} \ } \
a_attr bool \ a_attr bool \
a_name##tsd_get_allocates(void) \ a_name##tsd_get_allocates(void) \
{ \ { \
\
return (true); \ return (true); \
} \ } \
/* Get/set. */ \ /* Get/set. */ \
@ -466,7 +446,6 @@ a_name##tsd_cleanup_wrapper(void *arg) \
a_attr void \ a_attr void \
a_name##tsd_wrapper_set(a_name##tsd_wrapper_t *wrapper) \ a_name##tsd_wrapper_set(a_name##tsd_wrapper_t *wrapper) \
{ \ { \
\
if (pthread_setspecific(a_name##tsd_tsd, \ if (pthread_setspecific(a_name##tsd_tsd, \
(void *)wrapper)) { \ (void *)wrapper)) { \
malloc_write("<jemalloc>: Error setting" \ malloc_write("<jemalloc>: Error setting" \
@ -506,7 +485,6 @@ a_name##tsd_wrapper_get(bool init) \
a_attr bool \ a_attr bool \
a_name##tsd_boot0(void) \ a_name##tsd_boot0(void) \
{ \ { \
\
if (pthread_key_create(&a_name##tsd_tsd, \ if (pthread_key_create(&a_name##tsd_tsd, \
a_name##tsd_cleanup_wrapper) != 0) \ a_name##tsd_cleanup_wrapper) != 0) \
return (true); \ return (true); \
@ -532,7 +510,6 @@ a_name##tsd_boot1(void) \
a_attr bool \ a_attr bool \
a_name##tsd_boot(void) \ a_name##tsd_boot(void) \
{ \ { \
\
if (a_name##tsd_boot0()) \ if (a_name##tsd_boot0()) \
return (true); \ return (true); \
a_name##tsd_boot1(); \ a_name##tsd_boot1(); \
@ -541,13 +518,11 @@ a_name##tsd_boot(void) \
a_attr bool \ a_attr bool \
a_name##tsd_booted_get(void) \ a_name##tsd_booted_get(void) \
{ \ { \
\
return (a_name##tsd_booted); \ return (a_name##tsd_booted); \
} \ } \
a_attr bool \ a_attr bool \
a_name##tsd_get_allocates(void) \ a_name##tsd_get_allocates(void) \
{ \ { \
\
return (true); \ return (true); \
} \ } \
/* Get/set. */ \ /* Get/set. */ \

View File

@ -27,28 +27,24 @@ int get_errno(void);
JEMALLOC_ALWAYS_INLINE unsigned JEMALLOC_ALWAYS_INLINE unsigned
ffs_llu(unsigned long long bitmap) ffs_llu(unsigned long long bitmap)
{ {
return (JEMALLOC_INTERNAL_FFSLL(bitmap)); return (JEMALLOC_INTERNAL_FFSLL(bitmap));
} }
JEMALLOC_ALWAYS_INLINE unsigned JEMALLOC_ALWAYS_INLINE unsigned
ffs_lu(unsigned long bitmap) ffs_lu(unsigned long bitmap)
{ {
return (JEMALLOC_INTERNAL_FFSL(bitmap)); return (JEMALLOC_INTERNAL_FFSL(bitmap));
} }
JEMALLOC_ALWAYS_INLINE unsigned JEMALLOC_ALWAYS_INLINE unsigned
ffs_u(unsigned bitmap) ffs_u(unsigned bitmap)
{ {
return (JEMALLOC_INTERNAL_FFS(bitmap)); return (JEMALLOC_INTERNAL_FFS(bitmap));
} }
JEMALLOC_ALWAYS_INLINE unsigned JEMALLOC_ALWAYS_INLINE unsigned
ffs_zu(size_t bitmap) ffs_zu(size_t bitmap)
{ {
#if LG_SIZEOF_PTR == LG_SIZEOF_INT #if LG_SIZEOF_PTR == LG_SIZEOF_INT
return (ffs_u(bitmap)); return (ffs_u(bitmap));
#elif LG_SIZEOF_PTR == LG_SIZEOF_LONG #elif LG_SIZEOF_PTR == LG_SIZEOF_LONG
@ -63,7 +59,6 @@ ffs_zu(size_t bitmap)
JEMALLOC_ALWAYS_INLINE unsigned JEMALLOC_ALWAYS_INLINE unsigned
ffs_u64(uint64_t bitmap) ffs_u64(uint64_t bitmap)
{ {
#if LG_SIZEOF_LONG == 3 #if LG_SIZEOF_LONG == 3
return (ffs_lu(bitmap)); return (ffs_lu(bitmap));
#elif LG_SIZEOF_LONG_LONG == 3 #elif LG_SIZEOF_LONG_LONG == 3
@ -76,7 +71,6 @@ ffs_u64(uint64_t bitmap)
JEMALLOC_ALWAYS_INLINE unsigned JEMALLOC_ALWAYS_INLINE unsigned
ffs_u32(uint32_t bitmap) ffs_u32(uint32_t bitmap)
{ {
#if LG_SIZEOF_INT == 2 #if LG_SIZEOF_INT == 2
return (ffs_u(bitmap)); return (ffs_u(bitmap));
#else #else
@ -88,7 +82,6 @@ ffs_u32(uint32_t bitmap)
JEMALLOC_INLINE uint64_t JEMALLOC_INLINE uint64_t
pow2_ceil_u64(uint64_t x) pow2_ceil_u64(uint64_t x)
{ {
x--; x--;
x |= x >> 1; x |= x >> 1;
x |= x >> 2; x |= x >> 2;
@ -103,7 +96,6 @@ pow2_ceil_u64(uint64_t x)
JEMALLOC_INLINE uint32_t JEMALLOC_INLINE uint32_t
pow2_ceil_u32(uint32_t x) pow2_ceil_u32(uint32_t x)
{ {
x--; x--;
x |= x >> 1; x |= x >> 1;
x |= x >> 2; x |= x >> 2;
@ -118,7 +110,6 @@ pow2_ceil_u32(uint32_t x)
JEMALLOC_INLINE size_t JEMALLOC_INLINE size_t
pow2_ceil_zu(size_t x) pow2_ceil_zu(size_t x)
{ {
#if (LG_SIZEOF_PTR == 3) #if (LG_SIZEOF_PTR == 3)
return (pow2_ceil_u64(x)); return (pow2_ceil_u64(x));
#else #else
@ -163,7 +154,6 @@ lg_floor(size_t x)
JEMALLOC_INLINE unsigned JEMALLOC_INLINE unsigned
lg_floor(size_t x) lg_floor(size_t x)
{ {
assert(x != 0); assert(x != 0);
#if (LG_SIZEOF_PTR == LG_SIZEOF_INT) #if (LG_SIZEOF_PTR == LG_SIZEOF_INT)
@ -178,7 +168,6 @@ lg_floor(size_t x)
JEMALLOC_INLINE unsigned JEMALLOC_INLINE unsigned
lg_floor(size_t x) lg_floor(size_t x)
{ {
assert(x != 0); assert(x != 0);
x |= (x >> 1); x |= (x >> 1);
@ -200,7 +189,6 @@ lg_floor(size_t x)
JEMALLOC_INLINE void JEMALLOC_INLINE void
set_errno(int errnum) set_errno(int errnum)
{ {
#ifdef _WIN32 #ifdef _WIN32
SetLastError(errnum); SetLastError(errnum);
#else #else
@ -212,7 +200,6 @@ set_errno(int errnum)
JEMALLOC_INLINE int JEMALLOC_INLINE int
get_errno(void) get_errno(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
return (GetLastError()); return (GetLastError());
#else #else

View File

@ -17,7 +17,6 @@ static __forceinline int ffsl(long x)
static __forceinline int ffs(int x) static __forceinline int ffs(int x)
{ {
return (ffsl(x)); return (ffsl(x));
} }

View File

@ -40,7 +40,6 @@ static void arena_bin_lower_slab(tsdn_t *tsdn, arena_t *arena,
static size_t static size_t
arena_extent_dirty_npages(const extent_t *extent) arena_extent_dirty_npages(const extent_t *extent)
{ {
return (extent_size_get(extent) >> LG_PAGE); return (extent_size_get(extent) >> LG_PAGE);
} }
@ -76,7 +75,6 @@ static void
arena_extent_cache_dalloc_locked(tsdn_t *tsdn, arena_t *arena, arena_extent_cache_dalloc_locked(tsdn_t *tsdn, arena_t *arena,
extent_hooks_t **r_extent_hooks, extent_t *extent) extent_hooks_t **r_extent_hooks, extent_t *extent)
{ {
malloc_mutex_assert_owner(tsdn, &arena->lock); malloc_mutex_assert_owner(tsdn, &arena->lock);
extent_dalloc_cache(tsdn, arena, r_extent_hooks, extent); extent_dalloc_cache(tsdn, arena, r_extent_hooks, extent);
@ -87,7 +85,6 @@ void
arena_extent_cache_dalloc(tsdn_t *tsdn, arena_t *arena, arena_extent_cache_dalloc(tsdn_t *tsdn, arena_t *arena,
extent_hooks_t **r_extent_hooks, extent_t *extent) extent_hooks_t **r_extent_hooks, extent_t *extent)
{ {
malloc_mutex_lock(tsdn, &arena->lock); malloc_mutex_lock(tsdn, &arena->lock);
arena_extent_cache_dalloc_locked(tsdn, arena, r_extent_hooks, extent); arena_extent_cache_dalloc_locked(tsdn, arena, r_extent_hooks, extent);
malloc_mutex_unlock(tsdn, &arena->lock); malloc_mutex_unlock(tsdn, &arena->lock);
@ -97,7 +94,6 @@ void
arena_extent_cache_maybe_insert(tsdn_t *tsdn, arena_t *arena, extent_t *extent, arena_extent_cache_maybe_insert(tsdn_t *tsdn, arena_t *arena, extent_t *extent,
bool cache) bool cache)
{ {
malloc_mutex_assert_owner(tsdn, &arena->extents_mtx); malloc_mutex_assert_owner(tsdn, &arena->extents_mtx);
if (cache) { if (cache) {
@ -110,7 +106,6 @@ void
arena_extent_cache_maybe_remove(tsdn_t *tsdn, arena_t *arena, extent_t *extent, arena_extent_cache_maybe_remove(tsdn_t *tsdn, arena_t *arena, extent_t *extent,
bool dirty) bool dirty)
{ {
malloc_mutex_assert_owner(tsdn, &arena->extents_mtx); malloc_mutex_assert_owner(tsdn, &arena->extents_mtx);
if (dirty) { if (dirty) {
@ -196,14 +191,12 @@ arena_slab_reg_dalloc(tsdn_t *tsdn, extent_t *slab,
static void static void
arena_nactive_add(arena_t *arena, size_t add_pages) arena_nactive_add(arena_t *arena, size_t add_pages)
{ {
arena->nactive += add_pages; arena->nactive += add_pages;
} }
static void static void
arena_nactive_sub(arena_t *arena, size_t sub_pages) arena_nactive_sub(arena_t *arena, size_t sub_pages)
{ {
assert(arena->nactive >= sub_pages); assert(arena->nactive >= sub_pages);
arena->nactive -= sub_pages; arena->nactive -= sub_pages;
} }
@ -279,7 +272,6 @@ arena_large_reset_stats_cancel(arena_t *arena, size_t usize)
static void static void
arena_large_ralloc_stats_update(arena_t *arena, size_t oldusize, size_t usize) arena_large_ralloc_stats_update(arena_t *arena, size_t oldusize, size_t usize)
{ {
arena_large_dalloc_stats_update(arena, oldusize); arena_large_dalloc_stats_update(arena, oldusize);
arena_large_malloc_stats_update(arena, usize); arena_large_malloc_stats_update(arena, usize);
} }
@ -391,7 +383,6 @@ arena_extent_ralloc_large_expand(tsdn_t *tsdn, arena_t *arena, extent_t *extent,
static void static void
arena_decay_deadline_init(arena_t *arena) arena_decay_deadline_init(arena_t *arena)
{ {
/* /*
* Generate a new deadline that is uniformly random within the next * Generate a new deadline that is uniformly random within the next
* epoch after the current one. * epoch after the current one.
@ -410,7 +401,6 @@ arena_decay_deadline_init(arena_t *arena)
static bool static bool
arena_decay_deadline_reached(const arena_t *arena, const nstime_t *time) arena_decay_deadline_reached(const arena_t *arena, const nstime_t *time)
{ {
return (nstime_compare(&arena->decay.deadline, time) <= 0); return (nstime_compare(&arena->decay.deadline, time) <= 0);
} }
@ -451,7 +441,6 @@ arena_decay_backlog_update_last(arena_t *arena)
static void static void
arena_decay_backlog_update(arena_t *arena, uint64_t nadvance_u64) arena_decay_backlog_update(arena_t *arena, uint64_t nadvance_u64)
{ {
if (nadvance_u64 >= SMOOTHSTEP_NSTEPS) { if (nadvance_u64 >= SMOOTHSTEP_NSTEPS) {
memset(arena->decay.backlog, 0, (SMOOTHSTEP_NSTEPS-1) * memset(arena->decay.backlog, 0, (SMOOTHSTEP_NSTEPS-1) *
sizeof(size_t)); sizeof(size_t));
@ -509,7 +498,6 @@ arena_decay_epoch_advance_purge(tsdn_t *tsdn, arena_t *arena)
static void static void
arena_decay_epoch_advance(tsdn_t *tsdn, arena_t *arena, const nstime_t *time) arena_decay_epoch_advance(tsdn_t *tsdn, arena_t *arena, const nstime_t *time)
{ {
arena_decay_epoch_advance_helper(arena, time); arena_decay_epoch_advance_helper(arena, time);
arena_decay_epoch_advance_purge(tsdn, arena); arena_decay_epoch_advance_purge(tsdn, arena);
} }
@ -517,7 +505,6 @@ arena_decay_epoch_advance(tsdn_t *tsdn, arena_t *arena, const nstime_t *time)
static void static void
arena_decay_init(arena_t *arena, ssize_t decay_time) arena_decay_init(arena_t *arena, ssize_t decay_time)
{ {
arena->decay.time = decay_time; arena->decay.time = decay_time;
if (decay_time > 0) { if (decay_time > 0) {
nstime_init2(&arena->decay.interval, decay_time, 0); nstime_init2(&arena->decay.interval, decay_time, 0);
@ -535,7 +522,6 @@ arena_decay_init(arena_t *arena, ssize_t decay_time)
static bool static bool
arena_decay_time_valid(ssize_t decay_time) arena_decay_time_valid(ssize_t decay_time)
{ {
if (decay_time < -1) if (decay_time < -1)
return (false); return (false);
if (decay_time == -1 || (uint64_t)decay_time <= NSTIME_SEC_MAX) if (decay_time == -1 || (uint64_t)decay_time <= NSTIME_SEC_MAX)
@ -558,7 +544,6 @@ arena_decay_time_get(tsdn_t *tsdn, arena_t *arena)
bool bool
arena_decay_time_set(tsdn_t *tsdn, arena_t *arena, ssize_t decay_time) arena_decay_time_set(tsdn_t *tsdn, arena_t *arena, ssize_t decay_time)
{ {
if (!arena_decay_time_valid(decay_time)) if (!arena_decay_time_valid(decay_time))
return (true); return (true);
@ -623,7 +608,6 @@ arena_maybe_purge_helper(tsdn_t *tsdn, arena_t *arena)
void void
arena_maybe_purge(tsdn_t *tsdn, arena_t *arena) arena_maybe_purge(tsdn_t *tsdn, arena_t *arena)
{ {
malloc_mutex_assert_owner(tsdn, &arena->lock); malloc_mutex_assert_owner(tsdn, &arena->lock);
/* Don't recursively purge. */ /* Don't recursively purge. */
@ -762,7 +746,6 @@ label_return:
void void
arena_purge(tsdn_t *tsdn, arena_t *arena, bool all) arena_purge(tsdn_t *tsdn, arena_t *arena, bool all)
{ {
malloc_mutex_lock(tsdn, &arena->lock); malloc_mutex_lock(tsdn, &arena->lock);
if (all) if (all)
arena_purge_to_limit(tsdn, arena, 0); arena_purge_to_limit(tsdn, arena, 0);
@ -783,7 +766,6 @@ arena_slab_dalloc(tsdn_t *tsdn, arena_t *arena, extent_t *slab)
static void static void
arena_bin_slabs_nonfull_insert(arena_bin_t *bin, extent_t *slab) arena_bin_slabs_nonfull_insert(arena_bin_t *bin, extent_t *slab)
{ {
assert(extent_slab_data_get(slab)->nfree > 0); assert(extent_slab_data_get(slab)->nfree > 0);
extent_heap_insert(&bin->slabs_nonfull, slab); extent_heap_insert(&bin->slabs_nonfull, slab);
} }
@ -791,7 +773,6 @@ arena_bin_slabs_nonfull_insert(arena_bin_t *bin, extent_t *slab)
static void static void
arena_bin_slabs_nonfull_remove(arena_bin_t *bin, extent_t *slab) arena_bin_slabs_nonfull_remove(arena_bin_t *bin, extent_t *slab)
{ {
extent_heap_remove(&bin->slabs_nonfull, slab); extent_heap_remove(&bin->slabs_nonfull, slab);
} }
@ -809,7 +790,6 @@ arena_bin_slabs_nonfull_tryget(arena_bin_t *bin)
static void static void
arena_bin_slabs_full_insert(arena_bin_t *bin, extent_t *slab) arena_bin_slabs_full_insert(arena_bin_t *bin, extent_t *slab)
{ {
assert(extent_slab_data_get(slab)->nfree == 0); assert(extent_slab_data_get(slab)->nfree == 0);
extent_ring_insert(&bin->slabs_full, slab); extent_ring_insert(&bin->slabs_full, slab);
} }
@ -817,7 +797,6 @@ arena_bin_slabs_full_insert(arena_bin_t *bin, extent_t *slab)
static void static void
arena_bin_slabs_full_remove(extent_t *slab) arena_bin_slabs_full_remove(extent_t *slab)
{ {
extent_ring_remove(slab); extent_ring_remove(slab);
} }
@ -935,7 +914,6 @@ arena_destroy_retained(tsdn_t *tsdn, arena_t *arena)
void void
arena_destroy(tsd_t *tsd, arena_t *arena) arena_destroy(tsd_t *tsd, arena_t *arena)
{ {
assert(base_ind_get(arena->base) >= narenas_auto); assert(base_ind_get(arena->base) >= narenas_auto);
assert(arena_nthreads_get(arena, false) == 0); assert(arena_nthreads_get(arena, false) == 0);
assert(arena_nthreads_get(arena, true) == 0); assert(arena_nthreads_get(arena, true) == 0);
@ -1176,7 +1154,6 @@ arena_tcache_fill_small(tsdn_t *tsdn, arena_t *arena, tcache_bin_t *tbin,
void void
arena_alloc_junk_small(void *ptr, const arena_bin_info_t *bin_info, bool zero) arena_alloc_junk_small(void *ptr, const arena_bin_info_t *bin_info, bool zero)
{ {
if (!zero) if (!zero)
memset(ptr, JEMALLOC_ALLOC_JUNK, bin_info->reg_size); memset(ptr, JEMALLOC_ALLOC_JUNK, bin_info->reg_size);
} }
@ -1188,7 +1165,6 @@ arena_alloc_junk_small(void *ptr, const arena_bin_info_t *bin_info, bool zero)
void void
arena_dalloc_junk_small(void *ptr, const arena_bin_info_t *bin_info) arena_dalloc_junk_small(void *ptr, const arena_bin_info_t *bin_info)
{ {
memset(ptr, JEMALLOC_FREE_JUNK, bin_info->reg_size); memset(ptr, JEMALLOC_FREE_JUNK, bin_info->reg_size);
} }
#ifdef JEMALLOC_JET #ifdef JEMALLOC_JET
@ -1255,7 +1231,6 @@ void *
arena_malloc_hard(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind, arena_malloc_hard(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind,
bool zero) bool zero)
{ {
assert(!tsdn_null(tsdn) || arena != NULL); assert(!tsdn_null(tsdn) || arena != NULL);
if (likely(!tsdn_null(tsdn))) if (likely(!tsdn_null(tsdn)))
@ -1320,7 +1295,6 @@ arena_prof_promote(tsdn_t *tsdn, extent_t *extent, const void *ptr,
static size_t static size_t
arena_prof_demote(tsdn_t *tsdn, extent_t *extent, const void *ptr) arena_prof_demote(tsdn_t *tsdn, extent_t *extent, const void *ptr)
{ {
cassert(config_prof); cassert(config_prof);
assert(ptr != NULL); assert(ptr != NULL);
@ -1351,7 +1325,6 @@ arena_dalloc_promoted(tsdn_t *tsdn, extent_t *extent, void *ptr,
static void static void
arena_dissociate_bin_slab(extent_t *slab, arena_bin_t *bin) arena_dissociate_bin_slab(extent_t *slab, arena_bin_t *bin)
{ {
/* Dissociate slab from bin. */ /* Dissociate slab from bin. */
if (slab == bin->slabcur) if (slab == bin->slabcur)
bin->slabcur = NULL; bin->slabcur = NULL;
@ -1375,7 +1348,6 @@ static void
arena_dalloc_bin_slab(tsdn_t *tsdn, arena_t *arena, extent_t *slab, arena_dalloc_bin_slab(tsdn_t *tsdn, arena_t *arena, extent_t *slab,
arena_bin_t *bin) arena_bin_t *bin)
{ {
assert(slab != bin->slabcur); assert(slab != bin->slabcur);
malloc_mutex_unlock(tsdn, &bin->lock); malloc_mutex_unlock(tsdn, &bin->lock);
@ -1393,7 +1365,6 @@ static void
arena_bin_lower_slab(tsdn_t *tsdn, arena_t *arena, extent_t *slab, arena_bin_lower_slab(tsdn_t *tsdn, arena_t *arena, extent_t *slab,
arena_bin_t *bin) arena_bin_t *bin)
{ {
assert(extent_slab_data_get(slab)->nfree > 0); assert(extent_slab_data_get(slab)->nfree > 0);
/* /*
@ -1446,7 +1417,6 @@ void
arena_dalloc_bin_junked_locked(tsdn_t *tsdn, arena_t *arena, extent_t *extent, arena_dalloc_bin_junked_locked(tsdn_t *tsdn, arena_t *arena, extent_t *extent,
void *ptr) void *ptr)
{ {
arena_dalloc_bin_locked_impl(tsdn, arena, extent, ptr, true); arena_dalloc_bin_locked_impl(tsdn, arena, extent, ptr, true);
} }
@ -1463,7 +1433,6 @@ arena_dalloc_bin(tsdn_t *tsdn, arena_t *arena, extent_t *extent, void *ptr)
void void
arena_dalloc_small(tsdn_t *tsdn, arena_t *arena, extent_t *extent, void *ptr) arena_dalloc_small(tsdn_t *tsdn, arena_t *arena, extent_t *extent, void *ptr)
{ {
arena_dalloc_bin(tsdn, arena, extent, ptr); arena_dalloc_bin(tsdn, arena, extent, ptr);
arena_decay_tick(tsdn, arena); arena_decay_tick(tsdn, arena);
} }
@ -1508,7 +1477,6 @@ static void *
arena_ralloc_move_helper(tsdn_t *tsdn, arena_t *arena, size_t usize, arena_ralloc_move_helper(tsdn_t *tsdn, arena_t *arena, size_t usize,
size_t alignment, bool zero, tcache_t *tcache) size_t alignment, bool zero, tcache_t *tcache)
{ {
if (alignment == 0) if (alignment == 0)
return (arena_malloc(tsdn, arena, usize, size2index(usize), return (arena_malloc(tsdn, arena, usize, size2index(usize),
zero, tcache, true)); zero, tcache, true));
@ -1575,7 +1543,6 @@ arena_dss_prec_get(tsdn_t *tsdn, arena_t *arena)
bool bool
arena_dss_prec_set(tsdn_t *tsdn, arena_t *arena, dss_prec_t dss_prec) arena_dss_prec_set(tsdn_t *tsdn, arena_t *arena, dss_prec_t dss_prec)
{ {
if (!have_dss) if (!have_dss)
return (dss_prec != dss_prec_disabled); return (dss_prec != dss_prec_disabled);
malloc_mutex_lock(tsdn, &arena->lock); malloc_mutex_lock(tsdn, &arena->lock);
@ -1587,14 +1554,12 @@ arena_dss_prec_set(tsdn_t *tsdn, arena_t *arena, dss_prec_t dss_prec)
ssize_t ssize_t
arena_decay_time_default_get(void) arena_decay_time_default_get(void)
{ {
return ((ssize_t)atomic_read_zu((size_t *)&decay_time_default)); return ((ssize_t)atomic_read_zu((size_t *)&decay_time_default));
} }
bool bool
arena_decay_time_default_set(ssize_t decay_time) arena_decay_time_default_set(ssize_t decay_time)
{ {
if (!arena_decay_time_valid(decay_time)) if (!arena_decay_time_valid(decay_time))
return (true); return (true);
atomic_write_zu((size_t *)&decay_time_default, (size_t)decay_time); atomic_write_zu((size_t *)&decay_time_default, (size_t)decay_time);
@ -1605,7 +1570,6 @@ static void
arena_basic_stats_merge_locked(arena_t *arena, unsigned *nthreads, arena_basic_stats_merge_locked(arena_t *arena, unsigned *nthreads,
const char **dss, ssize_t *decay_time, size_t *nactive, size_t *ndirty) const char **dss, ssize_t *decay_time, size_t *nactive, size_t *ndirty)
{ {
*nthreads += arena_nthreads_get(arena, false); *nthreads += arena_nthreads_get(arena, false);
*dss = dss_prec_names[arena->dss_prec]; *dss = dss_prec_names[arena->dss_prec];
*decay_time = arena->decay.time; *decay_time = arena->decay.time;
@ -1617,7 +1581,6 @@ void
arena_basic_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads, arena_basic_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads,
const char **dss, ssize_t *decay_time, size_t *nactive, size_t *ndirty) const char **dss, ssize_t *decay_time, size_t *nactive, size_t *ndirty)
{ {
malloc_mutex_lock(tsdn, &arena->lock); malloc_mutex_lock(tsdn, &arena->lock);
arena_basic_stats_merge_locked(arena, nthreads, dss, decay_time, arena_basic_stats_merge_locked(arena, nthreads, dss, decay_time,
nactive, ndirty); nactive, ndirty);
@ -1686,28 +1649,24 @@ arena_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads,
unsigned unsigned
arena_nthreads_get(arena_t *arena, bool internal) arena_nthreads_get(arena_t *arena, bool internal)
{ {
return (atomic_read_u(&arena->nthreads[internal])); return (atomic_read_u(&arena->nthreads[internal]));
} }
void void
arena_nthreads_inc(arena_t *arena, bool internal) arena_nthreads_inc(arena_t *arena, bool internal)
{ {
atomic_add_u(&arena->nthreads[internal], 1); atomic_add_u(&arena->nthreads[internal], 1);
} }
void void
arena_nthreads_dec(arena_t *arena, bool internal) arena_nthreads_dec(arena_t *arena, bool internal)
{ {
atomic_sub_u(&arena->nthreads[internal], 1); atomic_sub_u(&arena->nthreads[internal], 1);
} }
size_t size_t
arena_extent_sn_next(arena_t *arena) arena_extent_sn_next(arena_t *arena)
{ {
return (atomic_add_zu(&arena->extent_sn_next, 1) - 1); return (atomic_add_zu(&arena->extent_sn_next, 1) - 1);
} }
@ -1813,28 +1772,24 @@ label_error:
void void
arena_boot(void) arena_boot(void)
{ {
arena_decay_time_default_set(opt_decay_time); arena_decay_time_default_set(opt_decay_time);
} }
void void
arena_prefork0(tsdn_t *tsdn, arena_t *arena) arena_prefork0(tsdn_t *tsdn, arena_t *arena)
{ {
malloc_mutex_prefork(tsdn, &arena->lock); malloc_mutex_prefork(tsdn, &arena->lock);
} }
void void
arena_prefork1(tsdn_t *tsdn, arena_t *arena) arena_prefork1(tsdn_t *tsdn, arena_t *arena)
{ {
malloc_mutex_prefork(tsdn, &arena->extents_mtx); malloc_mutex_prefork(tsdn, &arena->extents_mtx);
} }
void void
arena_prefork2(tsdn_t *tsdn, arena_t *arena) arena_prefork2(tsdn_t *tsdn, arena_t *arena)
{ {
malloc_mutex_prefork(tsdn, &arena->extent_cache_mtx); malloc_mutex_prefork(tsdn, &arena->extent_cache_mtx);
} }

View File

@ -30,7 +30,6 @@ base_map(extent_hooks_t *extent_hooks, unsigned ind, size_t size)
static void static void
base_unmap(extent_hooks_t *extent_hooks, unsigned ind, void *addr, size_t size) base_unmap(extent_hooks_t *extent_hooks, unsigned ind, void *addr, size_t size)
{ {
/* /*
* Cascade through dalloc, decommit, purge_lazy, and purge_forced, * Cascade through dalloc, decommit, purge_lazy, and purge_forced,
* stopping at first success. This cascade is performed for consistency * stopping at first success. This cascade is performed for consistency
@ -107,7 +106,6 @@ static void
base_extent_bump_alloc_post(tsdn_t *tsdn, base_t *base, extent_t *extent, base_extent_bump_alloc_post(tsdn_t *tsdn, base_t *base, extent_t *extent,
size_t gap_size, void *addr, size_t size) size_t gap_size, void *addr, size_t size)
{ {
if (extent_size_get(extent) > 0) { if (extent_size_get(extent) > 0) {
/* /*
* Compute the index for the largest size class that does not * Compute the index for the largest size class that does not
@ -202,7 +200,6 @@ base_extent_alloc(tsdn_t *tsdn, base_t *base, size_t size, size_t alignment)
base_t * base_t *
b0get(void) b0get(void)
{ {
return (b0); return (b0);
} }
@ -263,7 +260,6 @@ base_delete(base_t *base)
extent_hooks_t * extent_hooks_t *
base_extent_hooks_get(base_t *base) base_extent_hooks_get(base_t *base)
{ {
return ((extent_hooks_t *)atomic_read_p(&base->extent_hooks_pun)); return ((extent_hooks_t *)atomic_read_p(&base->extent_hooks_pun));
} }
@ -330,7 +326,6 @@ void
base_stats_get(tsdn_t *tsdn, base_t *base, size_t *allocated, size_t *resident, base_stats_get(tsdn_t *tsdn, base_t *base, size_t *allocated, size_t *resident,
size_t *mapped) size_t *mapped)
{ {
cassert(config_stats); cassert(config_stats);
malloc_mutex_lock(tsdn, &base->mtx); malloc_mutex_lock(tsdn, &base->mtx);
@ -345,28 +340,24 @@ base_stats_get(tsdn_t *tsdn, base_t *base, size_t *allocated, size_t *resident,
void void
base_prefork(tsdn_t *tsdn, base_t *base) base_prefork(tsdn_t *tsdn, base_t *base)
{ {
malloc_mutex_prefork(tsdn, &base->mtx); malloc_mutex_prefork(tsdn, &base->mtx);
} }
void void
base_postfork_parent(tsdn_t *tsdn, base_t *base) base_postfork_parent(tsdn_t *tsdn, base_t *base)
{ {
malloc_mutex_postfork_parent(tsdn, &base->mtx); malloc_mutex_postfork_parent(tsdn, &base->mtx);
} }
void void
base_postfork_child(tsdn_t *tsdn, base_t *base) base_postfork_child(tsdn_t *tsdn, base_t *base)
{ {
malloc_mutex_postfork_child(tsdn, &base->mtx); malloc_mutex_postfork_child(tsdn, &base->mtx);
} }
bool bool
base_boot(tsdn_t *tsdn) base_boot(tsdn_t *tsdn)
{ {
b0 = base_new(tsdn, 0, (extent_hooks_t *)&extent_hooks_default); b0 = base_new(tsdn, 0, (extent_hooks_t *)&extent_hooks_default);
return (b0 == NULL); return (b0 == NULL);
} }

View File

@ -37,7 +37,6 @@ bitmap_info_init(bitmap_info_t *binfo, size_t nbits)
static size_t static size_t
bitmap_info_ngroups(const bitmap_info_t *binfo) bitmap_info_ngroups(const bitmap_info_t *binfo)
{ {
return (binfo->levels[binfo->nlevels].group_offset); return (binfo->levels[binfo->nlevels].group_offset);
} }
@ -74,7 +73,6 @@ bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo)
void void
bitmap_info_init(bitmap_info_t *binfo, size_t nbits) bitmap_info_init(bitmap_info_t *binfo, size_t nbits)
{ {
assert(nbits > 0); assert(nbits > 0);
assert(nbits <= (ZU(1) << LG_BITMAP_MAXBITS)); assert(nbits <= (ZU(1) << LG_BITMAP_MAXBITS));
@ -85,7 +83,6 @@ bitmap_info_init(bitmap_info_t *binfo, size_t nbits)
static size_t static size_t
bitmap_info_ngroups(const bitmap_info_t *binfo) bitmap_info_ngroups(const bitmap_info_t *binfo)
{ {
return (binfo->ngroups); return (binfo->ngroups);
} }
@ -106,6 +103,5 @@ bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo)
size_t size_t
bitmap_size(const bitmap_info_t *binfo) bitmap_size(const bitmap_info_t *binfo)
{ {
return (bitmap_info_ngroups(binfo) << LG_SIZEOF_BITMAP); return (bitmap_info_ngroups(binfo) << LG_SIZEOF_BITMAP);
} }

View File

@ -411,7 +411,6 @@ label_return:
void void
ckh_delete(tsd_t *tsd, ckh_t *ckh) ckh_delete(tsd_t *tsd, ckh_t *ckh)
{ {
assert(ckh != NULL); assert(ckh != NULL);
#ifdef CKH_VERBOSE #ifdef CKH_VERBOSE
@ -435,7 +434,6 @@ ckh_delete(tsd_t *tsd, ckh_t *ckh)
size_t size_t
ckh_count(ckh_t *ckh) ckh_count(ckh_t *ckh)
{ {
assert(ckh != NULL); assert(ckh != NULL);
return (ckh->count); return (ckh->count);
@ -539,14 +537,12 @@ ckh_search(ckh_t *ckh, const void *searchkey, void **key, void **data)
void void
ckh_string_hash(const void *key, size_t r_hash[2]) ckh_string_hash(const void *key, size_t r_hash[2])
{ {
hash(key, strlen((const char *)key), 0x94122f33U, r_hash); hash(key, strlen((const char *)key), 0x94122f33U, r_hash);
} }
bool bool
ckh_string_keycomp(const void *k1, const void *k2) ckh_string_keycomp(const void *k1, const void *k2)
{ {
assert(k1 != NULL); assert(k1 != NULL);
assert(k2 != NULL); assert(k2 != NULL);
@ -569,6 +565,5 @@ ckh_pointer_hash(const void *key, size_t r_hash[2])
bool bool
ckh_pointer_keycomp(const void *k1, const void *k2) ckh_pointer_keycomp(const void *k1, const void *k2)
{ {
return ((k1 == k2) ? true : false); return ((k1 == k2) ? true : false);
} }

View File

@ -18,7 +18,6 @@ static ctl_stats_t *ctl_stats;
JEMALLOC_INLINE_C const ctl_named_node_t * JEMALLOC_INLINE_C const ctl_named_node_t *
ctl_named_node(const ctl_node_t *node) ctl_named_node(const ctl_node_t *node)
{ {
return ((node->named) ? (const ctl_named_node_t *)node : NULL); return ((node->named) ? (const ctl_named_node_t *)node : NULL);
} }
@ -33,7 +32,6 @@ ctl_named_children(const ctl_named_node_t *node, size_t index)
JEMALLOC_INLINE_C const ctl_indexed_node_t * JEMALLOC_INLINE_C const ctl_indexed_node_t *
ctl_indexed_node(const ctl_node_t *node) ctl_indexed_node(const ctl_node_t *node)
{ {
return (!node->named ? (const ctl_indexed_node_t *)node : NULL); return (!node->named ? (const ctl_indexed_node_t *)node : NULL);
} }
@ -475,7 +473,6 @@ stats_arenas_i2a_impl(size_t i, bool compat, bool validate)
static unsigned static unsigned
stats_arenas_i2a(size_t i) stats_arenas_i2a(size_t i)
{ {
return (stats_arenas_i2a_impl(i, true, false)); return (stats_arenas_i2a_impl(i, true, false));
} }
@ -513,7 +510,6 @@ stats_arenas_i(size_t i)
static void static void
ctl_arena_clear(ctl_arena_stats_t *astats) ctl_arena_clear(ctl_arena_stats_t *astats)
{ {
astats->nthreads = 0; astats->nthreads = 0;
astats->dss = dss_prec_names[dss_prec_limit]; astats->dss = dss_prec_names[dss_prec_limit];
astats->decay_time = -1; astats->decay_time = -1;
@ -985,7 +981,6 @@ label_return:
bool bool
ctl_boot(void) ctl_boot(void)
{ {
if (malloc_mutex_init(&ctl_mtx, "ctl", WITNESS_RANK_CTL)) if (malloc_mutex_init(&ctl_mtx, "ctl", WITNESS_RANK_CTL))
return (true); return (true);
@ -997,21 +992,18 @@ ctl_boot(void)
void void
ctl_prefork(tsdn_t *tsdn) ctl_prefork(tsdn_t *tsdn)
{ {
malloc_mutex_prefork(tsdn, &ctl_mtx); malloc_mutex_prefork(tsdn, &ctl_mtx);
} }
void void
ctl_postfork_parent(tsdn_t *tsdn) ctl_postfork_parent(tsdn_t *tsdn)
{ {
malloc_mutex_postfork_parent(tsdn, &ctl_mtx); malloc_mutex_postfork_parent(tsdn, &ctl_mtx);
} }
void void
ctl_postfork_child(tsdn_t *tsdn) ctl_postfork_child(tsdn_t *tsdn)
{ {
malloc_mutex_postfork_child(tsdn, &ctl_mtx); malloc_mutex_postfork_child(tsdn, &ctl_mtx);
} }
@ -1540,7 +1532,6 @@ label_return:
static void static void
arena_i_purge(tsdn_t *tsdn, unsigned arena_ind, bool all) arena_i_purge(tsdn_t *tsdn, unsigned arena_ind, bool all)
{ {
malloc_mutex_lock(tsdn, &ctl_mtx); malloc_mutex_lock(tsdn, &ctl_mtx);
{ {
unsigned narenas = ctl_stats->narenas; unsigned narenas = ctl_stats->narenas;
@ -1918,7 +1909,6 @@ CTL_RO_NL_GEN(arenas_bin_i_slab_size, arena_bin_info[mib[2]].slab_size, size_t)
static const ctl_named_node_t * static const ctl_named_node_t *
arenas_bin_i_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t i) arenas_bin_i_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t i)
{ {
if (i > NBINS) if (i > NBINS)
return (NULL); return (NULL);
return (super_arenas_bin_i_node); return (super_arenas_bin_i_node);
@ -1929,7 +1919,6 @@ CTL_RO_NL_GEN(arenas_lextent_i_size, index2size(NBINS+(szind_t)mib[2]), size_t)
static const ctl_named_node_t * static const ctl_named_node_t *
arenas_lextent_i_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t i) arenas_lextent_i_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t i)
{ {
if (i > NSIZES - NBINS) if (i > NSIZES - NBINS)
return (NULL); return (NULL);
return (super_arenas_lextent_i_node); return (super_arenas_lextent_i_node);
@ -2159,7 +2148,6 @@ static const ctl_named_node_t *
stats_arenas_i_bins_j_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, stats_arenas_i_bins_j_index(tsdn_t *tsdn, const size_t *mib, size_t miblen,
size_t j) size_t j)
{ {
if (j > NBINS) if (j > NBINS)
return (NULL); return (NULL);
return (super_stats_arenas_i_bins_j_node); return (super_stats_arenas_i_bins_j_node);
@ -2178,7 +2166,6 @@ static const ctl_named_node_t *
stats_arenas_i_lextents_j_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, stats_arenas_i_lextents_j_index(tsdn_t *tsdn, const size_t *mib, size_t miblen,
size_t j) size_t j)
{ {
if (j > NSIZES - NBINS) if (j > NSIZES - NBINS)
return (NULL); return (NULL);
return (super_stats_arenas_i_lextents_j_node); return (super_stats_arenas_i_lextents_j_node);

View File

@ -94,7 +94,6 @@ extent_alloc(tsdn_t *tsdn, arena_t *arena)
void void
extent_dalloc(tsdn_t *tsdn, arena_t *arena, extent_t *extent) extent_dalloc(tsdn_t *tsdn, arena_t *arena, extent_t *extent)
{ {
malloc_mutex_lock(tsdn, &arena->extent_cache_mtx); malloc_mutex_lock(tsdn, &arena->extent_cache_mtx);
ql_elm_new(extent, ql_link); ql_elm_new(extent, ql_link);
ql_tail_insert(&arena->extent_cache, extent, ql_link); ql_tail_insert(&arena->extent_cache, extent, ql_link);
@ -104,21 +103,18 @@ extent_dalloc(tsdn_t *tsdn, arena_t *arena, extent_t *extent)
extent_hooks_t * extent_hooks_t *
extent_hooks_get(arena_t *arena) extent_hooks_get(arena_t *arena)
{ {
return (base_extent_hooks_get(arena->base)); return (base_extent_hooks_get(arena->base));
} }
extent_hooks_t * extent_hooks_t *
extent_hooks_set(arena_t *arena, extent_hooks_t *extent_hooks) extent_hooks_set(arena_t *arena, extent_hooks_t *extent_hooks)
{ {
return (base_extent_hooks_set(arena->base, extent_hooks)); return (base_extent_hooks_set(arena->base, extent_hooks));
} }
static void static void
extent_hooks_assure_initialized(arena_t *arena, extent_hooks_t **r_extent_hooks) extent_hooks_assure_initialized(arena_t *arena, extent_hooks_t **r_extent_hooks)
{ {
if (*r_extent_hooks == EXTENT_HOOKS_INITIALIZER) if (*r_extent_hooks == EXTENT_HOOKS_INITIALIZER)
*r_extent_hooks = extent_hooks_get(arena); *r_extent_hooks = extent_hooks_get(arena);
} }
@ -226,7 +222,6 @@ extent_rtree_acquire(tsdn_t *tsdn, rtree_ctx_t *rtree_ctx,
const extent_t *extent, bool dependent, bool init_missing, const extent_t *extent, bool dependent, bool init_missing,
rtree_elm_t **r_elm_a, rtree_elm_t **r_elm_b) rtree_elm_t **r_elm_a, rtree_elm_t **r_elm_b)
{ {
*r_elm_a = rtree_elm_acquire(tsdn, &extents_rtree, rtree_ctx, *r_elm_a = rtree_elm_acquire(tsdn, &extents_rtree, rtree_ctx,
(uintptr_t)extent_base_get(extent), dependent, init_missing); (uintptr_t)extent_base_get(extent), dependent, init_missing);
if (!dependent && *r_elm_a == NULL) if (!dependent && *r_elm_a == NULL)
@ -252,7 +247,6 @@ static void
extent_rtree_write_acquired(tsdn_t *tsdn, rtree_elm_t *elm_a, extent_rtree_write_acquired(tsdn_t *tsdn, rtree_elm_t *elm_a,
rtree_elm_t *elm_b, const extent_t *extent) rtree_elm_t *elm_b, const extent_t *extent)
{ {
rtree_elm_write_acquired(tsdn, &extents_rtree, elm_a, extent); rtree_elm_write_acquired(tsdn, &extents_rtree, elm_a, extent);
if (elm_b != NULL) if (elm_b != NULL)
rtree_elm_write_acquired(tsdn, &extents_rtree, elm_b, extent); rtree_elm_write_acquired(tsdn, &extents_rtree, elm_b, extent);
@ -261,7 +255,6 @@ extent_rtree_write_acquired(tsdn_t *tsdn, rtree_elm_t *elm_a,
static void static void
extent_rtree_release(tsdn_t *tsdn, rtree_elm_t *elm_a, rtree_elm_t *elm_b) extent_rtree_release(tsdn_t *tsdn, rtree_elm_t *elm_a, rtree_elm_t *elm_b)
{ {
rtree_elm_release(tsdn, &extents_rtree, elm_a); rtree_elm_release(tsdn, &extents_rtree, elm_a);
if (elm_b != NULL) if (elm_b != NULL)
rtree_elm_release(tsdn, &extents_rtree, elm_b); rtree_elm_release(tsdn, &extents_rtree, elm_b);
@ -285,7 +278,6 @@ extent_interior_register(tsdn_t *tsdn, rtree_ctx_t *rtree_ctx,
static void static void
extent_gprof_add(tsdn_t *tsdn, const extent_t *extent) extent_gprof_add(tsdn_t *tsdn, const extent_t *extent)
{ {
cassert(config_prof); cassert(config_prof);
if (opt_prof && extent_active_get(extent)) { if (opt_prof && extent_active_get(extent)) {
@ -307,7 +299,6 @@ extent_gprof_add(tsdn_t *tsdn, const extent_t *extent)
static void static void
extent_gprof_sub(tsdn_t *tsdn, const extent_t *extent) extent_gprof_sub(tsdn_t *tsdn, const extent_t *extent)
{ {
cassert(config_prof); cassert(config_prof);
if (opt_prof && extent_active_get(extent)) { if (opt_prof && extent_active_get(extent)) {
@ -406,7 +397,6 @@ static void
extent_leak(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks, extent_leak(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks,
bool cache, extent_t *extent) bool cache, extent_t *extent)
{ {
/* /*
* Leak extent after making sure its pages have already been purged, so * Leak extent after making sure its pages have already been purged, so
* that this is only a virtual memory leak. * that this is only a virtual memory leak.
@ -641,7 +631,6 @@ extent_alloc_cache_locked(tsdn_t *tsdn, arena_t *arena,
extent_hooks_t **r_extent_hooks, void *new_addr, size_t usize, size_t pad, extent_hooks_t **r_extent_hooks, void *new_addr, size_t usize, size_t pad,
size_t alignment, bool *zero, bool *commit, bool slab) size_t alignment, bool *zero, bool *commit, bool slab)
{ {
malloc_mutex_assert_owner(tsdn, &arena->extents_mtx); malloc_mutex_assert_owner(tsdn, &arena->extents_mtx);
return (extent_alloc_cache_impl(tsdn, arena, r_extent_hooks, true, return (extent_alloc_cache_impl(tsdn, arena, r_extent_hooks, true,
@ -653,7 +642,6 @@ extent_alloc_cache(tsdn_t *tsdn, arena_t *arena,
extent_hooks_t **r_extent_hooks, void *new_addr, size_t usize, size_t pad, extent_hooks_t **r_extent_hooks, void *new_addr, size_t usize, size_t pad,
size_t alignment, bool *zero, bool *commit, bool slab) size_t alignment, bool *zero, bool *commit, bool slab)
{ {
return (extent_alloc_cache_impl(tsdn, arena, r_extent_hooks, false, return (extent_alloc_cache_impl(tsdn, arena, r_extent_hooks, false,
new_addr, usize, pad, alignment, zero, commit, slab)); new_addr, usize, pad, alignment, zero, commit, slab));
} }
@ -694,7 +682,6 @@ static void
extent_retain(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks, extent_retain(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks,
extent_t *extent) extent_t *extent)
{ {
if (config_stats) if (config_stats)
arena->stats.retained += extent_size_get(extent); arena->stats.retained += extent_size_get(extent);
extent_record(tsdn, arena, r_extent_hooks, arena->extents_retained, extent_record(tsdn, arena, r_extent_hooks, arena->extents_retained,
@ -906,7 +893,6 @@ extent_alloc_wrapper(tsdn_t *tsdn, arena_t *arena,
static bool static bool
extent_can_coalesce(const extent_t *a, const extent_t *b) extent_can_coalesce(const extent_t *a, const extent_t *b)
{ {
if (extent_arena_get(a) != extent_arena_get(b)) if (extent_arena_get(a) != extent_arena_get(b))
return (false); return (false);
if (extent_active_get(a) != extent_active_get(b)) if (extent_active_get(a) != extent_active_get(b))
@ -924,7 +910,6 @@ extent_try_coalesce(tsdn_t *tsdn, arena_t *arena,
extent_hooks_t **r_extent_hooks, extent_t *a, extent_t *b, extent_hooks_t **r_extent_hooks, extent_t *a, extent_t *b,
extent_heap_t extent_heaps[NPSIZES+1], bool cache) extent_heap_t extent_heaps[NPSIZES+1], bool cache)
{ {
if (!extent_can_coalesce(a, b)) if (!extent_can_coalesce(a, b))
return; return;
@ -1008,7 +993,6 @@ void
extent_dalloc_cache(tsdn_t *tsdn, arena_t *arena, extent_dalloc_cache(tsdn_t *tsdn, arena_t *arena,
extent_hooks_t **r_extent_hooks, extent_t *extent) extent_hooks_t **r_extent_hooks, extent_t *extent)
{ {
assert(extent_base_get(extent) != NULL); assert(extent_base_get(extent) != NULL);
assert(extent_size_get(extent) != 0); assert(extent_size_get(extent) != 0);
@ -1022,7 +1006,6 @@ extent_dalloc_cache(tsdn_t *tsdn, arena_t *arena,
static bool static bool
extent_dalloc_default_impl(void *addr, size_t size) extent_dalloc_default_impl(void *addr, size_t size)
{ {
if (!have_dss || !extent_in_dss(addr)) if (!have_dss || !extent_in_dss(addr))
return (extent_dalloc_mmap(addr, size)); return (extent_dalloc_mmap(addr, size));
return (true); return (true);
@ -1033,7 +1016,6 @@ static bool
extent_dalloc_default(extent_hooks_t *extent_hooks, void *addr, size_t size, extent_dalloc_default(extent_hooks_t *extent_hooks, void *addr, size_t size,
bool committed, unsigned arena_ind) bool committed, unsigned arena_ind)
{ {
assert(extent_hooks == &extent_hooks_default); assert(extent_hooks == &extent_hooks_default);
return (extent_dalloc_default_impl(addr, size)); return (extent_dalloc_default_impl(addr, size));
@ -1116,7 +1098,6 @@ static bool
extent_commit_default(extent_hooks_t *extent_hooks, void *addr, size_t size, extent_commit_default(extent_hooks_t *extent_hooks, void *addr, size_t size,
size_t offset, size_t length, unsigned arena_ind) size_t offset, size_t length, unsigned arena_ind)
{ {
assert(extent_hooks == &extent_hooks_default); assert(extent_hooks == &extent_hooks_default);
return (pages_commit((void *)((uintptr_t)addr + (uintptr_t)offset), return (pages_commit((void *)((uintptr_t)addr + (uintptr_t)offset),
@ -1142,7 +1123,6 @@ static bool
extent_decommit_default(extent_hooks_t *extent_hooks, void *addr, size_t size, extent_decommit_default(extent_hooks_t *extent_hooks, void *addr, size_t size,
size_t offset, size_t length, unsigned arena_ind) size_t offset, size_t length, unsigned arena_ind)
{ {
assert(extent_hooks == &extent_hooks_default); assert(extent_hooks == &extent_hooks_default);
return (pages_decommit((void *)((uintptr_t)addr + (uintptr_t)offset), return (pages_decommit((void *)((uintptr_t)addr + (uintptr_t)offset),
@ -1171,7 +1151,6 @@ static bool
extent_purge_lazy_default(extent_hooks_t *extent_hooks, void *addr, size_t size, extent_purge_lazy_default(extent_hooks_t *extent_hooks, void *addr, size_t size,
size_t offset, size_t length, unsigned arena_ind) size_t offset, size_t length, unsigned arena_ind)
{ {
assert(extent_hooks == &extent_hooks_default); assert(extent_hooks == &extent_hooks_default);
assert(addr != NULL); assert(addr != NULL);
assert((offset & PAGE_MASK) == 0); assert((offset & PAGE_MASK) == 0);
@ -1188,7 +1167,6 @@ extent_purge_lazy_wrapper(tsdn_t *tsdn, arena_t *arena,
extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset, extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset,
size_t length) size_t length)
{ {
extent_hooks_assure_initialized(arena, r_extent_hooks); extent_hooks_assure_initialized(arena, r_extent_hooks);
return ((*r_extent_hooks)->purge_lazy == NULL || return ((*r_extent_hooks)->purge_lazy == NULL ||
(*r_extent_hooks)->purge_lazy(*r_extent_hooks, (*r_extent_hooks)->purge_lazy(*r_extent_hooks,
@ -1201,7 +1179,6 @@ static bool
extent_purge_forced_default(extent_hooks_t *extent_hooks, void *addr, extent_purge_forced_default(extent_hooks_t *extent_hooks, void *addr,
size_t size, size_t offset, size_t length, unsigned arena_ind) size_t size, size_t offset, size_t length, unsigned arena_ind)
{ {
assert(extent_hooks == &extent_hooks_default); assert(extent_hooks == &extent_hooks_default);
assert(addr != NULL); assert(addr != NULL);
assert((offset & PAGE_MASK) == 0); assert((offset & PAGE_MASK) == 0);
@ -1218,7 +1195,6 @@ extent_purge_forced_wrapper(tsdn_t *tsdn, arena_t *arena,
extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset, extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset,
size_t length) size_t length)
{ {
extent_hooks_assure_initialized(arena, r_extent_hooks); extent_hooks_assure_initialized(arena, r_extent_hooks);
return ((*r_extent_hooks)->purge_forced == NULL || return ((*r_extent_hooks)->purge_forced == NULL ||
(*r_extent_hooks)->purge_forced(*r_extent_hooks, (*r_extent_hooks)->purge_forced(*r_extent_hooks,
@ -1231,7 +1207,6 @@ static bool
extent_split_default(extent_hooks_t *extent_hooks, void *addr, size_t size, extent_split_default(extent_hooks_t *extent_hooks, void *addr, size_t size,
size_t size_a, size_t size_b, bool committed, unsigned arena_ind) size_t size_a, size_t size_b, bool committed, unsigned arena_ind)
{ {
assert(extent_hooks == &extent_hooks_default); assert(extent_hooks == &extent_hooks_default);
if (!maps_coalesce) if (!maps_coalesce)
@ -1310,7 +1285,6 @@ label_error_a:
static bool static bool
extent_merge_default_impl(void *addr_a, void *addr_b) extent_merge_default_impl(void *addr_a, void *addr_b)
{ {
if (!maps_coalesce) if (!maps_coalesce)
return (true); return (true);
if (have_dss && !extent_dss_mergeable(addr_a, addr_b)) if (have_dss && !extent_dss_mergeable(addr_a, addr_b))
@ -1324,7 +1298,6 @@ static bool
extent_merge_default(extent_hooks_t *extent_hooks, void *addr_a, size_t size_a, extent_merge_default(extent_hooks_t *extent_hooks, void *addr_a, size_t size_a,
void *addr_b, size_t size_b, bool committed, unsigned arena_ind) void *addr_b, size_t size_b, bool committed, unsigned arena_ind)
{ {
assert(extent_hooks == &extent_hooks_default); assert(extent_hooks == &extent_hooks_default);
return (extent_merge_default_impl(addr_a, addr_b)); return (extent_merge_default_impl(addr_a, addr_b));
@ -1396,7 +1369,6 @@ extent_merge_wrapper(tsdn_t *tsdn, arena_t *arena,
bool bool
extent_boot(void) extent_boot(void)
{ {
if (rtree_new(&extents_rtree, (unsigned)((ZU(1) << (LG_SIZEOF_PTR+3)) - if (rtree_new(&extents_rtree, (unsigned)((ZU(1) << (LG_SIZEOF_PTR+3)) -
LG_PAGE))) LG_PAGE)))
return (true); return (true);

View File

@ -32,7 +32,6 @@ static void *dss_max;
static void * static void *
extent_dss_sbrk(intptr_t increment) extent_dss_sbrk(intptr_t increment)
{ {
#ifdef JEMALLOC_DSS #ifdef JEMALLOC_DSS
return (sbrk(increment)); return (sbrk(increment));
#else #else
@ -55,7 +54,6 @@ extent_dss_prec_get(void)
bool bool
extent_dss_prec_set(dss_prec_t dss_prec) extent_dss_prec_set(dss_prec_t dss_prec)
{ {
if (!have_dss) if (!have_dss)
return (dss_prec != dss_prec_disabled); return (dss_prec != dss_prec_disabled);
atomic_write_u(&dss_prec_default, (unsigned)dss_prec); atomic_write_u(&dss_prec_default, (unsigned)dss_prec);
@ -208,7 +206,6 @@ label_oom:
static bool static bool
extent_in_dss_helper(void *addr, void *max) extent_in_dss_helper(void *addr, void *max)
{ {
return ((uintptr_t)addr >= (uintptr_t)dss_base && (uintptr_t)addr < return ((uintptr_t)addr >= (uintptr_t)dss_base && (uintptr_t)addr <
(uintptr_t)max); (uintptr_t)max);
} }
@ -216,7 +213,6 @@ extent_in_dss_helper(void *addr, void *max)
bool bool
extent_in_dss(void *addr) extent_in_dss(void *addr)
{ {
cassert(have_dss); cassert(have_dss);
return (extent_in_dss_helper(addr, atomic_read_p(&dss_max))); return (extent_in_dss_helper(addr, atomic_read_p(&dss_max)));
@ -241,7 +237,6 @@ extent_dss_mergeable(void *addr_a, void *addr_b)
void void
extent_dss_boot(void) extent_dss_boot(void)
{ {
cassert(have_dss); cassert(have_dss);
dss_base = extent_dss_sbrk(0); dss_base = extent_dss_sbrk(0);

View File

@ -69,7 +69,6 @@ extent_alloc_mmap(void *new_addr, size_t size, size_t alignment, bool *zero,
bool bool
extent_dalloc_mmap(void *addr, size_t size) extent_dalloc_mmap(void *addr, size_t size)
{ {
if (config_munmap) if (config_munmap)
pages_unmap(addr, size); pages_unmap(addr, size);
return (!config_munmap); return (!config_munmap);

View File

@ -211,7 +211,6 @@ JEMALLOC_ATTR(constructor)
static void WINAPI static void WINAPI
_init_init_lock(void) _init_init_lock(void)
{ {
/* /*
* If another constructor in the same binary is using mallctl to e.g. * If another constructor in the same binary is using mallctl to e.g.
* set up extent hooks, it may end up running before this one, and * set up extent hooks, it may end up running before this one, and
@ -276,14 +275,12 @@ static bool malloc_init_hard(void);
JEMALLOC_ALWAYS_INLINE_C bool JEMALLOC_ALWAYS_INLINE_C bool
malloc_initialized(void) malloc_initialized(void)
{ {
return (malloc_init_state == malloc_init_initialized); return (malloc_init_state == malloc_init_initialized);
} }
JEMALLOC_ALWAYS_INLINE_C bool JEMALLOC_ALWAYS_INLINE_C bool
malloc_init_a0(void) malloc_init_a0(void)
{ {
if (unlikely(malloc_init_state == malloc_init_uninitialized)) if (unlikely(malloc_init_state == malloc_init_uninitialized))
return (malloc_init_hard_a0()); return (malloc_init_hard_a0());
return (false); return (false);
@ -292,7 +289,6 @@ malloc_init_a0(void)
JEMALLOC_ALWAYS_INLINE_C bool JEMALLOC_ALWAYS_INLINE_C bool
malloc_init(void) malloc_init(void)
{ {
if (unlikely(!malloc_initialized()) && malloc_init_hard()) if (unlikely(!malloc_initialized()) && malloc_init_hard())
return (true); return (true);
return (false); return (false);
@ -306,7 +302,6 @@ malloc_init(void)
static void * static void *
a0ialloc(size_t size, bool zero, bool is_internal) a0ialloc(size_t size, bool zero, bool is_internal)
{ {
if (unlikely(malloc_init_a0())) if (unlikely(malloc_init_a0()))
return (NULL); return (NULL);
@ -317,21 +312,18 @@ a0ialloc(size_t size, bool zero, bool is_internal)
static void static void
a0idalloc(extent_t *extent, void *ptr, bool is_internal) a0idalloc(extent_t *extent, void *ptr, bool is_internal)
{ {
idalloctm(TSDN_NULL, extent, ptr, false, is_internal, true); idalloctm(TSDN_NULL, extent, ptr, false, is_internal, true);
} }
void * void *
a0malloc(size_t size) a0malloc(size_t size)
{ {
return (a0ialloc(size, false, true)); return (a0ialloc(size, false, true));
} }
void void
a0dalloc(void *ptr) a0dalloc(void *ptr)
{ {
a0idalloc(iealloc(NULL, ptr), ptr, true); a0idalloc(iealloc(NULL, ptr), ptr, true);
} }
@ -344,7 +336,6 @@ a0dalloc(void *ptr)
void * void *
bootstrap_malloc(size_t size) bootstrap_malloc(size_t size)
{ {
if (unlikely(size == 0)) if (unlikely(size == 0))
size = 1; size = 1;
@ -368,7 +359,6 @@ bootstrap_calloc(size_t num, size_t size)
void void
bootstrap_free(void *ptr) bootstrap_free(void *ptr)
{ {
if (unlikely(ptr == NULL)) if (unlikely(ptr == NULL))
return; return;
@ -378,28 +368,24 @@ bootstrap_free(void *ptr)
void void
arena_set(unsigned ind, arena_t *arena) arena_set(unsigned ind, arena_t *arena)
{ {
atomic_write_p((void **)&arenas[ind], arena); atomic_write_p((void **)&arenas[ind], arena);
} }
static void static void
narenas_total_set(unsigned narenas) narenas_total_set(unsigned narenas)
{ {
atomic_write_u(&narenas_total, narenas); atomic_write_u(&narenas_total, narenas);
} }
static void static void
narenas_total_inc(void) narenas_total_inc(void)
{ {
atomic_add_u(&narenas_total, 1); atomic_add_u(&narenas_total, 1);
} }
unsigned unsigned
narenas_total_get(void) narenas_total_get(void)
{ {
return (atomic_read_u(&narenas_total)); return (atomic_read_u(&narenas_total));
} }
@ -689,7 +675,6 @@ arenas_tdata_cleanup(tsd_t *tsd)
static void static void
stats_print_atexit(void) stats_print_atexit(void)
{ {
if (config_tcache && config_stats) { if (config_tcache && config_stats) {
tsdn_t *tsdn; tsdn_t *tsdn;
unsigned narenas, i; unsigned narenas, i;
@ -737,7 +722,6 @@ stats_print_atexit(void)
static char * static char *
secure_getenv(const char *name) secure_getenv(const char *name)
{ {
# ifdef JEMALLOC_HAVE_ISSETUGID # ifdef JEMALLOC_HAVE_ISSETUGID
if (issetugid() != 0) if (issetugid() != 0)
return (NULL); return (NULL);
@ -855,7 +839,6 @@ static void
malloc_conf_error(const char *msg, const char *k, size_t klen, const char *v, malloc_conf_error(const char *msg, const char *k, size_t klen, const char *v,
size_t vlen) size_t vlen)
{ {
malloc_printf("<jemalloc>: %s: %.*s:%.*s\n", msg, (int)klen, k, malloc_printf("<jemalloc>: %s: %.*s:%.*s\n", msg, (int)klen, k,
(int)vlen, v); (int)vlen, v);
} }
@ -1167,7 +1150,6 @@ malloc_conf_init(void)
static bool static bool
malloc_init_hard_needed(void) malloc_init_hard_needed(void)
{ {
if (malloc_initialized() || (IS_INITIALIZER && malloc_init_state == if (malloc_initialized() || (IS_INITIALIZER && malloc_init_state ==
malloc_init_recursible)) { malloc_init_recursible)) {
/* /*
@ -1197,7 +1179,6 @@ malloc_init_hard_needed(void)
static bool static bool
malloc_init_hard_a0_locked() malloc_init_hard_a0_locked()
{ {
malloc_initializer = INITIALIZER; malloc_initializer = INITIALIZER;
if (config_prof) if (config_prof)
@ -1261,7 +1242,6 @@ malloc_init_hard_a0(void)
static bool static bool
malloc_init_hard_recursible(void) malloc_init_hard_recursible(void)
{ {
malloc_init_state = malloc_init_recursible; malloc_init_state = malloc_init_recursible;
ncpus = malloc_ncpus(); ncpus = malloc_ncpus();
@ -1285,7 +1265,6 @@ malloc_init_hard_recursible(void)
static bool static bool
malloc_init_hard_finish(tsdn_t *tsdn) malloc_init_hard_finish(tsdn_t *tsdn)
{ {
if (malloc_mutex_boot()) if (malloc_mutex_boot())
return (true); return (true);
@ -1458,7 +1437,6 @@ JEMALLOC_ALWAYS_INLINE_C void
ialloc_post_check(void *ret, tsdn_t *tsdn, size_t usize, const char *func, ialloc_post_check(void *ret, tsdn_t *tsdn, size_t usize, const char *func,
bool update_errno, bool slow_path) bool update_errno, bool slow_path)
{ {
assert(!tsdn_null(tsdn) || ret == NULL); assert(!tsdn_null(tsdn) || ret == NULL);
if (unlikely(ret == NULL)) { if (unlikely(ret == NULL)) {
@ -1617,7 +1595,6 @@ JEMALLOC_EXPORT int JEMALLOC_NOTHROW
JEMALLOC_ATTR(nonnull(1)) JEMALLOC_ATTR(nonnull(1))
je_posix_memalign(void **memptr, size_t alignment, size_t size) je_posix_memalign(void **memptr, size_t alignment, size_t size)
{ {
return (imemalign(memptr, alignment, size, sizeof(void *))); return (imemalign(memptr, alignment, size, sizeof(void *)));
} }
@ -1754,7 +1731,6 @@ JEMALLOC_INLINE_C void
isfree(tsd_t *tsd, extent_t *extent, void *ptr, size_t usize, tcache_t *tcache, isfree(tsd_t *tsd, extent_t *extent, void *ptr, size_t usize, tcache_t *tcache,
bool slow_path) bool slow_path)
{ {
witness_assert_lockless(tsd_tsdn(tsd)); witness_assert_lockless(tsd_tsdn(tsd));
assert(ptr != NULL); assert(ptr != NULL);
@ -1850,7 +1826,6 @@ je_realloc(void *ptr, size_t size)
JEMALLOC_EXPORT void JEMALLOC_NOTHROW JEMALLOC_EXPORT void JEMALLOC_NOTHROW
je_free(void *ptr) je_free(void *ptr)
{ {
UTRACE(ptr, 0, 0); UTRACE(ptr, 0, 0);
if (likely(ptr != NULL)) { if (likely(ptr != NULL)) {
tsd_t *tsd = tsd_fetch(); tsd_t *tsd = tsd_fetch();
@ -1959,7 +1934,6 @@ JEMALLOC_ALWAYS_INLINE_C bool
imallocx_flags_decode(tsd_t *tsd, size_t size, int flags, size_t *usize, imallocx_flags_decode(tsd_t *tsd, size_t size, int flags, size_t *usize,
size_t *alignment, bool *zero, tcache_t **tcache, arena_t **arena) size_t *alignment, bool *zero, tcache_t **tcache, arena_t **arena)
{ {
if ((flags & MALLOCX_LG_ALIGN_MASK) == 0) { if ((flags & MALLOCX_LG_ALIGN_MASK) == 0) {
*alignment = 0; *alignment = 0;
*usize = s2u(size); *usize = s2u(size);
@ -2641,7 +2615,6 @@ JEMALLOC_ATTR(constructor)
static void static void
jemalloc_constructor(void) jemalloc_constructor(void)
{ {
malloc_init(); malloc_init();
} }
#endif #endif

View File

@ -70,55 +70,47 @@ newImpl(std::size_t size) noexcept(IsNoExcept)
void * void *
operator new(std::size_t size) operator new(std::size_t size)
{ {
return (newImpl<false>(size)); return (newImpl<false>(size));
} }
void * void *
operator new[](std::size_t size) operator new[](std::size_t size)
{ {
return (newImpl<false>(size)); return (newImpl<false>(size));
} }
void * void *
operator new(std::size_t size, const std::nothrow_t&) noexcept operator new(std::size_t size, const std::nothrow_t&) noexcept
{ {
return (newImpl<true>(size)); return (newImpl<true>(size));
} }
void * void *
operator new[](std::size_t size, const std::nothrow_t&) noexcept operator new[](std::size_t size, const std::nothrow_t&) noexcept
{ {
return (newImpl<true>(size)); return (newImpl<true>(size));
} }
void void
operator delete(void* ptr) noexcept operator delete(void* ptr) noexcept
{ {
je_free(ptr); je_free(ptr);
} }
void void
operator delete[](void* ptr) noexcept operator delete[](void* ptr) noexcept
{ {
je_free(ptr); je_free(ptr);
} }
void void
operator delete(void* ptr, const std::nothrow_t&) noexcept operator delete(void* ptr, const std::nothrow_t&) noexcept
{ {
je_free(ptr); je_free(ptr);
} }
void operator delete[](void* ptr, const std::nothrow_t&) noexcept void operator delete[](void* ptr, const std::nothrow_t&) noexcept
{ {
je_free(ptr); je_free(ptr);
} }
@ -127,13 +119,11 @@ void operator delete[](void* ptr, const std::nothrow_t&) noexcept
void void
operator delete(void* ptr, std::size_t size) noexcept operator delete(void* ptr, std::size_t size) noexcept
{ {
je_sdallocx(ptr, size, /*flags=*/0); je_sdallocx(ptr, size, /*flags=*/0);
} }
void operator delete[](void* ptr, std::size_t size) noexcept void operator delete[](void* ptr, std::size_t size) noexcept
{ {
je_sdallocx(ptr, size, /*flags=*/0); je_sdallocx(ptr, size, /*flags=*/0);
} }

View File

@ -6,7 +6,6 @@
void * void *
large_malloc(tsdn_t *tsdn, arena_t *arena, size_t usize, bool zero) large_malloc(tsdn_t *tsdn, arena_t *arena, size_t usize, bool zero)
{ {
assert(usize == s2u(usize)); assert(usize == s2u(usize));
return (large_palloc(tsdn, arena, usize, CACHELINE, zero)); return (large_palloc(tsdn, arena, usize, CACHELINE, zero));
@ -67,7 +66,6 @@ large_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize, size_t alignment,
void void
large_dalloc_junk(void *ptr, size_t usize) large_dalloc_junk(void *ptr, size_t usize)
{ {
memset(ptr, JEMALLOC_FREE_JUNK, usize); memset(ptr, JEMALLOC_FREE_JUNK, usize);
} }
#ifdef JEMALLOC_JET #ifdef JEMALLOC_JET
@ -83,7 +81,6 @@ large_dalloc_junk_t *large_dalloc_junk = JEMALLOC_N(n_large_dalloc_junk);
void void
large_dalloc_maybe_junk(void *ptr, size_t usize) large_dalloc_maybe_junk(void *ptr, size_t usize)
{ {
if (config_fill && have_dss && unlikely(opt_junk_free)) { if (config_fill && have_dss && unlikely(opt_junk_free)) {
/* /*
* Only bother junk filling if the extent isn't about to be * Only bother junk filling if the extent isn't about to be
@ -198,7 +195,6 @@ bool
large_ralloc_no_move(tsdn_t *tsdn, extent_t *extent, size_t usize_min, large_ralloc_no_move(tsdn_t *tsdn, extent_t *extent, size_t usize_min,
size_t usize_max, bool zero) size_t usize_max, bool zero)
{ {
assert(s2u(extent_usize_get(extent)) == extent_usize_get(extent)); assert(s2u(extent_usize_get(extent)) == extent_usize_get(extent));
/* The following should have been caught by callers. */ /* The following should have been caught by callers. */
assert(usize_min > 0 && usize_max <= LARGE_MAXCLASS); assert(usize_min > 0 && usize_max <= LARGE_MAXCLASS);
@ -247,7 +243,6 @@ static void *
large_ralloc_move_helper(tsdn_t *tsdn, arena_t *arena, size_t usize, large_ralloc_move_helper(tsdn_t *tsdn, arena_t *arena, size_t usize,
size_t alignment, bool zero) size_t alignment, bool zero)
{ {
if (alignment <= CACHELINE) if (alignment <= CACHELINE)
return (large_malloc(tsdn, arena, usize, zero)); return (large_malloc(tsdn, arena, usize, zero));
return (large_palloc(tsdn, arena, usize, alignment, zero)); return (large_palloc(tsdn, arena, usize, alignment, zero));
@ -314,41 +309,35 @@ large_dalloc_impl(tsdn_t *tsdn, extent_t *extent, bool junked_locked)
void void
large_dalloc_junked_locked(tsdn_t *tsdn, extent_t *extent) large_dalloc_junked_locked(tsdn_t *tsdn, extent_t *extent)
{ {
large_dalloc_impl(tsdn, extent, true); large_dalloc_impl(tsdn, extent, true);
} }
void void
large_dalloc(tsdn_t *tsdn, extent_t *extent) large_dalloc(tsdn_t *tsdn, extent_t *extent)
{ {
large_dalloc_impl(tsdn, extent, false); large_dalloc_impl(tsdn, extent, false);
} }
size_t size_t
large_salloc(tsdn_t *tsdn, const extent_t *extent) large_salloc(tsdn_t *tsdn, const extent_t *extent)
{ {
return (extent_usize_get(extent)); return (extent_usize_get(extent));
} }
prof_tctx_t * prof_tctx_t *
large_prof_tctx_get(tsdn_t *tsdn, const extent_t *extent) large_prof_tctx_get(tsdn_t *tsdn, const extent_t *extent)
{ {
return (extent_prof_tctx_get(extent)); return (extent_prof_tctx_get(extent));
} }
void void
large_prof_tctx_set(tsdn_t *tsdn, extent_t *extent, prof_tctx_t *tctx) large_prof_tctx_set(tsdn_t *tsdn, extent_t *extent, prof_tctx_t *tctx)
{ {
extent_prof_tctx_set(extent, tctx); extent_prof_tctx_set(extent, tctx);
} }
void void
large_prof_tctx_reset(tsdn_t *tsdn, extent_t *extent) large_prof_tctx_reset(tsdn_t *tsdn, extent_t *extent)
{ {
large_prof_tctx_set(tsdn, extent, (prof_tctx_t *)(uintptr_t)1U); large_prof_tctx_set(tsdn, extent, (prof_tctx_t *)(uintptr_t)1U);
} }

View File

@ -37,7 +37,6 @@ static int (*pthread_create_fptr)(pthread_t *__restrict, const pthread_attr_t *,
static void static void
pthread_create_once(void) pthread_create_once(void)
{ {
pthread_create_fptr = dlsym(RTLD_NEXT, "pthread_create"); pthread_create_fptr = dlsym(RTLD_NEXT, "pthread_create");
if (pthread_create_fptr == NULL) { if (pthread_create_fptr == NULL) {
malloc_write("<jemalloc>: Error in dlsym(RTLD_NEXT, " malloc_write("<jemalloc>: Error in dlsym(RTLD_NEXT, "
@ -71,7 +70,6 @@ JEMALLOC_EXPORT int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex,
bool bool
malloc_mutex_init(malloc_mutex_t *mutex, const char *name, witness_rank_t rank) malloc_mutex_init(malloc_mutex_t *mutex, const char *name, witness_rank_t rank)
{ {
#ifdef _WIN32 #ifdef _WIN32
# if _WIN32_WINNT >= 0x0600 # if _WIN32_WINNT >= 0x0600
InitializeSRWLock(&mutex->lock); InitializeSRWLock(&mutex->lock);
@ -113,21 +111,18 @@ malloc_mutex_init(malloc_mutex_t *mutex, const char *name, witness_rank_t rank)
void void
malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex) malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex)
{ {
malloc_mutex_lock(tsdn, mutex); malloc_mutex_lock(tsdn, mutex);
} }
void void
malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex) malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex)
{ {
malloc_mutex_unlock(tsdn, mutex); malloc_mutex_unlock(tsdn, mutex);
} }
void void
malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex) malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex)
{ {
#ifdef JEMALLOC_MUTEX_INIT_CB #ifdef JEMALLOC_MUTEX_INIT_CB
malloc_mutex_unlock(tsdn, mutex); malloc_mutex_unlock(tsdn, mutex);
#else #else
@ -144,7 +139,6 @@ malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex)
bool bool
malloc_mutex_boot(void) malloc_mutex_boot(void)
{ {
#ifdef JEMALLOC_MUTEX_INIT_CB #ifdef JEMALLOC_MUTEX_INIT_CB
postpone_init = false; postpone_init = false;
while (postponed_mutexes != NULL) { while (postponed_mutexes != NULL) {

View File

@ -5,56 +5,48 @@
void void
nstime_init(nstime_t *time, uint64_t ns) nstime_init(nstime_t *time, uint64_t ns)
{ {
time->ns = ns; time->ns = ns;
} }
void void
nstime_init2(nstime_t *time, uint64_t sec, uint64_t nsec) nstime_init2(nstime_t *time, uint64_t sec, uint64_t nsec)
{ {
time->ns = sec * BILLION + nsec; time->ns = sec * BILLION + nsec;
} }
uint64_t uint64_t
nstime_ns(const nstime_t *time) nstime_ns(const nstime_t *time)
{ {
return (time->ns); return (time->ns);
} }
uint64_t uint64_t
nstime_sec(const nstime_t *time) nstime_sec(const nstime_t *time)
{ {
return (time->ns / BILLION); return (time->ns / BILLION);
} }
uint64_t uint64_t
nstime_nsec(const nstime_t *time) nstime_nsec(const nstime_t *time)
{ {
return (time->ns % BILLION); return (time->ns % BILLION);
} }
void void
nstime_copy(nstime_t *time, const nstime_t *source) nstime_copy(nstime_t *time, const nstime_t *source)
{ {
*time = *source; *time = *source;
} }
int int
nstime_compare(const nstime_t *a, const nstime_t *b) nstime_compare(const nstime_t *a, const nstime_t *b)
{ {
return ((a->ns > b->ns) - (a->ns < b->ns)); return ((a->ns > b->ns) - (a->ns < b->ns));
} }
void void
nstime_add(nstime_t *time, const nstime_t *addend) nstime_add(nstime_t *time, const nstime_t *addend)
{ {
assert(UINT64_MAX - time->ns >= addend->ns); assert(UINT64_MAX - time->ns >= addend->ns);
time->ns += addend->ns; time->ns += addend->ns;
@ -63,7 +55,6 @@ nstime_add(nstime_t *time, const nstime_t *addend)
void void
nstime_subtract(nstime_t *time, const nstime_t *subtrahend) nstime_subtract(nstime_t *time, const nstime_t *subtrahend)
{ {
assert(nstime_compare(time, subtrahend) >= 0); assert(nstime_compare(time, subtrahend) >= 0);
time->ns -= subtrahend->ns; time->ns -= subtrahend->ns;
@ -72,7 +63,6 @@ nstime_subtract(nstime_t *time, const nstime_t *subtrahend)
void void
nstime_imultiply(nstime_t *time, uint64_t multiplier) nstime_imultiply(nstime_t *time, uint64_t multiplier)
{ {
assert((((time->ns | multiplier) & (UINT64_MAX << (sizeof(uint64_t) << assert((((time->ns | multiplier) & (UINT64_MAX << (sizeof(uint64_t) <<
2))) == 0) || ((time->ns * multiplier) / multiplier == time->ns)); 2))) == 0) || ((time->ns * multiplier) / multiplier == time->ns));
@ -82,7 +72,6 @@ nstime_imultiply(nstime_t *time, uint64_t multiplier)
void void
nstime_idivide(nstime_t *time, uint64_t divisor) nstime_idivide(nstime_t *time, uint64_t divisor)
{ {
assert(divisor != 0); assert(divisor != 0);
time->ns /= divisor; time->ns /= divisor;
@ -91,7 +80,6 @@ nstime_idivide(nstime_t *time, uint64_t divisor)
uint64_t uint64_t
nstime_divide(const nstime_t *time, const nstime_t *divisor) nstime_divide(const nstime_t *time, const nstime_t *divisor)
{ {
assert(divisor->ns != 0); assert(divisor->ns != 0);
return (time->ns / divisor->ns); return (time->ns / divisor->ns);
@ -135,7 +123,6 @@ nstime_get(nstime_t *time)
static void static void
nstime_get(nstime_t *time) nstime_get(nstime_t *time)
{ {
nstime_init(time, mach_absolute_time()); nstime_init(time, mach_absolute_time());
} }
#else #else
@ -157,7 +144,6 @@ nstime_get(nstime_t *time)
bool bool
nstime_monotonic(void) nstime_monotonic(void)
{ {
return (NSTIME_MONOTONIC); return (NSTIME_MONOTONIC);
#undef NSTIME_MONOTONIC #undef NSTIME_MONOTONIC
} }

View File

@ -64,7 +64,6 @@ pages_map(void *addr, size_t size, bool *commit)
void void
pages_unmap(void *addr, size_t size) pages_unmap(void *addr, size_t size)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (VirtualFree(addr, 0, MEM_RELEASE) == 0) if (VirtualFree(addr, 0, MEM_RELEASE) == 0)
#else #else
@ -121,7 +120,6 @@ pages_trim(void *addr, size_t alloc_size, size_t leadsize, size_t size,
static bool static bool
pages_commit_impl(void *addr, size_t size, bool commit) pages_commit_impl(void *addr, size_t size, bool commit)
{ {
if (os_overcommits) if (os_overcommits)
return (true); return (true);
@ -151,21 +149,18 @@ pages_commit_impl(void *addr, size_t size, bool commit)
bool bool
pages_commit(void *addr, size_t size) pages_commit(void *addr, size_t size)
{ {
return (pages_commit_impl(addr, size, true)); return (pages_commit_impl(addr, size, true));
} }
bool bool
pages_decommit(void *addr, size_t size) pages_decommit(void *addr, size_t size)
{ {
return (pages_commit_impl(addr, size, false)); return (pages_commit_impl(addr, size, false));
} }
bool bool
pages_purge_lazy(void *addr, size_t size) pages_purge_lazy(void *addr, size_t size)
{ {
if (!pages_can_purge_lazy) if (!pages_can_purge_lazy)
return (true); return (true);
@ -182,7 +177,6 @@ pages_purge_lazy(void *addr, size_t size)
bool bool
pages_purge_forced(void *addr, size_t size) pages_purge_forced(void *addr, size_t size)
{ {
if (!pages_can_purge_forced) if (!pages_can_purge_forced)
return (true); return (true);
@ -196,7 +190,6 @@ pages_purge_forced(void *addr, size_t size)
bool bool
pages_huge(void *addr, size_t size) pages_huge(void *addr, size_t size)
{ {
assert(HUGEPAGE_ADDR2BASE(addr) == addr); assert(HUGEPAGE_ADDR2BASE(addr) == addr);
assert(HUGEPAGE_CEILING(size) == size); assert(HUGEPAGE_CEILING(size) == size);
@ -210,7 +203,6 @@ pages_huge(void *addr, size_t size)
bool bool
pages_nohuge(void *addr, size_t size) pages_nohuge(void *addr, size_t size)
{ {
assert(HUGEPAGE_ADDR2BASE(addr) == addr); assert(HUGEPAGE_ADDR2BASE(addr) == addr);
assert(HUGEPAGE_CEILING(size) == size); assert(HUGEPAGE_CEILING(size) == size);
@ -284,7 +276,6 @@ os_overcommits_proc(void)
void void
pages_boot(void) pages_boot(void)
{ {
#ifndef _WIN32 #ifndef _WIN32
mmap_flags = MAP_PRIVATE | MAP_ANON; mmap_flags = MAP_PRIVATE | MAP_ANON;
#endif #endif

View File

@ -226,7 +226,6 @@ void
prof_malloc_sample_object(tsdn_t *tsdn, extent_t *extent, const void *ptr, prof_malloc_sample_object(tsdn_t *tsdn, extent_t *extent, const void *ptr,
size_t usize, prof_tctx_t *tctx) size_t usize, prof_tctx_t *tctx)
{ {
prof_tctx_set(tsdn, extent, ptr, usize, tctx); prof_tctx_set(tsdn, extent, ptr, usize, tctx);
malloc_mutex_lock(tsdn, tctx->tdata->lock); malloc_mutex_lock(tsdn, tctx->tdata->lock);
@ -243,7 +242,6 @@ prof_malloc_sample_object(tsdn_t *tsdn, extent_t *extent, const void *ptr,
void void
prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_tctx_t *tctx) prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_tctx_t *tctx)
{ {
malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock); malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock);
assert(tctx->cnts.curobjs > 0); assert(tctx->cnts.curobjs > 0);
assert(tctx->cnts.curbytes >= usize); assert(tctx->cnts.curbytes >= usize);
@ -259,7 +257,6 @@ prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_tctx_t *tctx)
void void
bt_init(prof_bt_t *bt, void **vec) bt_init(prof_bt_t *bt, void **vec)
{ {
cassert(config_prof); cassert(config_prof);
bt->vec = vec; bt->vec = vec;
@ -269,7 +266,6 @@ bt_init(prof_bt_t *bt, void **vec)
JEMALLOC_INLINE_C void JEMALLOC_INLINE_C void
prof_enter(tsd_t *tsd, prof_tdata_t *tdata) prof_enter(tsd_t *tsd, prof_tdata_t *tdata)
{ {
cassert(config_prof); cassert(config_prof);
assert(tdata == prof_tdata_get(tsd, false)); assert(tdata == prof_tdata_get(tsd, false));
@ -284,7 +280,6 @@ prof_enter(tsd_t *tsd, prof_tdata_t *tdata)
JEMALLOC_INLINE_C void JEMALLOC_INLINE_C void
prof_leave(tsd_t *tsd, prof_tdata_t *tdata) prof_leave(tsd_t *tsd, prof_tdata_t *tdata)
{ {
cassert(config_prof); cassert(config_prof);
assert(tdata == prof_tdata_get(tsd, false)); assert(tdata == prof_tdata_get(tsd, false));
@ -326,7 +321,6 @@ prof_backtrace(prof_bt_t *bt)
static _Unwind_Reason_Code static _Unwind_Reason_Code
prof_unwind_init_callback(struct _Unwind_Context *context, void *arg) prof_unwind_init_callback(struct _Unwind_Context *context, void *arg)
{ {
cassert(config_prof); cassert(config_prof);
return (_URC_NO_REASON); return (_URC_NO_REASON);
@ -525,7 +519,6 @@ prof_backtrace(prof_bt_t *bt)
void void
prof_backtrace(prof_bt_t *bt) prof_backtrace(prof_bt_t *bt)
{ {
cassert(config_prof); cassert(config_prof);
not_reached(); not_reached();
} }
@ -542,7 +535,6 @@ prof_gctx_mutex_choose(void)
static malloc_mutex_t * static malloc_mutex_t *
prof_tdata_mutex_choose(uint64_t thr_uid) prof_tdata_mutex_choose(uint64_t thr_uid)
{ {
return (&tdata_locks[thr_uid % PROF_NTDATA_LOCKS]); return (&tdata_locks[thr_uid % PROF_NTDATA_LOCKS]);
} }
@ -576,7 +568,6 @@ static void
prof_gctx_try_destroy(tsd_t *tsd, prof_tdata_t *tdata_self, prof_gctx_t *gctx, prof_gctx_try_destroy(tsd_t *tsd, prof_tdata_t *tdata_self, prof_gctx_t *gctx,
prof_tdata_t *tdata) prof_tdata_t *tdata)
{ {
cassert(config_prof); cassert(config_prof);
/* /*
@ -612,7 +603,6 @@ prof_gctx_try_destroy(tsd_t *tsd, prof_tdata_t *tdata_self, prof_gctx_t *gctx,
static bool static bool
prof_tctx_should_destroy(tsdn_t *tsdn, prof_tctx_t *tctx) prof_tctx_should_destroy(tsdn_t *tsdn, prof_tctx_t *tctx)
{ {
malloc_mutex_assert_owner(tsdn, tctx->tdata->lock); malloc_mutex_assert_owner(tsdn, tctx->tdata->lock);
if (opt_prof_accum) if (opt_prof_accum)
@ -627,7 +617,6 @@ prof_tctx_should_destroy(tsdn_t *tsdn, prof_tctx_t *tctx)
static bool static bool
prof_gctx_should_destroy(prof_gctx_t *gctx) prof_gctx_should_destroy(prof_gctx_t *gctx)
{ {
if (opt_prof_accum) if (opt_prof_accum)
return (false); return (false);
if (!tctx_tree_empty(&gctx->tctxs)) if (!tctx_tree_empty(&gctx->tctxs))
@ -1044,7 +1033,6 @@ prof_dump_printf(bool propagate_err, const char *format, ...)
static void static void
prof_tctx_merge_tdata(tsdn_t *tsdn, prof_tctx_t *tctx, prof_tdata_t *tdata) prof_tctx_merge_tdata(tsdn_t *tsdn, prof_tctx_t *tctx, prof_tdata_t *tdata)
{ {
malloc_mutex_assert_owner(tsdn, tctx->tdata->lock); malloc_mutex_assert_owner(tsdn, tctx->tdata->lock);
malloc_mutex_lock(tsdn, tctx->gctx->lock); malloc_mutex_lock(tsdn, tctx->gctx->lock);
@ -1077,7 +1065,6 @@ prof_tctx_merge_tdata(tsdn_t *tsdn, prof_tctx_t *tctx, prof_tdata_t *tdata)
static void static void
prof_tctx_merge_gctx(tsdn_t *tsdn, prof_tctx_t *tctx, prof_gctx_t *gctx) prof_tctx_merge_gctx(tsdn_t *tsdn, prof_tctx_t *tctx, prof_gctx_t *gctx)
{ {
malloc_mutex_assert_owner(tsdn, gctx->lock); malloc_mutex_assert_owner(tsdn, gctx->lock);
gctx->cnt_summed.curobjs += tctx->dump_cnts.curobjs; gctx->cnt_summed.curobjs += tctx->dump_cnts.curobjs;
@ -1173,7 +1160,6 @@ label_return:
static void static void
prof_dump_gctx_prep(tsdn_t *tsdn, prof_gctx_t *gctx, prof_gctx_tree_t *gctxs) prof_dump_gctx_prep(tsdn_t *tsdn, prof_gctx_t *gctx, prof_gctx_tree_t *gctxs)
{ {
cassert(config_prof); cassert(config_prof);
malloc_mutex_lock(tsdn, gctx->lock); malloc_mutex_lock(tsdn, gctx->lock);
@ -1421,7 +1407,6 @@ prof_open_maps(const char *format, ...)
static int static int
prof_getpid(void) prof_getpid(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
return (GetCurrentProcessId()); return (GetCurrentProcessId());
#else #else
@ -1491,7 +1476,6 @@ static void
prof_leakcheck(const prof_cnt_t *cnt_all, size_t leak_ngctx, prof_leakcheck(const prof_cnt_t *cnt_all, size_t leak_ngctx,
const char *filename) const char *filename)
{ {
#ifdef JEMALLOC_PROF #ifdef JEMALLOC_PROF
/* /*
* Scaling is equivalent AdjustSamples() in jeprof, but the result may * Scaling is equivalent AdjustSamples() in jeprof, but the result may
@ -1640,7 +1624,6 @@ label_open_close_error:
static void static void
prof_dump_filename(char *filename, char v, uint64_t vseq) prof_dump_filename(char *filename, char v, uint64_t vseq)
{ {
cassert(config_prof); cassert(config_prof);
if (vseq != VSEQ_INVALID) { if (vseq != VSEQ_INVALID) {
@ -1844,7 +1827,6 @@ prof_tdata_init_impl(tsd_t *tsd, uint64_t thr_uid, uint64_t thr_discrim,
prof_tdata_t * prof_tdata_t *
prof_tdata_init(tsd_t *tsd) prof_tdata_init(tsd_t *tsd)
{ {
return (prof_tdata_init_impl(tsd, prof_thr_uid_alloc(tsd_tsdn(tsd)), 0, return (prof_tdata_init_impl(tsd, prof_thr_uid_alloc(tsd_tsdn(tsd)), 0,
NULL, prof_thread_active_init_get(tsd_tsdn(tsd)))); NULL, prof_thread_active_init_get(tsd_tsdn(tsd))));
} }
@ -1852,7 +1834,6 @@ prof_tdata_init(tsd_t *tsd)
static bool static bool
prof_tdata_should_destroy_unlocked(prof_tdata_t *tdata, bool even_if_attached) prof_tdata_should_destroy_unlocked(prof_tdata_t *tdata, bool even_if_attached)
{ {
if (tdata->attached && !even_if_attached) if (tdata->attached && !even_if_attached)
return (false); return (false);
if (ckh_count(&tdata->bt2tctx) != 0) if (ckh_count(&tdata->bt2tctx) != 0)
@ -1864,7 +1845,6 @@ static bool
prof_tdata_should_destroy(tsdn_t *tsdn, prof_tdata_t *tdata, prof_tdata_should_destroy(tsdn_t *tsdn, prof_tdata_t *tdata,
bool even_if_attached) bool even_if_attached)
{ {
malloc_mutex_assert_owner(tsdn, tdata->lock); malloc_mutex_assert_owner(tsdn, tdata->lock);
return (prof_tdata_should_destroy_unlocked(tdata, even_if_attached)); return (prof_tdata_should_destroy_unlocked(tdata, even_if_attached));
@ -1874,7 +1854,6 @@ static void
prof_tdata_destroy_locked(tsd_t *tsd, prof_tdata_t *tdata, prof_tdata_destroy_locked(tsd_t *tsd, prof_tdata_t *tdata,
bool even_if_attached) bool even_if_attached)
{ {
malloc_mutex_assert_owner(tsd_tsdn(tsd), &tdatas_mtx); malloc_mutex_assert_owner(tsd_tsdn(tsd), &tdatas_mtx);
tdata_tree_remove(&tdatas, tdata); tdata_tree_remove(&tdatas, tdata);
@ -1893,7 +1872,6 @@ prof_tdata_destroy_locked(tsd_t *tsd, prof_tdata_t *tdata,
static void static void
prof_tdata_destroy(tsd_t *tsd, prof_tdata_t *tdata, bool even_if_attached) prof_tdata_destroy(tsd_t *tsd, prof_tdata_t *tdata, bool even_if_attached)
{ {
malloc_mutex_lock(tsd_tsdn(tsd), &tdatas_mtx); malloc_mutex_lock(tsd_tsdn(tsd), &tdatas_mtx);
prof_tdata_destroy_locked(tsd, tdata, even_if_attached); prof_tdata_destroy_locked(tsd, tdata, even_if_attached);
malloc_mutex_unlock(tsd_tsdn(tsd), &tdatas_mtx); malloc_mutex_unlock(tsd_tsdn(tsd), &tdatas_mtx);
@ -2162,7 +2140,6 @@ prof_gdump_set(tsdn_t *tsdn, bool gdump)
void void
prof_boot0(void) prof_boot0(void)
{ {
cassert(config_prof); cassert(config_prof);
memcpy(opt_prof_prefix, PROF_PREFIX_DEFAULT, memcpy(opt_prof_prefix, PROF_PREFIX_DEFAULT,
@ -2172,7 +2149,6 @@ prof_boot0(void)
void void
prof_boot1(void) prof_boot1(void)
{ {
cassert(config_prof); cassert(config_prof);
/* /*
@ -2198,7 +2174,6 @@ prof_boot1(void)
bool bool
prof_boot2(tsd_t *tsd) prof_boot2(tsd_t *tsd)
{ {
cassert(config_prof); cassert(config_prof);
if (opt_prof) { if (opt_prof) {
@ -2292,7 +2267,6 @@ prof_boot2(tsd_t *tsd)
void void
prof_prefork0(tsdn_t *tsdn) prof_prefork0(tsdn_t *tsdn)
{ {
if (opt_prof) { if (opt_prof) {
unsigned i; unsigned i;
@ -2309,7 +2283,6 @@ prof_prefork0(tsdn_t *tsdn)
void void
prof_prefork1(tsdn_t *tsdn) prof_prefork1(tsdn_t *tsdn)
{ {
if (opt_prof) { if (opt_prof) {
malloc_mutex_prefork(tsdn, &prof_active_mtx); malloc_mutex_prefork(tsdn, &prof_active_mtx);
malloc_mutex_prefork(tsdn, &prof_dump_seq_mtx); malloc_mutex_prefork(tsdn, &prof_dump_seq_mtx);
@ -2322,7 +2295,6 @@ prof_prefork1(tsdn_t *tsdn)
void void
prof_postfork_parent(tsdn_t *tsdn) prof_postfork_parent(tsdn_t *tsdn)
{ {
if (opt_prof) { if (opt_prof) {
unsigned i; unsigned i;
@ -2345,7 +2317,6 @@ prof_postfork_parent(tsdn_t *tsdn)
void void
prof_postfork_child(tsdn_t *tsdn) prof_postfork_child(tsdn_t *tsdn)
{ {
if (opt_prof) { if (opt_prof) {
unsigned i; unsigned i;

View File

@ -4,7 +4,6 @@
static unsigned static unsigned
hmin(unsigned ha, unsigned hb) hmin(unsigned ha, unsigned hb)
{ {
return (ha < hb ? ha : hb); return (ha < hb ? ha : hb);
} }
@ -71,7 +70,6 @@ rtree_new(rtree_t *rtree, unsigned bits)
static rtree_elm_t * static rtree_elm_t *
rtree_node_alloc(tsdn_t *tsdn, rtree_t *rtree, size_t nelms) rtree_node_alloc(tsdn_t *tsdn, rtree_t *rtree, size_t nelms)
{ {
return ((rtree_elm_t *)base_alloc(tsdn, b0get(), nelms * return ((rtree_elm_t *)base_alloc(tsdn, b0get(), nelms *
sizeof(rtree_elm_t), CACHELINE)); sizeof(rtree_elm_t), CACHELINE));
} }
@ -88,7 +86,6 @@ rtree_node_alloc_t *rtree_node_alloc = JEMALLOC_N(rtree_node_alloc_impl);
UNUSED static void UNUSED static void
rtree_node_dalloc(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *node) rtree_node_dalloc(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *node)
{ {
/* Nodes are never deleted during normal operation. */ /* Nodes are never deleted during normal operation. */
not_reached(); not_reached();
} }
@ -103,7 +100,6 @@ static void
rtree_delete_subtree(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *node, rtree_delete_subtree(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *node,
unsigned level) unsigned level)
{ {
if (level + 1 < rtree->height) { if (level + 1 < rtree->height) {
size_t nchildren, i; size_t nchildren, i;
@ -157,7 +153,6 @@ rtree_node_init(tsdn_t *tsdn, rtree_t *rtree, unsigned level,
rtree_elm_t * rtree_elm_t *
rtree_subtree_read_hard(tsdn_t *tsdn, rtree_t *rtree, unsigned level) rtree_subtree_read_hard(tsdn_t *tsdn, rtree_t *rtree, unsigned level)
{ {
return (rtree_node_init(tsdn, rtree, level, return (rtree_node_init(tsdn, rtree, level,
&rtree->levels[level].subtree)); &rtree->levels[level].subtree));
} }
@ -166,7 +161,6 @@ rtree_elm_t *
rtree_child_read_hard(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *elm, rtree_child_read_hard(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *elm,
unsigned level) unsigned level)
{ {
return (rtree_node_init(tsdn, rtree, level+1, &elm->child)); return (rtree_node_init(tsdn, rtree, level+1, &elm->child));
} }

View File

@ -26,7 +26,6 @@ static tcaches_t *tcaches_avail;
size_t size_t
tcache_salloc(tsdn_t *tsdn, const void *ptr) tcache_salloc(tsdn_t *tsdn, const void *ptr)
{ {
return (arena_salloc(tsdn, iealloc(tsdn, ptr), ptr)); return (arena_salloc(tsdn, iealloc(tsdn, ptr), ptr));
} }
@ -249,7 +248,6 @@ tcache_bin_flush_large(tsd_t *tsd, tcache_bin_t *tbin, szind_t binind,
static void static void
tcache_arena_associate(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena) tcache_arena_associate(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena)
{ {
if (config_stats) { if (config_stats) {
/* Link into list of extant tcaches. */ /* Link into list of extant tcaches. */
malloc_mutex_lock(tsdn, &arena->lock); malloc_mutex_lock(tsdn, &arena->lock);
@ -262,7 +260,6 @@ tcache_arena_associate(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena)
static void static void
tcache_arena_dissociate(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena) tcache_arena_dissociate(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena)
{ {
if (config_stats) { if (config_stats) {
/* Unlink from list of extant tcaches. */ /* Unlink from list of extant tcaches. */
malloc_mutex_lock(tsdn, &arena->lock); malloc_mutex_lock(tsdn, &arena->lock);
@ -287,7 +284,6 @@ void
tcache_arena_reassociate(tsdn_t *tsdn, tcache_t *tcache, arena_t *oldarena, tcache_arena_reassociate(tsdn_t *tsdn, tcache_t *tcache, arena_t *oldarena,
arena_t *newarena) arena_t *newarena)
{ {
tcache_arena_dissociate(tsdn, tcache, oldarena); tcache_arena_dissociate(tsdn, tcache, oldarena);
tcache_arena_associate(tsdn, tcache, newarena); tcache_arena_associate(tsdn, tcache, newarena);
} }
@ -473,7 +469,6 @@ tcaches_create(tsd_t *tsd, unsigned *r_ind)
static void static void
tcaches_elm_flush(tsd_t *tsd, tcaches_t *elm) tcaches_elm_flush(tsd_t *tsd, tcaches_t *elm)
{ {
if (elm->tcache == NULL) if (elm->tcache == NULL)
return; return;
tcache_destroy(tsd, elm->tcache); tcache_destroy(tsd, elm->tcache);
@ -483,7 +478,6 @@ tcaches_elm_flush(tsd_t *tsd, tcaches_t *elm)
void void
tcaches_flush(tsd_t *tsd, unsigned ind) tcaches_flush(tsd_t *tsd, unsigned ind)
{ {
tcaches_elm_flush(tsd, &tcaches[ind]); tcaches_elm_flush(tsd, &tcaches[ind]);
} }

View File

@ -14,21 +14,18 @@ malloc_tsd_data(, , tsd_t, TSD_INITIALIZER)
void * void *
malloc_tsd_malloc(size_t size) malloc_tsd_malloc(size_t size)
{ {
return (a0malloc(CACHELINE_CEILING(size))); return (a0malloc(CACHELINE_CEILING(size)));
} }
void void
malloc_tsd_dalloc(void *wrapper) malloc_tsd_dalloc(void *wrapper)
{ {
a0dalloc(wrapper); a0dalloc(wrapper);
} }
void void
malloc_tsd_no_cleanup(void *arg) malloc_tsd_no_cleanup(void *arg)
{ {
not_reached(); not_reached();
} }
@ -61,7 +58,6 @@ _malloc_thread_cleanup(void)
void void
malloc_tsd_cleanup_register(bool (*f)(void)) malloc_tsd_cleanup_register(bool (*f)(void))
{ {
assert(ncleanups < MALLOC_TSD_CLEANUPS_MAX); assert(ncleanups < MALLOC_TSD_CLEANUPS_MAX);
cleanups[ncleanups] = f; cleanups[ncleanups] = f;
ncleanups++; ncleanups++;
@ -127,7 +123,6 @@ malloc_tsd_boot0(void)
void void
malloc_tsd_boot1(void) malloc_tsd_boot1(void)
{ {
tsd_boot1(); tsd_boot1();
*tsd_arenas_tdata_bypassp_get(tsd_fetch()) = false; *tsd_arenas_tdata_bypassp_get(tsd_fetch()) = false;
} }
@ -136,7 +131,6 @@ malloc_tsd_boot1(void)
static BOOL WINAPI static BOOL WINAPI
_tls_callback(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) _tls_callback(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
switch (fdwReason) { switch (fdwReason) {
#ifdef JEMALLOC_LAZY_LOCK #ifdef JEMALLOC_LAZY_LOCK
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:
@ -194,7 +188,6 @@ tsd_init_check_recursion(tsd_init_head_t *head, tsd_init_block_t *block)
void void
tsd_init_finish(tsd_init_head_t *head, tsd_init_block_t *block) tsd_init_finish(tsd_init_head_t *head, tsd_init_block_t *block)
{ {
malloc_mutex_lock(TSDN_NULL, &head->lock); malloc_mutex_lock(TSDN_NULL, &head->lock);
ql_remove(&head->blocks, block, link); ql_remove(&head->blocks, block, link);
malloc_mutex_unlock(TSDN_NULL, &head->lock); malloc_mutex_unlock(TSDN_NULL, &head->lock);

View File

@ -48,7 +48,6 @@ static char *x2s(uintmax_t x, bool alt_form, bool uppercase, char *s,
static void static void
wrtmessage(void *cbopaque, const char *s) wrtmessage(void *cbopaque, const char *s)
{ {
#if defined(JEMALLOC_USE_SYSCALL) && defined(SYS_write) #if defined(JEMALLOC_USE_SYSCALL) && defined(SYS_write)
/* /*
* Use syscall(2) rather than write(2) when possible in order to avoid * Use syscall(2) rather than write(2) when possible in order to avoid
@ -74,7 +73,6 @@ JEMALLOC_EXPORT void (*je_malloc_message)(void *, const char *s);
void void
malloc_write(const char *s) malloc_write(const char *s)
{ {
if (je_malloc_message != NULL) if (je_malloc_message != NULL)
je_malloc_message(NULL, s); je_malloc_message(NULL, s);
else else
@ -88,7 +86,6 @@ malloc_write(const char *s)
int int
buferror(int err, char *buf, size_t buflen) buferror(int err, char *buf, size_t buflen)
{ {
#ifdef _WIN32 #ifdef _WIN32
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0,
(LPSTR)buf, (DWORD)buflen, NULL); (LPSTR)buf, (DWORD)buflen, NULL);
@ -292,7 +289,6 @@ d2s(intmax_t x, char sign, char *s, size_t *slen_p)
static char * static char *
o2s(uintmax_t x, bool alt_form, char *s, size_t *slen_p) o2s(uintmax_t x, bool alt_form, char *s, size_t *slen_p)
{ {
s = u2s(x, 8, false, s, slen_p); s = u2s(x, 8, false, s, slen_p);
if (alt_form && *s != '0') { if (alt_form && *s != '0') {
s--; s--;
@ -305,7 +301,6 @@ o2s(uintmax_t x, bool alt_form, char *s, size_t *slen_p)
static char * static char *
x2s(uintmax_t x, bool alt_form, bool uppercase, char *s, size_t *slen_p) x2s(uintmax_t x, bool alt_form, bool uppercase, char *s, size_t *slen_p)
{ {
s = u2s(x, 16, uppercase, s, slen_p); s = u2s(x, 16, uppercase, s, slen_p);
if (alt_form) { if (alt_form) {
s -= 2; s -= 2;

View File

@ -5,7 +5,6 @@ void
witness_init(witness_t *witness, const char *name, witness_rank_t rank, witness_init(witness_t *witness, const char *name, witness_rank_t rank,
witness_comp_t *comp, void *opaque) witness_comp_t *comp, void *opaque)
{ {
witness->name = name; witness->name = name;
witness->rank = rank; witness->rank = rank;
witness->comp = comp; witness->comp = comp;
@ -41,7 +40,6 @@ witness_lock_error_t *witness_lock_error = JEMALLOC_N(n_witness_lock_error);
void void
witness_owner_error(const witness_t *witness) witness_owner_error(const witness_t *witness)
{ {
malloc_printf("<jemalloc>: Should own %s(%u)\n", witness->name, malloc_printf("<jemalloc>: Should own %s(%u)\n", witness->name,
witness->rank); witness->rank);
abort(); abort();
@ -59,7 +57,6 @@ witness_owner_error_t *witness_owner_error = JEMALLOC_N(n_witness_owner_error);
void void
witness_not_owner_error(const witness_t *witness) witness_not_owner_error(const witness_t *witness)
{ {
malloc_printf("<jemalloc>: Should not own %s(%u)\n", witness->name, malloc_printf("<jemalloc>: Should not own %s(%u)\n", witness->name,
witness->rank); witness->rank);
abort(); abort();
@ -97,7 +94,6 @@ witness_lockless_error_t *witness_lockless_error =
void void
witnesses_cleanup(tsd_t *tsd) witnesses_cleanup(tsd_t *tsd)
{ {
witness_assert_lockless(tsd_tsdn(tsd)); witness_assert_lockless(tsd_tsdn(tsd));
/* Do nothing. */ /* Do nothing. */
@ -106,14 +102,12 @@ witnesses_cleanup(tsd_t *tsd)
void void
witness_prefork(tsd_t *tsd) witness_prefork(tsd_t *tsd)
{ {
tsd_witness_fork_set(tsd, true); tsd_witness_fork_set(tsd, true);
} }
void void
witness_postfork_parent(tsd_t *tsd) witness_postfork_parent(tsd_t *tsd)
{ {
tsd_witness_fork_set(tsd, false); tsd_witness_fork_set(tsd, false);
} }

View File

@ -47,7 +47,6 @@ static void zone_force_unlock(malloc_zone_t *zone);
static size_t static size_t
zone_size(malloc_zone_t *zone, void *ptr) zone_size(malloc_zone_t *zone, void *ptr)
{ {
/* /*
* There appear to be places within Darwin (such as setenv(3)) that * There appear to be places within Darwin (such as setenv(3)) that
* cause calls to this function with pointers that *no* zone owns. If * cause calls to this function with pointers that *no* zone owns. If
@ -63,14 +62,12 @@ zone_size(malloc_zone_t *zone, void *ptr)
static void * static void *
zone_malloc(malloc_zone_t *zone, size_t size) zone_malloc(malloc_zone_t *zone, size_t size)
{ {
return (je_malloc(size)); return (je_malloc(size));
} }
static void * static void *
zone_calloc(malloc_zone_t *zone, size_t num, size_t size) zone_calloc(malloc_zone_t *zone, size_t num, size_t size)
{ {
return (je_calloc(num, size)); return (je_calloc(num, size));
} }
@ -87,7 +84,6 @@ zone_valloc(malloc_zone_t *zone, size_t size)
static void static void
zone_free(malloc_zone_t *zone, void *ptr) zone_free(malloc_zone_t *zone, void *ptr)
{ {
if (ivsalloc(tsdn_fetch(), ptr) != 0) { if (ivsalloc(tsdn_fetch(), ptr) != 0) {
je_free(ptr); je_free(ptr);
return; return;
@ -99,7 +95,6 @@ zone_free(malloc_zone_t *zone, void *ptr)
static void * static void *
zone_realloc(malloc_zone_t *zone, void *ptr, size_t size) zone_realloc(malloc_zone_t *zone, void *ptr, size_t size)
{ {
if (ivsalloc(tsdn_fetch(), ptr) != 0) if (ivsalloc(tsdn_fetch(), ptr) != 0)
return (je_realloc(ptr, size)); return (je_realloc(ptr, size));
@ -138,7 +133,6 @@ zone_free_definite_size(malloc_zone_t *zone, void *ptr, size_t size)
static void * static void *
zone_destroy(malloc_zone_t *zone) zone_destroy(malloc_zone_t *zone)
{ {
/* This function should never be called. */ /* This function should never be called. */
not_reached(); not_reached();
return (NULL); return (NULL);
@ -147,7 +141,6 @@ zone_destroy(malloc_zone_t *zone)
static size_t static size_t
zone_good_size(malloc_zone_t *zone, size_t size) zone_good_size(malloc_zone_t *zone, size_t size)
{ {
if (size == 0) if (size == 0)
size = 1; size = 1;
return (s2u(size)); return (s2u(size));
@ -156,7 +149,6 @@ zone_good_size(malloc_zone_t *zone, size_t size)
static void static void
zone_force_lock(malloc_zone_t *zone) zone_force_lock(malloc_zone_t *zone)
{ {
if (isthreaded) if (isthreaded)
jemalloc_prefork(); jemalloc_prefork();
} }
@ -164,7 +156,6 @@ zone_force_lock(malloc_zone_t *zone)
static void static void
zone_force_unlock(malloc_zone_t *zone) zone_force_unlock(malloc_zone_t *zone)
{ {
/* /*
* Call jemalloc_postfork_child() rather than * Call jemalloc_postfork_child() rather than
* jemalloc_postfork_parent(), because this function is executed by both * jemalloc_postfork_parent(), because this function is executed by both
@ -179,7 +170,6 @@ zone_force_unlock(malloc_zone_t *zone)
static void static void
zone_init(void) zone_init(void)
{ {
jemalloc_zone.size = (void *)zone_size; jemalloc_zone.size = (void *)zone_size;
jemalloc_zone.malloc = (void *)zone_malloc; jemalloc_zone.malloc = (void *)zone_malloc;
jemalloc_zone.calloc = (void *)zone_calloc; jemalloc_zone.calloc = (void *)zone_calloc;
@ -297,7 +287,6 @@ JEMALLOC_ATTR(constructor)
void void
zone_register(void) zone_register(void)
{ {
/* /*
* If something else replaced the system default zone allocator, don't * If something else replaced the system default zone allocator, don't
* register jemalloc's. * register jemalloc's.

View File

@ -305,7 +305,6 @@ pt_chi2(double p, double df, double ln_gamma_df_2)
JEMALLOC_INLINE double JEMALLOC_INLINE double
pt_gamma(double p, double shape, double scale, double ln_gamma_shape) pt_gamma(double p, double shape, double scale, double ln_gamma_shape)
{ {
return (pt_chi2(p, shape * 2.0, ln_gamma_shape) * 0.5 * scale); return (pt_chi2(p, shape * 2.0, ln_gamma_shape) * 0.5 * scale);
} }
#endif #endif

View File

@ -46,7 +46,6 @@ a_prefix##init(a_mq_type *mq) { \
a_attr void \ a_attr void \
a_prefix##fini(a_mq_type *mq) \ a_prefix##fini(a_mq_type *mq) \
{ \ { \
\
mtx_fini(&mq->lock); \ mtx_fini(&mq->lock); \
} \ } \
a_attr unsigned \ a_attr unsigned \

View File

@ -63,7 +63,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_MALLOCX_ARENA)); test_MALLOCX_ARENA));
} }

View File

@ -10,7 +10,6 @@
static void static void
purge(void) purge(void)
{ {
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0, assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
"Unexpected mallctl error"); "Unexpected mallctl error");
} }
@ -130,7 +129,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_alignment_errors, test_alignment_errors,
test_oom_errors, test_oom_errors,

View File

@ -98,7 +98,6 @@ label_ENOENT:
TEST_BEGIN(test_main_thread) TEST_BEGIN(test_main_thread)
{ {
thd_start(NULL); thd_start(NULL);
} }
TEST_END TEST_END
@ -115,7 +114,6 @@ TEST_END
int int
main(void) main(void)
{ {
/* Run tests multiple times to check for bad interactions. */ /* Run tests multiple times to check for bad interactions. */
return (test( return (test(
test_main_thread, test_main_thread,

View File

@ -12,7 +12,6 @@ TEST_END
int int
main() main()
{ {
return (test( return (test(
test_basic)); test_basic));
} }

View File

@ -176,7 +176,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_extent_manual_hook, test_extent_manual_hook,
test_extent_auto_hook)); test_extent_auto_hook));

View File

@ -20,7 +20,6 @@ get_nsizes_impl(const char *cmd)
static unsigned static unsigned
get_nlarge(void) get_nlarge(void)
{ {
return (get_nsizes_impl("arenas.nlextents")); return (get_nsizes_impl("arenas.nlextents"));
} }
@ -46,7 +45,6 @@ get_size_impl(const char *cmd, size_t ind)
static size_t static size_t
get_large_size(size_t ind) get_large_size(size_t ind)
{ {
return (get_size_impl("arenas.lextent.0.size", ind)); return (get_size_impl("arenas.lextent.0.size", ind));
} }
@ -58,7 +56,6 @@ get_large_size(size_t ind)
static void static void
purge(void) purge(void)
{ {
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0, assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
"Unexpected mallctl error"); "Unexpected mallctl error");
} }
@ -225,7 +222,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_overflow, test_overflow,
test_oom, test_oom,

View File

@ -43,7 +43,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_overflow)); test_overflow));
} }

View File

@ -10,7 +10,6 @@
static void static void
purge(void) purge(void)
{ {
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0, assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
"Unexpected mallctl error"); "Unexpected mallctl error");
} }
@ -124,7 +123,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_alignment_errors, test_alignment_errors,
test_oom_errors, test_oom_errors,

View File

@ -16,7 +16,6 @@ get_nsizes_impl(const char *cmd)
static unsigned static unsigned
get_nlarge(void) get_nlarge(void)
{ {
return (get_nsizes_impl("arenas.nlextents")); return (get_nsizes_impl("arenas.nlextents"));
} }
@ -42,7 +41,6 @@ get_size_impl(const char *cmd, size_t ind)
static size_t static size_t
get_large_size(size_t ind) get_large_size(size_t ind)
{ {
return (get_size_impl("arenas.lextent.0.size", ind)); return (get_size_impl("arenas.lextent.0.size", ind));
} }
@ -249,7 +247,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_grow_and_shrink, test_grow_and_shrink,
test_zero, test_zero,

View File

@ -50,7 +50,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_basic, test_basic,
test_alignment_and_size)); test_alignment_and_size));

View File

@ -75,7 +75,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_thread_arena)); test_thread_arena));
} }

View File

@ -86,7 +86,6 @@ label_ENOENT:
TEST_BEGIN(test_main_thread) TEST_BEGIN(test_main_thread)
{ {
thd_start(NULL); thd_start(NULL);
} }
TEST_END TEST_END
@ -103,7 +102,6 @@ TEST_END
int int
main(void) main(void)
{ {
/* Run tests multiple times to check for bad interactions. */ /* Run tests multiple times to check for bad interactions. */
return (test( return (test(
test_main_thread, test_main_thread,

View File

@ -87,14 +87,12 @@ get_nsizes_impl(const char *cmd)
static unsigned static unsigned
get_nsmall(void) get_nsmall(void)
{ {
return (get_nsizes_impl("arenas.nbins")); return (get_nsizes_impl("arenas.nbins"));
} }
static unsigned static unsigned
get_nlarge(void) get_nlarge(void)
{ {
return (get_nsizes_impl("arenas.nlextents")); return (get_nsizes_impl("arenas.nlextents"));
} }
@ -120,14 +118,12 @@ get_size_impl(const char *cmd, size_t ind)
static size_t static size_t
get_small_size(size_t ind) get_small_size(size_t ind)
{ {
return (get_size_impl("arenas.bin.0.size", ind)); return (get_size_impl("arenas.bin.0.size", ind));
} }
static size_t static size_t
get_large_size(size_t ind) get_large_size(size_t ind)
{ {
return (get_size_impl("arenas.lextent.0.size", ind)); return (get_size_impl("arenas.lextent.0.size", ind));
} }
@ -397,7 +393,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_same_size, test_same_size,
test_extra_no_move, test_extra_no_move,

View File

@ -3,6 +3,5 @@
void * void *
btalloc(size_t size, unsigned bits) btalloc(size_t size, unsigned bits)
{ {
return (btalloc_0(size, bits)); return (btalloc_0(size, bits));
} }

View File

@ -7,7 +7,6 @@
void void
mq_nanosleep(unsigned ns) mq_nanosleep(unsigned ns)
{ {
assert(ns <= 1000*1000*1000); assert(ns <= 1000*1000*1000);
#ifdef _WIN32 #ifdef _WIN32

View File

@ -7,7 +7,6 @@
bool bool
mtx_init(mtx_t *mtx) mtx_init(mtx_t *mtx)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (!InitializeCriticalSectionAndSpinCount(&mtx->lock, _CRT_SPINCOUNT)) if (!InitializeCriticalSectionAndSpinCount(&mtx->lock, _CRT_SPINCOUNT))
return (true); return (true);
@ -33,7 +32,6 @@ mtx_init(mtx_t *mtx)
void void
mtx_fini(mtx_t *mtx) mtx_fini(mtx_t *mtx)
{ {
#ifdef _WIN32 #ifdef _WIN32
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK)) #elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
#elif (defined(JEMALLOC_OSSPIN)) #elif (defined(JEMALLOC_OSSPIN))
@ -45,7 +43,6 @@ mtx_fini(mtx_t *mtx)
void void
mtx_lock(mtx_t *mtx) mtx_lock(mtx_t *mtx)
{ {
#ifdef _WIN32 #ifdef _WIN32
EnterCriticalSection(&mtx->lock); EnterCriticalSection(&mtx->lock);
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK)) #elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
@ -60,7 +57,6 @@ mtx_lock(mtx_t *mtx)
void void
mtx_unlock(mtx_t *mtx) mtx_unlock(mtx_t *mtx)
{ {
#ifdef _WIN32 #ifdef _WIN32
LeaveCriticalSection(&mtx->lock); LeaveCriticalSection(&mtx->lock);
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK)) #elif (defined(JEMALLOC_OS_UNFAIR_LOCK))

View File

@ -34,7 +34,6 @@ test_fail(const char *format, ...)
static const char * static const char *
test_status_string(test_status_t test_status) test_status_string(test_status_t test_status)
{ {
switch (test_status) { switch (test_status) {
case test_status_pass: return "pass"; case test_status_pass: return "pass";
case test_status_skip: return "skip"; case test_status_skip: return "skip";
@ -46,7 +45,6 @@ test_status_string(test_status_t test_status)
void void
p_test_init(const char *name) p_test_init(const char *name)
{ {
test_count++; test_count++;
test_status = test_status_pass; test_status = test_status_pass;
test_name = name; test_name = name;
@ -55,7 +53,6 @@ p_test_init(const char *name)
void void
p_test_fini(void) p_test_fini(void)
{ {
test_counts[test_status]++; test_counts[test_status]++;
malloc_printf("%s: %s\n", test_name, test_status_string(test_status)); malloc_printf("%s: %s\n", test_name, test_status_string(test_status));
} }
@ -127,7 +124,6 @@ p_test_no_malloc_init(test_t *t, ...)
void void
p_test_fail(const char *prefix, const char *message) p_test_fail(const char *prefix, const char *message)
{ {
malloc_cprintf(NULL, NULL, "%s%s\n", prefix, message); malloc_cprintf(NULL, NULL, "%s%s\n", prefix, message);
test_status = test_status_fail; test_status = test_status_fail;
} }

View File

@ -13,7 +13,6 @@ thd_create(thd_t *thd, void *(*proc)(void *), void *arg)
void void
thd_join(thd_t thd, void **ret) thd_join(thd_t thd, void **ret)
{ {
if (WaitForSingleObject(thd, INFINITE) == WAIT_OBJECT_0 && ret) { if (WaitForSingleObject(thd, INFINITE) == WAIT_OBJECT_0 && ret) {
DWORD exit_code; DWORD exit_code;
GetExitCodeThread(thd, (LPDWORD) &exit_code); GetExitCodeThread(thd, (LPDWORD) &exit_code);
@ -25,7 +24,6 @@ thd_join(thd_t thd, void **ret)
void void
thd_create(thd_t *thd, void *(*proc)(void *), void *arg) thd_create(thd_t *thd, void *(*proc)(void *), void *arg)
{ {
if (pthread_create(thd, NULL, proc, arg) != 0) if (pthread_create(thd, NULL, proc, arg) != 0)
test_fail("Error in pthread_create()\n"); test_fail("Error in pthread_create()\n");
} }
@ -33,7 +31,6 @@ thd_create(thd_t *thd, void *(*proc)(void *), void *arg)
void void
thd_join(thd_t thd, void **ret) thd_join(thd_t thd, void **ret)
{ {
pthread_join(thd, ret); pthread_join(thd, ret);
} }
#endif #endif

View File

@ -3,7 +3,6 @@
void void
timer_start(timedelta_t *timer) timer_start(timedelta_t *timer)
{ {
nstime_init(&timer->t0, 0); nstime_init(&timer->t0, 0);
nstime_update(&timer->t0); nstime_update(&timer->t0);
} }
@ -11,7 +10,6 @@ timer_start(timedelta_t *timer)
void void
timer_stop(timedelta_t *timer) timer_stop(timedelta_t *timer)
{ {
nstime_copy(&timer->t1, &timer->t0); nstime_copy(&timer->t1, &timer->t0);
nstime_update(&timer->t1); nstime_update(&timer->t1);
} }

View File

@ -65,7 +65,6 @@ mallocx_free(void)
TEST_BEGIN(test_malloc_vs_mallocx) TEST_BEGIN(test_malloc_vs_mallocx)
{ {
compare_funcs(10*1000*1000, 100*1000*1000, "malloc", compare_funcs(10*1000*1000, 100*1000*1000, "malloc",
malloc_free, "mallocx", mallocx_free); malloc_free, "mallocx", mallocx_free);
} }
@ -95,7 +94,6 @@ malloc_sdallocx(void)
TEST_BEGIN(test_free_vs_dallocx) TEST_BEGIN(test_free_vs_dallocx)
{ {
compare_funcs(10*1000*1000, 100*1000*1000, "free", malloc_free, compare_funcs(10*1000*1000, 100*1000*1000, "free", malloc_free,
"dallocx", malloc_dallocx); "dallocx", malloc_dallocx);
} }
@ -103,7 +101,6 @@ TEST_END
TEST_BEGIN(test_dallocx_vs_sdallocx) TEST_BEGIN(test_dallocx_vs_sdallocx)
{ {
compare_funcs(10*1000*1000, 100*1000*1000, "dallocx", malloc_dallocx, compare_funcs(10*1000*1000, 100*1000*1000, "dallocx", malloc_dallocx,
"sdallocx", malloc_sdallocx); "sdallocx", malloc_sdallocx);
} }
@ -140,7 +137,6 @@ malloc_sallocx_free(void)
TEST_BEGIN(test_mus_vs_sallocx) TEST_BEGIN(test_mus_vs_sallocx)
{ {
compare_funcs(10*1000*1000, 100*1000*1000, "malloc_usable_size", compare_funcs(10*1000*1000, 100*1000*1000, "malloc_usable_size",
malloc_mus_free, "sallocx", malloc_sallocx_free); malloc_mus_free, "sallocx", malloc_sallocx_free);
} }
@ -163,7 +159,6 @@ malloc_nallocx_free(void)
TEST_BEGIN(test_sallocx_vs_nallocx) TEST_BEGIN(test_sallocx_vs_nallocx)
{ {
compare_funcs(10*1000*1000, 100*1000*1000, "sallocx", compare_funcs(10*1000*1000, 100*1000*1000, "sallocx",
malloc_sallocx_free, "nallocx", malloc_nallocx_free); malloc_sallocx_free, "nallocx", malloc_nallocx_free);
} }
@ -172,7 +167,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_malloc_vs_mallocx, test_malloc_vs_mallocx,
test_free_vs_dallocx, test_free_vs_dallocx,

View File

@ -1596,7 +1596,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_gen_rand_32, test_gen_rand_32,
test_by_array_32, test_by_array_32,

View File

@ -13,7 +13,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test_no_malloc_init( return (test_no_malloc_init(
test_a0)); test_a0));
} }

View File

@ -20,14 +20,12 @@ get_nsizes_impl(const char *cmd)
static unsigned static unsigned
get_nsmall(void) get_nsmall(void)
{ {
return (get_nsizes_impl("arenas.nbins")); return (get_nsizes_impl("arenas.nbins"));
} }
static unsigned static unsigned
get_nlarge(void) get_nlarge(void)
{ {
return (get_nsizes_impl("arenas.nlextents")); return (get_nsizes_impl("arenas.nlextents"));
} }
@ -53,14 +51,12 @@ get_size_impl(const char *cmd, size_t ind)
static size_t static size_t
get_small_size(size_t ind) get_small_size(size_t ind)
{ {
return (get_size_impl("arenas.bin.0.size", ind)); return (get_size_impl("arenas.bin.0.size", ind));
} }
static size_t static size_t
get_large_size(size_t ind) get_large_size(size_t ind)
{ {
return (get_size_impl("arenas.lextent.0.size", ind)); return (get_size_impl("arenas.lextent.0.size", ind));
} }
@ -164,14 +160,12 @@ do_arena_reset_destroy(const char *name, unsigned arena_ind)
static void static void
do_arena_reset(unsigned arena_ind) do_arena_reset(unsigned arena_ind)
{ {
do_arena_reset_destroy("arena.0.reset", arena_ind); do_arena_reset_destroy("arena.0.reset", arena_ind);
} }
static void static void
do_arena_destroy(unsigned arena_ind) do_arena_destroy(unsigned arena_ind)
{ {
do_arena_reset_destroy("arena.0.destroy", arena_ind); do_arena_reset_destroy("arena.0.destroy", arena_ind);
} }
@ -214,7 +208,6 @@ arena_i_initialized(unsigned arena_ind, bool refresh)
TEST_BEGIN(test_arena_destroy_initial) TEST_BEGIN(test_arena_destroy_initial)
{ {
assert_false(arena_i_initialized(MALLCTL_ARENAS_DESTROYED, false), assert_false(arena_i_initialized(MALLCTL_ARENAS_DESTROYED, false),
"Destroyed arena stats should not be initialized"); "Destroyed arena stats should not be initialized");
} }
@ -269,7 +262,6 @@ static bool
extent_dalloc_unmap(extent_hooks_t *extent_hooks, void *addr, size_t size, extent_dalloc_unmap(extent_hooks_t *extent_hooks, void *addr, size_t size,
bool committed, unsigned arena_ind) bool committed, unsigned arena_ind)
{ {
TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, committed=%s, " TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, committed=%s, "
"arena_ind=%u)\n", __func__, extent_hooks, addr, size, committed ? "arena_ind=%u)\n", __func__, extent_hooks, addr, size, committed ?
"true" : "false", arena_ind); "true" : "false", arena_ind);
@ -338,7 +330,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_arena_reset, test_arena_reset,
test_arena_destroy_initial, test_arena_destroy_initial,

View File

@ -68,7 +68,6 @@ typedef struct p##_test_s p##_test_t;
TEST_STRUCT(u64, uint64_t) TEST_STRUCT(u64, uint64_t)
TEST_BEGIN(test_atomic_u64) TEST_BEGIN(test_atomic_u64)
{ {
#if !(LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3) #if !(LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
test_skip("64-bit atomic operations not supported"); test_skip("64-bit atomic operations not supported");
#else #else
@ -80,7 +79,6 @@ TEST_END
TEST_STRUCT(u32, uint32_t) TEST_STRUCT(u32, uint32_t)
TEST_BEGIN(test_atomic_u32) TEST_BEGIN(test_atomic_u32)
{ {
TEST_BODY(u32, uint32_t, uint32_t, u32, "#"FMTx32); TEST_BODY(u32, uint32_t, uint32_t, u32, "#"FMTx32);
} }
TEST_END TEST_END
@ -88,7 +86,6 @@ TEST_END
TEST_STRUCT(p, void *) TEST_STRUCT(p, void *)
TEST_BEGIN(test_atomic_p) TEST_BEGIN(test_atomic_p)
{ {
TEST_BODY(p, void *, uintptr_t, ptr, "p"); TEST_BODY(p, void *, uintptr_t, ptr, "p");
} }
TEST_END TEST_END
@ -96,7 +93,6 @@ TEST_END
TEST_STRUCT(zu, size_t) TEST_STRUCT(zu, size_t)
TEST_BEGIN(test_atomic_zu) TEST_BEGIN(test_atomic_zu)
{ {
TEST_BODY(zu, size_t, size_t, zu, "#zx"); TEST_BODY(zu, size_t, size_t, zu, "#zx");
} }
TEST_END TEST_END
@ -104,7 +100,6 @@ TEST_END
TEST_STRUCT(u, unsigned) TEST_STRUCT(u, unsigned)
TEST_BEGIN(test_atomic_u) TEST_BEGIN(test_atomic_u)
{ {
TEST_BODY(u, unsigned, unsigned, u, "#x"); TEST_BODY(u, unsigned, unsigned, u, "#x");
} }
TEST_END TEST_END
@ -112,7 +107,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_atomic_u64, test_atomic_u64,
test_atomic_u32, test_atomic_u32,

View File

@ -208,7 +208,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_base_hooks_default, test_base_hooks_default,
test_base_hooks_null, test_base_hooks_null,

View File

@ -126,7 +126,6 @@ test_bitmap_initializer_body(const bitmap_info_t *binfo, size_t nbits)
TEST_BEGIN(test_bitmap_initializer) TEST_BEGIN(test_bitmap_initializer)
{ {
#define NB(nbits) { \ #define NB(nbits) { \
if (nbits <= BITMAP_MAXBITS) { \ if (nbits <= BITMAP_MAXBITS) { \
bitmap_info_t binfo = \ bitmap_info_t binfo = \
@ -339,7 +338,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_bitmap_initializer, test_bitmap_initializer,
test_bitmap_size, test_bitmap_size,

View File

@ -206,7 +206,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_new_delete, test_new_delete,
test_count_insert_search_remove, test_count_insert_search_remove,

View File

@ -12,14 +12,12 @@ static bool monotonic_mock;
static bool static bool
nstime_monotonic_mock(void) nstime_monotonic_mock(void)
{ {
return (monotonic_mock); return (monotonic_mock);
} }
static bool static bool
nstime_update_mock(nstime_t *time) nstime_update_mock(nstime_t *time)
{ {
nupdates_mock++; nupdates_mock++;
if (monotonic_mock) if (monotonic_mock)
nstime_copy(time, &time_mock); nstime_copy(time, &time_mock);
@ -357,7 +355,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_decay_ticks, test_decay_ticks,
test_decay_ticker, test_decay_ticker,

View File

@ -138,7 +138,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_small_extent_size, test_small_extent_size,
test_large_extent_size, test_large_extent_size,

View File

@ -58,7 +58,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_fork)); test_fork));
} }

View File

@ -38,7 +38,6 @@ typedef enum {
static int static int
hash_variant_bits(hash_variant_t variant) hash_variant_bits(hash_variant_t variant)
{ {
switch (variant) { switch (variant) {
case hash_variant_x86_32: return (32); case hash_variant_x86_32: return (32);
case hash_variant_x86_128: return (128); case hash_variant_x86_128: return (128);
@ -50,7 +49,6 @@ hash_variant_bits(hash_variant_t variant)
static const char * static const char *
hash_variant_string(hash_variant_t variant) hash_variant_string(hash_variant_t variant)
{ {
switch (variant) { switch (variant) {
case hash_variant_x86_32: return ("hash_x86_32"); case hash_variant_x86_32: return ("hash_x86_32");
case hash_variant_x86_128: return ("hash_x86_128"); case hash_variant_x86_128: return ("hash_x86_128");
@ -155,21 +153,18 @@ hash_variant_verify(hash_variant_t variant)
TEST_BEGIN(test_hash_x86_32) TEST_BEGIN(test_hash_x86_32)
{ {
hash_variant_verify(hash_variant_x86_32); hash_variant_verify(hash_variant_x86_32);
} }
TEST_END TEST_END
TEST_BEGIN(test_hash_x86_128) TEST_BEGIN(test_hash_x86_128)
{ {
hash_variant_verify(hash_variant_x86_128); hash_variant_verify(hash_variant_x86_128);
} }
TEST_END TEST_END
TEST_BEGIN(test_hash_x64_128) TEST_BEGIN(test_hash_x64_128)
{ {
hash_variant_verify(hash_variant_x64_128); hash_variant_verify(hash_variant_x64_128);
} }
TEST_END TEST_END
@ -177,7 +172,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_hash_x86_32, test_hash_x86_32,
test_hash_x86_128, test_hash_x86_128,

View File

@ -17,7 +17,6 @@ static bool saw_junking;
static void static void
watch_junking(void *p) watch_junking(void *p)
{ {
watch_for_junking = p; watch_for_junking = p;
saw_junking = false; saw_junking = false;
} }
@ -55,7 +54,6 @@ large_dalloc_junk_intercept(void *ptr, size_t usize)
static void static void
large_dalloc_maybe_junk_intercept(void *ptr, size_t usize) large_dalloc_maybe_junk_intercept(void *ptr, size_t usize)
{ {
large_dalloc_maybe_junk_orig(ptr, usize); large_dalloc_maybe_junk_orig(ptr, usize);
if (ptr == watch_for_junking) if (ptr == watch_for_junking)
saw_junking = true; saw_junking = true;
@ -130,7 +128,6 @@ test_junk(size_t sz_min, size_t sz_max)
TEST_BEGIN(test_junk_small) TEST_BEGIN(test_junk_small)
{ {
test_skip_if(!config_fill); test_skip_if(!config_fill);
test_junk(1, SMALL_MAXCLASS-1); test_junk(1, SMALL_MAXCLASS-1);
} }
@ -138,7 +135,6 @@ TEST_END
TEST_BEGIN(test_junk_large) TEST_BEGIN(test_junk_large)
{ {
test_skip_if(!config_fill); test_skip_if(!config_fill);
test_junk(SMALL_MAXCLASS+1, (1U << (LG_LARGE_MINCLASS+1))); test_junk(SMALL_MAXCLASS+1, (1U << (LG_LARGE_MINCLASS+1)));
} }
@ -147,7 +143,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_junk_small, test_junk_small,
test_junk_large)); test_junk_large));

View File

@ -121,7 +121,6 @@ TEST_END
TEST_BEGIN(test_mallctl_config) TEST_BEGIN(test_mallctl_config)
{ {
#define TEST_MALLCTL_CONFIG(config, t) do { \ #define TEST_MALLCTL_CONFIG(config, t) do { \
t oldval; \ t oldval; \
size_t sz = sizeof(oldval); \ size_t sz = sizeof(oldval); \
@ -551,7 +550,6 @@ TEST_END
TEST_BEGIN(test_arenas_constants) TEST_BEGIN(test_arenas_constants)
{ {
#define TEST_ARENAS_CONSTANT(t, name, expected) do { \ #define TEST_ARENAS_CONSTANT(t, name, expected) do { \
t name; \ t name; \
size_t sz = sizeof(t); \ size_t sz = sizeof(t); \
@ -571,7 +569,6 @@ TEST_END
TEST_BEGIN(test_arenas_bin_constants) TEST_BEGIN(test_arenas_bin_constants)
{ {
#define TEST_ARENAS_BIN_CONSTANT(t, name, expected) do { \ #define TEST_ARENAS_BIN_CONSTANT(t, name, expected) do { \
t name; \ t name; \
size_t sz = sizeof(t); \ size_t sz = sizeof(t); \
@ -591,7 +588,6 @@ TEST_END
TEST_BEGIN(test_arenas_lextent_constants) TEST_BEGIN(test_arenas_lextent_constants)
{ {
#define TEST_ARENAS_LEXTENT_CONSTANT(t, name, expected) do { \ #define TEST_ARENAS_LEXTENT_CONSTANT(t, name, expected) do { \
t name; \ t name; \
size_t sz = sizeof(t); \ size_t sz = sizeof(t); \
@ -626,7 +622,6 @@ TEST_END
TEST_BEGIN(test_stats_arenas) TEST_BEGIN(test_stats_arenas)
{ {
#define TEST_STATS_ARENAS(t, name) do { \ #define TEST_STATS_ARENAS(t, name) do { \
t name; \ t name; \
size_t sz = sizeof(t); \ size_t sz = sizeof(t); \
@ -647,7 +642,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_mallctl_errors, test_mallctl_errors,
test_mallctlnametomib_errors, test_mallctlnametomib_errors,

View File

@ -387,7 +387,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_ln_gamma_factorial, test_ln_gamma_factorial,
test_ln_gamma_misc, test_ln_gamma_misc,

View File

@ -85,7 +85,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_mq_basic, test_mq_basic,
test_mq_threaded)); test_mq_threaded));

View File

@ -53,7 +53,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_mtx_basic, test_mtx_basic,
test_mtx_race)); test_mtx_race));

View File

@ -178,7 +178,6 @@ TEST_END
TEST_BEGIN(test_nstime_monotonic) TEST_BEGIN(test_nstime_monotonic)
{ {
nstime_monotonic(); nstime_monotonic();
} }
TEST_END TEST_END
@ -211,7 +210,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_nstime_init, test_nstime_init,
test_nstime_init2, test_nstime_init2,

View File

@ -161,7 +161,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_pack)); test_pack));
} }

View File

@ -24,7 +24,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_pages_huge)); test_pages_huge));
} }

View File

@ -148,7 +148,6 @@ TEST_END
static void static void
node_remove(heap_t *heap, node_t *node) node_remove(heap_t *heap, node_t *node)
{ {
heap_remove(heap, node); heap_remove(heap, node);
node->magic = 0; node->magic = 0;
@ -283,7 +282,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_ph_empty, test_ph_empty,
test_ph_random)); test_ph_random));

View File

@ -114,35 +114,30 @@ test_prng_lg_range_zu(bool atomic)
TEST_BEGIN(test_prng_lg_range_u32_nonatomic) TEST_BEGIN(test_prng_lg_range_u32_nonatomic)
{ {
test_prng_lg_range_u32(false); test_prng_lg_range_u32(false);
} }
TEST_END TEST_END
TEST_BEGIN(test_prng_lg_range_u32_atomic) TEST_BEGIN(test_prng_lg_range_u32_atomic)
{ {
test_prng_lg_range_u32(true); test_prng_lg_range_u32(true);
} }
TEST_END TEST_END
TEST_BEGIN(test_prng_lg_range_u64_nonatomic) TEST_BEGIN(test_prng_lg_range_u64_nonatomic)
{ {
test_prng_lg_range_u64(); test_prng_lg_range_u64();
} }
TEST_END TEST_END
TEST_BEGIN(test_prng_lg_range_zu_nonatomic) TEST_BEGIN(test_prng_lg_range_zu_nonatomic)
{ {
test_prng_lg_range_zu(false); test_prng_lg_range_zu(false);
} }
TEST_END TEST_END
TEST_BEGIN(test_prng_lg_range_zu_atomic) TEST_BEGIN(test_prng_lg_range_zu_atomic)
{ {
test_prng_lg_range_zu(true); test_prng_lg_range_zu(true);
} }
TEST_END TEST_END
@ -212,35 +207,30 @@ test_prng_range_zu(bool atomic)
TEST_BEGIN(test_prng_range_u32_nonatomic) TEST_BEGIN(test_prng_range_u32_nonatomic)
{ {
test_prng_range_u32(false); test_prng_range_u32(false);
} }
TEST_END TEST_END
TEST_BEGIN(test_prng_range_u32_atomic) TEST_BEGIN(test_prng_range_u32_atomic)
{ {
test_prng_range_u32(true); test_prng_range_u32(true);
} }
TEST_END TEST_END
TEST_BEGIN(test_prng_range_u64_nonatomic) TEST_BEGIN(test_prng_range_u64_nonatomic)
{ {
test_prng_range_u64(); test_prng_range_u64();
} }
TEST_END TEST_END
TEST_BEGIN(test_prng_range_zu_nonatomic) TEST_BEGIN(test_prng_range_zu_nonatomic)
{ {
test_prng_range_zu(false); test_prng_range_zu(false);
} }
TEST_END TEST_END
TEST_BEGIN(test_prng_range_zu_atomic) TEST_BEGIN(test_prng_range_zu_atomic)
{ {
test_prng_range_zu(true); test_prng_range_zu(true);
} }
TEST_END TEST_END
@ -248,7 +238,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_prng_lg_range_u32_nonatomic, test_prng_lg_range_u32_nonatomic,
test_prng_lg_range_u32_atomic, test_prng_lg_range_u32_atomic,

View File

@ -24,7 +24,6 @@ prof_dump_open_intercept(bool propagate_err, const char *filename)
static void * static void *
alloc_from_permuted_backtrace(unsigned thd_ind, unsigned iteration) alloc_from_permuted_backtrace(unsigned thd_ind, unsigned iteration)
{ {
return (btalloc(1, thd_ind*NALLOCS_PER_THREAD + iteration)); return (btalloc(1, thd_ind*NALLOCS_PER_THREAD + iteration));
} }
@ -86,7 +85,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_idump)); test_idump));
} }

View File

@ -38,7 +38,6 @@ static void
mallctl_prof_active_get_impl(bool prof_active_old_expected, const char *func, mallctl_prof_active_get_impl(bool prof_active_old_expected, const char *func,
int line) int line)
{ {
mallctl_bool_get("prof.active", prof_active_old_expected, func, line); mallctl_bool_get("prof.active", prof_active_old_expected, func, line);
} }
#define mallctl_prof_active_get(a) \ #define mallctl_prof_active_get(a) \
@ -48,7 +47,6 @@ static void
mallctl_prof_active_set_impl(bool prof_active_old_expected, mallctl_prof_active_set_impl(bool prof_active_old_expected,
bool prof_active_new, const char *func, int line) bool prof_active_new, const char *func, int line)
{ {
mallctl_bool_set("prof.active", prof_active_old_expected, mallctl_bool_set("prof.active", prof_active_old_expected,
prof_active_new, func, line); prof_active_new, func, line);
} }
@ -59,7 +57,6 @@ static void
mallctl_thread_prof_active_get_impl(bool thread_prof_active_old_expected, mallctl_thread_prof_active_get_impl(bool thread_prof_active_old_expected,
const char *func, int line) const char *func, int line)
{ {
mallctl_bool_get("thread.prof.active", thread_prof_active_old_expected, mallctl_bool_get("thread.prof.active", thread_prof_active_old_expected,
func, line); func, line);
} }
@ -70,7 +67,6 @@ static void
mallctl_thread_prof_active_set_impl(bool thread_prof_active_old_expected, mallctl_thread_prof_active_set_impl(bool thread_prof_active_old_expected,
bool thread_prof_active_new, const char *func, int line) bool thread_prof_active_new, const char *func, int line)
{ {
mallctl_bool_set("thread.prof.active", thread_prof_active_old_expected, mallctl_bool_set("thread.prof.active", thread_prof_active_old_expected,
thread_prof_active_new, func, line); thread_prof_active_new, func, line);
} }
@ -96,7 +92,6 @@ prof_sampling_probe_impl(bool expect_sample, const char *func, int line)
TEST_BEGIN(test_prof_active) TEST_BEGIN(test_prof_active)
{ {
test_skip_if(!config_prof); test_skip_if(!config_prof);
mallctl_prof_active_get(true); mallctl_prof_active_get(true);
@ -131,7 +126,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_prof_active)); test_prof_active));
} }

View File

@ -76,7 +76,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_gdump)); test_gdump));
} }

View File

@ -53,7 +53,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_idump)); test_idump));
} }

View File

@ -19,7 +19,6 @@ prof_dump_open_intercept(bool propagate_err, const char *filename)
static void static void
set_prof_active(bool active) set_prof_active(bool active)
{ {
assert_d_eq(mallctl("prof.active", NULL, NULL, (void *)&active, assert_d_eq(mallctl("prof.active", NULL, NULL, (void *)&active,
sizeof(active)), 0, "Unexpected mallctl failure"); sizeof(active)), 0, "Unexpected mallctl failure");
} }
@ -98,7 +97,6 @@ static bool
prof_dump_header_intercept(tsdn_t *tsdn, bool propagate_err, prof_dump_header_intercept(tsdn_t *tsdn, bool propagate_err,
const prof_cnt_t *cnt_all) const prof_cnt_t *cnt_all)
{ {
prof_dump_header_intercepted = true; prof_dump_header_intercepted = true;
memcpy(&cnt_all_copy, cnt_all, sizeof(prof_cnt_t)); memcpy(&cnt_all_copy, cnt_all, sizeof(prof_cnt_t));
@ -292,7 +290,6 @@ TEST_END
int int
main(void) main(void)
{ {
/* Intercept dumping prior to running any tests. */ /* Intercept dumping prior to running any tests. */
prof_dump_open = prof_dump_open_intercept; prof_dump_open = prof_dump_open_intercept;

View File

@ -26,7 +26,6 @@ static void
mallctl_thread_name_set_impl(const char *thread_name, const char *func, mallctl_thread_name_set_impl(const char *thread_name, const char *func,
int line) int line)
{ {
assert_d_eq(mallctl("thread.prof.name", NULL, NULL, assert_d_eq(mallctl("thread.prof.name", NULL, NULL,
(void *)&thread_name, sizeof(thread_name)), 0, (void *)&thread_name, sizeof(thread_name)), 0,
"%s():%d: Unexpected mallctl failure reading thread.prof.name", "%s():%d: Unexpected mallctl failure reading thread.prof.name",
@ -124,7 +123,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_prof_thread_name_validation, test_prof_thread_name_validation,
test_prof_thread_name_threaded)); test_prof_thread_name_threaded));

View File

@ -198,7 +198,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_ql_empty, test_ql_empty,
test_ql_tail_insert, test_ql_tail_insert,

View File

@ -238,7 +238,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_qr_one, test_qr_one,
test_qr_after_insert, test_qr_after_insert,

View File

@ -347,7 +347,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_rb_empty, test_rb_empty,
test_rb_random)); test_rb_random));

View File

@ -24,7 +24,6 @@ rtree_node_alloc_intercept(tsdn_t *tsdn, rtree_t *rtree, size_t nelms)
static void static void
rtree_node_dalloc_intercept(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *node) rtree_node_dalloc_intercept(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *node)
{ {
if (rtree != test_rtree) { if (rtree != test_rtree) {
rtree_node_dalloc_orig(tsdn, rtree, node); rtree_node_dalloc_orig(tsdn, rtree, node);
return; return;
@ -283,7 +282,6 @@ TEST_END
int int
main(void) main(void)
{ {
rtree_node_alloc_orig = rtree_node_alloc; rtree_node_alloc_orig = rtree_node_alloc;
rtree_node_alloc = rtree_node_alloc_intercept; rtree_node_alloc = rtree_node_alloc_intercept;
rtree_node_dalloc_orig = rtree_node_dalloc; rtree_node_dalloc_orig = rtree_node_dalloc;

View File

@ -178,7 +178,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_size_classes, test_size_classes,
test_psize_classes, test_psize_classes,

View File

@ -29,7 +29,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_arena_slab_regind)); test_arena_slab_regind));
} }

View File

@ -98,7 +98,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_smoothstep_integral, test_smoothstep_integral,
test_smoothstep_monotonic, test_smoothstep_monotonic,

View File

@ -120,7 +120,6 @@ TEST_END
void * void *
thd_start(void *arg) thd_start(void *arg)
{ {
return (NULL); return (NULL);
} }
@ -350,7 +349,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_stats_summary, test_stats_summary,
test_stats_large, test_stats_large,

View File

@ -68,7 +68,6 @@ TEST_END
int int
main(void) main(void)
{ {
return (test( return (test(
test_ticker_tick, test_ticker_tick,
test_ticker_ticks, test_ticker_ticks,

View File

@ -78,7 +78,6 @@ thd_start(void *arg)
TEST_BEGIN(test_tsd_main_thread) TEST_BEGIN(test_tsd_main_thread)
{ {
thd_start((void *)(uintptr_t)0xa5f3e329); thd_start((void *)(uintptr_t)0xa5f3e329);
} }
TEST_END TEST_END
@ -98,7 +97,6 @@ TEST_END
int int
main(void) main(void)
{ {
/* Core tsd bootstrapping must happen prior to data_tsd_boot(). */ /* Core tsd bootstrapping must happen prior to data_tsd_boot(). */
if (nallocx(1, 0) == 0) { if (nallocx(1, 0) == 0) {
malloc_printf("Initialization error"); malloc_printf("Initialization error");

Some files were not shown because too many files have changed in this diff Show More