Style and spelling fixes.
This commit is contained in:
parent
59cd80e6c6
commit
e12eaf93dc
@ -263,8 +263,7 @@ struct arena_s {
|
|||||||
/*
|
/*
|
||||||
* There are three classes of arena operations from a locking
|
* There are three classes of arena operations from a locking
|
||||||
* perspective:
|
* perspective:
|
||||||
* 1) Thread asssignment (modifies nthreads) is protected by
|
* 1) Thread assignment (modifies nthreads) is protected by arenas_lock.
|
||||||
* arenas_lock.
|
|
||||||
* 2) Bin-related operations are protected by bin locks.
|
* 2) Bin-related operations are protected by bin locks.
|
||||||
* 3) Chunk- and run-related operations are protected by this mutex.
|
* 3) Chunk- and run-related operations are protected by this mutex.
|
||||||
*/
|
*/
|
||||||
@ -314,7 +313,7 @@ struct arena_s {
|
|||||||
arena_chunk_miscelms_t runs_dirty;
|
arena_chunk_miscelms_t runs_dirty;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* user-configureable chunk allocation and deallocation functions.
|
* User-configurable chunk allocation and deallocation functions.
|
||||||
*/
|
*/
|
||||||
chunk_alloc_t *chunk_alloc;
|
chunk_alloc_t *chunk_alloc;
|
||||||
chunk_dalloc_t *chunk_dalloc;
|
chunk_dalloc_t *chunk_dalloc;
|
||||||
|
@ -24,7 +24,7 @@ struct extent_node_s {
|
|||||||
/* Total region size. */
|
/* Total region size. */
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
/* Arena from which this extent came, if any */
|
/* Arena from which this extent came, if any. */
|
||||||
arena_t *arena;
|
arena_t *arena;
|
||||||
|
|
||||||
/* True if zero-filled; used by chunk recycling code. */
|
/* True if zero-filled; used by chunk recycling code. */
|
||||||
|
@ -35,13 +35,14 @@ 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
|
||||||
|
@ -302,7 +302,7 @@ typedef unsigned index_t;
|
|||||||
#define ALIGNMENT_CEILING(s, alignment) \
|
#define ALIGNMENT_CEILING(s, alignment) \
|
||||||
(((s) + (alignment - 1)) & (-(alignment)))
|
(((s) + (alignment - 1)) & (-(alignment)))
|
||||||
|
|
||||||
/* Declare a variable length array */
|
/* Declare a variable-length array. */
|
||||||
#if __STDC_VERSION__ < 199901L
|
#if __STDC_VERSION__ < 199901L
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
|
@ -50,7 +50,7 @@ typedef intptr_t ssize_t;
|
|||||||
# define PATH_MAX 1024
|
# define PATH_MAX 1024
|
||||||
# define STDERR_FILENO 2
|
# define STDERR_FILENO 2
|
||||||
# define __func__ __FUNCTION__
|
# define __func__ __FUNCTION__
|
||||||
/* Disable warnings about deprecated system functions */
|
/* Disable warnings about deprecated system functions. */
|
||||||
# pragma warning(disable: 4996)
|
# pragma warning(disable: 4996)
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
* Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
|
* Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
|
||||||
* __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
|
* __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
|
||||||
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
|
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
|
||||||
* functions are defined in libgcc instead of being inlines)
|
* functions are defined in libgcc instead of being inlines).
|
||||||
*/
|
*/
|
||||||
#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4
|
#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4
|
||||||
|
|
||||||
@ -46,7 +46,7 @@
|
|||||||
* Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
|
* Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
|
||||||
* __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
|
* __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
|
||||||
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
|
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
|
||||||
* functions are defined in libgcc instead of being inlines)
|
* functions are defined in libgcc instead of being inlines).
|
||||||
*/
|
*/
|
||||||
#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8
|
#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8
|
||||||
|
|
||||||
@ -201,9 +201,7 @@
|
|||||||
#undef JEMALLOC_PURGE_MADVISE_DONTNEED
|
#undef JEMALLOC_PURGE_MADVISE_DONTNEED
|
||||||
#undef JEMALLOC_PURGE_MADVISE_FREE
|
#undef JEMALLOC_PURGE_MADVISE_FREE
|
||||||
|
|
||||||
/*
|
/* Define if operating system has alloca.h header. */
|
||||||
* Define if operating system has alloca.h header.
|
|
||||||
*/
|
|
||||||
#undef JEMALLOC_HAS_ALLOCA_H
|
#undef JEMALLOC_HAS_ALLOCA_H
|
||||||
|
|
||||||
/* C99 restrict keyword supported. */
|
/* C99 restrict keyword supported. */
|
||||||
@ -221,13 +219,13 @@
|
|||||||
/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
|
/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
|
||||||
#undef LG_SIZEOF_INTMAX_T
|
#undef LG_SIZEOF_INTMAX_T
|
||||||
|
|
||||||
/* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook) */
|
/* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */
|
||||||
#undef JEMALLOC_GLIBC_MALLOC_HOOK
|
#undef JEMALLOC_GLIBC_MALLOC_HOOK
|
||||||
|
|
||||||
/* glibc memalign hook */
|
/* glibc memalign hook. */
|
||||||
#undef JEMALLOC_GLIBC_MEMALIGN_HOOK
|
#undef JEMALLOC_GLIBC_MEMALIGN_HOOK
|
||||||
|
|
||||||
/* adaptive mutex support in pthreads */
|
/* Adaptive mutex support in pthreads. */
|
||||||
#undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
|
#undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
/*
|
/* List definitions. */
|
||||||
* List definitions.
|
|
||||||
*/
|
|
||||||
#define ql_head(a_type) \
|
#define ql_head(a_type) \
|
||||||
struct { \
|
struct { \
|
||||||
a_type *qlh_first; \
|
a_type *qlh_first; \
|
||||||
|
@ -40,8 +40,10 @@ struct { \
|
|||||||
(a_qr_b)->a_field.qre_prev = t; \
|
(a_qr_b)->a_field.qre_prev = t; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* qr_meld() and qr_split() are functionally equivalent, so there's no need to
|
/*
|
||||||
* have two copies of the code. */
|
* qr_meld() and qr_split() are functionally equivalent, so there's no need to
|
||||||
|
* have two copies of the code.
|
||||||
|
*/
|
||||||
#define qr_split(a_qr_a, a_qr_b, a_field) \
|
#define qr_split(a_qr_a, a_qr_b, a_field) \
|
||||||
qr_meld((a_qr_a), (a_qr_b), a_field)
|
qr_meld((a_qr_a), (a_qr_b), a_field)
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ a_prefix##reverse_iter(a_rbt_type *rbtree, a_type *start, \
|
|||||||
* int (a_cmp *)(a_type *a_node, a_type *a_other);
|
* int (a_cmp *)(a_type *a_node, a_type *a_other);
|
||||||
* ^^^^^^
|
* ^^^^^^
|
||||||
* or a_key
|
* or a_key
|
||||||
* Interpretation of comparision function return values:
|
* Interpretation of comparison function return values:
|
||||||
* -1 : a_node < a_other
|
* -1 : a_node < a_other
|
||||||
* 0 : a_node == a_other
|
* 0 : a_node == a_other
|
||||||
* 1 : a_node > a_other
|
* 1 : a_node > a_other
|
||||||
@ -693,7 +693,7 @@ a_prefix##remove(a_rbt_type *rbtree, a_type *node) { \
|
|||||||
rbtn_rotate_left(a_type, a_field, pathp->node, \
|
rbtn_rotate_left(a_type, a_field, pathp->node, \
|
||||||
tnode); \
|
tnode); \
|
||||||
/* Balance restored, but rotation modified */\
|
/* Balance restored, but rotation modified */\
|
||||||
/* subree root, which may actually be the tree */\
|
/* subtree root, which may actually be the tree */\
|
||||||
/* root. */\
|
/* root. */\
|
||||||
if (pathp == path) { \
|
if (pathp == path) { \
|
||||||
/* Set root. */ \
|
/* Set root. */ \
|
||||||
|
@ -69,7 +69,7 @@ struct tcache_bin_s {
|
|||||||
|
|
||||||
struct tcache_s {
|
struct tcache_s {
|
||||||
ql_elm(tcache_t) link; /* Used for aggregating stats. */
|
ql_elm(tcache_t) link; /* Used for aggregating stats. */
|
||||||
uint64_t prof_accumbytes;/* Cleared after arena_prof_accum() */
|
uint64_t prof_accumbytes;/* Cleared after arena_prof_accum(). */
|
||||||
arena_t *arena; /* This thread's arena. */
|
arena_t *arena; /* This thread's arena. */
|
||||||
unsigned ev_cnt; /* Event count since incremental GC. */
|
unsigned ev_cnt; /* Event count since incremental GC. */
|
||||||
index_t next_gc_bin; /* Next bin to GC. */
|
index_t next_gc_bin; /* Next bin to GC. */
|
||||||
|
@ -127,7 +127,7 @@ int get_errno(void);
|
|||||||
|
|
||||||
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_UTIL_C_))
|
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_UTIL_C_))
|
||||||
|
|
||||||
/* Sanity check: */
|
/* Sanity check. */
|
||||||
#if !defined(JEMALLOC_INTERNAL_FFSL) || !defined(JEMALLOC_INTERNAL_FFS)
|
#if !defined(JEMALLOC_INTERNAL_FFSL) || !defined(JEMALLOC_INTERNAL_FFS)
|
||||||
# error Both JEMALLOC_INTERNAL_FFSL && JEMALLOC_INTERNAL_FFS should have been defined by configure
|
# error Both JEMALLOC_INTERNAL_FFSL && JEMALLOC_INTERNAL_FFS should have been defined by configure
|
||||||
#endif
|
#endif
|
||||||
@ -231,7 +231,7 @@ lg_floor(size_t x)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Sets error code */
|
/* Set error code. */
|
||||||
JEMALLOC_INLINE void
|
JEMALLOC_INLINE void
|
||||||
set_errno(int errnum)
|
set_errno(int errnum)
|
||||||
{
|
{
|
||||||
@ -243,7 +243,7 @@ set_errno(int errnum)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get last error code */
|
/* Get last error code. */
|
||||||
JEMALLOC_INLINE int
|
JEMALLOC_INLINE int
|
||||||
get_errno(void)
|
get_errno(void)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ arena_miscelm_to_bits(arena_chunk_map_misc_t *miscelm)
|
|||||||
arena_chunk_t *chunk = CHUNK_ADDR2BASE(miscelm);
|
arena_chunk_t *chunk = CHUNK_ADDR2BASE(miscelm);
|
||||||
size_t pageind = arena_miscelm_to_pageind(miscelm);
|
size_t pageind = arena_miscelm_to_pageind(miscelm);
|
||||||
|
|
||||||
return arena_mapbits_get(chunk, pageind);
|
return (arena_mapbits_get(chunk, pageind));
|
||||||
}
|
}
|
||||||
|
|
||||||
JEMALLOC_INLINE_C int
|
JEMALLOC_INLINE_C int
|
||||||
|
@ -162,7 +162,7 @@ chunk_alloc_core(void *new_addr, size_t size, size_t alignment, bool base,
|
|||||||
if ((ret = chunk_recycle(&chunks_szad_mmap, &chunks_ad_mmap, new_addr,
|
if ((ret = chunk_recycle(&chunks_szad_mmap, &chunks_ad_mmap, new_addr,
|
||||||
size, alignment, base, zero)) != NULL)
|
size, alignment, base, zero)) != NULL)
|
||||||
return (ret);
|
return (ret);
|
||||||
/* requesting an address not implemented for chunk_alloc_mmap */
|
/* Requesting an address not implemented for chunk_alloc_mmap(). */
|
||||||
if (new_addr == NULL &&
|
if (new_addr == NULL &&
|
||||||
(ret = chunk_alloc_mmap(size, alignment, zero)) != NULL)
|
(ret = chunk_alloc_mmap(size, alignment, zero)) != NULL)
|
||||||
return (ret);
|
return (ret);
|
||||||
|
@ -367,10 +367,10 @@ ckh_new(tsd_t *tsd, ckh_t *ckh, size_t minitems, ckh_hash_t *hash,
|
|||||||
ckh->count = 0;
|
ckh->count = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the minimum power of 2 that is large enough to fit aBaseCount
|
* Find the minimum power of 2 that is large enough to fit minitems
|
||||||
* entries. We are using (2+,2) cuckoo hashing, which has an expected
|
* entries. We are using (2+,2) cuckoo hashing, which has an expected
|
||||||
* maximum load factor of at least ~0.86, so 0.75 is a conservative load
|
* maximum load factor of at least ~0.86, so 0.75 is a conservative load
|
||||||
* factor that will typically allow 2^aLgMinItems to fit without ever
|
* factor that will typically allow mincells items to fit without ever
|
||||||
* growing the table.
|
* growing the table.
|
||||||
*/
|
*/
|
||||||
assert(LG_CKH_BUCKET_CELLS > 0);
|
assert(LG_CKH_BUCKET_CELLS > 0);
|
||||||
|
@ -808,7 +808,7 @@ malloc_conf_init(void)
|
|||||||
if (linklen == -1) {
|
if (linklen == -1) {
|
||||||
/* No configuration specified. */
|
/* No configuration specified. */
|
||||||
linklen = 0;
|
linklen = 0;
|
||||||
/* restore errno */
|
/* Restore errno. */
|
||||||
set_errno(saved_errno);
|
set_errno(saved_errno);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* quarantine pointers close to NULL are used to encode state information that
|
* Quarantine pointers close to NULL are used to encode state information that
|
||||||
* is used for cleaning up during thread shutdown.
|
* is used for cleaning up during thread shutdown.
|
||||||
*/
|
*/
|
||||||
#define QUARANTINE_STATE_REINCARNATED ((quarantine_t *)(uintptr_t)1)
|
#define QUARANTINE_STATE_REINCARNATED ((quarantine_t *)(uintptr_t)1)
|
||||||
@ -49,7 +49,7 @@ quarantine_alloc_hook_work(tsd_t *tsd)
|
|||||||
quarantine = quarantine_init(tsd, LG_MAXOBJS_INIT);
|
quarantine = quarantine_init(tsd, LG_MAXOBJS_INIT);
|
||||||
/*
|
/*
|
||||||
* Check again whether quarantine has been initialized, because
|
* Check again whether quarantine has been initialized, because
|
||||||
* qurantine_init() may have triggered recursive initialization.
|
* quarantine_init() may have triggered recursive initialization.
|
||||||
*/
|
*/
|
||||||
if (tsd_quarantine_get(tsd) == NULL)
|
if (tsd_quarantine_get(tsd) == NULL)
|
||||||
tsd_quarantine_set(tsd, quarantine);
|
tsd_quarantine_set(tsd, quarantine);
|
||||||
|
@ -263,7 +263,7 @@ register_zone(void)
|
|||||||
* after the default zone. On OSX < 10.6, there is no purgeable
|
* after the default zone. On OSX < 10.6, there is no purgeable
|
||||||
* zone, so this does nothing. On OSX >= 10.6, unregistering
|
* zone, so this does nothing. On OSX >= 10.6, unregistering
|
||||||
* replaces the purgeable zone with the last registered zone
|
* replaces the purgeable zone with the last registered zone
|
||||||
* above, i.e the default zone. Registering it again then puts
|
* above, i.e. the default zone. Registering it again then puts
|
||||||
* it at the end, obviously after the default zone.
|
* it at the end, obviously after the default zone.
|
||||||
*/
|
*/
|
||||||
if (purgeable_zone) {
|
if (purgeable_zone) {
|
||||||
|
@ -299,7 +299,7 @@ pt_chi2(double p, double df, double ln_gamma_df_2)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Given a value p in [0..1] and Gamma distribution shape and scale parameters,
|
* Given a value p in [0..1] and Gamma distribution shape and scale parameters,
|
||||||
* compute the upper limit on the definite integeral from [0..z] that satisfies
|
* compute the upper limit on the definite integral from [0..z] that satisfies
|
||||||
* p.
|
* p.
|
||||||
*/
|
*/
|
||||||
JEMALLOC_INLINE double
|
JEMALLOC_INLINE double
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Abstraction layer for threading in tests */
|
/* Abstraction layer for threading in tests. */
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
typedef HANDLE thd_t;
|
typedef HANDLE thd_t;
|
||||||
#else
|
#else
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
/*
|
/* Simple timer, for use in benchmark reporting. */
|
||||||
* Simple timer, for use in benchmark reporting.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user