parent
f408643a4c
commit
c0cc5db871
@ -1,16 +1,16 @@
|
|||||||
#ifndef JEMALLOC_INTERNAL_ARENA_TYPES_H
|
#ifndef JEMALLOC_INTERNAL_ARENA_TYPES_H
|
||||||
#define JEMALLOC_INTERNAL_ARENA_TYPES_H
|
#define JEMALLOC_INTERNAL_ARENA_TYPES_H
|
||||||
|
|
||||||
#define LARGE_MINCLASS (ZU(1) << LG_LARGE_MINCLASS)
|
#define LARGE_MINCLASS (ZU(1) << LG_LARGE_MINCLASS)
|
||||||
|
|
||||||
/* Maximum number of regions in one slab. */
|
/* Maximum number of regions in one slab. */
|
||||||
#define LG_SLAB_MAXREGS (LG_PAGE - LG_TINY_MIN)
|
#define LG_SLAB_MAXREGS (LG_PAGE - LG_TINY_MIN)
|
||||||
#define SLAB_MAXREGS (1U << LG_SLAB_MAXREGS)
|
#define SLAB_MAXREGS (1U << LG_SLAB_MAXREGS)
|
||||||
|
|
||||||
/* Default decay time in seconds. */
|
/* Default decay time in seconds. */
|
||||||
#define DECAY_TIME_DEFAULT 10
|
#define DECAY_TIME_DEFAULT 10
|
||||||
/* Number of event ticks between time checks. */
|
/* Number of event ticks between time checks. */
|
||||||
#define DECAY_NTICKS_PER_UPDATE 1000
|
#define DECAY_NTICKS_PER_UPDATE 1000
|
||||||
|
|
||||||
typedef struct arena_slab_data_s arena_slab_data_t;
|
typedef struct arena_slab_data_s arena_slab_data_t;
|
||||||
typedef struct arena_bin_info_s arena_bin_info_t;
|
typedef struct arena_bin_info_s arena_bin_info_t;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* assertion failure.
|
* assertion failure.
|
||||||
*/
|
*/
|
||||||
#ifndef assert
|
#ifndef assert
|
||||||
#define assert(e) do { \
|
#define assert(e) do { \
|
||||||
if (unlikely(config_debug && !(e))) { \
|
if (unlikely(config_debug && !(e))) { \
|
||||||
malloc_printf( \
|
malloc_printf( \
|
||||||
"<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \
|
"<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \
|
||||||
@ -14,7 +14,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef not_reached
|
#ifndef not_reached
|
||||||
#define not_reached() do { \
|
#define not_reached() do { \
|
||||||
if (config_debug) { \
|
if (config_debug) { \
|
||||||
malloc_printf( \
|
malloc_printf( \
|
||||||
"<jemalloc>: %s:%d: Unreachable code reached\n", \
|
"<jemalloc>: %s:%d: Unreachable code reached\n", \
|
||||||
@ -26,7 +26,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef not_implemented
|
#ifndef not_implemented
|
||||||
#define not_implemented() do { \
|
#define not_implemented() do { \
|
||||||
if (config_debug) { \
|
if (config_debug) { \
|
||||||
malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \
|
malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \
|
||||||
__FILE__, __LINE__); \
|
__FILE__, __LINE__); \
|
||||||
@ -36,7 +36,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef assert_not_implemented
|
#ifndef assert_not_implemented
|
||||||
#define assert_not_implemented(e) do { \
|
#define assert_not_implemented(e) do { \
|
||||||
if (unlikely(config_debug && !(e))) { \
|
if (unlikely(config_debug && !(e))) { \
|
||||||
not_implemented(); \
|
not_implemented(); \
|
||||||
} \
|
} \
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
#define JEMALLOC_INTERNAL_ATOMIC_EXTERNS_H
|
#define JEMALLOC_INTERNAL_ATOMIC_EXTERNS_H
|
||||||
|
|
||||||
#if (LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
|
#if (LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
|
||||||
#define atomic_read_u64(p) atomic_add_u64(p, 0)
|
#define atomic_read_u64(p) atomic_add_u64(p, 0)
|
||||||
#endif
|
#endif
|
||||||
#define atomic_read_u32(p) atomic_add_u32(p, 0)
|
#define atomic_read_u32(p) atomic_add_u32(p, 0)
|
||||||
#define atomic_read_p(p) atomic_add_p(p, NULL)
|
#define atomic_read_p(p) atomic_add_p(p, NULL)
|
||||||
#define atomic_read_zu(p) atomic_add_zu(p, 0)
|
#define atomic_read_zu(p) atomic_add_zu(p, 0)
|
||||||
#define atomic_read_u(p) atomic_add_u(p, 0)
|
#define atomic_read_u(p) atomic_add_u(p, 0)
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_ATOMIC_EXTERNS_H */
|
#endif /* JEMALLOC_INTERNAL_ATOMIC_EXTERNS_H */
|
||||||
|
@ -2,18 +2,18 @@
|
|||||||
#define JEMALLOC_INTERNAL_BITMAP_TYPES_H
|
#define JEMALLOC_INTERNAL_BITMAP_TYPES_H
|
||||||
|
|
||||||
/* Maximum bitmap bit count is 2^LG_BITMAP_MAXBITS. */
|
/* Maximum bitmap bit count is 2^LG_BITMAP_MAXBITS. */
|
||||||
#define LG_BITMAP_MAXBITS LG_SLAB_MAXREGS
|
#define LG_BITMAP_MAXBITS LG_SLAB_MAXREGS
|
||||||
#define BITMAP_MAXBITS (ZU(1) << LG_BITMAP_MAXBITS)
|
#define BITMAP_MAXBITS (ZU(1) << LG_BITMAP_MAXBITS)
|
||||||
|
|
||||||
typedef struct bitmap_level_s bitmap_level_t;
|
typedef struct bitmap_level_s bitmap_level_t;
|
||||||
typedef struct bitmap_info_s bitmap_info_t;
|
typedef struct bitmap_info_s bitmap_info_t;
|
||||||
typedef unsigned long bitmap_t;
|
typedef unsigned long bitmap_t;
|
||||||
#define LG_SIZEOF_BITMAP LG_SIZEOF_LONG
|
#define LG_SIZEOF_BITMAP LG_SIZEOF_LONG
|
||||||
|
|
||||||
/* Number of bits per group. */
|
/* Number of bits per group. */
|
||||||
#define LG_BITMAP_GROUP_NBITS (LG_SIZEOF_BITMAP + 3)
|
#define LG_BITMAP_GROUP_NBITS (LG_SIZEOF_BITMAP + 3)
|
||||||
#define BITMAP_GROUP_NBITS (1U << LG_BITMAP_GROUP_NBITS)
|
#define BITMAP_GROUP_NBITS (1U << LG_BITMAP_GROUP_NBITS)
|
||||||
#define BITMAP_GROUP_NBITS_MASK (BITMAP_GROUP_NBITS-1)
|
#define BITMAP_GROUP_NBITS_MASK (BITMAP_GROUP_NBITS-1)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do some analysis on how big the bitmap is before we use a tree. For a brute
|
* Do some analysis on how big the bitmap is before we use a tree. For a brute
|
||||||
@ -25,22 +25,22 @@ typedef unsigned long bitmap_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Number of groups required to store a given number of bits. */
|
/* Number of groups required to store a given number of bits. */
|
||||||
#define BITMAP_BITS2GROUPS(nbits) \
|
#define BITMAP_BITS2GROUPS(nbits) \
|
||||||
(((nbits) + BITMAP_GROUP_NBITS_MASK) >> LG_BITMAP_GROUP_NBITS)
|
(((nbits) + BITMAP_GROUP_NBITS_MASK) >> LG_BITMAP_GROUP_NBITS)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Number of groups required at a particular level for a given number of bits.
|
* Number of groups required at a particular level for a given number of bits.
|
||||||
*/
|
*/
|
||||||
#define BITMAP_GROUPS_L0(nbits) \
|
#define BITMAP_GROUPS_L0(nbits) \
|
||||||
BITMAP_BITS2GROUPS(nbits)
|
BITMAP_BITS2GROUPS(nbits)
|
||||||
#define BITMAP_GROUPS_L1(nbits) \
|
#define BITMAP_GROUPS_L1(nbits) \
|
||||||
BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS(nbits))
|
BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS(nbits))
|
||||||
#define BITMAP_GROUPS_L2(nbits) \
|
#define BITMAP_GROUPS_L2(nbits) \
|
||||||
BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS((nbits))))
|
BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS((nbits))))
|
||||||
#define BITMAP_GROUPS_L3(nbits) \
|
#define BITMAP_GROUPS_L3(nbits) \
|
||||||
BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS( \
|
BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS( \
|
||||||
BITMAP_BITS2GROUPS((nbits)))))
|
BITMAP_BITS2GROUPS((nbits)))))
|
||||||
#define BITMAP_GROUPS_L4(nbits) \
|
#define BITMAP_GROUPS_L4(nbits) \
|
||||||
BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS( \
|
BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS( \
|
||||||
BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS((nbits))))))
|
BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS((nbits))))))
|
||||||
|
|
||||||
@ -48,15 +48,15 @@ typedef unsigned long bitmap_t;
|
|||||||
* Assuming the number of levels, number of groups required for a given number
|
* Assuming the number of levels, number of groups required for a given number
|
||||||
* of bits.
|
* of bits.
|
||||||
*/
|
*/
|
||||||
#define BITMAP_GROUPS_1_LEVEL(nbits) \
|
#define BITMAP_GROUPS_1_LEVEL(nbits) \
|
||||||
BITMAP_GROUPS_L0(nbits)
|
BITMAP_GROUPS_L0(nbits)
|
||||||
#define BITMAP_GROUPS_2_LEVEL(nbits) \
|
#define BITMAP_GROUPS_2_LEVEL(nbits) \
|
||||||
(BITMAP_GROUPS_1_LEVEL(nbits) + BITMAP_GROUPS_L1(nbits))
|
(BITMAP_GROUPS_1_LEVEL(nbits) + BITMAP_GROUPS_L1(nbits))
|
||||||
#define BITMAP_GROUPS_3_LEVEL(nbits) \
|
#define BITMAP_GROUPS_3_LEVEL(nbits) \
|
||||||
(BITMAP_GROUPS_2_LEVEL(nbits) + BITMAP_GROUPS_L2(nbits))
|
(BITMAP_GROUPS_2_LEVEL(nbits) + BITMAP_GROUPS_L2(nbits))
|
||||||
#define BITMAP_GROUPS_4_LEVEL(nbits) \
|
#define BITMAP_GROUPS_4_LEVEL(nbits) \
|
||||||
(BITMAP_GROUPS_3_LEVEL(nbits) + BITMAP_GROUPS_L3(nbits))
|
(BITMAP_GROUPS_3_LEVEL(nbits) + BITMAP_GROUPS_L3(nbits))
|
||||||
#define BITMAP_GROUPS_5_LEVEL(nbits) \
|
#define BITMAP_GROUPS_5_LEVEL(nbits) \
|
||||||
(BITMAP_GROUPS_4_LEVEL(nbits) + BITMAP_GROUPS_L4(nbits))
|
(BITMAP_GROUPS_4_LEVEL(nbits) + BITMAP_GROUPS_L4(nbits))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -92,9 +92,9 @@ typedef unsigned long bitmap_t;
|
|||||||
* unused trailing entries in bitmap_info_t structures; the bitmaps themselves
|
* unused trailing entries in bitmap_info_t structures; the bitmaps themselves
|
||||||
* are not impacted.
|
* are not impacted.
|
||||||
*/
|
*/
|
||||||
#define BITMAP_MAX_LEVELS 5
|
#define BITMAP_MAX_LEVELS 5
|
||||||
|
|
||||||
#define BITMAP_INFO_INITIALIZER(nbits) { \
|
#define BITMAP_INFO_INITIALIZER(nbits) { \
|
||||||
/* nbits. */ \
|
/* nbits. */ \
|
||||||
nbits, \
|
nbits, \
|
||||||
/* nlevels. */ \
|
/* nlevels. */ \
|
||||||
@ -119,9 +119,9 @@ typedef unsigned long bitmap_t;
|
|||||||
|
|
||||||
#else /* BITMAP_USE_TREE */
|
#else /* BITMAP_USE_TREE */
|
||||||
|
|
||||||
#define BITMAP_GROUPS_MAX BITMAP_BITS2GROUPS(BITMAP_MAXBITS)
|
#define BITMAP_GROUPS_MAX BITMAP_BITS2GROUPS(BITMAP_MAXBITS)
|
||||||
|
|
||||||
#define BITMAP_INFO_INITIALIZER(nbits) { \
|
#define BITMAP_INFO_INITIALIZER(nbits) { \
|
||||||
/* nbits. */ \
|
/* nbits. */ \
|
||||||
nbits, \
|
nbits, \
|
||||||
/* ngroups. */ \
|
/* ngroups. */ \
|
||||||
|
@ -9,14 +9,14 @@ typedef void ckh_hash_t (const void *, size_t[2]);
|
|||||||
typedef bool ckh_keycomp_t (const void *, const void *);
|
typedef bool ckh_keycomp_t (const void *, const void *);
|
||||||
|
|
||||||
/* Maintain counters used to get an idea of performance. */
|
/* Maintain counters used to get an idea of performance. */
|
||||||
/* #define CKH_COUNT */
|
/* #define CKH_COUNT */
|
||||||
/* Print counter values in ckh_delete() (requires CKH_COUNT). */
|
/* Print counter values in ckh_delete() (requires CKH_COUNT). */
|
||||||
/* #define CKH_VERBOSE */
|
/* #define CKH_VERBOSE */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There are 2^LG_CKH_BUCKET_CELLS cells in each hash table bucket. Try to fit
|
* There are 2^LG_CKH_BUCKET_CELLS cells in each hash table bucket. Try to fit
|
||||||
* one bucket per L1 cache line.
|
* one bucket per L1 cache line.
|
||||||
*/
|
*/
|
||||||
#define LG_CKH_BUCKET_CELLS (LG_CACHELINE - LG_SIZEOF_PTR - 1)
|
#define LG_CKH_BUCKET_CELLS (LG_CACHELINE - LG_SIZEOF_PTR - 1)
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_CKH_TYPES_H */
|
#endif /* JEMALLOC_INTERNAL_CKH_TYPES_H */
|
||||||
|
@ -13,7 +13,7 @@ void ctl_prefork(tsdn_t *tsdn);
|
|||||||
void ctl_postfork_parent(tsdn_t *tsdn);
|
void ctl_postfork_parent(tsdn_t *tsdn);
|
||||||
void ctl_postfork_child(tsdn_t *tsdn);
|
void ctl_postfork_child(tsdn_t *tsdn);
|
||||||
|
|
||||||
#define xmallctl(name, oldp, oldlenp, newp, newlen) do { \
|
#define xmallctl(name, oldp, oldlenp, newp, newlen) do { \
|
||||||
if (je_mallctl(name, oldp, oldlenp, newp, newlen) \
|
if (je_mallctl(name, oldp, oldlenp, newp, newlen) \
|
||||||
!= 0) { \
|
!= 0) { \
|
||||||
malloc_printf( \
|
malloc_printf( \
|
||||||
@ -23,7 +23,7 @@ void ctl_postfork_child(tsdn_t *tsdn);
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define xmallctlnametomib(name, mibp, miblenp) do { \
|
#define xmallctlnametomib(name, mibp, miblenp) do { \
|
||||||
if (je_mallctlnametomib(name, mibp, miblenp) != 0) { \
|
if (je_mallctlnametomib(name, mibp, miblenp) != 0) { \
|
||||||
malloc_printf("<jemalloc>: Failure in " \
|
malloc_printf("<jemalloc>: Failure in " \
|
||||||
"xmallctlnametomib(\"%s\", ...)\n", name); \
|
"xmallctlnametomib(\"%s\", ...)\n", name); \
|
||||||
@ -31,7 +31,7 @@ void ctl_postfork_child(tsdn_t *tsdn);
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define xmallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) do { \
|
#define xmallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) do { \
|
||||||
if (je_mallctlbymib(mib, miblen, oldp, oldlenp, newp, \
|
if (je_mallctlbymib(mib, miblen, oldp, oldlenp, newp, \
|
||||||
newlen) != 0) { \
|
newlen) != 0) { \
|
||||||
malloc_write( \
|
malloc_write( \
|
||||||
|
@ -8,7 +8,7 @@ typedef enum {
|
|||||||
|
|
||||||
dss_prec_limit = 3
|
dss_prec_limit = 3
|
||||||
} dss_prec_t;
|
} dss_prec_t;
|
||||||
#define DSS_PREC_DEFAULT dss_prec_secondary
|
#define DSS_PREC_DEFAULT dss_prec_secondary
|
||||||
#define DSS_DEFAULT "secondary"
|
#define DSS_DEFAULT "secondary"
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_EXTENT_DSS_TYPES_H */
|
#endif /* JEMALLOC_INTERNAL_EXTENT_DSS_TYPES_H */
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
typedef struct extent_s extent_t;
|
typedef struct extent_s extent_t;
|
||||||
|
|
||||||
#define EXTENT_HOOKS_INITIALIZER NULL
|
#define EXTENT_HOOKS_INITIALIZER NULL
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_EXTENT_TYPES_H */
|
#endif /* JEMALLOC_INTERNAL_EXTENT_TYPES_H */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef JEMALLOC_INTERNAL_H
|
#ifndef JEMALLOC_INTERNAL_H
|
||||||
#define JEMALLOC_INTERNAL_H
|
#define JEMALLOC_INTERNAL_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -12,7 +12,7 @@ extern "C" {
|
|||||||
#include <sys/ktrace.h>
|
#include <sys/ktrace.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define JEMALLOC_NO_DEMANGLE
|
#define JEMALLOC_NO_DEMANGLE
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
# define JEMALLOC_N(n) jet_##n
|
# define JEMALLOC_N(n) jet_##n
|
||||||
# include "jemalloc/internal/public_namespace.h"
|
# include "jemalloc/internal/public_namespace.h"
|
||||||
@ -166,7 +166,7 @@ static const bool have_thp =
|
|||||||
|
|
||||||
#include "jemalloc/internal/ph.h"
|
#include "jemalloc/internal/ph.h"
|
||||||
#ifndef __PGI
|
#ifndef __PGI
|
||||||
#define RB_COMPACT
|
#define RB_COMPACT
|
||||||
#endif
|
#endif
|
||||||
#include "jemalloc/internal/rb.h"
|
#include "jemalloc/internal/rb.h"
|
||||||
#include "jemalloc/internal/qr.h"
|
#include "jemalloc/internal/qr.h"
|
||||||
@ -224,34 +224,34 @@ typedef unsigned szind_t;
|
|||||||
*
|
*
|
||||||
* aaaaaaaa aaaatttt tttttttt 0znnnnnn
|
* aaaaaaaa aaaatttt tttttttt 0znnnnnn
|
||||||
*/
|
*/
|
||||||
#define MALLOCX_ARENA_BITS 12
|
#define MALLOCX_ARENA_BITS 12
|
||||||
#define MALLOCX_TCACHE_BITS 12
|
#define MALLOCX_TCACHE_BITS 12
|
||||||
#define MALLOCX_LG_ALIGN_BITS 6
|
#define MALLOCX_LG_ALIGN_BITS 6
|
||||||
#define MALLOCX_ARENA_SHIFT 20
|
#define MALLOCX_ARENA_SHIFT 20
|
||||||
#define MALLOCX_TCACHE_SHIFT 8
|
#define MALLOCX_TCACHE_SHIFT 8
|
||||||
#define MALLOCX_ARENA_MASK \
|
#define MALLOCX_ARENA_MASK \
|
||||||
(((1 << MALLOCX_ARENA_BITS) - 1) << MALLOCX_ARENA_SHIFT)
|
(((1 << MALLOCX_ARENA_BITS) - 1) << MALLOCX_ARENA_SHIFT)
|
||||||
/* NB: Arena index bias decreases the maximum number of arenas by 1. */
|
/* NB: Arena index bias decreases the maximum number of arenas by 1. */
|
||||||
#define MALLOCX_ARENA_MAX ((1 << MALLOCX_ARENA_BITS) - 2)
|
#define MALLOCX_ARENA_MAX ((1 << MALLOCX_ARENA_BITS) - 2)
|
||||||
#define MALLOCX_TCACHE_MASK \
|
#define MALLOCX_TCACHE_MASK \
|
||||||
(((1 << MALLOCX_TCACHE_BITS) - 1) << MALLOCX_TCACHE_SHIFT)
|
(((1 << MALLOCX_TCACHE_BITS) - 1) << MALLOCX_TCACHE_SHIFT)
|
||||||
#define MALLOCX_TCACHE_MAX ((1 << MALLOCX_TCACHE_BITS) - 3)
|
#define MALLOCX_TCACHE_MAX ((1 << MALLOCX_TCACHE_BITS) - 3)
|
||||||
#define MALLOCX_LG_ALIGN_MASK ((1 << MALLOCX_LG_ALIGN_BITS) - 1)
|
#define MALLOCX_LG_ALIGN_MASK ((1 << MALLOCX_LG_ALIGN_BITS) - 1)
|
||||||
/* Use MALLOCX_ALIGN_GET() if alignment may not be specified in flags. */
|
/* Use MALLOCX_ALIGN_GET() if alignment may not be specified in flags. */
|
||||||
#define MALLOCX_ALIGN_GET_SPECIFIED(flags) \
|
#define MALLOCX_ALIGN_GET_SPECIFIED(flags) \
|
||||||
(ZU(1) << (flags & MALLOCX_LG_ALIGN_MASK))
|
(ZU(1) << (flags & MALLOCX_LG_ALIGN_MASK))
|
||||||
#define MALLOCX_ALIGN_GET(flags) \
|
#define MALLOCX_ALIGN_GET(flags) \
|
||||||
(MALLOCX_ALIGN_GET_SPECIFIED(flags) & (SIZE_T_MAX-1))
|
(MALLOCX_ALIGN_GET_SPECIFIED(flags) & (SIZE_T_MAX-1))
|
||||||
#define MALLOCX_ZERO_GET(flags) \
|
#define MALLOCX_ZERO_GET(flags) \
|
||||||
((bool)(flags & MALLOCX_ZERO))
|
((bool)(flags & MALLOCX_ZERO))
|
||||||
|
|
||||||
#define MALLOCX_TCACHE_GET(flags) \
|
#define MALLOCX_TCACHE_GET(flags) \
|
||||||
(((unsigned)((flags & MALLOCX_TCACHE_MASK) >> MALLOCX_TCACHE_SHIFT)) - 2)
|
(((unsigned)((flags & MALLOCX_TCACHE_MASK) >> MALLOCX_TCACHE_SHIFT)) - 2)
|
||||||
#define MALLOCX_ARENA_GET(flags) \
|
#define MALLOCX_ARENA_GET(flags) \
|
||||||
(((unsigned)(((unsigned)flags) >> MALLOCX_ARENA_SHIFT)) - 1)
|
(((unsigned)(((unsigned)flags) >> MALLOCX_ARENA_SHIFT)) - 1)
|
||||||
|
|
||||||
/* Smallest size class to support. */
|
/* Smallest size class to support. */
|
||||||
#define TINY_MIN (1U << LG_TINY_MIN)
|
#define TINY_MIN (1U << LG_TINY_MIN)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
|
* Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
|
||||||
@ -312,25 +312,25 @@ typedef unsigned szind_t;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define QUANTUM ((size_t)(1U << LG_QUANTUM))
|
#define QUANTUM ((size_t)(1U << LG_QUANTUM))
|
||||||
#define QUANTUM_MASK (QUANTUM - 1)
|
#define QUANTUM_MASK (QUANTUM - 1)
|
||||||
|
|
||||||
/* Return the smallest quantum multiple that is >= a. */
|
/* Return the smallest quantum multiple that is >= a. */
|
||||||
#define QUANTUM_CEILING(a) \
|
#define QUANTUM_CEILING(a) \
|
||||||
(((a) + QUANTUM_MASK) & ~QUANTUM_MASK)
|
(((a) + QUANTUM_MASK) & ~QUANTUM_MASK)
|
||||||
|
|
||||||
#define LONG ((size_t)(1U << LG_SIZEOF_LONG))
|
#define LONG ((size_t)(1U << LG_SIZEOF_LONG))
|
||||||
#define LONG_MASK (LONG - 1)
|
#define LONG_MASK (LONG - 1)
|
||||||
|
|
||||||
/* Return the smallest long multiple that is >= a. */
|
/* Return the smallest long multiple that is >= a. */
|
||||||
#define LONG_CEILING(a) \
|
#define LONG_CEILING(a) \
|
||||||
(((a) + LONG_MASK) & ~LONG_MASK)
|
(((a) + LONG_MASK) & ~LONG_MASK)
|
||||||
|
|
||||||
#define SIZEOF_PTR (1U << LG_SIZEOF_PTR)
|
#define SIZEOF_PTR (1U << LG_SIZEOF_PTR)
|
||||||
#define PTR_MASK (SIZEOF_PTR - 1)
|
#define PTR_MASK (SIZEOF_PTR - 1)
|
||||||
|
|
||||||
/* Return the smallest (void *) multiple that is >= a. */
|
/* Return the smallest (void *) multiple that is >= a. */
|
||||||
#define PTR_CEILING(a) \
|
#define PTR_CEILING(a) \
|
||||||
(((a) + PTR_MASK) & ~PTR_MASK)
|
(((a) + PTR_MASK) & ~PTR_MASK)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -340,24 +340,24 @@ typedef unsigned szind_t;
|
|||||||
* CACHELINE cannot be based on LG_CACHELINE because __declspec(align()) can
|
* CACHELINE cannot be based on LG_CACHELINE because __declspec(align()) can
|
||||||
* only handle raw constants.
|
* only handle raw constants.
|
||||||
*/
|
*/
|
||||||
#define LG_CACHELINE 6
|
#define LG_CACHELINE 6
|
||||||
#define CACHELINE 64
|
#define CACHELINE 64
|
||||||
#define CACHELINE_MASK (CACHELINE - 1)
|
#define CACHELINE_MASK (CACHELINE - 1)
|
||||||
|
|
||||||
/* Return the smallest cacheline multiple that is >= s. */
|
/* Return the smallest cacheline multiple that is >= s. */
|
||||||
#define CACHELINE_CEILING(s) \
|
#define CACHELINE_CEILING(s) \
|
||||||
(((s) + CACHELINE_MASK) & ~CACHELINE_MASK)
|
(((s) + CACHELINE_MASK) & ~CACHELINE_MASK)
|
||||||
|
|
||||||
/* Return the nearest aligned address at or below a. */
|
/* Return the nearest aligned address at or below a. */
|
||||||
#define ALIGNMENT_ADDR2BASE(a, alignment) \
|
#define ALIGNMENT_ADDR2BASE(a, alignment) \
|
||||||
((void *)((uintptr_t)(a) & ((~(alignment)) + 1)))
|
((void *)((uintptr_t)(a) & ((~(alignment)) + 1)))
|
||||||
|
|
||||||
/* Return the offset between a and the nearest aligned address at or below a. */
|
/* Return the offset between a and the nearest aligned address at or below a. */
|
||||||
#define ALIGNMENT_ADDR2OFFSET(a, alignment) \
|
#define ALIGNMENT_ADDR2OFFSET(a, alignment) \
|
||||||
((size_t)((uintptr_t)(a) & (alignment - 1)))
|
((size_t)((uintptr_t)(a) & (alignment - 1)))
|
||||||
|
|
||||||
/* Return the smallest alignment multiple that is >= s. */
|
/* Return the smallest alignment multiple that is >= s. */
|
||||||
#define ALIGNMENT_CEILING(s, alignment) \
|
#define ALIGNMENT_CEILING(s, alignment) \
|
||||||
(((s) + (alignment - 1)) & ((~(alignment)) + 1))
|
(((s) + (alignment - 1)) & ((~(alignment)) + 1))
|
||||||
|
|
||||||
/* Declare a variable-length array. */
|
/* Declare a variable-length array. */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef JEMALLOC_INTERNAL_DECLS_H
|
#ifndef JEMALLOC_INTERNAL_DECLS_H
|
||||||
#define JEMALLOC_INTERNAL_DECLS_H
|
#define JEMALLOC_INTERNAL_DECLS_H
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef JEMALLOC_INTERNAL_DEFS_H_
|
#ifndef JEMALLOC_INTERNAL_DEFS_H_
|
||||||
#define JEMALLOC_INTERNAL_DEFS_H_
|
#define JEMALLOC_INTERNAL_DEFS_H_
|
||||||
/*
|
/*
|
||||||
* If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all
|
* If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all
|
||||||
* public APIs to be prefixed. This makes it possible, with some care, to use
|
* public APIs to be prefixed. This makes it possible, with some care, to use
|
||||||
|
@ -41,15 +41,15 @@
|
|||||||
# define UNUSED
|
# define UNUSED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ZU(z) ((size_t)z)
|
#define ZU(z) ((size_t)z)
|
||||||
#define ZI(z) ((ssize_t)z)
|
#define ZI(z) ((ssize_t)z)
|
||||||
#define QU(q) ((uint64_t)q)
|
#define QU(q) ((uint64_t)q)
|
||||||
#define QI(q) ((int64_t)q)
|
#define QI(q) ((int64_t)q)
|
||||||
|
|
||||||
#define KZU(z) ZU(z##ULL)
|
#define KZU(z) ZU(z##ULL)
|
||||||
#define KZI(z) ZI(z##LL)
|
#define KZI(z) ZI(z##LL)
|
||||||
#define KQU(q) QU(q##ULL)
|
#define KQU(q) QU(q##ULL)
|
||||||
#define KQI(q) QI(q##LL)
|
#define KQI(q) QI(q##LL)
|
||||||
|
|
||||||
#ifndef __DECONST
|
#ifndef __DECONST
|
||||||
# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
|
# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
typedef struct nstime_s nstime_t;
|
typedef struct nstime_s nstime_t;
|
||||||
|
|
||||||
/* Maximum supported number of seconds (~584 years). */
|
/* Maximum supported number of seconds (~584 years). */
|
||||||
#define NSTIME_SEC_MAX KQU(18446744072)
|
#define NSTIME_SEC_MAX KQU(18446744072)
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_NSTIME_TYPES_H */
|
#endif /* JEMALLOC_INTERNAL_NSTIME_TYPES_H */
|
||||||
|
@ -5,23 +5,23 @@
|
|||||||
#ifdef PAGE_MASK
|
#ifdef PAGE_MASK
|
||||||
# undef PAGE_MASK
|
# undef PAGE_MASK
|
||||||
#endif
|
#endif
|
||||||
#define PAGE ((size_t)(1U << LG_PAGE))
|
#define PAGE ((size_t)(1U << LG_PAGE))
|
||||||
#define PAGE_MASK ((size_t)(PAGE - 1))
|
#define PAGE_MASK ((size_t)(PAGE - 1))
|
||||||
/* Return the page base address for the page containing address a. */
|
/* Return the page base address for the page containing address a. */
|
||||||
#define PAGE_ADDR2BASE(a) \
|
#define PAGE_ADDR2BASE(a) \
|
||||||
((void *)((uintptr_t)(a) & ~PAGE_MASK))
|
((void *)((uintptr_t)(a) & ~PAGE_MASK))
|
||||||
/* Return the smallest pagesize multiple that is >= s. */
|
/* Return the smallest pagesize multiple that is >= s. */
|
||||||
#define PAGE_CEILING(s) \
|
#define PAGE_CEILING(s) \
|
||||||
(((s) + PAGE_MASK) & ~PAGE_MASK)
|
(((s) + PAGE_MASK) & ~PAGE_MASK)
|
||||||
|
|
||||||
/* Huge page size. LG_HUGEPAGE is determined by the configure script. */
|
/* Huge page size. LG_HUGEPAGE is determined by the configure script. */
|
||||||
#define HUGEPAGE ((size_t)(1U << LG_HUGEPAGE))
|
#define HUGEPAGE ((size_t)(1U << LG_HUGEPAGE))
|
||||||
#define HUGEPAGE_MASK ((size_t)(HUGEPAGE - 1))
|
#define HUGEPAGE_MASK ((size_t)(HUGEPAGE - 1))
|
||||||
/* Return the huge page base address for the huge page containing address a. */
|
/* Return the huge page base address for the huge page containing address a. */
|
||||||
#define HUGEPAGE_ADDR2BASE(a) \
|
#define HUGEPAGE_ADDR2BASE(a) \
|
||||||
((void *)((uintptr_t)(a) & ~HUGEPAGE_MASK))
|
((void *)((uintptr_t)(a) & ~HUGEPAGE_MASK))
|
||||||
/* Return the smallest pagesize multiple that is >= s. */
|
/* Return the smallest pagesize multiple that is >= s. */
|
||||||
#define HUGEPAGE_CEILING(s) \
|
#define HUGEPAGE_CEILING(s) \
|
||||||
(((s) + HUGEPAGE_MASK) & ~HUGEPAGE_MASK)
|
(((s) + HUGEPAGE_MASK) & ~HUGEPAGE_MASK)
|
||||||
|
|
||||||
/* PAGES_CAN_PURGE_LAZY is defined if lazy purging is supported. */
|
/* PAGES_CAN_PURGE_LAZY is defined if lazy purging is supported. */
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PH_H_
|
#ifndef PH_H_
|
||||||
#define PH_H_
|
#define PH_H_
|
||||||
|
|
||||||
/* Node structure. */
|
/* Node structure. */
|
||||||
#define phn(a_type) \
|
#define phn(a_type) \
|
||||||
struct { \
|
struct { \
|
||||||
a_type *phn_prev; \
|
a_type *phn_prev; \
|
||||||
a_type *phn_next; \
|
a_type *phn_next; \
|
||||||
@ -24,31 +24,31 @@ struct { \
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Root structure. */
|
/* Root structure. */
|
||||||
#define ph(a_type) \
|
#define ph(a_type) \
|
||||||
struct { \
|
struct { \
|
||||||
a_type *ph_root; \
|
a_type *ph_root; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Internal utility macros. */
|
/* Internal utility macros. */
|
||||||
#define phn_lchild_get(a_type, a_field, a_phn) \
|
#define phn_lchild_get(a_type, a_field, a_phn) \
|
||||||
(a_phn->a_field.phn_lchild)
|
(a_phn->a_field.phn_lchild)
|
||||||
#define phn_lchild_set(a_type, a_field, a_phn, a_lchild) do { \
|
#define phn_lchild_set(a_type, a_field, a_phn, a_lchild) do { \
|
||||||
a_phn->a_field.phn_lchild = a_lchild; \
|
a_phn->a_field.phn_lchild = a_lchild; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define phn_next_get(a_type, a_field, a_phn) \
|
#define phn_next_get(a_type, a_field, a_phn) \
|
||||||
(a_phn->a_field.phn_next)
|
(a_phn->a_field.phn_next)
|
||||||
#define phn_prev_set(a_type, a_field, a_phn, a_prev) do { \
|
#define phn_prev_set(a_type, a_field, a_phn, a_prev) do { \
|
||||||
a_phn->a_field.phn_prev = a_prev; \
|
a_phn->a_field.phn_prev = a_prev; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define phn_prev_get(a_type, a_field, a_phn) \
|
#define phn_prev_get(a_type, a_field, a_phn) \
|
||||||
(a_phn->a_field.phn_prev)
|
(a_phn->a_field.phn_prev)
|
||||||
#define phn_next_set(a_type, a_field, a_phn, a_next) do { \
|
#define phn_next_set(a_type, a_field, a_phn, a_next) do { \
|
||||||
a_phn->a_field.phn_next = a_next; \
|
a_phn->a_field.phn_next = a_next; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define phn_merge_ordered(a_type, a_field, a_phn0, a_phn1, a_cmp) do { \
|
#define phn_merge_ordered(a_type, a_field, a_phn0, a_phn1, a_cmp) do { \
|
||||||
a_type *phn0child; \
|
a_type *phn0child; \
|
||||||
\
|
\
|
||||||
assert(a_phn0 != NULL); \
|
assert(a_phn0 != NULL); \
|
||||||
@ -64,7 +64,7 @@ struct { \
|
|||||||
phn_lchild_set(a_type, a_field, a_phn0, a_phn1); \
|
phn_lchild_set(a_type, a_field, a_phn0, a_phn1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define phn_merge(a_type, a_field, a_phn0, a_phn1, a_cmp, r_phn) do { \
|
#define phn_merge(a_type, a_field, a_phn0, a_phn1, a_cmp, r_phn) do { \
|
||||||
if (a_phn0 == NULL) { \
|
if (a_phn0 == NULL) { \
|
||||||
r_phn = a_phn1; \
|
r_phn = a_phn1; \
|
||||||
} else if (a_phn1 == NULL) { \
|
} else if (a_phn1 == NULL) { \
|
||||||
@ -80,7 +80,7 @@ struct { \
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ph_merge_siblings(a_type, a_field, a_phn, a_cmp, r_phn) do { \
|
#define ph_merge_siblings(a_type, a_field, a_phn, a_cmp, r_phn) do { \
|
||||||
a_type *head = NULL; \
|
a_type *head = NULL; \
|
||||||
a_type *tail = NULL; \
|
a_type *tail = NULL; \
|
||||||
a_type *phn0 = a_phn; \
|
a_type *phn0 = a_phn; \
|
||||||
@ -167,7 +167,7 @@ struct { \
|
|||||||
r_phn = phn0; \
|
r_phn = phn0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ph_merge_aux(a_type, a_field, a_ph, a_cmp) do { \
|
#define ph_merge_aux(a_type, a_field, a_ph, a_cmp) do { \
|
||||||
a_type *phn = phn_next_get(a_type, a_field, a_ph->ph_root); \
|
a_type *phn = phn_next_get(a_type, a_field, a_ph->ph_root); \
|
||||||
if (phn != NULL) { \
|
if (phn != NULL) { \
|
||||||
phn_prev_set(a_type, a_field, a_ph->ph_root, NULL); \
|
phn_prev_set(a_type, a_field, a_ph->ph_root, NULL); \
|
||||||
@ -180,7 +180,7 @@ struct { \
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ph_merge_children(a_type, a_field, a_phn, a_cmp, r_phn) do { \
|
#define ph_merge_children(a_type, a_field, a_phn, a_cmp, r_phn) do { \
|
||||||
a_type *lchild = phn_lchild_get(a_type, a_field, a_phn); \
|
a_type *lchild = phn_lchild_get(a_type, a_field, a_phn); \
|
||||||
if (lchild == NULL) { \
|
if (lchild == NULL) { \
|
||||||
r_phn = NULL; \
|
r_phn = NULL; \
|
||||||
@ -194,7 +194,7 @@ struct { \
|
|||||||
* The ph_proto() macro generates function prototypes that correspond to the
|
* The ph_proto() macro generates function prototypes that correspond to the
|
||||||
* functions generated by an equivalently parameterized call to ph_gen().
|
* functions generated by an equivalently parameterized call to ph_gen().
|
||||||
*/
|
*/
|
||||||
#define ph_proto(a_attr, a_prefix, a_ph_type, a_type) \
|
#define ph_proto(a_attr, a_prefix, a_ph_type, a_type) \
|
||||||
a_attr void a_prefix##new(a_ph_type *ph); \
|
a_attr void a_prefix##new(a_ph_type *ph); \
|
||||||
a_attr bool a_prefix##empty(a_ph_type *ph); \
|
a_attr bool a_prefix##empty(a_ph_type *ph); \
|
||||||
a_attr a_type *a_prefix##first(a_ph_type *ph); \
|
a_attr a_type *a_prefix##first(a_ph_type *ph); \
|
||||||
@ -206,7 +206,7 @@ a_attr void a_prefix##remove(a_ph_type *ph, a_type *phn);
|
|||||||
* The ph_gen() macro generates a type-specific pairing heap implementation,
|
* The ph_gen() macro generates a type-specific pairing heap implementation,
|
||||||
* based on the above cpp macros.
|
* based on the above cpp macros.
|
||||||
*/
|
*/
|
||||||
#define ph_gen(a_attr, a_prefix, a_ph_type, a_type, a_field, a_cmp) \
|
#define ph_gen(a_attr, a_prefix, a_ph_type, a_type, a_field, a_cmp) \
|
||||||
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))); \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
for symbol in `cat $1` ; do
|
for symbol in `cat $1` ; do
|
||||||
echo "#define ${symbol} JEMALLOC_N(${symbol})"
|
echo "#define ${symbol} JEMALLOC_N(${symbol})"
|
||||||
done
|
done
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
* bits.
|
* bits.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PRNG_A_32 UINT32_C(1103515241)
|
#define PRNG_A_32 UINT32_C(1103515241)
|
||||||
#define PRNG_C_32 UINT32_C(12347)
|
#define PRNG_C_32 UINT32_C(12347)
|
||||||
|
|
||||||
#define PRNG_A_64 UINT64_C(6364136223846793005)
|
#define PRNG_A_64 UINT64_C(6364136223846793005)
|
||||||
#define PRNG_C_64 UINT64_C(1442695040888963407)
|
#define PRNG_C_64 UINT64_C(1442695040888963407)
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_PRNG_TYPES_H */
|
#endif /* JEMALLOC_INTERNAL_PRNG_TYPES_H */
|
||||||
|
@ -13,43 +13,43 @@ typedef struct prof_tdata_s prof_tdata_t;
|
|||||||
#else
|
#else
|
||||||
# define PROF_PREFIX_DEFAULT ""
|
# define PROF_PREFIX_DEFAULT ""
|
||||||
#endif
|
#endif
|
||||||
#define LG_PROF_SAMPLE_DEFAULT 19
|
#define LG_PROF_SAMPLE_DEFAULT 19
|
||||||
#define LG_PROF_INTERVAL_DEFAULT -1
|
#define LG_PROF_INTERVAL_DEFAULT -1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hard limit on stack backtrace depth. The version of prof_backtrace() that
|
* Hard limit on stack backtrace depth. The version of prof_backtrace() that
|
||||||
* is based on __builtin_return_address() necessarily has a hard-coded number
|
* is based on __builtin_return_address() necessarily has a hard-coded number
|
||||||
* of backtrace frame handlers, and should be kept in sync with this setting.
|
* of backtrace frame handlers, and should be kept in sync with this setting.
|
||||||
*/
|
*/
|
||||||
#define PROF_BT_MAX 128
|
#define PROF_BT_MAX 128
|
||||||
|
|
||||||
/* Initial hash table size. */
|
/* Initial hash table size. */
|
||||||
#define PROF_CKH_MINITEMS 64
|
#define PROF_CKH_MINITEMS 64
|
||||||
|
|
||||||
/* Size of memory buffer to use when writing dump files. */
|
/* Size of memory buffer to use when writing dump files. */
|
||||||
#define PROF_DUMP_BUFSIZE 65536
|
#define PROF_DUMP_BUFSIZE 65536
|
||||||
|
|
||||||
/* Size of stack-allocated buffer used by prof_printf(). */
|
/* Size of stack-allocated buffer used by prof_printf(). */
|
||||||
#define PROF_PRINTF_BUFSIZE 128
|
#define PROF_PRINTF_BUFSIZE 128
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Number of mutexes shared among all gctx's. No space is allocated for these
|
* Number of mutexes shared among all gctx's. No space is allocated for these
|
||||||
* unless profiling is enabled, so it's okay to over-provision.
|
* unless profiling is enabled, so it's okay to over-provision.
|
||||||
*/
|
*/
|
||||||
#define PROF_NCTX_LOCKS 1024
|
#define PROF_NCTX_LOCKS 1024
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Number of mutexes shared among all tdata's. No space is allocated for these
|
* Number of mutexes shared among all tdata's. No space is allocated for these
|
||||||
* unless profiling is enabled, so it's okay to over-provision.
|
* unless profiling is enabled, so it's okay to over-provision.
|
||||||
*/
|
*/
|
||||||
#define PROF_NTDATA_LOCKS 256
|
#define PROF_NTDATA_LOCKS 256
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* prof_tdata pointers close to NULL are used to encode state information that
|
* prof_tdata 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 PROF_TDATA_STATE_REINCARNATED ((prof_tdata_t *)(uintptr_t)1)
|
#define PROF_TDATA_STATE_REINCARNATED ((prof_tdata_t *)(uintptr_t)1)
|
||||||
#define PROF_TDATA_STATE_PURGATORY ((prof_tdata_t *)(uintptr_t)2)
|
#define PROF_TDATA_STATE_PURGATORY ((prof_tdata_t *)(uintptr_t)2)
|
||||||
#define PROF_TDATA_STATE_MAX PROF_TDATA_STATE_PURGATORY
|
#define PROF_TDATA_STATE_MAX PROF_TDATA_STATE_PURGATORY
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_PROF_TYPES_H */
|
#endif /* JEMALLOC_INTERNAL_PROF_TYPES_H */
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
for nm in `cat $1` ; do
|
for nm in `cat $1` ; do
|
||||||
n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'`
|
n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'`
|
||||||
echo "#define je_${n} JEMALLOC_N(${n})"
|
echo "#define je_${n} JEMALLOC_N(${n})"
|
||||||
done
|
done
|
||||||
|
@ -2,61 +2,61 @@
|
|||||||
#define JEMALLOC_INTERNAL_QL_H
|
#define JEMALLOC_INTERNAL_QL_H
|
||||||
|
|
||||||
/* List definitions. */
|
/* List definitions. */
|
||||||
#define ql_head(a_type) \
|
#define ql_head(a_type) \
|
||||||
struct { \
|
struct { \
|
||||||
a_type *qlh_first; \
|
a_type *qlh_first; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ql_head_initializer(a_head) {NULL}
|
#define ql_head_initializer(a_head) {NULL}
|
||||||
|
|
||||||
#define ql_elm(a_type) qr(a_type)
|
#define ql_elm(a_type) qr(a_type)
|
||||||
|
|
||||||
/* List functions. */
|
/* List functions. */
|
||||||
#define ql_new(a_head) do { \
|
#define ql_new(a_head) do { \
|
||||||
(a_head)->qlh_first = NULL; \
|
(a_head)->qlh_first = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ql_elm_new(a_elm, a_field) qr_new((a_elm), a_field)
|
#define ql_elm_new(a_elm, a_field) qr_new((a_elm), a_field)
|
||||||
|
|
||||||
#define ql_first(a_head) ((a_head)->qlh_first)
|
#define ql_first(a_head) ((a_head)->qlh_first)
|
||||||
|
|
||||||
#define ql_last(a_head, a_field) \
|
#define ql_last(a_head, a_field) \
|
||||||
((ql_first(a_head) != NULL) \
|
((ql_first(a_head) != NULL) \
|
||||||
? qr_prev(ql_first(a_head), a_field) : NULL)
|
? qr_prev(ql_first(a_head), a_field) : NULL)
|
||||||
|
|
||||||
#define ql_next(a_head, a_elm, a_field) \
|
#define ql_next(a_head, a_elm, a_field) \
|
||||||
((ql_last(a_head, a_field) != (a_elm)) \
|
((ql_last(a_head, a_field) != (a_elm)) \
|
||||||
? qr_next((a_elm), a_field) : NULL)
|
? qr_next((a_elm), a_field) : NULL)
|
||||||
|
|
||||||
#define ql_prev(a_head, a_elm, a_field) \
|
#define ql_prev(a_head, a_elm, a_field) \
|
||||||
((ql_first(a_head) != (a_elm)) ? qr_prev((a_elm), a_field) \
|
((ql_first(a_head) != (a_elm)) ? qr_prev((a_elm), a_field) \
|
||||||
: NULL)
|
: NULL)
|
||||||
|
|
||||||
#define ql_before_insert(a_head, a_qlelm, a_elm, a_field) do { \
|
#define ql_before_insert(a_head, a_qlelm, a_elm, a_field) do { \
|
||||||
qr_before_insert((a_qlelm), (a_elm), a_field); \
|
qr_before_insert((a_qlelm), (a_elm), a_field); \
|
||||||
if (ql_first(a_head) == (a_qlelm)) { \
|
if (ql_first(a_head) == (a_qlelm)) { \
|
||||||
ql_first(a_head) = (a_elm); \
|
ql_first(a_head) = (a_elm); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ql_after_insert(a_qlelm, a_elm, a_field) \
|
#define ql_after_insert(a_qlelm, a_elm, a_field) \
|
||||||
qr_after_insert((a_qlelm), (a_elm), a_field)
|
qr_after_insert((a_qlelm), (a_elm), a_field)
|
||||||
|
|
||||||
#define ql_head_insert(a_head, a_elm, a_field) do { \
|
#define ql_head_insert(a_head, a_elm, a_field) do { \
|
||||||
if (ql_first(a_head) != NULL) { \
|
if (ql_first(a_head) != NULL) { \
|
||||||
qr_before_insert(ql_first(a_head), (a_elm), a_field); \
|
qr_before_insert(ql_first(a_head), (a_elm), a_field); \
|
||||||
} \
|
} \
|
||||||
ql_first(a_head) = (a_elm); \
|
ql_first(a_head) = (a_elm); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ql_tail_insert(a_head, a_elm, a_field) do { \
|
#define ql_tail_insert(a_head, a_elm, a_field) do { \
|
||||||
if (ql_first(a_head) != NULL) { \
|
if (ql_first(a_head) != NULL) { \
|
||||||
qr_before_insert(ql_first(a_head), (a_elm), a_field); \
|
qr_before_insert(ql_first(a_head), (a_elm), a_field); \
|
||||||
} \
|
} \
|
||||||
ql_first(a_head) = qr_next((a_elm), a_field); \
|
ql_first(a_head) = qr_next((a_elm), a_field); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ql_remove(a_head, a_elm, a_field) do { \
|
#define ql_remove(a_head, a_elm, a_field) do { \
|
||||||
if (ql_first(a_head) == (a_elm)) { \
|
if (ql_first(a_head) == (a_elm)) { \
|
||||||
ql_first(a_head) = qr_next(ql_first(a_head), a_field); \
|
ql_first(a_head) = qr_next(ql_first(a_head), a_field); \
|
||||||
} \
|
} \
|
||||||
@ -67,20 +67,20 @@ struct { \
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ql_head_remove(a_head, a_type, a_field) do { \
|
#define ql_head_remove(a_head, a_type, a_field) do { \
|
||||||
a_type *t = ql_first(a_head); \
|
a_type *t = ql_first(a_head); \
|
||||||
ql_remove((a_head), t, a_field); \
|
ql_remove((a_head), t, a_field); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ql_tail_remove(a_head, a_type, a_field) do { \
|
#define ql_tail_remove(a_head, a_type, a_field) do { \
|
||||||
a_type *t = ql_last(a_head, a_field); \
|
a_type *t = ql_last(a_head, a_field); \
|
||||||
ql_remove((a_head), t, a_field); \
|
ql_remove((a_head), t, a_field); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ql_foreach(a_var, a_head, a_field) \
|
#define ql_foreach(a_var, a_head, a_field) \
|
||||||
qr_foreach((a_var), ql_first(a_head), a_field)
|
qr_foreach((a_var), ql_first(a_head), a_field)
|
||||||
|
|
||||||
#define ql_reverse_foreach(a_var, a_head, a_field) \
|
#define ql_reverse_foreach(a_var, a_head, a_field) \
|
||||||
qr_reverse_foreach((a_var), ql_first(a_head), a_field)
|
qr_reverse_foreach((a_var), ql_first(a_head), a_field)
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_QL_H */
|
#endif /* JEMALLOC_INTERNAL_QL_H */
|
||||||
|
@ -2,37 +2,37 @@
|
|||||||
#define JEMALLOC_INTERNAL_QR_H
|
#define JEMALLOC_INTERNAL_QR_H
|
||||||
|
|
||||||
/* Ring definitions. */
|
/* Ring definitions. */
|
||||||
#define qr(a_type) \
|
#define qr(a_type) \
|
||||||
struct { \
|
struct { \
|
||||||
a_type *qre_next; \
|
a_type *qre_next; \
|
||||||
a_type *qre_prev; \
|
a_type *qre_prev; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ring functions. */
|
/* Ring functions. */
|
||||||
#define qr_new(a_qr, a_field) do { \
|
#define qr_new(a_qr, a_field) do { \
|
||||||
(a_qr)->a_field.qre_next = (a_qr); \
|
(a_qr)->a_field.qre_next = (a_qr); \
|
||||||
(a_qr)->a_field.qre_prev = (a_qr); \
|
(a_qr)->a_field.qre_prev = (a_qr); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define qr_next(a_qr, a_field) ((a_qr)->a_field.qre_next)
|
#define qr_next(a_qr, a_field) ((a_qr)->a_field.qre_next)
|
||||||
|
|
||||||
#define qr_prev(a_qr, a_field) ((a_qr)->a_field.qre_prev)
|
#define qr_prev(a_qr, a_field) ((a_qr)->a_field.qre_prev)
|
||||||
|
|
||||||
#define qr_before_insert(a_qrelm, a_qr, a_field) do { \
|
#define qr_before_insert(a_qrelm, a_qr, a_field) do { \
|
||||||
(a_qr)->a_field.qre_prev = (a_qrelm)->a_field.qre_prev; \
|
(a_qr)->a_field.qre_prev = (a_qrelm)->a_field.qre_prev; \
|
||||||
(a_qr)->a_field.qre_next = (a_qrelm); \
|
(a_qr)->a_field.qre_next = (a_qrelm); \
|
||||||
(a_qr)->a_field.qre_prev->a_field.qre_next = (a_qr); \
|
(a_qr)->a_field.qre_prev->a_field.qre_next = (a_qr); \
|
||||||
(a_qrelm)->a_field.qre_prev = (a_qr); \
|
(a_qrelm)->a_field.qre_prev = (a_qr); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define qr_after_insert(a_qrelm, a_qr, a_field) do { \
|
#define qr_after_insert(a_qrelm, a_qr, a_field) do { \
|
||||||
(a_qr)->a_field.qre_next = (a_qrelm)->a_field.qre_next; \
|
(a_qr)->a_field.qre_next = (a_qrelm)->a_field.qre_next; \
|
||||||
(a_qr)->a_field.qre_prev = (a_qrelm); \
|
(a_qr)->a_field.qre_prev = (a_qrelm); \
|
||||||
(a_qr)->a_field.qre_next->a_field.qre_prev = (a_qr); \
|
(a_qr)->a_field.qre_next->a_field.qre_prev = (a_qr); \
|
||||||
(a_qrelm)->a_field.qre_next = (a_qr); \
|
(a_qrelm)->a_field.qre_next = (a_qr); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define qr_meld(a_qr_a, a_qr_b, a_type, a_field) do { \
|
#define qr_meld(a_qr_a, a_qr_b, a_type, a_field) do { \
|
||||||
a_type *t; \
|
a_type *t; \
|
||||||
(a_qr_a)->a_field.qre_prev->a_field.qre_next = (a_qr_b); \
|
(a_qr_a)->a_field.qre_prev->a_field.qre_next = (a_qr_b); \
|
||||||
(a_qr_b)->a_field.qre_prev->a_field.qre_next = (a_qr_a); \
|
(a_qr_b)->a_field.qre_prev->a_field.qre_next = (a_qr_a); \
|
||||||
@ -45,10 +45,10 @@ struct { \
|
|||||||
* qr_meld() and qr_split() are functionally equivalent, so there's no need to
|
* qr_meld() and qr_split() are functionally equivalent, so there's no need to
|
||||||
* have two copies of the code.
|
* have two copies of the code.
|
||||||
*/
|
*/
|
||||||
#define qr_split(a_qr_a, a_qr_b, a_type, a_field) \
|
#define qr_split(a_qr_a, a_qr_b, a_type, a_field) \
|
||||||
qr_meld((a_qr_a), (a_qr_b), a_type, a_field)
|
qr_meld((a_qr_a), (a_qr_b), a_type, a_field)
|
||||||
|
|
||||||
#define qr_remove(a_qr, a_field) do { \
|
#define qr_remove(a_qr, a_field) do { \
|
||||||
(a_qr)->a_field.qre_prev->a_field.qre_next \
|
(a_qr)->a_field.qre_prev->a_field.qre_next \
|
||||||
= (a_qr)->a_field.qre_next; \
|
= (a_qr)->a_field.qre_next; \
|
||||||
(a_qr)->a_field.qre_next->a_field.qre_prev \
|
(a_qr)->a_field.qre_next->a_field.qre_prev \
|
||||||
@ -57,13 +57,13 @@ struct { \
|
|||||||
(a_qr)->a_field.qre_prev = (a_qr); \
|
(a_qr)->a_field.qre_prev = (a_qr); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define qr_foreach(var, a_qr, a_field) \
|
#define qr_foreach(var, a_qr, a_field) \
|
||||||
for ((var) = (a_qr); \
|
for ((var) = (a_qr); \
|
||||||
(var) != NULL; \
|
(var) != NULL; \
|
||||||
(var) = (((var)->a_field.qre_next != (a_qr)) \
|
(var) = (((var)->a_field.qre_next != (a_qr)) \
|
||||||
? (var)->a_field.qre_next : NULL))
|
? (var)->a_field.qre_next : NULL))
|
||||||
|
|
||||||
#define qr_reverse_foreach(var, a_qr, a_field) \
|
#define qr_reverse_foreach(var, a_qr, a_field) \
|
||||||
for ((var) = ((a_qr) != NULL) ? qr_prev(a_qr, a_field) : NULL; \
|
for ((var) = ((a_qr) != NULL) ? qr_prev(a_qr, a_field) : NULL; \
|
||||||
(var) != NULL; \
|
(var) != NULL; \
|
||||||
(var) = (((var) != (a_qr)) \
|
(var) = (((var) != (a_qr)) \
|
||||||
|
@ -20,17 +20,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RB_H_
|
#ifndef RB_H_
|
||||||
#define RB_H_
|
#define RB_H_
|
||||||
|
|
||||||
#ifdef RB_COMPACT
|
#ifdef RB_COMPACT
|
||||||
/* Node structure. */
|
/* Node structure. */
|
||||||
#define rb_node(a_type) \
|
#define rb_node(a_type) \
|
||||||
struct { \
|
struct { \
|
||||||
a_type *rbn_left; \
|
a_type *rbn_left; \
|
||||||
a_type *rbn_right_red; \
|
a_type *rbn_right_red; \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define rb_node(a_type) \
|
#define rb_node(a_type) \
|
||||||
struct { \
|
struct { \
|
||||||
a_type *rbn_left; \
|
a_type *rbn_left; \
|
||||||
a_type *rbn_right; \
|
a_type *rbn_right; \
|
||||||
@ -39,48 +39,48 @@ struct { \
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Root structure. */
|
/* Root structure. */
|
||||||
#define rb_tree(a_type) \
|
#define rb_tree(a_type) \
|
||||||
struct { \
|
struct { \
|
||||||
a_type *rbt_root; \
|
a_type *rbt_root; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Left accessors. */
|
/* Left accessors. */
|
||||||
#define rbtn_left_get(a_type, a_field, a_node) \
|
#define rbtn_left_get(a_type, a_field, a_node) \
|
||||||
((a_node)->a_field.rbn_left)
|
((a_node)->a_field.rbn_left)
|
||||||
#define rbtn_left_set(a_type, a_field, a_node, a_left) do { \
|
#define rbtn_left_set(a_type, a_field, a_node, a_left) do { \
|
||||||
(a_node)->a_field.rbn_left = a_left; \
|
(a_node)->a_field.rbn_left = a_left; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#ifdef RB_COMPACT
|
#ifdef RB_COMPACT
|
||||||
/* Right accessors. */
|
/* Right accessors. */
|
||||||
#define rbtn_right_get(a_type, a_field, a_node) \
|
#define rbtn_right_get(a_type, a_field, a_node) \
|
||||||
((a_type *) (((intptr_t) (a_node)->a_field.rbn_right_red) \
|
((a_type *) (((intptr_t) (a_node)->a_field.rbn_right_red) \
|
||||||
& ((ssize_t)-2)))
|
& ((ssize_t)-2)))
|
||||||
#define rbtn_right_set(a_type, a_field, a_node, a_right) do { \
|
#define rbtn_right_set(a_type, a_field, a_node, a_right) do { \
|
||||||
(a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) a_right) \
|
(a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) a_right) \
|
||||||
| (((uintptr_t) (a_node)->a_field.rbn_right_red) & ((size_t)1))); \
|
| (((uintptr_t) (a_node)->a_field.rbn_right_red) & ((size_t)1))); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* Color accessors. */
|
/* Color accessors. */
|
||||||
#define rbtn_red_get(a_type, a_field, a_node) \
|
#define rbtn_red_get(a_type, a_field, a_node) \
|
||||||
((bool) (((uintptr_t) (a_node)->a_field.rbn_right_red) \
|
((bool) (((uintptr_t) (a_node)->a_field.rbn_right_red) \
|
||||||
& ((size_t)1)))
|
& ((size_t)1)))
|
||||||
#define rbtn_color_set(a_type, a_field, a_node, a_red) do { \
|
#define rbtn_color_set(a_type, a_field, a_node, a_red) do { \
|
||||||
(a_node)->a_field.rbn_right_red = (a_type *) ((((intptr_t) \
|
(a_node)->a_field.rbn_right_red = (a_type *) ((((intptr_t) \
|
||||||
(a_node)->a_field.rbn_right_red) & ((ssize_t)-2)) \
|
(a_node)->a_field.rbn_right_red) & ((ssize_t)-2)) \
|
||||||
| ((ssize_t)a_red)); \
|
| ((ssize_t)a_red)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define rbtn_red_set(a_type, a_field, a_node) do { \
|
#define rbtn_red_set(a_type, a_field, a_node) do { \
|
||||||
(a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) \
|
(a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) \
|
||||||
(a_node)->a_field.rbn_right_red) | ((size_t)1)); \
|
(a_node)->a_field.rbn_right_red) | ((size_t)1)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define rbtn_black_set(a_type, a_field, a_node) do { \
|
#define rbtn_black_set(a_type, a_field, a_node) do { \
|
||||||
(a_node)->a_field.rbn_right_red = (a_type *) (((intptr_t) \
|
(a_node)->a_field.rbn_right_red = (a_type *) (((intptr_t) \
|
||||||
(a_node)->a_field.rbn_right_red) & ((ssize_t)-2)); \
|
(a_node)->a_field.rbn_right_red) & ((ssize_t)-2)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* Node initializer. */
|
/* Node initializer. */
|
||||||
#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \
|
#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \
|
||||||
/* Bookkeeping bit cannot be used by node pointer. */ \
|
/* Bookkeeping bit cannot be used by node pointer. */ \
|
||||||
assert(((uintptr_t)(a_node) & 0x1) == 0); \
|
assert(((uintptr_t)(a_node) & 0x1) == 0); \
|
||||||
rbtn_left_set(a_type, a_field, (a_node), NULL); \
|
rbtn_left_set(a_type, a_field, (a_node), NULL); \
|
||||||
@ -89,27 +89,27 @@ struct { \
|
|||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
/* Right accessors. */
|
/* Right accessors. */
|
||||||
#define rbtn_right_get(a_type, a_field, a_node) \
|
#define rbtn_right_get(a_type, a_field, a_node) \
|
||||||
((a_node)->a_field.rbn_right)
|
((a_node)->a_field.rbn_right)
|
||||||
#define rbtn_right_set(a_type, a_field, a_node, a_right) do { \
|
#define rbtn_right_set(a_type, a_field, a_node, a_right) do { \
|
||||||
(a_node)->a_field.rbn_right = a_right; \
|
(a_node)->a_field.rbn_right = a_right; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* Color accessors. */
|
/* Color accessors. */
|
||||||
#define rbtn_red_get(a_type, a_field, a_node) \
|
#define rbtn_red_get(a_type, a_field, a_node) \
|
||||||
((a_node)->a_field.rbn_red)
|
((a_node)->a_field.rbn_red)
|
||||||
#define rbtn_color_set(a_type, a_field, a_node, a_red) do { \
|
#define rbtn_color_set(a_type, a_field, a_node, a_red) do { \
|
||||||
(a_node)->a_field.rbn_red = (a_red); \
|
(a_node)->a_field.rbn_red = (a_red); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define rbtn_red_set(a_type, a_field, a_node) do { \
|
#define rbtn_red_set(a_type, a_field, a_node) do { \
|
||||||
(a_node)->a_field.rbn_red = true; \
|
(a_node)->a_field.rbn_red = true; \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define rbtn_black_set(a_type, a_field, a_node) do { \
|
#define rbtn_black_set(a_type, a_field, a_node) do { \
|
||||||
(a_node)->a_field.rbn_red = false; \
|
(a_node)->a_field.rbn_red = false; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* Node initializer. */
|
/* Node initializer. */
|
||||||
#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \
|
#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \
|
||||||
rbtn_left_set(a_type, a_field, (a_node), NULL); \
|
rbtn_left_set(a_type, a_field, (a_node), NULL); \
|
||||||
rbtn_right_set(a_type, a_field, (a_node), NULL); \
|
rbtn_right_set(a_type, a_field, (a_node), NULL); \
|
||||||
rbtn_red_set(a_type, a_field, (a_node)); \
|
rbtn_red_set(a_type, a_field, (a_node)); \
|
||||||
@ -117,12 +117,12 @@ struct { \
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Tree initializer. */
|
/* Tree initializer. */
|
||||||
#define rb_new(a_type, a_field, a_rbt) do { \
|
#define rb_new(a_type, a_field, a_rbt) do { \
|
||||||
(a_rbt)->rbt_root = NULL; \
|
(a_rbt)->rbt_root = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* Internal utility macros. */
|
/* Internal utility macros. */
|
||||||
#define rbtn_first(a_type, a_field, a_rbt, a_root, r_node) do { \
|
#define rbtn_first(a_type, a_field, a_rbt, a_root, r_node) do { \
|
||||||
(r_node) = (a_root); \
|
(r_node) = (a_root); \
|
||||||
if ((r_node) != NULL) { \
|
if ((r_node) != NULL) { \
|
||||||
for (; \
|
for (; \
|
||||||
@ -132,7 +132,7 @@ struct { \
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define rbtn_last(a_type, a_field, a_rbt, a_root, r_node) do { \
|
#define rbtn_last(a_type, a_field, a_rbt, a_root, r_node) do { \
|
||||||
(r_node) = (a_root); \
|
(r_node) = (a_root); \
|
||||||
if ((r_node) != NULL) { \
|
if ((r_node) != NULL) { \
|
||||||
for (; rbtn_right_get(a_type, a_field, (r_node)) != NULL; \
|
for (; rbtn_right_get(a_type, a_field, (r_node)) != NULL; \
|
||||||
@ -141,14 +141,14 @@ struct { \
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define rbtn_rotate_left(a_type, a_field, a_node, r_node) do { \
|
#define rbtn_rotate_left(a_type, a_field, a_node, r_node) do { \
|
||||||
(r_node) = rbtn_right_get(a_type, a_field, (a_node)); \
|
(r_node) = rbtn_right_get(a_type, a_field, (a_node)); \
|
||||||
rbtn_right_set(a_type, a_field, (a_node), \
|
rbtn_right_set(a_type, a_field, (a_node), \
|
||||||
rbtn_left_get(a_type, a_field, (r_node))); \
|
rbtn_left_get(a_type, a_field, (r_node))); \
|
||||||
rbtn_left_set(a_type, a_field, (r_node), (a_node)); \
|
rbtn_left_set(a_type, a_field, (r_node), (a_node)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define rbtn_rotate_right(a_type, a_field, a_node, r_node) do { \
|
#define rbtn_rotate_right(a_type, a_field, a_node, r_node) do { \
|
||||||
(r_node) = rbtn_left_get(a_type, a_field, (a_node)); \
|
(r_node) = rbtn_left_get(a_type, a_field, (a_node)); \
|
||||||
rbtn_left_set(a_type, a_field, (a_node), \
|
rbtn_left_set(a_type, a_field, (a_node), \
|
||||||
rbtn_right_get(a_type, a_field, (r_node))); \
|
rbtn_right_get(a_type, a_field, (r_node))); \
|
||||||
@ -160,7 +160,7 @@ struct { \
|
|||||||
* functions generated by an equivalently parameterized call to rb_gen().
|
* functions generated by an equivalently parameterized call to rb_gen().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define rb_proto(a_attr, a_prefix, a_rbt_type, a_type) \
|
#define rb_proto(a_attr, a_prefix, a_rbt_type, a_type) \
|
||||||
a_attr void \
|
a_attr void \
|
||||||
a_prefix##new(a_rbt_type *rbtree); \
|
a_prefix##new(a_rbt_type *rbtree); \
|
||||||
a_attr bool \
|
a_attr bool \
|
||||||
@ -335,7 +335,7 @@ a_prefix##destroy(a_rbt_type *rbtree, void (*cb)(a_type *, void *), \
|
|||||||
* has begun.
|
* has begun.
|
||||||
* arg : Opaque pointer passed to cb().
|
* arg : Opaque pointer passed to cb().
|
||||||
*/
|
*/
|
||||||
#define rb_gen(a_attr, a_prefix, a_rbt_type, a_type, a_field, a_cmp) \
|
#define rb_gen(a_attr, a_prefix, a_rbt_type, a_type, a_field, a_cmp) \
|
||||||
a_attr void \
|
a_attr void \
|
||||||
a_prefix##new(a_rbt_type *rbtree) { \
|
a_prefix##new(a_rbt_type *rbtree) { \
|
||||||
rb_new(a_type, a_field, rbtree); \
|
rb_new(a_type, a_field, rbtree); \
|
||||||
|
@ -225,9 +225,9 @@ rtree_elm_lookup(tsdn_t *tsdn, rtree_t *rtree, rtree_ctx_t *rtree_ctx,
|
|||||||
start_level, dependent);
|
start_level, dependent);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RTREE_GET_BIAS (RTREE_HEIGHT_MAX - rtree->height)
|
#define RTREE_GET_BIAS (RTREE_HEIGHT_MAX - rtree->height)
|
||||||
switch (start_level + RTREE_GET_BIAS) {
|
switch (start_level + RTREE_GET_BIAS) {
|
||||||
#define RTREE_GET_SUBTREE(level) \
|
#define RTREE_GET_SUBTREE(level) \
|
||||||
case level: \
|
case level: \
|
||||||
assert(level < (RTREE_HEIGHT_MAX-1)); \
|
assert(level < (RTREE_HEIGHT_MAX-1)); \
|
||||||
if (!dependent && unlikely(!rtree_node_valid(node))) { \
|
if (!dependent && unlikely(!rtree_node_valid(node))) { \
|
||||||
@ -246,7 +246,7 @@ rtree_elm_lookup(tsdn_t *tsdn, rtree_t *rtree, rtree_ctx_t *rtree_ctx,
|
|||||||
node; \
|
node; \
|
||||||
} \
|
} \
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
#define RTREE_GET_LEAF(level) \
|
#define RTREE_GET_LEAF(level) \
|
||||||
case level: \
|
case level: \
|
||||||
assert(level == (RTREE_HEIGHT_MAX-1)); \
|
assert(level == (RTREE_HEIGHT_MAX-1)); \
|
||||||
if (!dependent && unlikely(!rtree_node_valid(node))) { \
|
if (!dependent && unlikely(!rtree_node_valid(node))) { \
|
||||||
|
@ -19,13 +19,13 @@ typedef struct rtree_s rtree_t;
|
|||||||
* RTREE_BITS_PER_LEVEL must be a power of two that is no larger than the
|
* RTREE_BITS_PER_LEVEL must be a power of two that is no larger than the
|
||||||
* machine address width.
|
* machine address width.
|
||||||
*/
|
*/
|
||||||
#define LG_RTREE_BITS_PER_LEVEL 4
|
#define LG_RTREE_BITS_PER_LEVEL 4
|
||||||
#define RTREE_BITS_PER_LEVEL (1U << LG_RTREE_BITS_PER_LEVEL)
|
#define RTREE_BITS_PER_LEVEL (1U << LG_RTREE_BITS_PER_LEVEL)
|
||||||
/* Maximum rtree height. */
|
/* Maximum rtree height. */
|
||||||
#define RTREE_HEIGHT_MAX \
|
#define RTREE_HEIGHT_MAX \
|
||||||
((1U << (LG_SIZEOF_PTR+3)) / RTREE_BITS_PER_LEVEL)
|
((1U << (LG_SIZEOF_PTR+3)) / RTREE_BITS_PER_LEVEL)
|
||||||
|
|
||||||
#define RTREE_CTX_INITIALIZER { \
|
#define RTREE_CTX_INITIALIZER { \
|
||||||
false, \
|
false, \
|
||||||
0, \
|
0, \
|
||||||
0, \
|
0, \
|
||||||
@ -38,15 +38,15 @@ typedef struct rtree_s rtree_t;
|
|||||||
* have a witness_t directly embedded, but that would dramatically bloat the
|
* have a witness_t directly embedded, but that would dramatically bloat the
|
||||||
* tree. This must contain enough entries to e.g. coalesce two extents.
|
* tree. This must contain enough entries to e.g. coalesce two extents.
|
||||||
*/
|
*/
|
||||||
#define RTREE_ELM_ACQUIRE_MAX 4
|
#define RTREE_ELM_ACQUIRE_MAX 4
|
||||||
|
|
||||||
/* Initializers for rtree_elm_witness_tsd_t. */
|
/* Initializers for rtree_elm_witness_tsd_t. */
|
||||||
#define RTREE_ELM_WITNESS_INITIALIZER { \
|
#define RTREE_ELM_WITNESS_INITIALIZER { \
|
||||||
NULL, \
|
NULL, \
|
||||||
WITNESS_INITIALIZER("rtree_elm", WITNESS_RANK_RTREE_ELM) \
|
WITNESS_INITIALIZER("rtree_elm", WITNESS_RANK_RTREE_ELM) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RTREE_ELM_WITNESS_TSD_INITIALIZER { \
|
#define RTREE_ELM_WITNESS_TSD_INITIALIZER { \
|
||||||
{ \
|
{ \
|
||||||
RTREE_ELM_WITNESS_INITIALIZER, \
|
RTREE_ELM_WITNESS_INITIALIZER, \
|
||||||
RTREE_ELM_WITNESS_INITIALIZER, \
|
RTREE_ELM_WITNESS_INITIALIZER, \
|
||||||
|
@ -150,7 +150,7 @@ size_classes() {
|
|||||||
pow2 $((${lg_z} + 3)); ptr_bits=${pow2_result}
|
pow2 $((${lg_z} + 3)); ptr_bits=${pow2_result}
|
||||||
pow2 ${lg_g}; g=${pow2_result}
|
pow2 ${lg_g}; g=${pow2_result}
|
||||||
|
|
||||||
echo "#define SIZE_CLASSES \\"
|
echo "#define SIZE_CLASSES \\"
|
||||||
echo " /* index, lg_grp, lg_delta, ndelta, psz, bin, pgs, lg_delta_lookup */ \\"
|
echo " /* index, lg_grp, lg_delta, ndelta, psz, bin, pgs, lg_delta_lookup */ \\"
|
||||||
|
|
||||||
ntbins=0
|
ntbins=0
|
||||||
@ -294,7 +294,7 @@ cat <<EOF
|
|||||||
* LARGE_MAXCLASS: Maximum (large) size class.
|
* LARGE_MAXCLASS: Maximum (large) size class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LG_SIZE_CLASS_GROUP ${lg_g}
|
#define LG_SIZE_CLASS_GROUP ${lg_g}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -306,17 +306,17 @@ for lg_z in ${lg_zarr} ; do
|
|||||||
for lg_p in ${lg_parr} ; do
|
for lg_p in ${lg_parr} ; do
|
||||||
echo "#if (LG_SIZEOF_PTR == ${lg_z} && LG_TINY_MIN == ${lg_t} && LG_QUANTUM == ${lg_q} && LG_PAGE == ${lg_p})"
|
echo "#if (LG_SIZEOF_PTR == ${lg_z} && LG_TINY_MIN == ${lg_t} && LG_QUANTUM == ${lg_q} && LG_PAGE == ${lg_p})"
|
||||||
size_classes ${lg_z} ${lg_q} ${lg_t} ${lg_p} ${lg_g}
|
size_classes ${lg_z} ${lg_q} ${lg_t} ${lg_p} ${lg_g}
|
||||||
echo "#define SIZE_CLASSES_DEFINED"
|
echo "#define SIZE_CLASSES_DEFINED"
|
||||||
echo "#define NTBINS ${ntbins}"
|
echo "#define NTBINS ${ntbins}"
|
||||||
echo "#define NLBINS ${nlbins}"
|
echo "#define NLBINS ${nlbins}"
|
||||||
echo "#define NBINS ${nbins}"
|
echo "#define NBINS ${nbins}"
|
||||||
echo "#define NSIZES ${nsizes}"
|
echo "#define NSIZES ${nsizes}"
|
||||||
echo "#define NPSIZES ${npsizes}"
|
echo "#define NPSIZES ${npsizes}"
|
||||||
echo "#define LG_TINY_MAXCLASS ${lg_tiny_maxclass}"
|
echo "#define LG_TINY_MAXCLASS ${lg_tiny_maxclass}"
|
||||||
echo "#define LOOKUP_MAXCLASS ${lookup_maxclass}"
|
echo "#define LOOKUP_MAXCLASS ${lookup_maxclass}"
|
||||||
echo "#define SMALL_MAXCLASS ${small_maxclass}"
|
echo "#define SMALL_MAXCLASS ${small_maxclass}"
|
||||||
echo "#define LG_LARGE_MINCLASS ${lg_large_minclass}"
|
echo "#define LG_LARGE_MINCLASS ${lg_large_minclass}"
|
||||||
echo "#define LARGE_MAXCLASS ${large_maxclass}"
|
echo "#define LARGE_MAXCLASS ${large_maxclass}"
|
||||||
echo "#endif"
|
echo "#endif"
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
|
@ -23,10 +23,10 @@
|
|||||||
* smootheststep(x) = -20x + 70x - 84x + 35x
|
* smootheststep(x) = -20x + 70x - 84x + 35x
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SMOOTHSTEP_VARIANT "smoother"
|
#define SMOOTHSTEP_VARIANT "smoother"
|
||||||
#define SMOOTHSTEP_NSTEPS 200
|
#define SMOOTHSTEP_NSTEPS 200
|
||||||
#define SMOOTHSTEP_BFP 24
|
#define SMOOTHSTEP_BFP 24
|
||||||
#define SMOOTHSTEP \
|
#define SMOOTHSTEP \
|
||||||
/* STEP(step, h, x, y) */ \
|
/* STEP(step, h, x, y) */ \
|
||||||
STEP( 1, UINT64_C(0x0000000000000014), 0.005, 0.000001240643750) \
|
STEP( 1, UINT64_C(0x0000000000000014), 0.005, 0.000001240643750) \
|
||||||
STEP( 2, UINT64_C(0x00000000000000a5), 0.010, 0.000009850600000) \
|
STEP( 2, UINT64_C(0x00000000000000a5), 0.010, 0.000009850600000) \
|
||||||
|
@ -79,10 +79,10 @@ cat <<EOF
|
|||||||
* smootheststep(x) = -20x + 70x - 84x + 35x
|
* smootheststep(x) = -20x + 70x - 84x + 35x
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SMOOTHSTEP_VARIANT "${variant}"
|
#define SMOOTHSTEP_VARIANT "${variant}"
|
||||||
#define SMOOTHSTEP_NSTEPS ${nsteps}
|
#define SMOOTHSTEP_NSTEPS ${nsteps}
|
||||||
#define SMOOTHSTEP_BFP ${bfp}
|
#define SMOOTHSTEP_BFP ${bfp}
|
||||||
#define SMOOTHSTEP \\
|
#define SMOOTHSTEP \\
|
||||||
/* STEP(step, h, x, y) */ \\
|
/* STEP(step, h, x, y) */ \\
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -11,15 +11,15 @@ typedef struct tcaches_s tcaches_t;
|
|||||||
* used for two purposes: preventing thread caching on a per thread basis and
|
* used for two purposes: preventing thread caching on a per thread basis and
|
||||||
* cleaning up during thread shutdown.
|
* cleaning up during thread shutdown.
|
||||||
*/
|
*/
|
||||||
#define TCACHE_STATE_DISABLED ((tcache_t *)(uintptr_t)1)
|
#define TCACHE_STATE_DISABLED ((tcache_t *)(uintptr_t)1)
|
||||||
#define TCACHE_STATE_REINCARNATED ((tcache_t *)(uintptr_t)2)
|
#define TCACHE_STATE_REINCARNATED ((tcache_t *)(uintptr_t)2)
|
||||||
#define TCACHE_STATE_PURGATORY ((tcache_t *)(uintptr_t)3)
|
#define TCACHE_STATE_PURGATORY ((tcache_t *)(uintptr_t)3)
|
||||||
#define TCACHE_STATE_MAX TCACHE_STATE_PURGATORY
|
#define TCACHE_STATE_MAX TCACHE_STATE_PURGATORY
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Absolute minimum number of cache slots for each small bin.
|
* Absolute minimum number of cache slots for each small bin.
|
||||||
*/
|
*/
|
||||||
#define TCACHE_NSLOTS_SMALL_MIN 20
|
#define TCACHE_NSLOTS_SMALL_MIN 20
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Absolute maximum number of cache slots for each small bin in the thread
|
* Absolute maximum number of cache slots for each small bin in the thread
|
||||||
@ -28,23 +28,23 @@ typedef struct tcaches_s tcaches_t;
|
|||||||
*
|
*
|
||||||
* This constant must be an even number.
|
* This constant must be an even number.
|
||||||
*/
|
*/
|
||||||
#define TCACHE_NSLOTS_SMALL_MAX 200
|
#define TCACHE_NSLOTS_SMALL_MAX 200
|
||||||
|
|
||||||
/* Number of cache slots for large size classes. */
|
/* Number of cache slots for large size classes. */
|
||||||
#define TCACHE_NSLOTS_LARGE 20
|
#define TCACHE_NSLOTS_LARGE 20
|
||||||
|
|
||||||
/* (1U << opt_lg_tcache_max) is used to compute tcache_maxclass. */
|
/* (1U << opt_lg_tcache_max) is used to compute tcache_maxclass. */
|
||||||
#define LG_TCACHE_MAXCLASS_DEFAULT 15
|
#define LG_TCACHE_MAXCLASS_DEFAULT 15
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TCACHE_GC_SWEEP is the approximate number of allocation events between
|
* TCACHE_GC_SWEEP is the approximate number of allocation events between
|
||||||
* full GC sweeps. Integer rounding may cause the actual number to be
|
* full GC sweeps. Integer rounding may cause the actual number to be
|
||||||
* slightly higher, since GC is performed incrementally.
|
* slightly higher, since GC is performed incrementally.
|
||||||
*/
|
*/
|
||||||
#define TCACHE_GC_SWEEP 8192
|
#define TCACHE_GC_SWEEP 8192
|
||||||
|
|
||||||
/* Number of tcache allocation/deallocation events between incremental GCs. */
|
/* Number of tcache allocation/deallocation events between incremental GCs. */
|
||||||
#define TCACHE_GC_INCR \
|
#define TCACHE_GC_INCR \
|
||||||
((TCACHE_GC_SWEEP / NBINS) + ((TCACHE_GC_SWEEP / NBINS == 0) ? 0 : 1))
|
((TCACHE_GC_SWEEP / NBINS) + ((TCACHE_GC_SWEEP / NBINS == 0) ? 0 : 1))
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_TCACHE_TYPES_H */
|
#endif /* JEMALLOC_INTERNAL_TCACHE_TYPES_H */
|
||||||
|
@ -8,7 +8,7 @@ tsd_t *tsd_fetch_impl(bool init);
|
|||||||
tsd_t *tsd_fetch(void);
|
tsd_t *tsd_fetch(void);
|
||||||
tsdn_t *tsd_tsdn(tsd_t *tsd);
|
tsdn_t *tsd_tsdn(tsd_t *tsd);
|
||||||
bool tsd_nominal(tsd_t *tsd);
|
bool tsd_nominal(tsd_t *tsd);
|
||||||
#define O(n, t, c) \
|
#define O(n, t, c) \
|
||||||
t *tsd_##n##p_get(tsd_t *tsd); \
|
t *tsd_##n##p_get(tsd_t *tsd); \
|
||||||
t tsd_##n##_get(tsd_t *tsd); \
|
t tsd_##n##_get(tsd_t *tsd); \
|
||||||
void tsd_##n##_set(tsd_t *tsd, t n);
|
void tsd_##n##_set(tsd_t *tsd, t n);
|
||||||
@ -64,7 +64,7 @@ tsd_nominal(tsd_t *tsd) {
|
|||||||
return (tsd->state == tsd_state_nominal);
|
return (tsd->state == tsd_state_nominal);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define O(n, t, c) \
|
#define O(n, t, c) \
|
||||||
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; \
|
||||||
|
@ -14,7 +14,7 @@ struct tsd_init_head_s {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MALLOC_TSD \
|
#define MALLOC_TSD \
|
||||||
/* O(name, type, cleanup) */ \
|
/* O(name, type, cleanup) */ \
|
||||||
O(tcache, tcache_t *, yes) \
|
O(tcache, tcache_t *, yes) \
|
||||||
O(thread_allocated, uint64_t, no) \
|
O(thread_allocated, uint64_t, no) \
|
||||||
@ -31,7 +31,7 @@ struct tsd_init_head_s {
|
|||||||
O(rtree_elm_witnesses, rtree_elm_witness_tsd_t,no) \
|
O(rtree_elm_witnesses, rtree_elm_witness_tsd_t,no) \
|
||||||
O(witness_fork, bool, no) \
|
O(witness_fork, bool, no) \
|
||||||
|
|
||||||
#define TSD_INITIALIZER { \
|
#define TSD_INITIALIZER { \
|
||||||
tsd_state_uninitialized, \
|
tsd_state_uninitialized, \
|
||||||
NULL, \
|
NULL, \
|
||||||
0, \
|
0, \
|
||||||
@ -51,7 +51,7 @@ struct tsd_init_head_s {
|
|||||||
|
|
||||||
struct tsd_s {
|
struct tsd_s {
|
||||||
tsd_state_t state;
|
tsd_state_t state;
|
||||||
#define O(n, t, c) \
|
#define O(n, t, c) \
|
||||||
t n;
|
t n;
|
||||||
MALLOC_TSD
|
MALLOC_TSD
|
||||||
#undef O
|
#undef O
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define JEMALLOC_INTERNAL_TSD_TYPES_H
|
#define JEMALLOC_INTERNAL_TSD_TYPES_H
|
||||||
|
|
||||||
/* Maximum number of malloc_tsd users with cleanup functions. */
|
/* Maximum number of malloc_tsd users with cleanup functions. */
|
||||||
#define MALLOC_TSD_CLEANUPS_MAX 2
|
#define MALLOC_TSD_CLEANUPS_MAX 2
|
||||||
|
|
||||||
typedef bool (*malloc_tsd_cleanup_t)(void);
|
typedef bool (*malloc_tsd_cleanup_t)(void);
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ typedef struct tsd_init_head_s tsd_init_head_t;
|
|||||||
typedef struct tsd_s tsd_t;
|
typedef struct tsd_s tsd_t;
|
||||||
typedef struct tsdn_s tsdn_t;
|
typedef struct tsdn_s tsdn_t;
|
||||||
|
|
||||||
#define TSDN_NULL ((tsdn_t *)0)
|
#define TSDN_NULL ((tsdn_t *)0)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
tsd_state_uninitialized,
|
tsd_state_uninitialized,
|
||||||
@ -77,17 +77,17 @@ typedef enum {
|
|||||||
|
|
||||||
/* malloc_tsd_types(). */
|
/* malloc_tsd_types(). */
|
||||||
#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
|
#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
|
||||||
#define malloc_tsd_types(a_name, a_type)
|
#define malloc_tsd_types(a_name, a_type)
|
||||||
#elif (defined(JEMALLOC_TLS))
|
#elif (defined(JEMALLOC_TLS))
|
||||||
#define malloc_tsd_types(a_name, a_type)
|
#define malloc_tsd_types(a_name, a_type)
|
||||||
#elif (defined(_WIN32))
|
#elif (defined(_WIN32))
|
||||||
#define malloc_tsd_types(a_name, a_type) \
|
#define malloc_tsd_types(a_name, a_type) \
|
||||||
typedef struct { \
|
typedef struct { \
|
||||||
bool initialized; \
|
bool initialized; \
|
||||||
a_type val; \
|
a_type val; \
|
||||||
} a_name##tsd_wrapper_t;
|
} a_name##tsd_wrapper_t;
|
||||||
#else
|
#else
|
||||||
#define malloc_tsd_types(a_name, a_type) \
|
#define malloc_tsd_types(a_name, a_type) \
|
||||||
typedef struct { \
|
typedef struct { \
|
||||||
bool initialized; \
|
bool initialized; \
|
||||||
a_type val; \
|
a_type val; \
|
||||||
@ -95,7 +95,7 @@ typedef struct { \
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* malloc_tsd_protos(). */
|
/* malloc_tsd_protos(). */
|
||||||
#define malloc_tsd_protos(a_attr, a_name, a_type) \
|
#define malloc_tsd_protos(a_attr, a_name, a_type) \
|
||||||
a_attr bool \
|
a_attr bool \
|
||||||
a_name##tsd_boot0(void); \
|
a_name##tsd_boot0(void); \
|
||||||
a_attr void \
|
a_attr void \
|
||||||
@ -111,22 +111,22 @@ a_name##tsd_set(a_type *val);
|
|||||||
|
|
||||||
/* malloc_tsd_externs(). */
|
/* malloc_tsd_externs(). */
|
||||||
#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
|
#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
|
||||||
#define malloc_tsd_externs(a_name, a_type) \
|
#define malloc_tsd_externs(a_name, a_type) \
|
||||||
extern __thread a_type a_name##tsd_tls; \
|
extern __thread a_type a_name##tsd_tls; \
|
||||||
extern __thread bool a_name##tsd_initialized; \
|
extern __thread bool a_name##tsd_initialized; \
|
||||||
extern bool a_name##tsd_booted;
|
extern bool a_name##tsd_booted;
|
||||||
#elif (defined(JEMALLOC_TLS))
|
#elif (defined(JEMALLOC_TLS))
|
||||||
#define malloc_tsd_externs(a_name, a_type) \
|
#define malloc_tsd_externs(a_name, a_type) \
|
||||||
extern __thread a_type a_name##tsd_tls; \
|
extern __thread a_type a_name##tsd_tls; \
|
||||||
extern pthread_key_t a_name##tsd_tsd; \
|
extern pthread_key_t a_name##tsd_tsd; \
|
||||||
extern bool a_name##tsd_booted;
|
extern bool a_name##tsd_booted;
|
||||||
#elif (defined(_WIN32))
|
#elif (defined(_WIN32))
|
||||||
#define malloc_tsd_externs(a_name, a_type) \
|
#define malloc_tsd_externs(a_name, a_type) \
|
||||||
extern DWORD a_name##tsd_tsd; \
|
extern DWORD a_name##tsd_tsd; \
|
||||||
extern a_name##tsd_wrapper_t a_name##tsd_boot_wrapper; \
|
extern a_name##tsd_wrapper_t a_name##tsd_boot_wrapper; \
|
||||||
extern bool a_name##tsd_booted;
|
extern bool a_name##tsd_booted;
|
||||||
#else
|
#else
|
||||||
#define malloc_tsd_externs(a_name, a_type) \
|
#define malloc_tsd_externs(a_name, a_type) \
|
||||||
extern pthread_key_t a_name##tsd_tsd; \
|
extern pthread_key_t a_name##tsd_tsd; \
|
||||||
extern tsd_init_head_t a_name##tsd_init_head; \
|
extern tsd_init_head_t a_name##tsd_init_head; \
|
||||||
extern a_name##tsd_wrapper_t a_name##tsd_boot_wrapper; \
|
extern a_name##tsd_wrapper_t a_name##tsd_boot_wrapper; \
|
||||||
@ -135,20 +135,20 @@ extern bool a_name##tsd_booted;
|
|||||||
|
|
||||||
/* malloc_tsd_data(). */
|
/* malloc_tsd_data(). */
|
||||||
#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
|
#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
|
||||||
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
||||||
a_attr __thread a_type JEMALLOC_TLS_MODEL \
|
a_attr __thread a_type JEMALLOC_TLS_MODEL \
|
||||||
a_name##tsd_tls = a_initializer; \
|
a_name##tsd_tls = a_initializer; \
|
||||||
a_attr __thread bool JEMALLOC_TLS_MODEL \
|
a_attr __thread bool JEMALLOC_TLS_MODEL \
|
||||||
a_name##tsd_initialized = false; \
|
a_name##tsd_initialized = false; \
|
||||||
a_attr bool a_name##tsd_booted = false;
|
a_attr bool a_name##tsd_booted = false;
|
||||||
#elif (defined(JEMALLOC_TLS))
|
#elif (defined(JEMALLOC_TLS))
|
||||||
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
||||||
a_attr __thread a_type JEMALLOC_TLS_MODEL \
|
a_attr __thread a_type JEMALLOC_TLS_MODEL \
|
||||||
a_name##tsd_tls = a_initializer; \
|
a_name##tsd_tls = a_initializer; \
|
||||||
a_attr pthread_key_t a_name##tsd_tsd; \
|
a_attr pthread_key_t a_name##tsd_tsd; \
|
||||||
a_attr bool a_name##tsd_booted = false;
|
a_attr bool a_name##tsd_booted = false;
|
||||||
#elif (defined(_WIN32))
|
#elif (defined(_WIN32))
|
||||||
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
||||||
a_attr DWORD a_name##tsd_tsd; \
|
a_attr DWORD a_name##tsd_tsd; \
|
||||||
a_attr a_name##tsd_wrapper_t a_name##tsd_boot_wrapper = { \
|
a_attr a_name##tsd_wrapper_t a_name##tsd_boot_wrapper = { \
|
||||||
false, \
|
false, \
|
||||||
@ -156,7 +156,7 @@ a_attr a_name##tsd_wrapper_t a_name##tsd_boot_wrapper = { \
|
|||||||
}; \
|
}; \
|
||||||
a_attr bool a_name##tsd_booted = false;
|
a_attr bool a_name##tsd_booted = false;
|
||||||
#else
|
#else
|
||||||
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
||||||
a_attr pthread_key_t a_name##tsd_tsd; \
|
a_attr pthread_key_t a_name##tsd_tsd; \
|
||||||
a_attr tsd_init_head_t a_name##tsd_init_head = { \
|
a_attr tsd_init_head_t a_name##tsd_init_head = { \
|
||||||
ql_head_initializer(blocks), \
|
ql_head_initializer(blocks), \
|
||||||
@ -171,7 +171,7 @@ a_attr bool a_name##tsd_booted = false;
|
|||||||
|
|
||||||
/* malloc_tsd_funcs(). */
|
/* malloc_tsd_funcs(). */
|
||||||
#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
|
#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
|
||||||
#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
|
#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
|
||||||
a_cleanup) \
|
a_cleanup) \
|
||||||
/* Initialization/cleanup. */ \
|
/* Initialization/cleanup. */ \
|
||||||
a_attr bool \
|
a_attr bool \
|
||||||
@ -224,7 +224,7 @@ a_name##tsd_set(a_type *val) { \
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#elif (defined(JEMALLOC_TLS))
|
#elif (defined(JEMALLOC_TLS))
|
||||||
#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
|
#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
|
||||||
a_cleanup) \
|
a_cleanup) \
|
||||||
/* Initialization/cleanup. */ \
|
/* Initialization/cleanup. */ \
|
||||||
a_attr bool \
|
a_attr bool \
|
||||||
@ -278,7 +278,7 @@ a_name##tsd_set(a_type *val) { \
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#elif (defined(_WIN32))
|
#elif (defined(_WIN32))
|
||||||
#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
|
#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
|
||||||
a_cleanup) \
|
a_cleanup) \
|
||||||
/* Initialization/cleanup. */ \
|
/* Initialization/cleanup. */ \
|
||||||
a_attr bool \
|
a_attr bool \
|
||||||
@ -403,7 +403,7 @@ a_name##tsd_set(a_type *val) { \
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
|
#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
|
||||||
a_cleanup) \
|
a_cleanup) \
|
||||||
/* Initialization/cleanup. */ \
|
/* Initialization/cleanup. */ \
|
||||||
a_attr void \
|
a_attr void \
|
||||||
|
@ -32,13 +32,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Size of stack-allocated buffer passed to buferror(). */
|
/* Size of stack-allocated buffer passed to buferror(). */
|
||||||
#define BUFERROR_BUF 64
|
#define BUFERROR_BUF 64
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Size of stack-allocated buffer used by malloc_{,v,vc}printf(). This must be
|
* Size of stack-allocated buffer used by malloc_{,v,vc}printf(). This must be
|
||||||
* large enough for all possible uses within jemalloc.
|
* large enough for all possible uses within jemalloc.
|
||||||
*/
|
*/
|
||||||
#define MALLOC_PRINTF_BUFSIZE 4096
|
#define MALLOC_PRINTF_BUFSIZE 4096
|
||||||
|
|
||||||
/* Junk fill patterns. */
|
/* Junk fill patterns. */
|
||||||
#ifndef JEMALLOC_ALLOC_JUNK
|
#ifndef JEMALLOC_ALLOC_JUNK
|
||||||
@ -52,11 +52,11 @@
|
|||||||
* Wrap a cpp argument that contains commas such that it isn't broken up into
|
* Wrap a cpp argument that contains commas such that it isn't broken up into
|
||||||
* multiple arguments.
|
* multiple arguments.
|
||||||
*/
|
*/
|
||||||
#define JEMALLOC_ARG_CONCAT(...) __VA_ARGS__
|
#define JEMALLOC_ARG_CONCAT(...) __VA_ARGS__
|
||||||
|
|
||||||
/* cpp macro definition stringification. */
|
/* cpp macro definition stringification. */
|
||||||
#define STRINGIFY_HELPER(x) #x
|
#define STRINGIFY_HELPER(x) #x
|
||||||
#define STRINGIFY(x) STRINGIFY_HELPER(x)
|
#define STRINGIFY(x) STRINGIFY_HELPER(x)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Silence compiler warnings due to uninitialized values. This is used
|
* Silence compiler warnings due to uninitialized values. This is used
|
||||||
@ -86,7 +86,7 @@
|
|||||||
#include "jemalloc/internal/assert.h"
|
#include "jemalloc/internal/assert.h"
|
||||||
|
|
||||||
/* Use to assert a particular configuration, e.g., cassert(config_debug). */
|
/* Use to assert a particular configuration, e.g., cassert(config_debug). */
|
||||||
#define cassert(c) do { \
|
#define cassert(c) do { \
|
||||||
if (unlikely(!(c))) { \
|
if (unlikely(!(c))) { \
|
||||||
not_reached(); \
|
not_reached(); \
|
||||||
} \
|
} \
|
||||||
|
@ -11,36 +11,36 @@ typedef int witness_comp_t (const witness_t *, void *, const witness_t *,
|
|||||||
* Lock ranks. Witnesses with rank WITNESS_RANK_OMIT are completely ignored by
|
* Lock ranks. Witnesses with rank WITNESS_RANK_OMIT are completely ignored by
|
||||||
* the witness machinery.
|
* the witness machinery.
|
||||||
*/
|
*/
|
||||||
#define WITNESS_RANK_OMIT 0U
|
#define WITNESS_RANK_OMIT 0U
|
||||||
|
|
||||||
#define WITNESS_RANK_INIT 1U
|
#define WITNESS_RANK_INIT 1U
|
||||||
#define WITNESS_RANK_CTL 1U
|
#define WITNESS_RANK_CTL 1U
|
||||||
#define WITNESS_RANK_ARENAS 2U
|
#define WITNESS_RANK_ARENAS 2U
|
||||||
|
|
||||||
#define WITNESS_RANK_PROF_DUMP 3U
|
#define WITNESS_RANK_PROF_DUMP 3U
|
||||||
#define WITNESS_RANK_PROF_BT2GCTX 4U
|
#define WITNESS_RANK_PROF_BT2GCTX 4U
|
||||||
#define WITNESS_RANK_PROF_TDATAS 5U
|
#define WITNESS_RANK_PROF_TDATAS 5U
|
||||||
#define WITNESS_RANK_PROF_TDATA 6U
|
#define WITNESS_RANK_PROF_TDATA 6U
|
||||||
#define WITNESS_RANK_PROF_GCTX 7U
|
#define WITNESS_RANK_PROF_GCTX 7U
|
||||||
|
|
||||||
#define WITNESS_RANK_ARENA 8U
|
#define WITNESS_RANK_ARENA 8U
|
||||||
#define WITNESS_RANK_ARENA_EXTENTS 9U
|
#define WITNESS_RANK_ARENA_EXTENTS 9U
|
||||||
#define WITNESS_RANK_ARENA_EXTENT_CACHE 10
|
#define WITNESS_RANK_ARENA_EXTENT_CACHE 10
|
||||||
|
|
||||||
#define WITNESS_RANK_RTREE_ELM 11U
|
#define WITNESS_RANK_RTREE_ELM 11U
|
||||||
#define WITNESS_RANK_RTREE 12U
|
#define WITNESS_RANK_RTREE 12U
|
||||||
#define WITNESS_RANK_BASE 13U
|
#define WITNESS_RANK_BASE 13U
|
||||||
|
|
||||||
#define WITNESS_RANK_LEAF 0xffffffffU
|
#define WITNESS_RANK_LEAF 0xffffffffU
|
||||||
#define WITNESS_RANK_ARENA_BIN WITNESS_RANK_LEAF
|
#define WITNESS_RANK_ARENA_BIN WITNESS_RANK_LEAF
|
||||||
#define WITNESS_RANK_ARENA_LARGE WITNESS_RANK_LEAF
|
#define WITNESS_RANK_ARENA_LARGE WITNESS_RANK_LEAF
|
||||||
#define WITNESS_RANK_DSS WITNESS_RANK_LEAF
|
#define WITNESS_RANK_DSS WITNESS_RANK_LEAF
|
||||||
#define WITNESS_RANK_PROF_ACTIVE WITNESS_RANK_LEAF
|
#define WITNESS_RANK_PROF_ACTIVE WITNESS_RANK_LEAF
|
||||||
#define WITNESS_RANK_PROF_DUMP_SEQ WITNESS_RANK_LEAF
|
#define WITNESS_RANK_PROF_DUMP_SEQ WITNESS_RANK_LEAF
|
||||||
#define WITNESS_RANK_PROF_GDUMP WITNESS_RANK_LEAF
|
#define WITNESS_RANK_PROF_GDUMP WITNESS_RANK_LEAF
|
||||||
#define WITNESS_RANK_PROF_NEXT_THR_UID WITNESS_RANK_LEAF
|
#define WITNESS_RANK_PROF_NEXT_THR_UID WITNESS_RANK_LEAF
|
||||||
#define WITNESS_RANK_PROF_THREAD_ACTIVE_INIT WITNESS_RANK_LEAF
|
#define WITNESS_RANK_PROF_THREAD_ACTIVE_INIT WITNESS_RANK_LEAF
|
||||||
|
|
||||||
#define WITNESS_INITIALIZER(name, rank) {name, rank, NULL, NULL, {NULL, NULL}}
|
#define WITNESS_INITIALIZER(name, rank) {name, rank, NULL, NULL, {NULL, NULL}}
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_WITNESS_TYPES_H */
|
#endif /* JEMALLOC_INTERNAL_WITNESS_TYPES_H */
|
||||||
|
@ -4,7 +4,7 @@ objroot=$1
|
|||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
#ifndef JEMALLOC_H_
|
#ifndef JEMALLOC_H_
|
||||||
#define JEMALLOC_H_
|
#define JEMALLOC_H_
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -15,7 +15,6 @@ for hdr in jemalloc_defs.h jemalloc_rename.h jemalloc_macros.h \
|
|||||||
jemalloc_protos.h jemalloc_typedefs.h jemalloc_mangle.h ; do
|
jemalloc_protos.h jemalloc_typedefs.h jemalloc_mangle.h ; do
|
||||||
cat "${objroot}include/jemalloc/${hdr}" \
|
cat "${objroot}include/jemalloc/${hdr}" \
|
||||||
| grep -v 'Generated from .* by configure\.' \
|
| grep -v 'Generated from .* by configure\.' \
|
||||||
| sed -e 's/^#define /#define /g' \
|
|
||||||
| sed -e 's/ $//g'
|
| sed -e 's/ $//g'
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
#define JEMALLOC_VERSION "@jemalloc_version@"
|
#define JEMALLOC_VERSION "@jemalloc_version@"
|
||||||
#define JEMALLOC_VERSION_MAJOR @jemalloc_version_major@
|
#define JEMALLOC_VERSION_MAJOR @jemalloc_version_major@
|
||||||
#define JEMALLOC_VERSION_MINOR @jemalloc_version_minor@
|
#define JEMALLOC_VERSION_MINOR @jemalloc_version_minor@
|
||||||
#define JEMALLOC_VERSION_BUGFIX @jemalloc_version_bugfix@
|
#define JEMALLOC_VERSION_BUGFIX @jemalloc_version_bugfix@
|
||||||
#define JEMALLOC_VERSION_NREV @jemalloc_version_nrev@
|
#define JEMALLOC_VERSION_NREV @jemalloc_version_nrev@
|
||||||
#define JEMALLOC_VERSION_GID "@jemalloc_version_gid@"
|
#define JEMALLOC_VERSION_GID "@jemalloc_version_gid@"
|
||||||
|
|
||||||
#define MALLOCX_LG_ALIGN(la) ((int)(la))
|
#define MALLOCX_LG_ALIGN(la) ((int)(la))
|
||||||
#if LG_SIZEOF_PTR == 2
|
#if LG_SIZEOF_PTR == 2
|
||||||
# define MALLOCX_ALIGN(a) ((int)(ffs((int)(a))-1))
|
# define MALLOCX_ALIGN(a) ((int)(ffs((int)(a))-1))
|
||||||
#else
|
#else
|
||||||
@ -19,17 +19,17 @@
|
|||||||
((int)(((size_t)(a) < (size_t)INT_MAX) ? ffs((int)(a))-1 : \
|
((int)(((size_t)(a) < (size_t)INT_MAX) ? ffs((int)(a))-1 : \
|
||||||
ffs((int)(((size_t)(a))>>32))+31))
|
ffs((int)(((size_t)(a))>>32))+31))
|
||||||
#endif
|
#endif
|
||||||
#define MALLOCX_ZERO ((int)0x40)
|
#define MALLOCX_ZERO ((int)0x40)
|
||||||
/*
|
/*
|
||||||
* Bias tcache index bits so that 0 encodes "automatic tcache management", and 1
|
* Bias tcache index bits so that 0 encodes "automatic tcache management", and 1
|
||||||
* encodes MALLOCX_TCACHE_NONE.
|
* encodes MALLOCX_TCACHE_NONE.
|
||||||
*/
|
*/
|
||||||
#define MALLOCX_TCACHE(tc) ((int)(((tc)+2) << 8))
|
#define MALLOCX_TCACHE(tc) ((int)(((tc)+2) << 8))
|
||||||
#define MALLOCX_TCACHE_NONE MALLOCX_TCACHE(-1)
|
#define MALLOCX_TCACHE_NONE MALLOCX_TCACHE(-1)
|
||||||
/*
|
/*
|
||||||
* Bias arena index bits so that 0 encodes "use an automatically chosen arena".
|
* Bias arena index bits so that 0 encodes "use an automatically chosen arena".
|
||||||
*/
|
*/
|
||||||
#define MALLOCX_ARENA(a) ((((int)(a))+1) << 20)
|
#define MALLOCX_ARENA(a) ((((int)(a))+1) << 20)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use as arena index in "arena.<i>.{purge,decay,dss}" and
|
* Use as arena index in "arena.<i>.{purge,decay,dss}" and
|
||||||
@ -43,12 +43,12 @@
|
|||||||
* mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".purge", NULL, NULL, NULL,
|
* mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".purge", NULL, NULL, NULL,
|
||||||
* 0);
|
* 0);
|
||||||
*/
|
*/
|
||||||
#define MALLCTL_ARENAS_ALL 4096
|
#define MALLCTL_ARENAS_ALL 4096
|
||||||
/*
|
/*
|
||||||
* Use as arena index in "stats.arenas.<i>.*" mallctl interfaces to select
|
* Use as arena index in "stats.arenas.<i>.*" mallctl interfaces to select
|
||||||
* destroyed arenas.
|
* destroyed arenas.
|
||||||
*/
|
*/
|
||||||
#define MALLCTL_ARENAS_DESTROYED 4097
|
#define MALLCTL_ARENAS_DESTROYED 4097
|
||||||
|
|
||||||
#if defined(__cplusplus) && defined(JEMALLOC_USE_CXX_THROW)
|
#if defined(__cplusplus) && defined(JEMALLOC_USE_CXX_THROW)
|
||||||
# define JEMALLOC_CXX_THROW throw()
|
# define JEMALLOC_CXX_THROW throw()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef MSVC_COMPAT_WINDOWS_EXTRA_H
|
#ifndef MSVC_COMPAT_WINDOWS_EXTRA_H
|
||||||
#define MSVC_COMPAT_WINDOWS_EXTRA_H
|
#define MSVC_COMPAT_WINDOWS_EXTRA_H
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
20
src/arena.c
20
src/arena.c
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_ARENA_C_
|
#define JEMALLOC_ARENA_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -8,10 +8,10 @@ ssize_t opt_decay_time = DECAY_TIME_DEFAULT;
|
|||||||
static ssize_t decay_time_default;
|
static ssize_t decay_time_default;
|
||||||
|
|
||||||
const arena_bin_info_t arena_bin_info[NBINS] = {
|
const arena_bin_info_t arena_bin_info[NBINS] = {
|
||||||
#define BIN_INFO_bin_yes(reg_size, slab_size, nregs) \
|
#define BIN_INFO_bin_yes(reg_size, slab_size, nregs) \
|
||||||
{reg_size, slab_size, nregs, BITMAP_INFO_INITIALIZER(nregs)},
|
{reg_size, slab_size, nregs, BITMAP_INFO_INITIALIZER(nregs)},
|
||||||
#define BIN_INFO_bin_no(reg_size, slab_size, nregs)
|
#define BIN_INFO_bin_no(reg_size, slab_size, nregs)
|
||||||
#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, \
|
#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, \
|
||||||
lg_delta_lookup) \
|
lg_delta_lookup) \
|
||||||
BIN_INFO_bin_##bin((1U<<lg_grp) + (ndelta<<lg_delta), \
|
BIN_INFO_bin_##bin((1U<<lg_grp) + (ndelta<<lg_delta), \
|
||||||
(pgs << LG_PAGE), (pgs << LG_PAGE) / ((1U<<lg_grp) + \
|
(pgs << LG_PAGE), (pgs << LG_PAGE) / ((1U<<lg_grp) + \
|
||||||
@ -142,13 +142,13 @@ arena_slab_regind(extent_t *slab, szind_t binind, const void *ptr) {
|
|||||||
/* Avoid doing division with a variable divisor. */
|
/* Avoid doing division with a variable divisor. */
|
||||||
diff = (size_t)((uintptr_t)ptr - (uintptr_t)extent_addr_get(slab));
|
diff = (size_t)((uintptr_t)ptr - (uintptr_t)extent_addr_get(slab));
|
||||||
switch (binind) {
|
switch (binind) {
|
||||||
#define REGIND_bin_yes(index, reg_size) \
|
#define REGIND_bin_yes(index, reg_size) \
|
||||||
case index: \
|
case index: \
|
||||||
regind = diff / (reg_size); \
|
regind = diff / (reg_size); \
|
||||||
assert(diff == regind * (reg_size)); \
|
assert(diff == regind * (reg_size)); \
|
||||||
break;
|
break;
|
||||||
#define REGIND_bin_no(index, reg_size)
|
#define REGIND_bin_no(index, reg_size)
|
||||||
#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, \
|
#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, \
|
||||||
lg_delta_lookup) \
|
lg_delta_lookup) \
|
||||||
REGIND_bin_##bin(index, (1U<<lg_grp) + (ndelta<<lg_delta))
|
REGIND_bin_##bin(index, (1U<<lg_grp) + (ndelta<<lg_delta))
|
||||||
SIZE_CLASSES
|
SIZE_CLASSES
|
||||||
@ -389,7 +389,7 @@ arena_decay_deadline_reached(const arena_t *arena, const nstime_t *time) {
|
|||||||
static size_t
|
static size_t
|
||||||
arena_decay_backlog_npages_limit(const arena_t *arena) {
|
arena_decay_backlog_npages_limit(const arena_t *arena) {
|
||||||
static const uint64_t h_steps[] = {
|
static const uint64_t h_steps[] = {
|
||||||
#define STEP(step, h, x, y) \
|
#define STEP(step, h, x, y) \
|
||||||
h,
|
h,
|
||||||
SMOOTHSTEP
|
SMOOTHSTEP
|
||||||
#undef STEP
|
#undef STEP
|
||||||
@ -1138,7 +1138,7 @@ arena_alloc_junk_small(void *ptr, const arena_bin_info_t *bin_info, bool zero) {
|
|||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef arena_dalloc_junk_small
|
#undef arena_dalloc_junk_small
|
||||||
#define arena_dalloc_junk_small JEMALLOC_N(n_arena_dalloc_junk_small)
|
#define arena_dalloc_junk_small JEMALLOC_N(n_arena_dalloc_junk_small)
|
||||||
#endif
|
#endif
|
||||||
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) {
|
||||||
@ -1146,7 +1146,7 @@ arena_dalloc_junk_small(void *ptr, const arena_bin_info_t *bin_info) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef arena_dalloc_junk_small
|
#undef arena_dalloc_junk_small
|
||||||
#define arena_dalloc_junk_small JEMALLOC_N(arena_dalloc_junk_small)
|
#define arena_dalloc_junk_small JEMALLOC_N(arena_dalloc_junk_small)
|
||||||
arena_dalloc_junk_small_t *arena_dalloc_junk_small =
|
arena_dalloc_junk_small_t *arena_dalloc_junk_small =
|
||||||
JEMALLOC_N(n_arena_dalloc_junk_small);
|
JEMALLOC_N(n_arena_dalloc_junk_small);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#define JEMALLOC_ATOMIC_C_
|
#define JEMALLOC_ATOMIC_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_BASE_C_
|
#define JEMALLOC_BASE_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_BITMAP_C_
|
#define JEMALLOC_BITMAP_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
* respectively.
|
* respectively.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define JEMALLOC_CKH_C_
|
#define JEMALLOC_CKH_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
42
src/ctl.c
42
src/ctl.c
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_CTL_C_
|
#define JEMALLOC_CTL_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -36,11 +36,11 @@ ctl_indexed_node(const ctl_node_t *node) {
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Function prototypes for non-inline static functions. */
|
/* Function prototypes for non-inline static functions. */
|
||||||
|
|
||||||
#define CTL_PROTO(n) \
|
#define CTL_PROTO(n) \
|
||||||
static int n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, \
|
static int n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, \
|
||||||
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
|
void *oldp, size_t *oldlenp, void *newp, size_t newlen);
|
||||||
|
|
||||||
#define INDEX_PROTO(n) \
|
#define INDEX_PROTO(n) \
|
||||||
static const ctl_named_node_t *n##_index(tsdn_t *tsdn, \
|
static const ctl_named_node_t *n##_index(tsdn_t *tsdn, \
|
||||||
const size_t *mib, size_t miblen, size_t i);
|
const size_t *mib, size_t miblen, size_t i);
|
||||||
|
|
||||||
@ -173,20 +173,20 @@ CTL_PROTO(stats_retained)
|
|||||||
/* mallctl tree. */
|
/* mallctl tree. */
|
||||||
|
|
||||||
/* Maximum tree depth. */
|
/* Maximum tree depth. */
|
||||||
#define CTL_MAX_DEPTH 6
|
#define CTL_MAX_DEPTH 6
|
||||||
|
|
||||||
#define NAME(n) {true}, n
|
#define NAME(n) {true}, n
|
||||||
#define CHILD(t, c) \
|
#define CHILD(t, c) \
|
||||||
sizeof(c##_node) / sizeof(ctl_##t##_node_t), \
|
sizeof(c##_node) / sizeof(ctl_##t##_node_t), \
|
||||||
(ctl_node_t *)c##_node, \
|
(ctl_node_t *)c##_node, \
|
||||||
NULL
|
NULL
|
||||||
#define CTL(c) 0, NULL, c##_ctl
|
#define CTL(c) 0, NULL, c##_ctl
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only handles internal indexed nodes, since there are currently no external
|
* Only handles internal indexed nodes, since there are currently no external
|
||||||
* ones.
|
* ones.
|
||||||
*/
|
*/
|
||||||
#define INDEX(i) {false}, i##_index
|
#define INDEX(i) {false}, i##_index
|
||||||
|
|
||||||
static const ctl_named_node_t thread_tcache_node[] = {
|
static const ctl_named_node_t thread_tcache_node[] = {
|
||||||
{NAME("enabled"), CTL(thread_tcache_enabled)},
|
{NAME("enabled"), CTL(thread_tcache_enabled)},
|
||||||
@ -1045,21 +1045,21 @@ ctl_postfork_child(tsdn_t *tsdn) {
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* *_ctl() functions. */
|
/* *_ctl() functions. */
|
||||||
|
|
||||||
#define READONLY() do { \
|
#define READONLY() do { \
|
||||||
if (newp != NULL || newlen != 0) { \
|
if (newp != NULL || newlen != 0) { \
|
||||||
ret = EPERM; \
|
ret = EPERM; \
|
||||||
goto label_return; \
|
goto label_return; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define WRITEONLY() do { \
|
#define WRITEONLY() do { \
|
||||||
if (oldp != NULL || oldlenp != NULL) { \
|
if (oldp != NULL || oldlenp != NULL) { \
|
||||||
ret = EPERM; \
|
ret = EPERM; \
|
||||||
goto label_return; \
|
goto label_return; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define READ_XOR_WRITE() do { \
|
#define READ_XOR_WRITE() do { \
|
||||||
if ((oldp != NULL && oldlenp != NULL) && (newp != NULL || \
|
if ((oldp != NULL && oldlenp != NULL) && (newp != NULL || \
|
||||||
newlen != 0)) { \
|
newlen != 0)) { \
|
||||||
ret = EPERM; \
|
ret = EPERM; \
|
||||||
@ -1067,7 +1067,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define READ(v, t) do { \
|
#define READ(v, t) do { \
|
||||||
if (oldp != NULL && oldlenp != NULL) { \
|
if (oldp != NULL && oldlenp != NULL) { \
|
||||||
if (*oldlenp != sizeof(t)) { \
|
if (*oldlenp != sizeof(t)) { \
|
||||||
size_t copylen = (sizeof(t) <= *oldlenp) \
|
size_t copylen = (sizeof(t) <= *oldlenp) \
|
||||||
@ -1080,7 +1080,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define WRITE(v, t) do { \
|
#define WRITE(v, t) do { \
|
||||||
if (newp != NULL) { \
|
if (newp != NULL) { \
|
||||||
if (newlen != sizeof(t)) { \
|
if (newlen != sizeof(t)) { \
|
||||||
ret = EINVAL; \
|
ret = EINVAL; \
|
||||||
@ -1090,7 +1090,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define MIB_UNSIGNED(v, i) do { \
|
#define MIB_UNSIGNED(v, i) do { \
|
||||||
if (mib[i] > UINT_MAX) { \
|
if (mib[i] > UINT_MAX) { \
|
||||||
ret = EFAULT; \
|
ret = EFAULT; \
|
||||||
goto label_return; \
|
goto label_return; \
|
||||||
@ -1102,7 +1102,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
|
|||||||
* There's a lot of code duplication in the following macros due to limitations
|
* There's a lot of code duplication in the following macros due to limitations
|
||||||
* in how nested cpp macros are expanded.
|
* in how nested cpp macros are expanded.
|
||||||
*/
|
*/
|
||||||
#define CTL_RO_CLGEN(c, l, n, v, t) \
|
#define CTL_RO_CLGEN(c, l, n, v, t) \
|
||||||
static int \
|
static int \
|
||||||
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
||||||
size_t *oldlenp, void *newp, size_t newlen) { \
|
size_t *oldlenp, void *newp, size_t newlen) { \
|
||||||
@ -1127,7 +1127,7 @@ label_return: \
|
|||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CTL_RO_CGEN(c, n, v, t) \
|
#define CTL_RO_CGEN(c, n, v, t) \
|
||||||
static int \
|
static int \
|
||||||
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
||||||
size_t *oldlenp, void *newp, size_t newlen) { \
|
size_t *oldlenp, void *newp, size_t newlen) { \
|
||||||
@ -1148,7 +1148,7 @@ label_return: \
|
|||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CTL_RO_GEN(n, v, t) \
|
#define CTL_RO_GEN(n, v, t) \
|
||||||
static int \
|
static int \
|
||||||
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
||||||
size_t *oldlenp, void *newp, size_t newlen) { \
|
size_t *oldlenp, void *newp, size_t newlen) { \
|
||||||
@ -1170,7 +1170,7 @@ label_return: \
|
|||||||
* ctl_mtx is not acquired, under the assumption that no pertinent data will
|
* ctl_mtx is not acquired, under the assumption that no pertinent data will
|
||||||
* mutate during the call.
|
* mutate during the call.
|
||||||
*/
|
*/
|
||||||
#define CTL_RO_NL_CGEN(c, n, v, t) \
|
#define CTL_RO_NL_CGEN(c, n, v, t) \
|
||||||
static int \
|
static int \
|
||||||
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
||||||
size_t *oldlenp, void *newp, size_t newlen) { \
|
size_t *oldlenp, void *newp, size_t newlen) { \
|
||||||
@ -1189,7 +1189,7 @@ label_return: \
|
|||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CTL_RO_NL_GEN(n, v, t) \
|
#define CTL_RO_NL_GEN(n, v, t) \
|
||||||
static int \
|
static int \
|
||||||
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
||||||
size_t *oldlenp, void *newp, size_t newlen) { \
|
size_t *oldlenp, void *newp, size_t newlen) { \
|
||||||
@ -1205,7 +1205,7 @@ label_return: \
|
|||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CTL_TSD_RO_NL_CGEN(c, n, m, t) \
|
#define CTL_TSD_RO_NL_CGEN(c, n, m, t) \
|
||||||
static int \
|
static int \
|
||||||
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
||||||
size_t *oldlenp, void *newp, size_t newlen) { \
|
size_t *oldlenp, void *newp, size_t newlen) { \
|
||||||
@ -1224,7 +1224,7 @@ label_return: \
|
|||||||
return ret; \
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CTL_RO_CONFIG_GEN(n, t) \
|
#define CTL_RO_CONFIG_GEN(n, t) \
|
||||||
static int \
|
static int \
|
||||||
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
|
||||||
size_t *oldlenp, void *newp, size_t newlen) { \
|
size_t *oldlenp, void *newp, size_t newlen) { \
|
||||||
|
10
src/extent.c
10
src/extent.c
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_EXTENT_C_
|
#define JEMALLOC_EXTENT_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -118,7 +118,7 @@ extent_hooks_assure_initialized(arena_t *arena,
|
|||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef extent_size_quantize_floor
|
#undef extent_size_quantize_floor
|
||||||
#define extent_size_quantize_floor JEMALLOC_N(n_extent_size_quantize_floor)
|
#define extent_size_quantize_floor JEMALLOC_N(n_extent_size_quantize_floor)
|
||||||
#endif
|
#endif
|
||||||
size_t
|
size_t
|
||||||
extent_size_quantize_floor(size_t size) {
|
extent_size_quantize_floor(size_t size) {
|
||||||
@ -147,14 +147,14 @@ extent_size_quantize_floor(size_t size) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef extent_size_quantize_floor
|
#undef extent_size_quantize_floor
|
||||||
#define extent_size_quantize_floor JEMALLOC_N(extent_size_quantize_floor)
|
#define extent_size_quantize_floor JEMALLOC_N(extent_size_quantize_floor)
|
||||||
extent_size_quantize_t *extent_size_quantize_floor =
|
extent_size_quantize_t *extent_size_quantize_floor =
|
||||||
JEMALLOC_N(n_extent_size_quantize_floor);
|
JEMALLOC_N(n_extent_size_quantize_floor);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef extent_size_quantize_ceil
|
#undef extent_size_quantize_ceil
|
||||||
#define extent_size_quantize_ceil JEMALLOC_N(n_extent_size_quantize_ceil)
|
#define extent_size_quantize_ceil JEMALLOC_N(n_extent_size_quantize_ceil)
|
||||||
#endif
|
#endif
|
||||||
size_t
|
size_t
|
||||||
extent_size_quantize_ceil(size_t size) {
|
extent_size_quantize_ceil(size_t size) {
|
||||||
@ -180,7 +180,7 @@ extent_size_quantize_ceil(size_t size) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef extent_size_quantize_ceil
|
#undef extent_size_quantize_ceil
|
||||||
#define extent_size_quantize_ceil JEMALLOC_N(extent_size_quantize_ceil)
|
#define extent_size_quantize_ceil JEMALLOC_N(extent_size_quantize_ceil)
|
||||||
extent_size_quantize_t *extent_size_quantize_ceil =
|
extent_size_quantize_t *extent_size_quantize_ceil =
|
||||||
JEMALLOC_N(n_extent_size_quantize_ceil);
|
JEMALLOC_N(n_extent_size_quantize_ceil);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_EXTENT_DSS_C_
|
#define JEMALLOC_EXTENT_DSS_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Data. */
|
/* Data. */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_EXTENT_MMAP_C_
|
#define JEMALLOC_EXTENT_MMAP_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#define JEMALLOC_HASH_C_
|
#define JEMALLOC_HASH_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_C_
|
#define JEMALLOC_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -84,10 +84,10 @@ static uint8_t malloc_slow_flags;
|
|||||||
|
|
||||||
JEMALLOC_ALIGNED(CACHELINE)
|
JEMALLOC_ALIGNED(CACHELINE)
|
||||||
const size_t pind2sz_tab[NPSIZES+1] = {
|
const size_t pind2sz_tab[NPSIZES+1] = {
|
||||||
#define PSZ_yes(lg_grp, ndelta, lg_delta) \
|
#define PSZ_yes(lg_grp, ndelta, lg_delta) \
|
||||||
(((ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta))),
|
(((ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta))),
|
||||||
#define PSZ_no(lg_grp, ndelta, lg_delta)
|
#define PSZ_no(lg_grp, ndelta, lg_delta)
|
||||||
#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, lg_delta_lookup) \
|
#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, lg_delta_lookup) \
|
||||||
PSZ_##psz(lg_grp, ndelta, lg_delta)
|
PSZ_##psz(lg_grp, ndelta, lg_delta)
|
||||||
SIZE_CLASSES
|
SIZE_CLASSES
|
||||||
#undef PSZ_yes
|
#undef PSZ_yes
|
||||||
@ -98,7 +98,7 @@ const size_t pind2sz_tab[NPSIZES+1] = {
|
|||||||
|
|
||||||
JEMALLOC_ALIGNED(CACHELINE)
|
JEMALLOC_ALIGNED(CACHELINE)
|
||||||
const size_t index2size_tab[NSIZES] = {
|
const size_t index2size_tab[NSIZES] = {
|
||||||
#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, lg_delta_lookup) \
|
#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, lg_delta_lookup) \
|
||||||
((ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta)),
|
((ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta)),
|
||||||
SIZE_CLASSES
|
SIZE_CLASSES
|
||||||
#undef SC
|
#undef SC
|
||||||
@ -108,69 +108,69 @@ JEMALLOC_ALIGNED(CACHELINE)
|
|||||||
const uint8_t size2index_tab[] = {
|
const uint8_t size2index_tab[] = {
|
||||||
#if LG_TINY_MIN == 0
|
#if LG_TINY_MIN == 0
|
||||||
#warning "Dangerous LG_TINY_MIN"
|
#warning "Dangerous LG_TINY_MIN"
|
||||||
#define S2B_0(i) i,
|
#define S2B_0(i) i,
|
||||||
#elif LG_TINY_MIN == 1
|
#elif LG_TINY_MIN == 1
|
||||||
#warning "Dangerous LG_TINY_MIN"
|
#warning "Dangerous LG_TINY_MIN"
|
||||||
#define S2B_1(i) i,
|
#define S2B_1(i) i,
|
||||||
#elif LG_TINY_MIN == 2
|
#elif LG_TINY_MIN == 2
|
||||||
#warning "Dangerous LG_TINY_MIN"
|
#warning "Dangerous LG_TINY_MIN"
|
||||||
#define S2B_2(i) i,
|
#define S2B_2(i) i,
|
||||||
#elif LG_TINY_MIN == 3
|
#elif LG_TINY_MIN == 3
|
||||||
#define S2B_3(i) i,
|
#define S2B_3(i) i,
|
||||||
#elif LG_TINY_MIN == 4
|
#elif LG_TINY_MIN == 4
|
||||||
#define S2B_4(i) i,
|
#define S2B_4(i) i,
|
||||||
#elif LG_TINY_MIN == 5
|
#elif LG_TINY_MIN == 5
|
||||||
#define S2B_5(i) i,
|
#define S2B_5(i) i,
|
||||||
#elif LG_TINY_MIN == 6
|
#elif LG_TINY_MIN == 6
|
||||||
#define S2B_6(i) i,
|
#define S2B_6(i) i,
|
||||||
#elif LG_TINY_MIN == 7
|
#elif LG_TINY_MIN == 7
|
||||||
#define S2B_7(i) i,
|
#define S2B_7(i) i,
|
||||||
#elif LG_TINY_MIN == 8
|
#elif LG_TINY_MIN == 8
|
||||||
#define S2B_8(i) i,
|
#define S2B_8(i) i,
|
||||||
#elif LG_TINY_MIN == 9
|
#elif LG_TINY_MIN == 9
|
||||||
#define S2B_9(i) i,
|
#define S2B_9(i) i,
|
||||||
#elif LG_TINY_MIN == 10
|
#elif LG_TINY_MIN == 10
|
||||||
#define S2B_10(i) i,
|
#define S2B_10(i) i,
|
||||||
#elif LG_TINY_MIN == 11
|
#elif LG_TINY_MIN == 11
|
||||||
#define S2B_11(i) i,
|
#define S2B_11(i) i,
|
||||||
#else
|
#else
|
||||||
#error "Unsupported LG_TINY_MIN"
|
#error "Unsupported LG_TINY_MIN"
|
||||||
#endif
|
#endif
|
||||||
#if LG_TINY_MIN < 1
|
#if LG_TINY_MIN < 1
|
||||||
#define S2B_1(i) S2B_0(i) S2B_0(i)
|
#define S2B_1(i) S2B_0(i) S2B_0(i)
|
||||||
#endif
|
#endif
|
||||||
#if LG_TINY_MIN < 2
|
#if LG_TINY_MIN < 2
|
||||||
#define S2B_2(i) S2B_1(i) S2B_1(i)
|
#define S2B_2(i) S2B_1(i) S2B_1(i)
|
||||||
#endif
|
#endif
|
||||||
#if LG_TINY_MIN < 3
|
#if LG_TINY_MIN < 3
|
||||||
#define S2B_3(i) S2B_2(i) S2B_2(i)
|
#define S2B_3(i) S2B_2(i) S2B_2(i)
|
||||||
#endif
|
#endif
|
||||||
#if LG_TINY_MIN < 4
|
#if LG_TINY_MIN < 4
|
||||||
#define S2B_4(i) S2B_3(i) S2B_3(i)
|
#define S2B_4(i) S2B_3(i) S2B_3(i)
|
||||||
#endif
|
#endif
|
||||||
#if LG_TINY_MIN < 5
|
#if LG_TINY_MIN < 5
|
||||||
#define S2B_5(i) S2B_4(i) S2B_4(i)
|
#define S2B_5(i) S2B_4(i) S2B_4(i)
|
||||||
#endif
|
#endif
|
||||||
#if LG_TINY_MIN < 6
|
#if LG_TINY_MIN < 6
|
||||||
#define S2B_6(i) S2B_5(i) S2B_5(i)
|
#define S2B_6(i) S2B_5(i) S2B_5(i)
|
||||||
#endif
|
#endif
|
||||||
#if LG_TINY_MIN < 7
|
#if LG_TINY_MIN < 7
|
||||||
#define S2B_7(i) S2B_6(i) S2B_6(i)
|
#define S2B_7(i) S2B_6(i) S2B_6(i)
|
||||||
#endif
|
#endif
|
||||||
#if LG_TINY_MIN < 8
|
#if LG_TINY_MIN < 8
|
||||||
#define S2B_8(i) S2B_7(i) S2B_7(i)
|
#define S2B_8(i) S2B_7(i) S2B_7(i)
|
||||||
#endif
|
#endif
|
||||||
#if LG_TINY_MIN < 9
|
#if LG_TINY_MIN < 9
|
||||||
#define S2B_9(i) S2B_8(i) S2B_8(i)
|
#define S2B_9(i) S2B_8(i) S2B_8(i)
|
||||||
#endif
|
#endif
|
||||||
#if LG_TINY_MIN < 10
|
#if LG_TINY_MIN < 10
|
||||||
#define S2B_10(i) S2B_9(i) S2B_9(i)
|
#define S2B_10(i) S2B_9(i) S2B_9(i)
|
||||||
#endif
|
#endif
|
||||||
#if LG_TINY_MIN < 11
|
#if LG_TINY_MIN < 11
|
||||||
#define S2B_11(i) S2B_10(i) S2B_10(i)
|
#define S2B_11(i) S2B_10(i) S2B_10(i)
|
||||||
#endif
|
#endif
|
||||||
#define S2B_no(i)
|
#define S2B_no(i)
|
||||||
#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, lg_delta_lookup) \
|
#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, lg_delta_lookup) \
|
||||||
S2B_##lg_delta_lookup(index)
|
S2B_##lg_delta_lookup(index)
|
||||||
SIZE_CLASSES
|
SIZE_CLASSES
|
||||||
#undef S2B_3
|
#undef S2B_3
|
||||||
@ -928,11 +928,11 @@ malloc_conf_init(void) {
|
|||||||
|
|
||||||
while (*opts != '\0' && !malloc_conf_next(&opts, &k, &klen, &v,
|
while (*opts != '\0' && !malloc_conf_next(&opts, &k, &klen, &v,
|
||||||
&vlen)) {
|
&vlen)) {
|
||||||
#define CONF_MATCH(n) \
|
#define CONF_MATCH(n) \
|
||||||
(sizeof(n)-1 == klen && strncmp(n, k, klen) == 0)
|
(sizeof(n)-1 == klen && strncmp(n, k, klen) == 0)
|
||||||
#define CONF_MATCH_VALUE(n) \
|
#define CONF_MATCH_VALUE(n) \
|
||||||
(sizeof(n)-1 == vlen && strncmp(n, v, vlen) == 0)
|
(sizeof(n)-1 == vlen && strncmp(n, v, vlen) == 0)
|
||||||
#define CONF_HANDLE_BOOL(o, n, cont) \
|
#define CONF_HANDLE_BOOL(o, n, cont) \
|
||||||
if (CONF_MATCH(n)) { \
|
if (CONF_MATCH(n)) { \
|
||||||
if (CONF_MATCH_VALUE("true")) { \
|
if (CONF_MATCH_VALUE("true")) { \
|
||||||
o = true; \
|
o = true; \
|
||||||
@ -947,11 +947,11 @@ malloc_conf_init(void) {
|
|||||||
continue; \
|
continue; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define CONF_MIN_no(um, min) false
|
#define CONF_MIN_no(um, min) false
|
||||||
#define CONF_MIN_yes(um, min) ((um) < (min))
|
#define CONF_MIN_yes(um, min) ((um) < (min))
|
||||||
#define CONF_MAX_no(um, max) false
|
#define CONF_MAX_no(um, max) false
|
||||||
#define CONF_MAX_yes(um, max) ((um) > (max))
|
#define CONF_MAX_yes(um, max) ((um) > (max))
|
||||||
#define CONF_HANDLE_T_U(t, o, n, min, max, check_min, check_max, clip) \
|
#define CONF_HANDLE_T_U(t, o, n, min, max, check_min, check_max, clip) \
|
||||||
if (CONF_MATCH(n)) { \
|
if (CONF_MATCH(n)) { \
|
||||||
uintmax_t um; \
|
uintmax_t um; \
|
||||||
char *end; \
|
char *end; \
|
||||||
@ -989,14 +989,14 @@ malloc_conf_init(void) {
|
|||||||
} \
|
} \
|
||||||
continue; \
|
continue; \
|
||||||
}
|
}
|
||||||
#define CONF_HANDLE_UNSIGNED(o, n, min, max, check_min, check_max, \
|
#define CONF_HANDLE_UNSIGNED(o, n, min, max, check_min, check_max, \
|
||||||
clip) \
|
clip) \
|
||||||
CONF_HANDLE_T_U(unsigned, o, n, min, max, \
|
CONF_HANDLE_T_U(unsigned, o, n, min, max, \
|
||||||
check_min, check_max, clip)
|
check_min, check_max, clip)
|
||||||
#define CONF_HANDLE_SIZE_T(o, n, min, max, check_min, check_max, clip) \
|
#define CONF_HANDLE_SIZE_T(o, n, min, max, check_min, check_max, clip) \
|
||||||
CONF_HANDLE_T_U(size_t, o, n, min, max, \
|
CONF_HANDLE_T_U(size_t, o, n, min, max, \
|
||||||
check_min, check_max, clip)
|
check_min, check_max, clip)
|
||||||
#define CONF_HANDLE_SSIZE_T(o, n, min, max) \
|
#define CONF_HANDLE_SSIZE_T(o, n, min, max) \
|
||||||
if (CONF_MATCH(n)) { \
|
if (CONF_MATCH(n)) { \
|
||||||
long l; \
|
long l; \
|
||||||
char *end; \
|
char *end; \
|
||||||
@ -1018,7 +1018,7 @@ malloc_conf_init(void) {
|
|||||||
} \
|
} \
|
||||||
continue; \
|
continue; \
|
||||||
}
|
}
|
||||||
#define CONF_HANDLE_CHAR_P(o, n, d) \
|
#define CONF_HANDLE_CHAR_P(o, n, d) \
|
||||||
if (CONF_MATCH(n)) { \
|
if (CONF_MATCH(n)) { \
|
||||||
size_t cpylen = (vlen <= \
|
size_t cpylen = (vlen <= \
|
||||||
sizeof(o)-1) ? vlen : \
|
sizeof(o)-1) ? vlen : \
|
||||||
@ -2119,9 +2119,9 @@ je_valloc(size_t size) {
|
|||||||
* is_malloc(je_malloc) is some macro magic to detect if jemalloc_defs.h has
|
* is_malloc(je_malloc) is some macro magic to detect if jemalloc_defs.h has
|
||||||
* #define je_malloc malloc
|
* #define je_malloc malloc
|
||||||
*/
|
*/
|
||||||
#define malloc_is_malloc 1
|
#define malloc_is_malloc 1
|
||||||
#define is_malloc_(a) malloc_is_ ## a
|
#define is_malloc_(a) malloc_is_ ## a
|
||||||
#define is_malloc(a) is_malloc_(a)
|
#define is_malloc(a) is_malloc_(a)
|
||||||
|
|
||||||
#if ((is_malloc(je_malloc) == 1) && defined(JEMALLOC_GLIBC_MALLOC_HOOK))
|
#if ((is_malloc(je_malloc) == 1) && defined(JEMALLOC_GLIBC_MALLOC_HOOK))
|
||||||
/*
|
/*
|
||||||
@ -2147,9 +2147,9 @@ JEMALLOC_EXPORT void *(*__memalign_hook)(size_t alignment, size_t size) =
|
|||||||
* be implemented also, so none of glibc's malloc.o functions are added to the
|
* be implemented also, so none of glibc's malloc.o functions are added to the
|
||||||
* link.
|
* link.
|
||||||
*/
|
*/
|
||||||
#define ALIAS(je_fn) __attribute__((alias (#je_fn), used))
|
#define ALIAS(je_fn) __attribute__((alias (#je_fn), used))
|
||||||
/* To force macro expansion of je_ prefix before stringification. */
|
/* To force macro expansion of je_ prefix before stringification. */
|
||||||
#define PREALIAS(je_fn) ALIAS(je_fn)
|
#define PREALIAS(je_fn) ALIAS(je_fn)
|
||||||
void *__libc_malloc(size_t size) PREALIAS(je_malloc);
|
void *__libc_malloc(size_t size) PREALIAS(je_malloc);
|
||||||
void __libc_free(void* ptr) PREALIAS(je_free);
|
void __libc_free(void* ptr) PREALIAS(je_free);
|
||||||
void *__libc_realloc(void* ptr, size_t size) PREALIAS(je_realloc);
|
void *__libc_realloc(void* ptr, size_t size) PREALIAS(je_realloc);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#define JEMALLOC_CPP_CPP_
|
#define JEMALLOC_CPP_CPP_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
// All operators in this file are exported.
|
// All operators in this file are exported.
|
||||||
|
10
src/large.c
10
src/large.c
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_LARGE_C_
|
#define JEMALLOC_LARGE_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -63,7 +63,7 @@ large_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize, size_t alignment,
|
|||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef large_dalloc_junk
|
#undef large_dalloc_junk
|
||||||
#define large_dalloc_junk JEMALLOC_N(n_large_dalloc_junk)
|
#define large_dalloc_junk JEMALLOC_N(n_large_dalloc_junk)
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
large_dalloc_junk(void *ptr, size_t usize) {
|
large_dalloc_junk(void *ptr, size_t usize) {
|
||||||
@ -71,13 +71,13 @@ large_dalloc_junk(void *ptr, size_t usize) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef large_dalloc_junk
|
#undef large_dalloc_junk
|
||||||
#define large_dalloc_junk JEMALLOC_N(large_dalloc_junk)
|
#define large_dalloc_junk JEMALLOC_N(large_dalloc_junk)
|
||||||
large_dalloc_junk_t *large_dalloc_junk = JEMALLOC_N(n_large_dalloc_junk);
|
large_dalloc_junk_t *large_dalloc_junk = JEMALLOC_N(n_large_dalloc_junk);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef large_dalloc_maybe_junk
|
#undef large_dalloc_maybe_junk
|
||||||
#define large_dalloc_maybe_junk JEMALLOC_N(n_large_dalloc_maybe_junk)
|
#define large_dalloc_maybe_junk JEMALLOC_N(n_large_dalloc_maybe_junk)
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
large_dalloc_maybe_junk(void *ptr, size_t usize) {
|
large_dalloc_maybe_junk(void *ptr, size_t usize) {
|
||||||
@ -93,7 +93,7 @@ large_dalloc_maybe_junk(void *ptr, size_t usize) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef large_dalloc_maybe_junk
|
#undef large_dalloc_maybe_junk
|
||||||
#define large_dalloc_maybe_junk JEMALLOC_N(large_dalloc_maybe_junk)
|
#define large_dalloc_maybe_junk JEMALLOC_N(large_dalloc_maybe_junk)
|
||||||
large_dalloc_maybe_junk_t *large_dalloc_maybe_junk =
|
large_dalloc_maybe_junk_t *large_dalloc_maybe_junk =
|
||||||
JEMALLOC_N(n_large_dalloc_maybe_junk);
|
JEMALLOC_N(n_large_dalloc_maybe_junk);
|
||||||
#endif
|
#endif
|
||||||
|
2
src/mb.c
2
src/mb.c
@ -1,2 +1,2 @@
|
|||||||
#define JEMALLOC_MB_C_
|
#define JEMALLOC_MB_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_MUTEX_C_
|
#define JEMALLOC_MUTEX_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
#if defined(JEMALLOC_LAZY_LOCK) && !defined(_WIN32)
|
#if defined(JEMALLOC_LAZY_LOCK) && !defined(_WIN32)
|
||||||
@ -6,7 +6,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _CRT_SPINCOUNT
|
#ifndef _CRT_SPINCOUNT
|
||||||
#define _CRT_SPINCOUNT 4000
|
#define _CRT_SPINCOUNT 4000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
10
src/nstime.c
10
src/nstime.c
@ -1,6 +1,6 @@
|
|||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
#define BILLION UINT64_C(1000000000)
|
#define BILLION UINT64_C(1000000000)
|
||||||
|
|
||||||
void
|
void
|
||||||
nstime_init(nstime_t *time, uint64_t ns) {
|
nstime_init(nstime_t *time, uint64_t ns) {
|
||||||
@ -122,7 +122,7 @@ nstime_get(nstime_t *time) {
|
|||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef nstime_monotonic
|
#undef nstime_monotonic
|
||||||
#define nstime_monotonic JEMALLOC_N(n_nstime_monotonic)
|
#define nstime_monotonic JEMALLOC_N(n_nstime_monotonic)
|
||||||
#endif
|
#endif
|
||||||
bool
|
bool
|
||||||
nstime_monotonic(void) {
|
nstime_monotonic(void) {
|
||||||
@ -131,13 +131,13 @@ nstime_monotonic(void) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef nstime_monotonic
|
#undef nstime_monotonic
|
||||||
#define nstime_monotonic JEMALLOC_N(nstime_monotonic)
|
#define nstime_monotonic JEMALLOC_N(nstime_monotonic)
|
||||||
nstime_monotonic_t *nstime_monotonic = JEMALLOC_N(n_nstime_monotonic);
|
nstime_monotonic_t *nstime_monotonic = JEMALLOC_N(n_nstime_monotonic);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef nstime_update
|
#undef nstime_update
|
||||||
#define nstime_update JEMALLOC_N(n_nstime_update)
|
#define nstime_update JEMALLOC_N(n_nstime_update)
|
||||||
#endif
|
#endif
|
||||||
bool
|
bool
|
||||||
nstime_update(nstime_t *time) {
|
nstime_update(nstime_t *time) {
|
||||||
@ -156,6 +156,6 @@ nstime_update(nstime_t *time) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef nstime_update
|
#undef nstime_update
|
||||||
#define nstime_update JEMALLOC_N(nstime_update)
|
#define nstime_update JEMALLOC_N(nstime_update)
|
||||||
nstime_update_t *nstime_update = JEMALLOC_N(n_nstime_update);
|
nstime_update_t *nstime_update = JEMALLOC_N(n_nstime_update);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_PAGES_C_
|
#define JEMALLOC_PAGES_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
#ifdef JEMALLOC_SYSCTL_VM_OVERCOMMIT
|
#ifdef JEMALLOC_SYSCTL_VM_OVERCOMMIT
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#define JEMALLOC_PRNG_C_
|
#define JEMALLOC_PRNG_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
18
src/prof.c
18
src/prof.c
@ -1,9 +1,9 @@
|
|||||||
#define JEMALLOC_PROF_C_
|
#define JEMALLOC_PROF_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#ifdef JEMALLOC_PROF_LIBUNWIND
|
#ifdef JEMALLOC_PROF_LIBUNWIND
|
||||||
#define UNW_LOCAL_ONLY
|
#define UNW_LOCAL_ONLY
|
||||||
#include <libunwind.h>
|
#include <libunwind.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ prof_backtrace(prof_bt_t *bt) {
|
|||||||
#elif (defined(JEMALLOC_PROF_GCC))
|
#elif (defined(JEMALLOC_PROF_GCC))
|
||||||
void
|
void
|
||||||
prof_backtrace(prof_bt_t *bt) {
|
prof_backtrace(prof_bt_t *bt) {
|
||||||
#define BT_FRAME(i) \
|
#define BT_FRAME(i) \
|
||||||
if ((i) < PROF_BT_MAX) { \
|
if ((i) < PROF_BT_MAX) { \
|
||||||
void *p; \
|
void *p; \
|
||||||
if (__builtin_frame_address(i) == 0) { \
|
if (__builtin_frame_address(i) == 0) { \
|
||||||
@ -928,7 +928,7 @@ prof_bt_count(void) {
|
|||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef prof_dump_open
|
#undef prof_dump_open
|
||||||
#define prof_dump_open JEMALLOC_N(prof_dump_open_impl)
|
#define prof_dump_open JEMALLOC_N(prof_dump_open_impl)
|
||||||
#endif
|
#endif
|
||||||
static int
|
static int
|
||||||
prof_dump_open(bool propagate_err, const char *filename) {
|
prof_dump_open(bool propagate_err, const char *filename) {
|
||||||
@ -947,7 +947,7 @@ prof_dump_open(bool propagate_err, const char *filename) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef prof_dump_open
|
#undef prof_dump_open
|
||||||
#define prof_dump_open JEMALLOC_N(prof_dump_open)
|
#define prof_dump_open JEMALLOC_N(prof_dump_open)
|
||||||
prof_dump_open_t *prof_dump_open = JEMALLOC_N(prof_dump_open_impl);
|
prof_dump_open_t *prof_dump_open = JEMALLOC_N(prof_dump_open_impl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1305,7 +1305,7 @@ prof_tdata_dump_iter(prof_tdata_tree_t *tdatas, prof_tdata_t *tdata,
|
|||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef prof_dump_header
|
#undef prof_dump_header
|
||||||
#define prof_dump_header JEMALLOC_N(prof_dump_header_impl)
|
#define prof_dump_header JEMALLOC_N(prof_dump_header_impl)
|
||||||
#endif
|
#endif
|
||||||
static bool
|
static bool
|
||||||
prof_dump_header(tsdn_t *tsdn, bool propagate_err, const prof_cnt_t *cnt_all) {
|
prof_dump_header(tsdn_t *tsdn, bool propagate_err, const prof_cnt_t *cnt_all) {
|
||||||
@ -1327,7 +1327,7 @@ prof_dump_header(tsdn_t *tsdn, bool propagate_err, const prof_cnt_t *cnt_all) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef prof_dump_header
|
#undef prof_dump_header
|
||||||
#define prof_dump_header JEMALLOC_N(prof_dump_header)
|
#define prof_dump_header JEMALLOC_N(prof_dump_header)
|
||||||
prof_dump_header_t *prof_dump_header = JEMALLOC_N(prof_dump_header_impl);
|
prof_dump_header_t *prof_dump_header = JEMALLOC_N(prof_dump_header_impl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1696,8 +1696,8 @@ prof_cnt_all(uint64_t *curobjs, uint64_t *curbytes, uint64_t *accumobjs,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DUMP_FILENAME_BUFSIZE (PATH_MAX + 1)
|
#define DUMP_FILENAME_BUFSIZE (PATH_MAX + 1)
|
||||||
#define VSEQ_INVALID UINT64_C(0xffffffffffffffff)
|
#define VSEQ_INVALID UINT64_C(0xffffffffffffffff)
|
||||||
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);
|
||||||
|
10
src/rtree.c
10
src/rtree.c
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_RTREE_C_
|
#define JEMALLOC_RTREE_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
@ -65,7 +65,7 @@ rtree_new(rtree_t *rtree, unsigned bits) {
|
|||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef rtree_node_alloc
|
#undef rtree_node_alloc
|
||||||
#define rtree_node_alloc JEMALLOC_N(rtree_node_alloc_impl)
|
#define rtree_node_alloc JEMALLOC_N(rtree_node_alloc_impl)
|
||||||
#endif
|
#endif
|
||||||
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) {
|
||||||
@ -74,13 +74,13 @@ rtree_node_alloc(tsdn_t *tsdn, rtree_t *rtree, size_t nelms) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef rtree_node_alloc
|
#undef rtree_node_alloc
|
||||||
#define rtree_node_alloc JEMALLOC_N(rtree_node_alloc)
|
#define rtree_node_alloc JEMALLOC_N(rtree_node_alloc)
|
||||||
rtree_node_alloc_t *rtree_node_alloc = JEMALLOC_N(rtree_node_alloc_impl);
|
rtree_node_alloc_t *rtree_node_alloc = JEMALLOC_N(rtree_node_alloc_impl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef rtree_node_dalloc
|
#undef rtree_node_dalloc
|
||||||
#define rtree_node_dalloc JEMALLOC_N(rtree_node_dalloc_impl)
|
#define rtree_node_dalloc JEMALLOC_N(rtree_node_dalloc_impl)
|
||||||
#endif
|
#endif
|
||||||
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) {
|
||||||
@ -89,7 +89,7 @@ rtree_node_dalloc(tsdn_t *tsdn, rtree_t *rtree, rtree_elm_t *node) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef rtree_node_dalloc
|
#undef rtree_node_dalloc
|
||||||
#define rtree_node_dalloc JEMALLOC_N(rtree_node_dalloc)
|
#define rtree_node_dalloc JEMALLOC_N(rtree_node_dalloc)
|
||||||
rtree_node_dalloc_t *rtree_node_dalloc = JEMALLOC_N(rtree_node_dalloc_impl);
|
rtree_node_dalloc_t *rtree_node_dalloc = JEMALLOC_N(rtree_node_dalloc_impl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#define JEMALLOC_SPIN_C_
|
#define JEMALLOC_SPIN_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
22
src/stats.c
22
src/stats.c
@ -1,12 +1,12 @@
|
|||||||
#define JEMALLOC_STATS_C_
|
#define JEMALLOC_STATS_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
#define CTL_GET(n, v, t) do { \
|
#define CTL_GET(n, v, t) do { \
|
||||||
size_t sz = sizeof(t); \
|
size_t sz = sizeof(t); \
|
||||||
xmallctl(n, (void *)v, &sz, NULL, 0); \
|
xmallctl(n, (void *)v, &sz, NULL, 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define CTL_M2_GET(n, i, v, t) do { \
|
#define CTL_M2_GET(n, i, v, t) do { \
|
||||||
size_t mib[6]; \
|
size_t mib[6]; \
|
||||||
size_t miblen = sizeof(mib) / sizeof(size_t); \
|
size_t miblen = sizeof(mib) / sizeof(size_t); \
|
||||||
size_t sz = sizeof(t); \
|
size_t sz = sizeof(t); \
|
||||||
@ -15,7 +15,7 @@
|
|||||||
xmallctlbymib(mib, miblen, (void *)v, &sz, NULL, 0); \
|
xmallctlbymib(mib, miblen, (void *)v, &sz, NULL, 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define CTL_M2_M4_GET(n, i, j, v, t) do { \
|
#define CTL_M2_M4_GET(n, i, j, v, t) do { \
|
||||||
size_t mib[6]; \
|
size_t mib[6]; \
|
||||||
size_t miblen = sizeof(mib) / sizeof(size_t); \
|
size_t miblen = sizeof(mib) / sizeof(size_t); \
|
||||||
size_t sz = sizeof(t); \
|
size_t sz = sizeof(t); \
|
||||||
@ -478,7 +478,7 @@ stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* config. */
|
/* config. */
|
||||||
#define CONFIG_WRITE_BOOL_JSON(n, c) \
|
#define CONFIG_WRITE_BOOL_JSON(n, c) \
|
||||||
if (json) { \
|
if (json) { \
|
||||||
CTL_GET("config."#n, &bv, bool); \
|
CTL_GET("config."#n, &bv, bool); \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
@ -531,7 +531,7 @@ stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
#undef CONFIG_WRITE_BOOL_JSON
|
#undef CONFIG_WRITE_BOOL_JSON
|
||||||
|
|
||||||
/* opt. */
|
/* opt. */
|
||||||
#define OPT_WRITE_BOOL(n, c) \
|
#define OPT_WRITE_BOOL(n, c) \
|
||||||
if (je_mallctl("opt."#n, (void *)&bv, &bsz, NULL, 0) == 0) { \
|
if (je_mallctl("opt."#n, (void *)&bv, &bsz, NULL, 0) == 0) { \
|
||||||
if (json) { \
|
if (json) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
@ -542,7 +542,7 @@ stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
" opt."#n": %s\n", bv ? "true" : "false"); \
|
" opt."#n": %s\n", bv ? "true" : "false"); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define OPT_WRITE_BOOL_MUTABLE(n, m, c) { \
|
#define OPT_WRITE_BOOL_MUTABLE(n, m, c) { \
|
||||||
bool bv2; \
|
bool bv2; \
|
||||||
if (je_mallctl("opt."#n, (void *)&bv, &bsz, NULL, 0) == 0 && \
|
if (je_mallctl("opt."#n, (void *)&bv, &bsz, NULL, 0) == 0 && \
|
||||||
je_mallctl(#m, (void *)&bv2, &bsz, NULL, 0) == 0) { \
|
je_mallctl(#m, (void *)&bv2, &bsz, NULL, 0) == 0) { \
|
||||||
@ -557,7 +557,7 @@ stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define OPT_WRITE_UNSIGNED(n, c) \
|
#define OPT_WRITE_UNSIGNED(n, c) \
|
||||||
if (je_mallctl("opt."#n, (void *)&uv, &usz, NULL, 0) == 0) { \
|
if (je_mallctl("opt."#n, (void *)&uv, &usz, NULL, 0) == 0) { \
|
||||||
if (json) { \
|
if (json) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
@ -567,7 +567,7 @@ stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
" opt."#n": %u\n", uv); \
|
" opt."#n": %u\n", uv); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define OPT_WRITE_SSIZE_T(n, c) \
|
#define OPT_WRITE_SSIZE_T(n, c) \
|
||||||
if (je_mallctl("opt."#n, (void *)&ssv, &sssz, NULL, 0) == 0) { \
|
if (je_mallctl("opt."#n, (void *)&ssv, &sssz, NULL, 0) == 0) { \
|
||||||
if (json) { \
|
if (json) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
@ -577,7 +577,7 @@ stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
" opt."#n": %zd\n", ssv); \
|
" opt."#n": %zd\n", ssv); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define OPT_WRITE_SSIZE_T_MUTABLE(n, m, c) { \
|
#define OPT_WRITE_SSIZE_T_MUTABLE(n, m, c) { \
|
||||||
ssize_t ssv2; \
|
ssize_t ssv2; \
|
||||||
if (je_mallctl("opt."#n, (void *)&ssv, &sssz, NULL, 0) == 0 && \
|
if (je_mallctl("opt."#n, (void *)&ssv, &sssz, NULL, 0) == 0 && \
|
||||||
je_mallctl(#m, (void *)&ssv2, &sssz, NULL, 0) == 0) { \
|
je_mallctl(#m, (void *)&ssv2, &sssz, NULL, 0) == 0) { \
|
||||||
@ -591,7 +591,7 @@ stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define OPT_WRITE_CHAR_P(n, c) \
|
#define OPT_WRITE_CHAR_P(n, c) \
|
||||||
if (je_mallctl("opt."#n, (void *)&cpv, &cpsz, NULL, 0) == 0) { \
|
if (je_mallctl("opt."#n, (void *)&cpv, &cpsz, NULL, 0) == 0) { \
|
||||||
if (json) { \
|
if (json) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_TCACHE_C_
|
#define JEMALLOC_TCACHE_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#define JEMALLOC_TICKER_C_
|
#define JEMALLOC_TICKER_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_TSD_C_
|
#define JEMALLOC_TSD_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -69,10 +69,10 @@ tsd_cleanup(void *arg) {
|
|||||||
/* Do nothing. */
|
/* Do nothing. */
|
||||||
break;
|
break;
|
||||||
case tsd_state_nominal:
|
case tsd_state_nominal:
|
||||||
#define MALLOC_TSD_cleanup_yes(n, t) \
|
#define MALLOC_TSD_cleanup_yes(n, t) \
|
||||||
n##_cleanup(tsd);
|
n##_cleanup(tsd);
|
||||||
#define MALLOC_TSD_cleanup_no(n, t)
|
#define MALLOC_TSD_cleanup_no(n, t)
|
||||||
#define O(n, t, c) \
|
#define O(n, t, c) \
|
||||||
MALLOC_TSD_cleanup_##c(n, t)
|
MALLOC_TSD_cleanup_##c(n, t)
|
||||||
MALLOC_TSD
|
MALLOC_TSD
|
||||||
#undef MALLOC_TSD_cleanup_yes
|
#undef MALLOC_TSD_cleanup_yes
|
||||||
|
24
src/util.c
24
src/util.c
@ -2,14 +2,14 @@
|
|||||||
* Define simple versions of assertion macros that won't recurse in case
|
* Define simple versions of assertion macros that won't recurse in case
|
||||||
* of assertion failures in malloc_*printf().
|
* of assertion failures in malloc_*printf().
|
||||||
*/
|
*/
|
||||||
#define assert(e) do { \
|
#define assert(e) do { \
|
||||||
if (config_debug && !(e)) { \
|
if (config_debug && !(e)) { \
|
||||||
malloc_write("<jemalloc>: Failed assertion\n"); \
|
malloc_write("<jemalloc>: Failed assertion\n"); \
|
||||||
abort(); \
|
abort(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define not_reached() do { \
|
#define not_reached() do { \
|
||||||
if (config_debug) { \
|
if (config_debug) { \
|
||||||
malloc_write("<jemalloc>: Unreachable code reached\n"); \
|
malloc_write("<jemalloc>: Unreachable code reached\n"); \
|
||||||
abort(); \
|
abort(); \
|
||||||
@ -17,28 +17,28 @@
|
|||||||
unreachable(); \
|
unreachable(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define not_implemented() do { \
|
#define not_implemented() do { \
|
||||||
if (config_debug) { \
|
if (config_debug) { \
|
||||||
malloc_write("<jemalloc>: Not implemented\n"); \
|
malloc_write("<jemalloc>: Not implemented\n"); \
|
||||||
abort(); \
|
abort(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define JEMALLOC_UTIL_C_
|
#define JEMALLOC_UTIL_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Function prototypes for non-inline static functions. */
|
/* Function prototypes for non-inline static functions. */
|
||||||
|
|
||||||
static void wrtmessage(void *cbopaque, const char *s);
|
static void wrtmessage(void *cbopaque, const char *s);
|
||||||
#define U2S_BUFSIZE ((1U << (LG_SIZEOF_INTMAX_T + 3)) + 1)
|
#define U2S_BUFSIZE ((1U << (LG_SIZEOF_INTMAX_T + 3)) + 1)
|
||||||
static char *u2s(uintmax_t x, unsigned base, bool uppercase, char *s,
|
static char *u2s(uintmax_t x, unsigned base, bool uppercase, char *s,
|
||||||
size_t *slen_p);
|
size_t *slen_p);
|
||||||
#define D2S_BUFSIZE (1 + U2S_BUFSIZE)
|
#define D2S_BUFSIZE (1 + U2S_BUFSIZE)
|
||||||
static char *d2s(intmax_t x, char sign, char *s, size_t *slen_p);
|
static char *d2s(intmax_t x, char sign, char *s, size_t *slen_p);
|
||||||
#define O2S_BUFSIZE (1 + U2S_BUFSIZE)
|
#define O2S_BUFSIZE (1 + U2S_BUFSIZE)
|
||||||
static char *o2s(uintmax_t x, bool alt_form, char *s, size_t *slen_p);
|
static char *o2s(uintmax_t x, bool alt_form, char *s, size_t *slen_p);
|
||||||
#define X2S_BUFSIZE (2 + U2S_BUFSIZE)
|
#define X2S_BUFSIZE (2 + U2S_BUFSIZE)
|
||||||
static char *x2s(uintmax_t x, bool alt_form, bool uppercase, char *s,
|
static char *x2s(uintmax_t x, bool alt_form, bool uppercase, char *s,
|
||||||
size_t *slen_p);
|
size_t *slen_p);
|
||||||
|
|
||||||
@ -318,20 +318,20 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
|
|||||||
size_t i;
|
size_t i;
|
||||||
const char *f;
|
const char *f;
|
||||||
|
|
||||||
#define APPEND_C(c) do { \
|
#define APPEND_C(c) do { \
|
||||||
if (i < size) { \
|
if (i < size) { \
|
||||||
str[i] = (c); \
|
str[i] = (c); \
|
||||||
} \
|
} \
|
||||||
i++; \
|
i++; \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define APPEND_S(s, slen) do { \
|
#define APPEND_S(s, slen) do { \
|
||||||
if (i < size) { \
|
if (i < size) { \
|
||||||
size_t cpylen = (slen <= size - i) ? slen : size - i; \
|
size_t cpylen = (slen <= size - i) ? slen : size - i; \
|
||||||
memcpy(&str[i], s, cpylen); \
|
memcpy(&str[i], s, cpylen); \
|
||||||
} \
|
} \
|
||||||
i += slen; \
|
i += slen; \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define APPEND_PADDED_S(s, slen, width, left_justify) do { \
|
#define APPEND_PADDED_S(s, slen, width, left_justify) do { \
|
||||||
/* Left padding. */ \
|
/* Left padding. */ \
|
||||||
size_t pad_len = (width == -1) ? 0 : ((slen < (size_t)width) ? \
|
size_t pad_len = (width == -1) ? 0 : ((slen < (size_t)width) ? \
|
||||||
(size_t)width - slen : 0); \
|
(size_t)width - slen : 0); \
|
||||||
@ -351,7 +351,7 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define GET_ARG_NUMERIC(val, len) do { \
|
#define GET_ARG_NUMERIC(val, len) do { \
|
||||||
switch (len) { \
|
switch (len) { \
|
||||||
case '?': \
|
case '?': \
|
||||||
val = va_arg(ap, int); \
|
val = va_arg(ap, int); \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define JEMALLOC_WITNESS_C_
|
#define JEMALLOC_WITNESS_C_
|
||||||
#include "jemalloc/internal/jemalloc_internal.h"
|
#include "jemalloc/internal/jemalloc_internal.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -12,7 +12,7 @@ witness_init(witness_t *witness, const char *name, witness_rank_t rank,
|
|||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef witness_lock_error
|
#undef witness_lock_error
|
||||||
#define witness_lock_error JEMALLOC_N(n_witness_lock_error)
|
#define witness_lock_error JEMALLOC_N(n_witness_lock_error)
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
witness_lock_error(const witness_list_t *witnesses, const witness_t *witness) {
|
witness_lock_error(const witness_list_t *witnesses, const witness_t *witness) {
|
||||||
@ -27,13 +27,13 @@ witness_lock_error(const witness_list_t *witnesses, const witness_t *witness) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef witness_lock_error
|
#undef witness_lock_error
|
||||||
#define witness_lock_error JEMALLOC_N(witness_lock_error)
|
#define witness_lock_error JEMALLOC_N(witness_lock_error)
|
||||||
witness_lock_error_t *witness_lock_error = JEMALLOC_N(n_witness_lock_error);
|
witness_lock_error_t *witness_lock_error = JEMALLOC_N(n_witness_lock_error);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef witness_owner_error
|
#undef witness_owner_error
|
||||||
#define witness_owner_error JEMALLOC_N(n_witness_owner_error)
|
#define witness_owner_error JEMALLOC_N(n_witness_owner_error)
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
witness_owner_error(const witness_t *witness) {
|
witness_owner_error(const witness_t *witness) {
|
||||||
@ -43,13 +43,13 @@ witness_owner_error(const witness_t *witness) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef witness_owner_error
|
#undef witness_owner_error
|
||||||
#define witness_owner_error JEMALLOC_N(witness_owner_error)
|
#define witness_owner_error JEMALLOC_N(witness_owner_error)
|
||||||
witness_owner_error_t *witness_owner_error = JEMALLOC_N(n_witness_owner_error);
|
witness_owner_error_t *witness_owner_error = JEMALLOC_N(n_witness_owner_error);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef witness_not_owner_error
|
#undef witness_not_owner_error
|
||||||
#define witness_not_owner_error JEMALLOC_N(n_witness_not_owner_error)
|
#define witness_not_owner_error JEMALLOC_N(n_witness_not_owner_error)
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
witness_not_owner_error(const witness_t *witness) {
|
witness_not_owner_error(const witness_t *witness) {
|
||||||
@ -59,14 +59,14 @@ witness_not_owner_error(const witness_t *witness) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef witness_not_owner_error
|
#undef witness_not_owner_error
|
||||||
#define witness_not_owner_error JEMALLOC_N(witness_not_owner_error)
|
#define witness_not_owner_error JEMALLOC_N(witness_not_owner_error)
|
||||||
witness_not_owner_error_t *witness_not_owner_error =
|
witness_not_owner_error_t *witness_not_owner_error =
|
||||||
JEMALLOC_N(n_witness_not_owner_error);
|
JEMALLOC_N(n_witness_not_owner_error);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef witness_lockless_error
|
#undef witness_lockless_error
|
||||||
#define witness_lockless_error JEMALLOC_N(n_witness_lockless_error)
|
#define witness_lockless_error JEMALLOC_N(n_witness_lockless_error)
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
witness_lockless_error(const witness_list_t *witnesses) {
|
witness_lockless_error(const witness_list_t *witnesses) {
|
||||||
@ -81,7 +81,7 @@ witness_lockless_error(const witness_list_t *witnesses) {
|
|||||||
}
|
}
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
#undef witness_lockless_error
|
#undef witness_lockless_error
|
||||||
#define witness_lockless_error JEMALLOC_N(witness_lockless_error)
|
#define witness_lockless_error JEMALLOC_N(witness_lockless_error)
|
||||||
witness_lockless_error_t *witness_lockless_error =
|
witness_lockless_error_t *witness_lockless_error =
|
||||||
JEMALLOC_N(n_witness_lockless_error);
|
JEMALLOC_N(n_witness_lockless_error);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/* btalloc() provides a mechanism for allocating via permuted backtraces. */
|
/* btalloc() provides a mechanism for allocating via permuted backtraces. */
|
||||||
void *btalloc(size_t size, unsigned bits);
|
void *btalloc(size_t size, unsigned bits);
|
||||||
|
|
||||||
#define btalloc_n_proto(n) \
|
#define btalloc_n_proto(n) \
|
||||||
void *btalloc_##n(size_t size, unsigned bits);
|
void *btalloc_##n(size_t size, unsigned bits);
|
||||||
btalloc_n_proto(0)
|
btalloc_n_proto(0)
|
||||||
btalloc_n_proto(1)
|
btalloc_n_proto(1)
|
||||||
|
|
||||||
#define btalloc_n_gen(n) \
|
#define btalloc_n_gen(n) \
|
||||||
void * \
|
void * \
|
||||||
btalloc_##n(size_t size, unsigned bits) { \
|
btalloc_##n(size_t size, unsigned bits) { \
|
||||||
void *p; \
|
void *p; \
|
||||||
|
@ -123,7 +123,7 @@ static const bool config_debug =
|
|||||||
#include "test/test.h"
|
#include "test/test.h"
|
||||||
#include "test/timer.h"
|
#include "test/timer.h"
|
||||||
#include "test/thd.h"
|
#include "test/thd.h"
|
||||||
#define MEXP 19937
|
#define MEXP 19937
|
||||||
#include "test/SFMT.h"
|
#include "test/SFMT.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -136,7 +136,7 @@ static const bool config_debug =
|
|||||||
#undef not_implemented
|
#undef not_implemented
|
||||||
#undef assert_not_implemented
|
#undef assert_not_implemented
|
||||||
|
|
||||||
#define assert(e) do { \
|
#define assert(e) do { \
|
||||||
if (!(e)) { \
|
if (!(e)) { \
|
||||||
malloc_printf( \
|
malloc_printf( \
|
||||||
"<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \
|
"<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \
|
||||||
@ -145,20 +145,20 @@ static const bool config_debug =
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define not_reached() do { \
|
#define not_reached() do { \
|
||||||
malloc_printf( \
|
malloc_printf( \
|
||||||
"<jemalloc>: %s:%d: Unreachable code reached\n", \
|
"<jemalloc>: %s:%d: Unreachable code reached\n", \
|
||||||
__FILE__, __LINE__); \
|
__FILE__, __LINE__); \
|
||||||
abort(); \
|
abort(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define not_implemented() do { \
|
#define not_implemented() do { \
|
||||||
malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \
|
malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \
|
||||||
__FILE__, __LINE__); \
|
__FILE__, __LINE__); \
|
||||||
abort(); \
|
abort(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define assert_not_implemented(e) do { \
|
#define assert_not_implemented(e) do { \
|
||||||
if (!(e)) { \
|
if (!(e)) { \
|
||||||
not_implemented(); \
|
not_implemented(); \
|
||||||
} \
|
} \
|
||||||
|
@ -26,9 +26,9 @@ void mq_nanosleep(unsigned ns);
|
|||||||
* does not perform any cleanup of messages, since it knows nothing of their
|
* does not perform any cleanup of messages, since it knows nothing of their
|
||||||
* payloads.
|
* payloads.
|
||||||
*/
|
*/
|
||||||
#define mq_msg(a_mq_msg_type) ql_elm(a_mq_msg_type)
|
#define mq_msg(a_mq_msg_type) ql_elm(a_mq_msg_type)
|
||||||
|
|
||||||
#define mq_gen(a_attr, a_prefix, a_mq_type, a_mq_msg_type, a_field) \
|
#define mq_gen(a_attr, a_prefix, a_mq_type, a_mq_msg_type, a_field) \
|
||||||
typedef struct { \
|
typedef struct { \
|
||||||
mtx_t lock; \
|
mtx_t lock; \
|
||||||
ql_head(a_mq_msg_type) msgs; \
|
ql_head(a_mq_msg_type) msgs; \
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#define ASSERT_BUFSIZE 256
|
#define ASSERT_BUFSIZE 256
|
||||||
|
|
||||||
#define assert_cmp(t, a, b, cmp, neg_cmp, pri, ...) do { \
|
#define assert_cmp(t, a, b, cmp, neg_cmp, pri, ...) do { \
|
||||||
t a_ = (a); \
|
t a_ = (a); \
|
||||||
t b_ = (b); \
|
t b_ = (b); \
|
||||||
if (!(a_ cmp b_)) { \
|
if (!(a_ cmp b_)) { \
|
||||||
@ -17,200 +17,200 @@
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define assert_ptr_eq(a, b, ...) assert_cmp(void *, a, b, ==, \
|
#define assert_ptr_eq(a, b, ...) assert_cmp(void *, a, b, ==, \
|
||||||
!=, "p", __VA_ARGS__)
|
!=, "p", __VA_ARGS__)
|
||||||
#define assert_ptr_ne(a, b, ...) assert_cmp(void *, a, b, !=, \
|
#define assert_ptr_ne(a, b, ...) assert_cmp(void *, a, b, !=, \
|
||||||
==, "p", __VA_ARGS__)
|
==, "p", __VA_ARGS__)
|
||||||
#define assert_ptr_null(a, ...) assert_cmp(void *, a, NULL, ==, \
|
#define assert_ptr_null(a, ...) assert_cmp(void *, a, NULL, ==, \
|
||||||
!=, "p", __VA_ARGS__)
|
!=, "p", __VA_ARGS__)
|
||||||
#define assert_ptr_not_null(a, ...) assert_cmp(void *, a, NULL, !=, \
|
#define assert_ptr_not_null(a, ...) assert_cmp(void *, a, NULL, !=, \
|
||||||
==, "p", __VA_ARGS__)
|
==, "p", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_c_eq(a, b, ...) assert_cmp(char, a, b, ==, !=, "c", __VA_ARGS__)
|
#define assert_c_eq(a, b, ...) assert_cmp(char, a, b, ==, !=, "c", __VA_ARGS__)
|
||||||
#define assert_c_ne(a, b, ...) assert_cmp(char, a, b, !=, ==, "c", __VA_ARGS__)
|
#define assert_c_ne(a, b, ...) assert_cmp(char, a, b, !=, ==, "c", __VA_ARGS__)
|
||||||
#define assert_c_lt(a, b, ...) assert_cmp(char, a, b, <, >=, "c", __VA_ARGS__)
|
#define assert_c_lt(a, b, ...) assert_cmp(char, a, b, <, >=, "c", __VA_ARGS__)
|
||||||
#define assert_c_le(a, b, ...) assert_cmp(char, a, b, <=, >, "c", __VA_ARGS__)
|
#define assert_c_le(a, b, ...) assert_cmp(char, a, b, <=, >, "c", __VA_ARGS__)
|
||||||
#define assert_c_ge(a, b, ...) assert_cmp(char, a, b, >=, <, "c", __VA_ARGS__)
|
#define assert_c_ge(a, b, ...) assert_cmp(char, a, b, >=, <, "c", __VA_ARGS__)
|
||||||
#define assert_c_gt(a, b, ...) assert_cmp(char, a, b, >, <=, "c", __VA_ARGS__)
|
#define assert_c_gt(a, b, ...) assert_cmp(char, a, b, >, <=, "c", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_x_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "#x", __VA_ARGS__)
|
#define assert_x_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "#x", __VA_ARGS__)
|
||||||
#define assert_x_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "#x", __VA_ARGS__)
|
#define assert_x_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "#x", __VA_ARGS__)
|
||||||
#define assert_x_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "#x", __VA_ARGS__)
|
#define assert_x_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "#x", __VA_ARGS__)
|
||||||
#define assert_x_le(a, b, ...) assert_cmp(int, a, b, <=, >, "#x", __VA_ARGS__)
|
#define assert_x_le(a, b, ...) assert_cmp(int, a, b, <=, >, "#x", __VA_ARGS__)
|
||||||
#define assert_x_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "#x", __VA_ARGS__)
|
#define assert_x_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "#x", __VA_ARGS__)
|
||||||
#define assert_x_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "#x", __VA_ARGS__)
|
#define assert_x_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "#x", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_d_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "d", __VA_ARGS__)
|
#define assert_d_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "d", __VA_ARGS__)
|
||||||
#define assert_d_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "d", __VA_ARGS__)
|
#define assert_d_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "d", __VA_ARGS__)
|
||||||
#define assert_d_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "d", __VA_ARGS__)
|
#define assert_d_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "d", __VA_ARGS__)
|
||||||
#define assert_d_le(a, b, ...) assert_cmp(int, a, b, <=, >, "d", __VA_ARGS__)
|
#define assert_d_le(a, b, ...) assert_cmp(int, a, b, <=, >, "d", __VA_ARGS__)
|
||||||
#define assert_d_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "d", __VA_ARGS__)
|
#define assert_d_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "d", __VA_ARGS__)
|
||||||
#define assert_d_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "d", __VA_ARGS__)
|
#define assert_d_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "d", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_u_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "u", __VA_ARGS__)
|
#define assert_u_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "u", __VA_ARGS__)
|
||||||
#define assert_u_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "u", __VA_ARGS__)
|
#define assert_u_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "u", __VA_ARGS__)
|
||||||
#define assert_u_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "u", __VA_ARGS__)
|
#define assert_u_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "u", __VA_ARGS__)
|
||||||
#define assert_u_le(a, b, ...) assert_cmp(int, a, b, <=, >, "u", __VA_ARGS__)
|
#define assert_u_le(a, b, ...) assert_cmp(int, a, b, <=, >, "u", __VA_ARGS__)
|
||||||
#define assert_u_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "u", __VA_ARGS__)
|
#define assert_u_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "u", __VA_ARGS__)
|
||||||
#define assert_u_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "u", __VA_ARGS__)
|
#define assert_u_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "u", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_ld_eq(a, b, ...) assert_cmp(long, a, b, ==, \
|
#define assert_ld_eq(a, b, ...) assert_cmp(long, a, b, ==, \
|
||||||
!=, "ld", __VA_ARGS__)
|
!=, "ld", __VA_ARGS__)
|
||||||
#define assert_ld_ne(a, b, ...) assert_cmp(long, a, b, !=, \
|
#define assert_ld_ne(a, b, ...) assert_cmp(long, a, b, !=, \
|
||||||
==, "ld", __VA_ARGS__)
|
==, "ld", __VA_ARGS__)
|
||||||
#define assert_ld_lt(a, b, ...) assert_cmp(long, a, b, <, \
|
#define assert_ld_lt(a, b, ...) assert_cmp(long, a, b, <, \
|
||||||
>=, "ld", __VA_ARGS__)
|
>=, "ld", __VA_ARGS__)
|
||||||
#define assert_ld_le(a, b, ...) assert_cmp(long, a, b, <=, \
|
#define assert_ld_le(a, b, ...) assert_cmp(long, a, b, <=, \
|
||||||
>, "ld", __VA_ARGS__)
|
>, "ld", __VA_ARGS__)
|
||||||
#define assert_ld_ge(a, b, ...) assert_cmp(long, a, b, >=, \
|
#define assert_ld_ge(a, b, ...) assert_cmp(long, a, b, >=, \
|
||||||
<, "ld", __VA_ARGS__)
|
<, "ld", __VA_ARGS__)
|
||||||
#define assert_ld_gt(a, b, ...) assert_cmp(long, a, b, >, \
|
#define assert_ld_gt(a, b, ...) assert_cmp(long, a, b, >, \
|
||||||
<=, "ld", __VA_ARGS__)
|
<=, "ld", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_lu_eq(a, b, ...) assert_cmp(unsigned long, \
|
#define assert_lu_eq(a, b, ...) assert_cmp(unsigned long, \
|
||||||
a, b, ==, !=, "lu", __VA_ARGS__)
|
a, b, ==, !=, "lu", __VA_ARGS__)
|
||||||
#define assert_lu_ne(a, b, ...) assert_cmp(unsigned long, \
|
#define assert_lu_ne(a, b, ...) assert_cmp(unsigned long, \
|
||||||
a, b, !=, ==, "lu", __VA_ARGS__)
|
a, b, !=, ==, "lu", __VA_ARGS__)
|
||||||
#define assert_lu_lt(a, b, ...) assert_cmp(unsigned long, \
|
#define assert_lu_lt(a, b, ...) assert_cmp(unsigned long, \
|
||||||
a, b, <, >=, "lu", __VA_ARGS__)
|
a, b, <, >=, "lu", __VA_ARGS__)
|
||||||
#define assert_lu_le(a, b, ...) assert_cmp(unsigned long, \
|
#define assert_lu_le(a, b, ...) assert_cmp(unsigned long, \
|
||||||
a, b, <=, >, "lu", __VA_ARGS__)
|
a, b, <=, >, "lu", __VA_ARGS__)
|
||||||
#define assert_lu_ge(a, b, ...) assert_cmp(unsigned long, \
|
#define assert_lu_ge(a, b, ...) assert_cmp(unsigned long, \
|
||||||
a, b, >=, <, "lu", __VA_ARGS__)
|
a, b, >=, <, "lu", __VA_ARGS__)
|
||||||
#define assert_lu_gt(a, b, ...) assert_cmp(unsigned long, \
|
#define assert_lu_gt(a, b, ...) assert_cmp(unsigned long, \
|
||||||
a, b, >, <=, "lu", __VA_ARGS__)
|
a, b, >, <=, "lu", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_qd_eq(a, b, ...) assert_cmp(long long, a, b, ==, \
|
#define assert_qd_eq(a, b, ...) assert_cmp(long long, a, b, ==, \
|
||||||
!=, "qd", __VA_ARGS__)
|
!=, "qd", __VA_ARGS__)
|
||||||
#define assert_qd_ne(a, b, ...) assert_cmp(long long, a, b, !=, \
|
#define assert_qd_ne(a, b, ...) assert_cmp(long long, a, b, !=, \
|
||||||
==, "qd", __VA_ARGS__)
|
==, "qd", __VA_ARGS__)
|
||||||
#define assert_qd_lt(a, b, ...) assert_cmp(long long, a, b, <, \
|
#define assert_qd_lt(a, b, ...) assert_cmp(long long, a, b, <, \
|
||||||
>=, "qd", __VA_ARGS__)
|
>=, "qd", __VA_ARGS__)
|
||||||
#define assert_qd_le(a, b, ...) assert_cmp(long long, a, b, <=, \
|
#define assert_qd_le(a, b, ...) assert_cmp(long long, a, b, <=, \
|
||||||
>, "qd", __VA_ARGS__)
|
>, "qd", __VA_ARGS__)
|
||||||
#define assert_qd_ge(a, b, ...) assert_cmp(long long, a, b, >=, \
|
#define assert_qd_ge(a, b, ...) assert_cmp(long long, a, b, >=, \
|
||||||
<, "qd", __VA_ARGS__)
|
<, "qd", __VA_ARGS__)
|
||||||
#define assert_qd_gt(a, b, ...) assert_cmp(long long, a, b, >, \
|
#define assert_qd_gt(a, b, ...) assert_cmp(long long, a, b, >, \
|
||||||
<=, "qd", __VA_ARGS__)
|
<=, "qd", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_qu_eq(a, b, ...) assert_cmp(unsigned long long, \
|
#define assert_qu_eq(a, b, ...) assert_cmp(unsigned long long, \
|
||||||
a, b, ==, !=, "qu", __VA_ARGS__)
|
a, b, ==, !=, "qu", __VA_ARGS__)
|
||||||
#define assert_qu_ne(a, b, ...) assert_cmp(unsigned long long, \
|
#define assert_qu_ne(a, b, ...) assert_cmp(unsigned long long, \
|
||||||
a, b, !=, ==, "qu", __VA_ARGS__)
|
a, b, !=, ==, "qu", __VA_ARGS__)
|
||||||
#define assert_qu_lt(a, b, ...) assert_cmp(unsigned long long, \
|
#define assert_qu_lt(a, b, ...) assert_cmp(unsigned long long, \
|
||||||
a, b, <, >=, "qu", __VA_ARGS__)
|
a, b, <, >=, "qu", __VA_ARGS__)
|
||||||
#define assert_qu_le(a, b, ...) assert_cmp(unsigned long long, \
|
#define assert_qu_le(a, b, ...) assert_cmp(unsigned long long, \
|
||||||
a, b, <=, >, "qu", __VA_ARGS__)
|
a, b, <=, >, "qu", __VA_ARGS__)
|
||||||
#define assert_qu_ge(a, b, ...) assert_cmp(unsigned long long, \
|
#define assert_qu_ge(a, b, ...) assert_cmp(unsigned long long, \
|
||||||
a, b, >=, <, "qu", __VA_ARGS__)
|
a, b, >=, <, "qu", __VA_ARGS__)
|
||||||
#define assert_qu_gt(a, b, ...) assert_cmp(unsigned long long, \
|
#define assert_qu_gt(a, b, ...) assert_cmp(unsigned long long, \
|
||||||
a, b, >, <=, "qu", __VA_ARGS__)
|
a, b, >, <=, "qu", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_jd_eq(a, b, ...) assert_cmp(intmax_t, a, b, ==, \
|
#define assert_jd_eq(a, b, ...) assert_cmp(intmax_t, a, b, ==, \
|
||||||
!=, "jd", __VA_ARGS__)
|
!=, "jd", __VA_ARGS__)
|
||||||
#define assert_jd_ne(a, b, ...) assert_cmp(intmax_t, a, b, !=, \
|
#define assert_jd_ne(a, b, ...) assert_cmp(intmax_t, a, b, !=, \
|
||||||
==, "jd", __VA_ARGS__)
|
==, "jd", __VA_ARGS__)
|
||||||
#define assert_jd_lt(a, b, ...) assert_cmp(intmax_t, a, b, <, \
|
#define assert_jd_lt(a, b, ...) assert_cmp(intmax_t, a, b, <, \
|
||||||
>=, "jd", __VA_ARGS__)
|
>=, "jd", __VA_ARGS__)
|
||||||
#define assert_jd_le(a, b, ...) assert_cmp(intmax_t, a, b, <=, \
|
#define assert_jd_le(a, b, ...) assert_cmp(intmax_t, a, b, <=, \
|
||||||
>, "jd", __VA_ARGS__)
|
>, "jd", __VA_ARGS__)
|
||||||
#define assert_jd_ge(a, b, ...) assert_cmp(intmax_t, a, b, >=, \
|
#define assert_jd_ge(a, b, ...) assert_cmp(intmax_t, a, b, >=, \
|
||||||
<, "jd", __VA_ARGS__)
|
<, "jd", __VA_ARGS__)
|
||||||
#define assert_jd_gt(a, b, ...) assert_cmp(intmax_t, a, b, >, \
|
#define assert_jd_gt(a, b, ...) assert_cmp(intmax_t, a, b, >, \
|
||||||
<=, "jd", __VA_ARGS__)
|
<=, "jd", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_ju_eq(a, b, ...) assert_cmp(uintmax_t, a, b, ==, \
|
#define assert_ju_eq(a, b, ...) assert_cmp(uintmax_t, a, b, ==, \
|
||||||
!=, "ju", __VA_ARGS__)
|
!=, "ju", __VA_ARGS__)
|
||||||
#define assert_ju_ne(a, b, ...) assert_cmp(uintmax_t, a, b, !=, \
|
#define assert_ju_ne(a, b, ...) assert_cmp(uintmax_t, a, b, !=, \
|
||||||
==, "ju", __VA_ARGS__)
|
==, "ju", __VA_ARGS__)
|
||||||
#define assert_ju_lt(a, b, ...) assert_cmp(uintmax_t, a, b, <, \
|
#define assert_ju_lt(a, b, ...) assert_cmp(uintmax_t, a, b, <, \
|
||||||
>=, "ju", __VA_ARGS__)
|
>=, "ju", __VA_ARGS__)
|
||||||
#define assert_ju_le(a, b, ...) assert_cmp(uintmax_t, a, b, <=, \
|
#define assert_ju_le(a, b, ...) assert_cmp(uintmax_t, a, b, <=, \
|
||||||
>, "ju", __VA_ARGS__)
|
>, "ju", __VA_ARGS__)
|
||||||
#define assert_ju_ge(a, b, ...) assert_cmp(uintmax_t, a, b, >=, \
|
#define assert_ju_ge(a, b, ...) assert_cmp(uintmax_t, a, b, >=, \
|
||||||
<, "ju", __VA_ARGS__)
|
<, "ju", __VA_ARGS__)
|
||||||
#define assert_ju_gt(a, b, ...) assert_cmp(uintmax_t, a, b, >, \
|
#define assert_ju_gt(a, b, ...) assert_cmp(uintmax_t, a, b, >, \
|
||||||
<=, "ju", __VA_ARGS__)
|
<=, "ju", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_zd_eq(a, b, ...) assert_cmp(ssize_t, a, b, ==, \
|
#define assert_zd_eq(a, b, ...) assert_cmp(ssize_t, a, b, ==, \
|
||||||
!=, "zd", __VA_ARGS__)
|
!=, "zd", __VA_ARGS__)
|
||||||
#define assert_zd_ne(a, b, ...) assert_cmp(ssize_t, a, b, !=, \
|
#define assert_zd_ne(a, b, ...) assert_cmp(ssize_t, a, b, !=, \
|
||||||
==, "zd", __VA_ARGS__)
|
==, "zd", __VA_ARGS__)
|
||||||
#define assert_zd_lt(a, b, ...) assert_cmp(ssize_t, a, b, <, \
|
#define assert_zd_lt(a, b, ...) assert_cmp(ssize_t, a, b, <, \
|
||||||
>=, "zd", __VA_ARGS__)
|
>=, "zd", __VA_ARGS__)
|
||||||
#define assert_zd_le(a, b, ...) assert_cmp(ssize_t, a, b, <=, \
|
#define assert_zd_le(a, b, ...) assert_cmp(ssize_t, a, b, <=, \
|
||||||
>, "zd", __VA_ARGS__)
|
>, "zd", __VA_ARGS__)
|
||||||
#define assert_zd_ge(a, b, ...) assert_cmp(ssize_t, a, b, >=, \
|
#define assert_zd_ge(a, b, ...) assert_cmp(ssize_t, a, b, >=, \
|
||||||
<, "zd", __VA_ARGS__)
|
<, "zd", __VA_ARGS__)
|
||||||
#define assert_zd_gt(a, b, ...) assert_cmp(ssize_t, a, b, >, \
|
#define assert_zd_gt(a, b, ...) assert_cmp(ssize_t, a, b, >, \
|
||||||
<=, "zd", __VA_ARGS__)
|
<=, "zd", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_zu_eq(a, b, ...) assert_cmp(size_t, a, b, ==, \
|
#define assert_zu_eq(a, b, ...) assert_cmp(size_t, a, b, ==, \
|
||||||
!=, "zu", __VA_ARGS__)
|
!=, "zu", __VA_ARGS__)
|
||||||
#define assert_zu_ne(a, b, ...) assert_cmp(size_t, a, b, !=, \
|
#define assert_zu_ne(a, b, ...) assert_cmp(size_t, a, b, !=, \
|
||||||
==, "zu", __VA_ARGS__)
|
==, "zu", __VA_ARGS__)
|
||||||
#define assert_zu_lt(a, b, ...) assert_cmp(size_t, a, b, <, \
|
#define assert_zu_lt(a, b, ...) assert_cmp(size_t, a, b, <, \
|
||||||
>=, "zu", __VA_ARGS__)
|
>=, "zu", __VA_ARGS__)
|
||||||
#define assert_zu_le(a, b, ...) assert_cmp(size_t, a, b, <=, \
|
#define assert_zu_le(a, b, ...) assert_cmp(size_t, a, b, <=, \
|
||||||
>, "zu", __VA_ARGS__)
|
>, "zu", __VA_ARGS__)
|
||||||
#define assert_zu_ge(a, b, ...) assert_cmp(size_t, a, b, >=, \
|
#define assert_zu_ge(a, b, ...) assert_cmp(size_t, a, b, >=, \
|
||||||
<, "zu", __VA_ARGS__)
|
<, "zu", __VA_ARGS__)
|
||||||
#define assert_zu_gt(a, b, ...) assert_cmp(size_t, a, b, >, \
|
#define assert_zu_gt(a, b, ...) assert_cmp(size_t, a, b, >, \
|
||||||
<=, "zu", __VA_ARGS__)
|
<=, "zu", __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_d32_eq(a, b, ...) assert_cmp(int32_t, a, b, ==, \
|
#define assert_d32_eq(a, b, ...) assert_cmp(int32_t, a, b, ==, \
|
||||||
!=, FMTd32, __VA_ARGS__)
|
!=, FMTd32, __VA_ARGS__)
|
||||||
#define assert_d32_ne(a, b, ...) assert_cmp(int32_t, a, b, !=, \
|
#define assert_d32_ne(a, b, ...) assert_cmp(int32_t, a, b, !=, \
|
||||||
==, FMTd32, __VA_ARGS__)
|
==, FMTd32, __VA_ARGS__)
|
||||||
#define assert_d32_lt(a, b, ...) assert_cmp(int32_t, a, b, <, \
|
#define assert_d32_lt(a, b, ...) assert_cmp(int32_t, a, b, <, \
|
||||||
>=, FMTd32, __VA_ARGS__)
|
>=, FMTd32, __VA_ARGS__)
|
||||||
#define assert_d32_le(a, b, ...) assert_cmp(int32_t, a, b, <=, \
|
#define assert_d32_le(a, b, ...) assert_cmp(int32_t, a, b, <=, \
|
||||||
>, FMTd32, __VA_ARGS__)
|
>, FMTd32, __VA_ARGS__)
|
||||||
#define assert_d32_ge(a, b, ...) assert_cmp(int32_t, a, b, >=, \
|
#define assert_d32_ge(a, b, ...) assert_cmp(int32_t, a, b, >=, \
|
||||||
<, FMTd32, __VA_ARGS__)
|
<, FMTd32, __VA_ARGS__)
|
||||||
#define assert_d32_gt(a, b, ...) assert_cmp(int32_t, a, b, >, \
|
#define assert_d32_gt(a, b, ...) assert_cmp(int32_t, a, b, >, \
|
||||||
<=, FMTd32, __VA_ARGS__)
|
<=, FMTd32, __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_u32_eq(a, b, ...) assert_cmp(uint32_t, a, b, ==, \
|
#define assert_u32_eq(a, b, ...) assert_cmp(uint32_t, a, b, ==, \
|
||||||
!=, FMTu32, __VA_ARGS__)
|
!=, FMTu32, __VA_ARGS__)
|
||||||
#define assert_u32_ne(a, b, ...) assert_cmp(uint32_t, a, b, !=, \
|
#define assert_u32_ne(a, b, ...) assert_cmp(uint32_t, a, b, !=, \
|
||||||
==, FMTu32, __VA_ARGS__)
|
==, FMTu32, __VA_ARGS__)
|
||||||
#define assert_u32_lt(a, b, ...) assert_cmp(uint32_t, a, b, <, \
|
#define assert_u32_lt(a, b, ...) assert_cmp(uint32_t, a, b, <, \
|
||||||
>=, FMTu32, __VA_ARGS__)
|
>=, FMTu32, __VA_ARGS__)
|
||||||
#define assert_u32_le(a, b, ...) assert_cmp(uint32_t, a, b, <=, \
|
#define assert_u32_le(a, b, ...) assert_cmp(uint32_t, a, b, <=, \
|
||||||
>, FMTu32, __VA_ARGS__)
|
>, FMTu32, __VA_ARGS__)
|
||||||
#define assert_u32_ge(a, b, ...) assert_cmp(uint32_t, a, b, >=, \
|
#define assert_u32_ge(a, b, ...) assert_cmp(uint32_t, a, b, >=, \
|
||||||
<, FMTu32, __VA_ARGS__)
|
<, FMTu32, __VA_ARGS__)
|
||||||
#define assert_u32_gt(a, b, ...) assert_cmp(uint32_t, a, b, >, \
|
#define assert_u32_gt(a, b, ...) assert_cmp(uint32_t, a, b, >, \
|
||||||
<=, FMTu32, __VA_ARGS__)
|
<=, FMTu32, __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_d64_eq(a, b, ...) assert_cmp(int64_t, a, b, ==, \
|
#define assert_d64_eq(a, b, ...) assert_cmp(int64_t, a, b, ==, \
|
||||||
!=, FMTd64, __VA_ARGS__)
|
!=, FMTd64, __VA_ARGS__)
|
||||||
#define assert_d64_ne(a, b, ...) assert_cmp(int64_t, a, b, !=, \
|
#define assert_d64_ne(a, b, ...) assert_cmp(int64_t, a, b, !=, \
|
||||||
==, FMTd64, __VA_ARGS__)
|
==, FMTd64, __VA_ARGS__)
|
||||||
#define assert_d64_lt(a, b, ...) assert_cmp(int64_t, a, b, <, \
|
#define assert_d64_lt(a, b, ...) assert_cmp(int64_t, a, b, <, \
|
||||||
>=, FMTd64, __VA_ARGS__)
|
>=, FMTd64, __VA_ARGS__)
|
||||||
#define assert_d64_le(a, b, ...) assert_cmp(int64_t, a, b, <=, \
|
#define assert_d64_le(a, b, ...) assert_cmp(int64_t, a, b, <=, \
|
||||||
>, FMTd64, __VA_ARGS__)
|
>, FMTd64, __VA_ARGS__)
|
||||||
#define assert_d64_ge(a, b, ...) assert_cmp(int64_t, a, b, >=, \
|
#define assert_d64_ge(a, b, ...) assert_cmp(int64_t, a, b, >=, \
|
||||||
<, FMTd64, __VA_ARGS__)
|
<, FMTd64, __VA_ARGS__)
|
||||||
#define assert_d64_gt(a, b, ...) assert_cmp(int64_t, a, b, >, \
|
#define assert_d64_gt(a, b, ...) assert_cmp(int64_t, a, b, >, \
|
||||||
<=, FMTd64, __VA_ARGS__)
|
<=, FMTd64, __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_u64_eq(a, b, ...) assert_cmp(uint64_t, a, b, ==, \
|
#define assert_u64_eq(a, b, ...) assert_cmp(uint64_t, a, b, ==, \
|
||||||
!=, FMTu64, __VA_ARGS__)
|
!=, FMTu64, __VA_ARGS__)
|
||||||
#define assert_u64_ne(a, b, ...) assert_cmp(uint64_t, a, b, !=, \
|
#define assert_u64_ne(a, b, ...) assert_cmp(uint64_t, a, b, !=, \
|
||||||
==, FMTu64, __VA_ARGS__)
|
==, FMTu64, __VA_ARGS__)
|
||||||
#define assert_u64_lt(a, b, ...) assert_cmp(uint64_t, a, b, <, \
|
#define assert_u64_lt(a, b, ...) assert_cmp(uint64_t, a, b, <, \
|
||||||
>=, FMTu64, __VA_ARGS__)
|
>=, FMTu64, __VA_ARGS__)
|
||||||
#define assert_u64_le(a, b, ...) assert_cmp(uint64_t, a, b, <=, \
|
#define assert_u64_le(a, b, ...) assert_cmp(uint64_t, a, b, <=, \
|
||||||
>, FMTu64, __VA_ARGS__)
|
>, FMTu64, __VA_ARGS__)
|
||||||
#define assert_u64_ge(a, b, ...) assert_cmp(uint64_t, a, b, >=, \
|
#define assert_u64_ge(a, b, ...) assert_cmp(uint64_t, a, b, >=, \
|
||||||
<, FMTu64, __VA_ARGS__)
|
<, FMTu64, __VA_ARGS__)
|
||||||
#define assert_u64_gt(a, b, ...) assert_cmp(uint64_t, a, b, >, \
|
#define assert_u64_gt(a, b, ...) assert_cmp(uint64_t, a, b, >, \
|
||||||
<=, FMTu64, __VA_ARGS__)
|
<=, FMTu64, __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_b_eq(a, b, ...) do { \
|
#define assert_b_eq(a, b, ...) do { \
|
||||||
bool a_ = (a); \
|
bool a_ = (a); \
|
||||||
bool b_ = (b); \
|
bool b_ = (b); \
|
||||||
if (!(a_ == b_)) { \
|
if (!(a_ == b_)) { \
|
||||||
@ -226,7 +226,7 @@
|
|||||||
p_test_fail(prefix, message); \
|
p_test_fail(prefix, message); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define assert_b_ne(a, b, ...) do { \
|
#define assert_b_ne(a, b, ...) do { \
|
||||||
bool a_ = (a); \
|
bool a_ = (a); \
|
||||||
bool b_ = (b); \
|
bool b_ = (b); \
|
||||||
if (!(a_ != b_)) { \
|
if (!(a_ != b_)) { \
|
||||||
@ -242,10 +242,10 @@
|
|||||||
p_test_fail(prefix, message); \
|
p_test_fail(prefix, message); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define assert_true(a, ...) assert_b_eq(a, true, __VA_ARGS__)
|
#define assert_true(a, ...) assert_b_eq(a, true, __VA_ARGS__)
|
||||||
#define assert_false(a, ...) assert_b_eq(a, false, __VA_ARGS__)
|
#define assert_false(a, ...) assert_b_eq(a, false, __VA_ARGS__)
|
||||||
|
|
||||||
#define assert_str_eq(a, b, ...) do { \
|
#define assert_str_eq(a, b, ...) do { \
|
||||||
if (strcmp((a), (b))) { \
|
if (strcmp((a), (b))) { \
|
||||||
char prefix[ASSERT_BUFSIZE]; \
|
char prefix[ASSERT_BUFSIZE]; \
|
||||||
char message[ASSERT_BUFSIZE]; \
|
char message[ASSERT_BUFSIZE]; \
|
||||||
@ -258,7 +258,7 @@
|
|||||||
p_test_fail(prefix, message); \
|
p_test_fail(prefix, message); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define assert_str_ne(a, b, ...) do { \
|
#define assert_str_ne(a, b, ...) do { \
|
||||||
if (!strcmp((a), (b))) { \
|
if (!strcmp((a), (b))) { \
|
||||||
char prefix[ASSERT_BUFSIZE]; \
|
char prefix[ASSERT_BUFSIZE]; \
|
||||||
char message[ASSERT_BUFSIZE]; \
|
char message[ASSERT_BUFSIZE]; \
|
||||||
@ -272,7 +272,7 @@
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define assert_not_reached(...) do { \
|
#define assert_not_reached(...) do { \
|
||||||
char prefix[ASSERT_BUFSIZE]; \
|
char prefix[ASSERT_BUFSIZE]; \
|
||||||
char message[ASSERT_BUFSIZE]; \
|
char message[ASSERT_BUFSIZE]; \
|
||||||
malloc_snprintf(prefix, sizeof(prefix), \
|
malloc_snprintf(prefix, sizeof(prefix), \
|
||||||
@ -296,24 +296,24 @@ typedef enum {
|
|||||||
|
|
||||||
typedef void (test_t)(void);
|
typedef void (test_t)(void);
|
||||||
|
|
||||||
#define TEST_BEGIN(f) \
|
#define TEST_BEGIN(f) \
|
||||||
static void \
|
static void \
|
||||||
f(void) { \
|
f(void) { \
|
||||||
p_test_init(#f);
|
p_test_init(#f);
|
||||||
|
|
||||||
#define TEST_END \
|
#define TEST_END \
|
||||||
goto label_test_end; \
|
goto label_test_end; \
|
||||||
label_test_end: \
|
label_test_end: \
|
||||||
p_test_fini(); \
|
p_test_fini(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define test(...) \
|
#define test(...) \
|
||||||
p_test(__VA_ARGS__, NULL)
|
p_test(__VA_ARGS__, NULL)
|
||||||
|
|
||||||
#define test_no_malloc_init(...) \
|
#define test_no_malloc_init(...) \
|
||||||
p_test_no_malloc_init(__VA_ARGS__, NULL)
|
p_test_no_malloc_init(__VA_ARGS__, NULL)
|
||||||
|
|
||||||
#define test_skip_if(e) do { \
|
#define test_skip_if(e) do { \
|
||||||
if (e) { \
|
if (e) { \
|
||||||
test_skip("%s:%s:%d: Test skipped: (%s)", \
|
test_skip("%s:%s:%d: Test skipped: (%s)", \
|
||||||
__func__, __FILE__, __LINE__, #e); \
|
__func__, __FILE__, __LINE__, #e); \
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define NTHREADS 10
|
#define NTHREADS 10
|
||||||
|
|
||||||
static bool have_dss =
|
static bool have_dss =
|
||||||
#ifdef JEMALLOC_DSS
|
#ifdef JEMALLOC_DSS
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define MAXALIGN (((size_t)1) << 23)
|
#define MAXALIGN (((size_t)1) << 23)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On systems which can't merge extents, tests that call this function generate
|
* On systems which can't merge extents, tests that call this function generate
|
||||||
@ -79,7 +79,7 @@ TEST_BEGIN(test_oom_errors) {
|
|||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
TEST_BEGIN(test_alignment_and_size) {
|
TEST_BEGIN(test_alignment_and_size) {
|
||||||
#define NITER 4
|
#define NITER 4
|
||||||
size_t alignment, size, total;
|
size_t alignment, size, total;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
void *ps[NITER];
|
void *ps[NITER];
|
||||||
|
@ -118,7 +118,7 @@ TEST_BEGIN(test_oom) {
|
|||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
TEST_BEGIN(test_basic) {
|
TEST_BEGIN(test_basic) {
|
||||||
#define MAXSZ (((size_t)1) << 23)
|
#define MAXSZ (((size_t)1) << 23)
|
||||||
size_t sz;
|
size_t sz;
|
||||||
|
|
||||||
for (sz = 1; sz < MAXSZ; sz = nallocx(sz, 0) + 1) {
|
for (sz = 1; sz < MAXSZ; sz = nallocx(sz, 0) + 1) {
|
||||||
@ -155,8 +155,8 @@ TEST_BEGIN(test_basic) {
|
|||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
TEST_BEGIN(test_alignment_and_size) {
|
TEST_BEGIN(test_alignment_and_size) {
|
||||||
#define MAXALIGN (((size_t)1) << 23)
|
#define MAXALIGN (((size_t)1) << 23)
|
||||||
#define NITER 4
|
#define NITER 4
|
||||||
size_t nsz, rsz, sz, alignment, total;
|
size_t nsz, rsz, sz, alignment, total;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
void *ps[NITER];
|
void *ps[NITER];
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define MAXALIGN (((size_t)1) << 23)
|
#define MAXALIGN (((size_t)1) << 23)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On systems which can't merge extents, tests that call this function generate
|
* On systems which can't merge extents, tests that call this function generate
|
||||||
@ -71,7 +71,7 @@ TEST_BEGIN(test_oom_errors) {
|
|||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
TEST_BEGIN(test_alignment_and_size) {
|
TEST_BEGIN(test_alignment_and_size) {
|
||||||
#define NITER 4
|
#define NITER 4
|
||||||
size_t alignment, size, total;
|
size_t alignment, size, total;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
int err;
|
int err;
|
||||||
|
@ -43,11 +43,11 @@ get_large_size(size_t ind) {
|
|||||||
TEST_BEGIN(test_grow_and_shrink) {
|
TEST_BEGIN(test_grow_and_shrink) {
|
||||||
void *p, *q;
|
void *p, *q;
|
||||||
size_t tsz;
|
size_t tsz;
|
||||||
#define NCYCLES 3
|
#define NCYCLES 3
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
#define NSZS 1024
|
#define NSZS 1024
|
||||||
size_t szs[NSZS];
|
size_t szs[NSZS];
|
||||||
#define MAXSZ ZU(12 * 1024 * 1024)
|
#define MAXSZ ZU(12 * 1024 * 1024)
|
||||||
|
|
||||||
p = mallocx(1, 0);
|
p = mallocx(1, 0);
|
||||||
assert_ptr_not_null(p, "Unexpected mallocx() error");
|
assert_ptr_not_null(p, "Unexpected mallocx() error");
|
||||||
@ -107,8 +107,8 @@ TEST_BEGIN(test_zero) {
|
|||||||
void *p, *q;
|
void *p, *q;
|
||||||
size_t psz, qsz, i, j;
|
size_t psz, qsz, i, j;
|
||||||
size_t start_sizes[] = {1, 3*1024, 63*1024, 4095*1024};
|
size_t start_sizes[] = {1, 3*1024, 63*1024, 4095*1024};
|
||||||
#define FILL_BYTE 0xaaU
|
#define FILL_BYTE 0xaaU
|
||||||
#define RANGE 2048
|
#define RANGE 2048
|
||||||
|
|
||||||
for (i = 0; i < sizeof(start_sizes)/sizeof(size_t); i++) {
|
for (i = 0; i < sizeof(start_sizes)/sizeof(size_t); i++) {
|
||||||
size_t start_size = start_sizes[i];
|
size_t start_size = start_sizes[i];
|
||||||
@ -150,7 +150,7 @@ TEST_END
|
|||||||
TEST_BEGIN(test_align) {
|
TEST_BEGIN(test_align) {
|
||||||
void *p, *q;
|
void *p, *q;
|
||||||
size_t align;
|
size_t align;
|
||||||
#define MAX_ALIGN (ZU(1) << 25)
|
#define MAX_ALIGN (ZU(1) << 25)
|
||||||
|
|
||||||
align = ZU(1);
|
align = ZU(1);
|
||||||
p = mallocx(1, MALLOCX_ALIGN(align));
|
p = mallocx(1, MALLOCX_ALIGN(align));
|
||||||
@ -175,8 +175,8 @@ TEST_BEGIN(test_lg_align_and_zero) {
|
|||||||
void *p, *q;
|
void *p, *q;
|
||||||
unsigned lg_align;
|
unsigned lg_align;
|
||||||
size_t sz;
|
size_t sz;
|
||||||
#define MAX_LG_ALIGN 25
|
#define MAX_LG_ALIGN 25
|
||||||
#define MAX_VALIDATE (ZU(1) << 22)
|
#define MAX_VALIDATE (ZU(1) << 22)
|
||||||
|
|
||||||
lg_align = 0;
|
lg_align = 0;
|
||||||
p = mallocx(1, MALLOCX_LG_ALIGN(lg_align)|MALLOCX_ZERO);
|
p = mallocx(1, MALLOCX_LG_ALIGN(lg_align)|MALLOCX_ZERO);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define MAXALIGN (((size_t)1) << 22)
|
#define MAXALIGN (((size_t)1) << 22)
|
||||||
#define NITER 3
|
#define NITER 3
|
||||||
|
|
||||||
TEST_BEGIN(test_basic) {
|
TEST_BEGIN(test_basic) {
|
||||||
void *ptr = mallocx(64, 0);
|
void *ptr = mallocx(64, 0);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define NTHREADS 10
|
#define NTHREADS 10
|
||||||
|
|
||||||
void *
|
void *
|
||||||
thd_start(void *arg) {
|
thd_start(void *arg) {
|
||||||
|
@ -320,7 +320,7 @@ test_zero(size_t szmin, size_t szmax) {
|
|||||||
int flags = MALLOCX_ARENA(arena_ind()) | MALLOCX_ZERO;
|
int flags = MALLOCX_ARENA(arena_ind()) | MALLOCX_ZERO;
|
||||||
size_t sz, nsz;
|
size_t sz, nsz;
|
||||||
void *p;
|
void *p;
|
||||||
#define FILL_BYTE 0x7aU
|
#define FILL_BYTE 0x7aU
|
||||||
|
|
||||||
sz = szmax;
|
sz = szmax;
|
||||||
p = mallocx(sz, flags);
|
p = mallocx(sz, flags);
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
*
|
*
|
||||||
* The new BSD License is applied to this software, see LICENSE.txt
|
* The new BSD License is applied to this software, see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
#define SFMT_C_
|
#define SFMT_C_
|
||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
#include "test/SFMT-params.h"
|
#include "test/SFMT-params.h"
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#define MATH_C_
|
#define MATH_C_
|
||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#ifndef _CRT_SPINCOUNT
|
#ifndef _CRT_SPINCOUNT
|
||||||
#define _CRT_SPINCOUNT 4000
|
#define _CRT_SPINCOUNT 4000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -35,10 +35,10 @@
|
|||||||
*/
|
*/
|
||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define BLOCK_SIZE 10000
|
#define BLOCK_SIZE 10000
|
||||||
#define BLOCK_SIZE64 (BLOCK_SIZE / 2)
|
#define BLOCK_SIZE64 (BLOCK_SIZE / 2)
|
||||||
#define COUNT_1 1000
|
#define COUNT_1 1000
|
||||||
#define COUNT_2 700
|
#define COUNT_2 700
|
||||||
|
|
||||||
static const uint32_t init_gen_rand_32_expected[] = {
|
static const uint32_t init_gen_rand_32_expected[] = {
|
||||||
3440181298U, 1564997079U, 1510669302U, 2930277156U, 1452439940U,
|
3440181298U, 1564997079U, 1510669302U, 2930277156U, 1452439940U,
|
||||||
|
@ -82,7 +82,7 @@ do_arena_create(extent_hooks_t *h) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
do_arena_reset_pre(unsigned arena_ind, void ***ptrs, unsigned *nptrs) {
|
do_arena_reset_pre(unsigned arena_ind, void ***ptrs, unsigned *nptrs) {
|
||||||
#define NLARGE 32
|
#define NLARGE 32
|
||||||
unsigned nsmall, nlarge, i;
|
unsigned nsmall, nlarge, i;
|
||||||
size_t sz;
|
size_t sz;
|
||||||
int flags;
|
int flags;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
#define ARENA_RESET_PROF_C_
|
#define ARENA_RESET_PROF_C_
|
||||||
|
|
||||||
const char *malloc_conf = "prof:true,lg_prof_sample:0";
|
const char *malloc_conf = "prof:true,lg_prof_sample:0";
|
||||||
#include "arena_reset.c"
|
#include "arena_reset.c"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define TEST_STRUCT(p, t) \
|
#define TEST_STRUCT(p, t) \
|
||||||
struct p##_test_s { \
|
struct p##_test_s { \
|
||||||
t accum0; \
|
t accum0; \
|
||||||
t x; \
|
t x; \
|
||||||
@ -8,7 +8,7 @@ struct p##_test_s { \
|
|||||||
}; \
|
}; \
|
||||||
typedef struct p##_test_s p##_test_t;
|
typedef struct p##_test_s p##_test_t;
|
||||||
|
|
||||||
#define TEST_BODY(p, t, tc, ta, FMT) do { \
|
#define TEST_BODY(p, t, tc, ta, FMT) do { \
|
||||||
const p##_test_t tests[] = { \
|
const p##_test_t tests[] = { \
|
||||||
{(t)-1, (t)-1, (t)-2}, \
|
{(t)-1, (t)-1, (t)-2}, \
|
||||||
{(t)-1, (t) 0, (t)-2}, \
|
{(t)-1, (t) 0, (t)-2}, \
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define NBITS_TAB \
|
#define NBITS_TAB \
|
||||||
NB( 1) \
|
NB( 1) \
|
||||||
NB( 2) \
|
NB( 2) \
|
||||||
NB( 3) \
|
NB( 3) \
|
||||||
@ -124,7 +124,7 @@ 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 = \
|
||||||
BITMAP_INFO_INITIALIZER(nbits); \
|
BITMAP_INFO_INITIALIZER(nbits); \
|
||||||
@ -155,7 +155,7 @@ TEST_BEGIN(test_bitmap_size) {
|
|||||||
bitmap_info_init(&binfo, nbits);
|
bitmap_info_init(&binfo, nbits);
|
||||||
prev_size = test_bitmap_size_body(&binfo, nbits, prev_size);
|
prev_size = test_bitmap_size_body(&binfo, nbits, prev_size);
|
||||||
}
|
}
|
||||||
#define NB(nbits) { \
|
#define NB(nbits) { \
|
||||||
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
||||||
prev_size = test_bitmap_size_body(&binfo, nbits, \
|
prev_size = test_bitmap_size_body(&binfo, nbits, \
|
||||||
prev_size); \
|
prev_size); \
|
||||||
@ -188,7 +188,7 @@ TEST_BEGIN(test_bitmap_init) {
|
|||||||
bitmap_info_init(&binfo, nbits);
|
bitmap_info_init(&binfo, nbits);
|
||||||
test_bitmap_init_body(&binfo, nbits);
|
test_bitmap_init_body(&binfo, nbits);
|
||||||
}
|
}
|
||||||
#define NB(nbits) { \
|
#define NB(nbits) { \
|
||||||
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
||||||
test_bitmap_init_body(&binfo, nbits); \
|
test_bitmap_init_body(&binfo, nbits); \
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ TEST_BEGIN(test_bitmap_set) {
|
|||||||
bitmap_info_init(&binfo, nbits);
|
bitmap_info_init(&binfo, nbits);
|
||||||
test_bitmap_set_body(&binfo, nbits);
|
test_bitmap_set_body(&binfo, nbits);
|
||||||
}
|
}
|
||||||
#define NB(nbits) { \
|
#define NB(nbits) { \
|
||||||
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
||||||
test_bitmap_set_body(&binfo, nbits); \
|
test_bitmap_set_body(&binfo, nbits); \
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ TEST_BEGIN(test_bitmap_unset) {
|
|||||||
bitmap_info_init(&binfo, nbits);
|
bitmap_info_init(&binfo, nbits);
|
||||||
test_bitmap_unset_body(&binfo, nbits);
|
test_bitmap_unset_body(&binfo, nbits);
|
||||||
}
|
}
|
||||||
#define NB(nbits) { \
|
#define NB(nbits) { \
|
||||||
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
||||||
test_bitmap_unset_body(&binfo, nbits); \
|
test_bitmap_unset_body(&binfo, nbits); \
|
||||||
}
|
}
|
||||||
@ -318,7 +318,7 @@ TEST_BEGIN(test_bitmap_sfu) {
|
|||||||
bitmap_info_init(&binfo, nbits);
|
bitmap_info_init(&binfo, nbits);
|
||||||
test_bitmap_sfu_body(&binfo, nbits);
|
test_bitmap_sfu_body(&binfo, nbits);
|
||||||
}
|
}
|
||||||
#define NB(nbits) { \
|
#define NB(nbits) { \
|
||||||
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
||||||
test_bitmap_sfu_body(&binfo, nbits); \
|
test_bitmap_sfu_body(&binfo, nbits); \
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ TEST_BEGIN(test_count_insert_search_remove) {
|
|||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
TEST_BEGIN(test_insert_iter_remove) {
|
TEST_BEGIN(test_insert_iter_remove) {
|
||||||
#define NITEMS ZU(1000)
|
#define NITEMS ZU(1000)
|
||||||
tsd_t *tsd;
|
tsd_t *tsd;
|
||||||
ckh_t ckh;
|
ckh_t ckh;
|
||||||
void **p[NITEMS];
|
void **p[NITEMS];
|
||||||
|
@ -196,7 +196,7 @@ TEST_BEGIN(test_decay_ticks) {
|
|||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
TEST_BEGIN(test_decay_ticker) {
|
TEST_BEGIN(test_decay_ticker) {
|
||||||
#define NPS 1024
|
#define NPS 1024
|
||||||
int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
|
int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
|
||||||
void *ps[NPS];
|
void *ps[NPS];
|
||||||
uint64_t epoch;
|
uint64_t epoch;
|
||||||
@ -289,7 +289,7 @@ TEST_BEGIN(test_decay_ticker) {
|
|||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
TEST_BEGIN(test_decay_nonmonotonic) {
|
TEST_BEGIN(test_decay_nonmonotonic) {
|
||||||
#define NPS (SMOOTHSTEP_NSTEPS + 1)
|
#define NPS (SMOOTHSTEP_NSTEPS + 1)
|
||||||
int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
|
int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
|
||||||
void *ps[NPS];
|
void *ps[NPS];
|
||||||
uint64_t epoch;
|
uint64_t epoch;
|
||||||
|
@ -99,7 +99,7 @@ TEST_BEGIN(test_large_extent_size) {
|
|||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
TEST_BEGIN(test_monotonic) {
|
TEST_BEGIN(test_monotonic) {
|
||||||
#define SZ_MAX ZU(4 * 1024 * 1024)
|
#define SZ_MAX ZU(4 * 1024 * 1024)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
size_t floor_prev, ceil_prev;
|
size_t floor_prev, ceil_prev;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ hash_variant_string(hash_variant_t variant) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define KEY_SIZE 256
|
#define KEY_SIZE 256
|
||||||
static void
|
static void
|
||||||
hash_variant_verify_key(hash_variant_t variant, uint8_t *key) {
|
hash_variant_verify_key(hash_variant_t variant, uint8_t *key) {
|
||||||
const int hashbytes = hash_variant_bits(variant) / 8;
|
const int hashbytes = hash_variant_bits(variant) / 8;
|
||||||
@ -137,7 +137,7 @@ hash_variant_verify_key(hash_variant_t variant, uint8_t *key) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
hash_variant_verify(hash_variant_t variant) {
|
hash_variant_verify(hash_variant_t variant) {
|
||||||
#define MAX_ALIGN 16
|
#define MAX_ALIGN 16
|
||||||
uint8_t key[KEY_SIZE + (MAX_ALIGN - 1)];
|
uint8_t key[KEY_SIZE + (MAX_ALIGN - 1)];
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#define JEMALLOC_TEST_JUNK_OPT "junk:alloc"
|
#define JEMALLOC_TEST_JUNK_OPT "junk:alloc"
|
||||||
#include "junk.c"
|
#include "junk.c"
|
||||||
#undef JEMALLOC_TEST_JUNK_OPT
|
#undef JEMALLOC_TEST_JUNK_OPT
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#define JEMALLOC_TEST_JUNK_OPT "junk:free"
|
#define JEMALLOC_TEST_JUNK_OPT "junk:free"
|
||||||
#include "junk.c"
|
#include "junk.c"
|
||||||
#undef JEMALLOC_TEST_JUNK_OPT
|
#undef JEMALLOC_TEST_JUNK_OPT
|
||||||
|
@ -115,7 +115,7 @@ TEST_BEGIN(test_mallctlnametomib_short_mib) {
|
|||||||
TEST_END
|
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); \
|
||||||
assert_d_eq(mallctl("config."#config, (void *)&oldval, &sz, \
|
assert_d_eq(mallctl("config."#config, (void *)&oldval, &sz, \
|
||||||
@ -146,7 +146,7 @@ TEST_END
|
|||||||
TEST_BEGIN(test_mallctl_opt) {
|
TEST_BEGIN(test_mallctl_opt) {
|
||||||
bool config_always = true;
|
bool config_always = true;
|
||||||
|
|
||||||
#define TEST_MALLCTL_OPT(t, opt, config) do { \
|
#define TEST_MALLCTL_OPT(t, opt, config) do { \
|
||||||
t oldval; \
|
t oldval; \
|
||||||
size_t sz = sizeof(oldval); \
|
size_t sz = sizeof(oldval); \
|
||||||
int expected = config_##config ? 0 : ENOENT; \
|
int expected = config_##config ? 0 : ENOENT; \
|
||||||
@ -232,7 +232,7 @@ TEST_BEGIN(test_tcache_none) {
|
|||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
TEST_BEGIN(test_tcache) {
|
TEST_BEGIN(test_tcache) {
|
||||||
#define NTCACHES 10
|
#define NTCACHES 10
|
||||||
unsigned tis[NTCACHES];
|
unsigned tis[NTCACHES];
|
||||||
void *ps[NTCACHES];
|
void *ps[NTCACHES];
|
||||||
void *qs[NTCACHES];
|
void *qs[NTCACHES];
|
||||||
@ -534,7 +534,7 @@ TEST_BEGIN(test_arenas_decay_time) {
|
|||||||
TEST_END
|
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); \
|
||||||
assert_d_eq(mallctl("arenas."#name, (void *)&name, &sz, NULL, \
|
assert_d_eq(mallctl("arenas."#name, (void *)&name, &sz, NULL, \
|
||||||
@ -552,7 +552,7 @@ TEST_BEGIN(test_arenas_constants) {
|
|||||||
TEST_END
|
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); \
|
||||||
assert_d_eq(mallctl("arenas.bin.0."#name, (void *)&name, &sz, \
|
assert_d_eq(mallctl("arenas.bin.0."#name, (void *)&name, &sz, \
|
||||||
@ -570,7 +570,7 @@ TEST_BEGIN(test_arenas_bin_constants) {
|
|||||||
TEST_END
|
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); \
|
||||||
assert_d_eq(mallctl("arenas.lextent.0."#name, (void *)&name, \
|
assert_d_eq(mallctl("arenas.lextent.0."#name, (void *)&name, \
|
||||||
@ -602,7 +602,7 @@ TEST_BEGIN(test_arenas_create) {
|
|||||||
TEST_END
|
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); \
|
||||||
assert_d_eq(mallctl("stats.arenas.0."#name, (void *)&name, &sz, \
|
assert_d_eq(mallctl("stats.arenas.0."#name, (void *)&name, &sz, \
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define MAX_REL_ERR 1.0e-9
|
#define MAX_REL_ERR 1.0e-9
|
||||||
#define MAX_ABS_ERR 1.0e-9
|
#define MAX_ABS_ERR 1.0e-9
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef INFINITY
|
#ifndef INFINITY
|
||||||
#define INFINITY (DBL_MAX + DBL_MAX)
|
#define INFINITY (DBL_MAX + DBL_MAX)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define NSENDERS 3
|
#define NSENDERS 3
|
||||||
#define NMSGS 100000
|
#define NMSGS 100000
|
||||||
|
|
||||||
typedef struct mq_msg_s mq_msg_t;
|
typedef struct mq_msg_s mq_msg_t;
|
||||||
struct mq_msg_s {
|
struct mq_msg_s {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define NTHREADS 2
|
#define NTHREADS 2
|
||||||
#define NINCRS 2000000
|
#define NINCRS 2000000
|
||||||
|
|
||||||
TEST_BEGIN(test_mtx_basic) {
|
TEST_BEGIN(test_mtx_basic) {
|
||||||
mtx_t mtx;
|
mtx_t mtx;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define BILLION UINT64_C(1000000000)
|
#define BILLION UINT64_C(1000000000)
|
||||||
|
|
||||||
TEST_BEGIN(test_nstime_init) {
|
TEST_BEGIN(test_nstime_init) {
|
||||||
nstime_t nst;
|
nstime_t nst;
|
||||||
|
@ -7,9 +7,9 @@ const char *malloc_conf = "decay_time:-1";
|
|||||||
* Size class that is a divisor of the page size, ideally 4+ regions per run.
|
* Size class that is a divisor of the page size, ideally 4+ regions per run.
|
||||||
*/
|
*/
|
||||||
#if LG_PAGE <= 14
|
#if LG_PAGE <= 14
|
||||||
#define SZ (ZU(1) << (LG_PAGE - 2))
|
#define SZ (ZU(1) << (LG_PAGE - 2))
|
||||||
#else
|
#else
|
||||||
#define SZ 4096
|
#define SZ 4096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -17,7 +17,7 @@ const char *malloc_conf = "decay_time:-1";
|
|||||||
* if mmap()ed memory grows downward, downward growth of mmap()ed memory is
|
* if mmap()ed memory grows downward, downward growth of mmap()ed memory is
|
||||||
* tested.
|
* tested.
|
||||||
*/
|
*/
|
||||||
#define NSLABS 8
|
#define NSLABS 8
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
binind_compute(void) {
|
binind_compute(void) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
typedef struct node_s node_t;
|
typedef struct node_s node_t;
|
||||||
|
|
||||||
struct node_s {
|
struct node_s {
|
||||||
#define NODE_MAGIC 0x9823af7e
|
#define NODE_MAGIC 0x9823af7e
|
||||||
uint32_t magic;
|
uint32_t magic;
|
||||||
phn(node_t) link;
|
phn(node_t) link;
|
||||||
uint64_t key;
|
uint64_t key;
|
||||||
@ -160,9 +160,9 @@ node_remove_first(heap_t *heap) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_BEGIN(test_ph_random) {
|
TEST_BEGIN(test_ph_random) {
|
||||||
#define NNODES 25
|
#define NNODES 25
|
||||||
#define NBAGS 250
|
#define NBAGS 250
|
||||||
#define SEED 42
|
#define SEED 42
|
||||||
sfmt_t *sfmt;
|
sfmt_t *sfmt;
|
||||||
uint64_t bag[NNODES];
|
uint64_t bag[NNODES];
|
||||||
heap_t heap;
|
heap_t heap;
|
||||||
|
@ -137,9 +137,9 @@ TEST_END
|
|||||||
static void
|
static void
|
||||||
test_prng_range_u32(bool atomic) {
|
test_prng_range_u32(bool atomic) {
|
||||||
uint32_t range;
|
uint32_t range;
|
||||||
#define MAX_RANGE 10000000
|
#define MAX_RANGE 10000000
|
||||||
#define RANGE_STEP 97
|
#define RANGE_STEP 97
|
||||||
#define NREPS 10
|
#define NREPS 10
|
||||||
|
|
||||||
for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
|
for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
|
||||||
uint32_t s;
|
uint32_t s;
|
||||||
@ -157,9 +157,9 @@ test_prng_range_u32(bool atomic) {
|
|||||||
static void
|
static void
|
||||||
test_prng_range_u64(void) {
|
test_prng_range_u64(void) {
|
||||||
uint64_t range;
|
uint64_t range;
|
||||||
#define MAX_RANGE 10000000
|
#define MAX_RANGE 10000000
|
||||||
#define RANGE_STEP 97
|
#define RANGE_STEP 97
|
||||||
#define NREPS 10
|
#define NREPS 10
|
||||||
|
|
||||||
for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
|
for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
|
||||||
uint64_t s;
|
uint64_t s;
|
||||||
@ -177,9 +177,9 @@ test_prng_range_u64(void) {
|
|||||||
static void
|
static void
|
||||||
test_prng_range_zu(bool atomic) {
|
test_prng_range_zu(bool atomic) {
|
||||||
size_t range;
|
size_t range;
|
||||||
#define MAX_RANGE 10000000
|
#define MAX_RANGE 10000000
|
||||||
#define RANGE_STEP 97
|
#define RANGE_STEP 97
|
||||||
#define NREPS 10
|
#define NREPS 10
|
||||||
|
|
||||||
for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
|
for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
|
||||||
size_t s;
|
size_t s;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "test/jemalloc_test.h"
|
#include "test/jemalloc_test.h"
|
||||||
|
|
||||||
#define NTHREADS 4
|
#define NTHREADS 4
|
||||||
#define NALLOCS_PER_THREAD 50
|
#define NALLOCS_PER_THREAD 50
|
||||||
#define DUMP_INTERVAL 1
|
#define DUMP_INTERVAL 1
|
||||||
#define BT_COUNT_CHECK_INTERVAL 5
|
#define BT_COUNT_CHECK_INTERVAL 5
|
||||||
|
|
||||||
#ifdef JEMALLOC_PROF
|
#ifdef JEMALLOC_PROF
|
||||||
const char *malloc_conf =
|
const char *malloc_conf =
|
||||||
|
@ -37,7 +37,7 @@ 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) \
|
||||||
mallctl_prof_active_get_impl(a, __func__, __LINE__)
|
mallctl_prof_active_get_impl(a, __func__, __LINE__)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -46,7 +46,7 @@ mallctl_prof_active_set_impl(bool prof_active_old_expected,
|
|||||||
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);
|
||||||
}
|
}
|
||||||
#define mallctl_prof_active_set(a, b) \
|
#define mallctl_prof_active_set(a, b) \
|
||||||
mallctl_prof_active_set_impl(a, b, __func__, __LINE__)
|
mallctl_prof_active_set_impl(a, b, __func__, __LINE__)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -55,7 +55,7 @@ mallctl_thread_prof_active_get_impl(bool thread_prof_active_old_expected,
|
|||||||
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);
|
||||||
}
|
}
|
||||||
#define mallctl_thread_prof_active_get(a) \
|
#define mallctl_thread_prof_active_get(a) \
|
||||||
mallctl_thread_prof_active_get_impl(a, __func__, __LINE__)
|
mallctl_thread_prof_active_get_impl(a, __func__, __LINE__)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -64,7 +64,7 @@ mallctl_thread_prof_active_set_impl(bool thread_prof_active_old_expected,
|
|||||||
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);
|
||||||
}
|
}
|
||||||
#define mallctl_thread_prof_active_set(a, b) \
|
#define mallctl_thread_prof_active_set(a, b) \
|
||||||
mallctl_thread_prof_active_set_impl(a, b, __func__, __LINE__)
|
mallctl_thread_prof_active_set_impl(a, b, __func__, __LINE__)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -80,7 +80,7 @@ prof_sampling_probe_impl(bool expect_sample, const char *func, int line) {
|
|||||||
"%s():%d: Unexpected backtrace count", func, line);
|
"%s():%d: Unexpected backtrace count", func, line);
|
||||||
dallocx(p, 0);
|
dallocx(p, 0);
|
||||||
}
|
}
|
||||||
#define prof_sampling_probe(a) \
|
#define prof_sampling_probe(a) \
|
||||||
prof_sampling_probe_impl(a, __func__, __LINE__)
|
prof_sampling_probe_impl(a, __func__, __LINE__)
|
||||||
|
|
||||||
TEST_BEGIN(test_prof_active) {
|
TEST_BEGIN(test_prof_active) {
|
||||||
|
@ -135,11 +135,11 @@ TEST_BEGIN(test_prof_reset_cleanup) {
|
|||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
#define NTHREADS 4
|
#define NTHREADS 4
|
||||||
#define NALLOCS_PER_THREAD (1U << 13)
|
#define NALLOCS_PER_THREAD (1U << 13)
|
||||||
#define OBJ_RING_BUF_COUNT 1531
|
#define OBJ_RING_BUF_COUNT 1531
|
||||||
#define RESET_INTERVAL (1U << 10)
|
#define RESET_INTERVAL (1U << 10)
|
||||||
#define DUMP_INTERVAL 3677
|
#define DUMP_INTERVAL 3677
|
||||||
static void *
|
static void *
|
||||||
thd_start(void *varg) {
|
thd_start(void *varg) {
|
||||||
unsigned thd_ind = *(unsigned *)varg;
|
unsigned thd_ind = *(unsigned *)varg;
|
||||||
@ -228,7 +228,7 @@ TEST_END
|
|||||||
#undef DUMP_INTERVAL
|
#undef DUMP_INTERVAL
|
||||||
|
|
||||||
/* Test sampling at the same allocation site across resets. */
|
/* Test sampling at the same allocation site across resets. */
|
||||||
#define NITER 10
|
#define NITER 10
|
||||||
TEST_BEGIN(test_xallocx) {
|
TEST_BEGIN(test_xallocx) {
|
||||||
size_t lg_prof_sample_orig;
|
size_t lg_prof_sample_orig;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user