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 the equivalent of FreeBSD's atomic(9) functions are available. */
     31 /* #undef JEMALLOC_ATOMIC9 */
     32 
     33 /*
     34  * Defined if OSAtomic*() functions are available, as provided by Darwin, and
     35  * documented in the atomic(3) manual page.
     36  */
     37 /* #undef JEMALLOC_OSATOMIC */
     38 
     39 /*
     40  * Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
     41  * __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
     42  * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
     43  * functions are defined in libgcc instead of being inlines)
     44  */
     45 /* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4 */
     46 
     47 /*
     48  * Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
     49  * __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
     50  * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
     51  * functions are defined in libgcc instead of being inlines)
     52  */
     53 /* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8 */
     54 
     55 /*
     56  * Defined if __builtin_clz() and __builtin_clzl() are available.
     57  */
     58 #define JEMALLOC_HAVE_BUILTIN_CLZ
     59 
     60 /*
     61  * Defined if madvise(2) is available.
     62  */
     63 #define JEMALLOC_HAVE_MADVISE
     64 
     65 /*
     66  * Defined if OSSpin*() functions are available, as provided by Darwin, and
     67  * documented in the spinlock(3) manual page.
     68  */
     69 /* #undef JEMALLOC_OSSPIN */
     70 
     71 /*
     72  * Defined if _malloc_thread_cleanup() exists.  At least in the case of
     73  * FreeBSD, pthread_key_create() allocates, which if used during malloc
     74  * bootstrapping will cause recursion into the pthreads library.  Therefore, if
     75  * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
     76  * malloc_tsd.
     77  */
     78 /* #undef JEMALLOC_MALLOC_THREAD_CLEANUP */
     79 
     80 /*
     81  * Defined if threaded initialization is known to be safe on this platform.
     82  * Among other things, it must be possible to initialize a mutex without
     83  * triggering allocation in order for threaded allocation to be safe.
     84  */
     85 #define JEMALLOC_THREADED_INIT
     86 
     87 /*
     88  * Defined if the pthreads implementation defines
     89  * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
     90  * to avoid recursive allocation during mutex initialization.
     91  */
     92 /* #undef JEMALLOC_MUTEX_INIT_CB */
     93 
     94 /* Non-empty if the tls_model attribute is supported. */
     95 #define JEMALLOC_TLS_MODEL
     96 
     97 /* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
     98 #define JEMALLOC_CC_SILENCE
     99 
    100 /* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */
    101 /* #undef JEMALLOC_CODE_COVERAGE */
    102 
    103 /*
    104  * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
    105  * inline functions.
    106  */
    107 /* #undef JEMALLOC_DEBUG */
    108 
    109 /* JEMALLOC_STATS enables statistics calculation. */
    110 #define JEMALLOC_STATS
    111 
    112 /* JEMALLOC_PROF enables allocation profiling. */
    113 /* #undef JEMALLOC_PROF */
    114 
    115 /* Use libunwind for profile backtracing if defined. */
    116 /* #undef JEMALLOC_PROF_LIBUNWIND */
    117 
    118 /* Use libgcc for profile backtracing if defined. */
    119 /* #undef JEMALLOC_PROF_LIBGCC */
    120 
    121 /* Use gcc intrinsics for profile backtracing if defined. */
    122 /* #undef JEMALLOC_PROF_GCC */
    123 
    124 /*
    125  * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
    126  * This makes it possible to allocate/deallocate objects without any locking
    127  * when the cache is in the steady state.
    128  */
    129 #define JEMALLOC_TCACHE
    130 
    131 /*
    132  * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
    133  * segment (DSS).
    134  */
    135 #define JEMALLOC_DSS
    136 
    137 /* Support memory filling (junk/zero/quarantine/redzone). */
    138 #define JEMALLOC_FILL
    139 
    140 /* Support utrace(2)-based tracing. */
    141 /* #undef JEMALLOC_UTRACE */
    142 
    143 /* Support Valgrind. */
    144 /* #undef JEMALLOC_VALGRIND */
    145 
    146 /* Support optional abort() on OOM. */
    147 /* #undef JEMALLOC_XMALLOC */
    148 
    149 /* Support lazy locking (avoid locking unless a second thread is launched). */
    150 /* #undef JEMALLOC_LAZY_LOCK */
    151 
    152 /* One page is 2^STATIC_PAGE_SHIFT bytes. */
    153 #define STATIC_PAGE_SHIFT 12
    154 
    155 /*
    156  * If defined, use munmap() to unmap freed chunks, rather than storing them for
    157  * later reuse.  This is disabled by default on Linux because common sequences
    158  * of mmap()/munmap() calls will cause virtual memory map holes.
    159  */
    160 /* #undef JEMALLOC_MUNMAP */
    161 
    162 /* TLS is used to map arenas and magazine caches to threads. */
    163 /* #undef JEMALLOC_TLS */
    164 
    165 /*
    166  * ffs()/ffsl() functions to use for bitmapping.  Don't use these directly;
    167  * instead, use jemalloc_ffs() or jemalloc_ffsl() from util.h.
    168  */
    169 #define JEMALLOC_INTERNAL_FFSL __builtin_ffsl
    170 #define JEMALLOC_INTERNAL_FFS __builtin_ffs
    171 
    172 /*
    173  * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
    174  * within jemalloc-owned chunks before dereferencing them.
    175  */
    176 /* #undef JEMALLOC_IVSALLOC */
    177 
    178 /*
    179  * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
    180  */
    181 /* #undef JEMALLOC_ZONE */
    182 /* #undef JEMALLOC_ZONE_VERSION */
    183 
    184 /*
    185  * Methods for purging unused pages differ between operating systems.
    186  *
    187  *   madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages,
    188  *                                 such that new pages will be demand-zeroed if
    189  *                                 the address region is later touched.
    190  *   madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being
    191  *                             unused, such that they will be discarded rather
    192  *                             than swapped out.
    193  */
    194 #define JEMALLOC_PURGE_MADVISE_DONTNEED
    195 /* #undef JEMALLOC_PURGE_MADVISE_FREE */
    196 
    197 /*
    198  * Define if operating system has alloca.h header.
    199  */
    200 #define JEMALLOC_HAS_ALLOCA_H 1
    201 
    202 /* C99 restrict keyword supported. */
    203 #define JEMALLOC_HAS_RESTRICT 1
    204 
    205 /* For use by hash code. */
    206 /* #undef JEMALLOC_BIG_ENDIAN */
    207 
    208 /* sizeof(int) == 2^LG_SIZEOF_INT. */
    209 #define LG_SIZEOF_INT 2
    210 
    211 /* sizeof(long) == 2^LG_SIZEOF_LONG. */
    212 #ifdef __LP64__
    213 #define LG_SIZEOF_LONG 3
    214 #else
    215 #define LG_SIZEOF_LONG 2
    216 #endif
    217 
    218 /* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
    219 #define LG_SIZEOF_INTMAX_T 3
    220 
    221 #endif /* JEMALLOC_INTERNAL_DEFS_H_ */
    222