Home | History | Annotate | Download | only in internal
      1 /* include/jemalloc/internal/jemalloc_internal_defs.h.  Generated from jemalloc_internal_defs.h.in by configure.  */
      2 #ifndef JEMALLOC_INTERNAL_DEFS_H_
      3 #define	JEMALLOC_INTERNAL_DEFS_H_
      4 /*
      5  * If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all
      6  * public APIs to be prefixed.  This makes it possible, with some care, to use
      7  * multiple allocators simultaneously.
      8  */
      9 #define JEMALLOC_PREFIX "je_"
     10 #define JEMALLOC_CPREFIX "JE_"
     11 
     12 /*
     13  * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs.
     14  * For shared libraries, symbol visibility mechanisms prevent these symbols
     15  * from being exported, but for static libraries, naming collisions are a real
     16  * possibility.
     17  */
     18 #define JEMALLOC_PRIVATE_NAMESPACE je_
     19 
     20 /*
     21  * Hyper-threaded CPUs may need a special instruction inside spin loops in
     22  * order to yield to another virtual CPU.
     23  */
     24 #ifdef __x86_64__
     25 #define CPU_SPINWAIT __asm__ volatile("pause")
     26 #else
     27 #define CPU_SPINWAIT
     28 #endif
     29 
     30 /* Defined if C11 atomics are available. */
     31 #define JEMALLOC_C11ATOMICS
     32 
     33 /* Defined if the equivalent of FreeBSD's atomic(9) functions are available. */
     34 /* #undef JEMALLOC_ATOMIC9 */
     35 
     36 /*
     37  * Defined if OSAtomic*() functions are available, as provided by Darwin, and
     38  * documented in the atomic(3) manual page.
     39  */
     40 /* #undef JEMALLOC_OSATOMIC */
     41 
     42 /*
     43  * Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
     44  * __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
     45  * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
     46  * functions are defined in libgcc instead of being inlines).
     47  */
     48 /* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4 */
     49 
     50 /*
     51  * Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
     52  * __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
     53  * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
     54  * functions are defined in libgcc instead of being inlines).
     55  */
     56 /* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8 */
     57 
     58 /*
     59  * Defined if __builtin_clz() and __builtin_clzl() are available.
     60  */
     61 #define JEMALLOC_HAVE_BUILTIN_CLZ
     62 
     63 /*
     64  * Defined if madvise(2) is available.
     65  */
     66 #define JEMALLOC_HAVE_MADVISE
     67 
     68 /*
     69  * Defined if OSSpin*() functions are available, as provided by Darwin, and
     70  * documented in the spinlock(3) manual page.
     71  */
     72 /* #undef JEMALLOC_OSSPIN */
     73 
     74 /*
     75  * Defined if secure_getenv(3) is available.
     76  */
     77 /* #undef JEMALLOC_HAVE_SECURE_GETENV */
     78 
     79 /*
     80  * Defined if issetugid(2) is available.
     81  */
     82 /* #undef JEMALLOC_HAVE_ISSETUGID */
     83 
     84 /*
     85  * Defined if _malloc_thread_cleanup() exists.  At least in the case of
     86  * FreeBSD, pthread_key_create() allocates, which if used during malloc
     87  * bootstrapping will cause recursion into the pthreads library.  Therefore, if
     88  * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
     89  * malloc_tsd.
     90  */
     91 /* #undef JEMALLOC_MALLOC_THREAD_CLEANUP */
     92 
     93 /*
     94  * Defined if threaded initialization is known to be safe on this platform.
     95  * Among other things, it must be possible to initialize a mutex without
     96  * triggering allocation in order for threaded allocation to be safe.
     97  */
     98 #define JEMALLOC_THREADED_INIT
     99 
    100 /*
    101  * Defined if the pthreads implementation defines
    102  * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
    103  * to avoid recursive allocation during mutex initialization.
    104  */
    105 /* #undef JEMALLOC_MUTEX_INIT_CB */
    106 
    107 /* Non-empty if the tls_model attribute is supported. */
    108 #define JEMALLOC_TLS_MODEL
    109 
    110 /* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
    111 #define JEMALLOC_CC_SILENCE
    112 
    113 /* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */
    114 /* #undef JEMALLOC_CODE_COVERAGE */
    115 
    116 /*
    117  * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
    118  * inline functions.
    119  */
    120 /* #undef JEMALLOC_DEBUG */
    121 
    122 /* JEMALLOC_STATS enables statistics calculation. */
    123 #define JEMALLOC_STATS
    124 
    125 /* JEMALLOC_PROF enables allocation profiling. */
    126 /* #undef JEMALLOC_PROF */
    127 
    128 /* Use libunwind for profile backtracing if defined. */
    129 /* #undef JEMALLOC_PROF_LIBUNWIND */
    130 
    131 /* Use libgcc for profile backtracing if defined. */
    132 /* #undef JEMALLOC_PROF_LIBGCC */
    133 
    134 /* Use gcc intrinsics for profile backtracing if defined. */
    135 /* #undef JEMALLOC_PROF_GCC */
    136 
    137 /*
    138  * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
    139  * This makes it possible to allocate/deallocate objects without any locking
    140  * when the cache is in the steady state.
    141  */
    142 /* ANDROID: The tcache is enabled/disabled in the Makefile, not here. */
    143 /* #undef JEMALLOC_TCACHE */
    144 
    145 /*
    146  * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
    147  * segment (DSS).
    148  */
    149 #define JEMALLOC_DSS
    150 
    151 /* Support memory filling (junk/zero/quarantine/redzone). */
    152 #define JEMALLOC_FILL
    153 
    154 /* Support utrace(2)-based tracing. */
    155 /* #undef JEMALLOC_UTRACE */
    156 
    157 /* Support Valgrind. */
    158 /* #undef JEMALLOC_VALGRIND */
    159 
    160 /* Support optional abort() on OOM. */
    161 /* #undef JEMALLOC_XMALLOC */
    162 
    163 /* Support lazy locking (avoid locking unless a second thread is launched). */
    164 /* #undef JEMALLOC_LAZY_LOCK */
    165 
    166 /* Minimum size class to support is 2^LG_TINY_MIN bytes. */
    167 #define LG_TINY_MIN 3
    168 
    169 /*
    170  * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
    171  * classes).
    172  */
    173 /* #undef LG_QUANTUM */
    174 
    175 /* One page is 2^LG_PAGE bytes. */
    176 #define LG_PAGE 12
    177 
    178 /*
    179  * If defined, adjacent virtual memory mappings with identical attributes
    180  * automatically coalesce, and they fragment when changes are made to subranges.
    181  * This is the normal order of things for mmap()/munmap(), but on Windows
    182  * VirtualAlloc()/VirtualFree() operations must be precisely matched, i.e.
    183  * mappings do *not* coalesce/fragment.
    184  */
    185 #define JEMALLOC_MAPS_COALESCE
    186 
    187 /*
    188  * If defined, use munmap() to unmap freed chunks, rather than storing them for
    189  * later reuse.  This is disabled by default on Linux because common sequences
    190  * of mmap()/munmap() calls will cause virtual memory map holes.
    191  */
    192 /* #undef JEMALLOC_MUNMAP */
    193 
    194 /* TLS is used to map arenas and magazine caches to threads. */
    195 /* #undef JEMALLOC_TLS */
    196 
    197 /*
    198  * ffs*() functions to use for bitmapping.  Don't use these directly; instead,
    199  * use ffs_*() from util.h.
    200  */
    201 #define JEMALLOC_INTERNAL_FFSLL __builtin_ffsll
    202 #define JEMALLOC_INTERNAL_FFSL __builtin_ffsl
    203 #define JEMALLOC_INTERNAL_FFS __builtin_ffs
    204 
    205 /*
    206  * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
    207  * within jemalloc-owned chunks before dereferencing them.
    208  */
    209 /* #undef JEMALLOC_IVSALLOC */
    210 
    211 /*
    212  * If defined, explicitly attempt to more uniformly distribute large allocation
    213  * pointer alignments across all cache indices.
    214  */
    215 #define JEMALLOC_CACHE_OBLIVIOUS
    216 
    217 /*
    218  * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
    219  */
    220 /* #undef JEMALLOC_ZONE */
    221 /* #undef JEMALLOC_ZONE_VERSION */
    222 
    223 /*
    224  * Methods for purging unused pages differ between operating systems.
    225  *
    226  *   madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages,
    227  *                                 such that new pages will be demand-zeroed if
    228  *                                 the address region is later touched.
    229  *   madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being
    230  *                             unused, such that they will be discarded rather
    231  *                             than swapped out.
    232  */
    233 #define JEMALLOC_PURGE_MADVISE_DONTNEED
    234 /* #undef JEMALLOC_PURGE_MADVISE_FREE */
    235 
    236 /* Define if operating system has alloca.h header. */
    237 #define JEMALLOC_HAS_ALLOCA_H 1
    238 
    239 /* C99 restrict keyword supported. */
    240 #define JEMALLOC_HAS_RESTRICT 1
    241 
    242 /* For use by hash code. */
    243 /* #undef JEMALLOC_BIG_ENDIAN */
    244 
    245 /* sizeof(int) == 2^LG_SIZEOF_INT. */
    246 #define LG_SIZEOF_INT 2
    247 
    248 /* sizeof(long) == 2^LG_SIZEOF_LONG. */
    249 #ifdef __LP64__
    250 #define LG_SIZEOF_LONG 3
    251 #else
    252 #define LG_SIZEOF_LONG 2
    253 #endif
    254 
    255 /* sizeof(long long) == 2^LG_SIZEOF_LONG_LONG. */
    256 #define LG_SIZEOF_LONG_LONG 3
    257 
    258 /* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
    259 #define LG_SIZEOF_INTMAX_T 3
    260 
    261 /* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */
    262 /* #undef JEMALLOC_GLIBC_MALLOC_HOOK */
    263 
    264 /* glibc memalign hook. */
    265 /* #undef JEMALLOC_GLIBC_MEMALIGN_HOOK */
    266 
    267 /* Adaptive mutex support in pthreads. */
    268 /* #undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
    269 
    270 /*
    271  * If defined, jemalloc symbols are not exported (doesn't work when
    272  * JEMALLOC_PREFIX is not defined).
    273  */
    274 #define JEMALLOC_EXPORT
    275 
    276 /* config.malloc_conf options string. */
    277 #define JEMALLOC_CONFIG_MALLOC_CONF ""
    278 
    279 #endif /* JEMALLOC_INTERNAL_DEFS_H_ */
    280