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