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 /* #undef JEMALLOC_PREFIX */
10 /* #undef JEMALLOC_CPREFIX */
11 
12 /*
13  * Define overrides for non-standard allocator-related functions if they are
14  * present on the system.
15  */
16 /* #undef JEMALLOC_OVERRIDE___LIBC_CALLOC */
17 /* #undef JEMALLOC_OVERRIDE___LIBC_FREE */
18 /* #undef JEMALLOC_OVERRIDE___LIBC_MALLOC */
19 /* #undef JEMALLOC_OVERRIDE___LIBC_MEMALIGN */
20 /* #undef JEMALLOC_OVERRIDE___LIBC_REALLOC */
21 /* #undef JEMALLOC_OVERRIDE___LIBC_VALLOC */
22 #define JEMALLOC_OVERRIDE___POSIX_MEMALIGN
23 
24 /*
25  * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs.
26  * For shared libraries, symbol visibility mechanisms prevent these symbols
27  * from being exported, but for static libraries, naming collisions are a real
28  * possibility.
29  */
30 #define JEMALLOC_PRIVATE_NAMESPACE __je_
31 
32 /*
33  * Hyper-threaded CPUs may need a special instruction inside spin loops in
34  * order to yield to another virtual CPU.
35  */
36 #define CPU_SPINWAIT __asm__ volatile("pause")
37 /* 1 if CPU_SPINWAIT is defined, 0 otherwise. */
38 #define HAVE_CPU_SPINWAIT 1
39 
40 /*
41  * Number of significant bits in virtual addresses.  This may be less than the
42  * total number of bits in a pointer, e.g. on x64, for which the uppermost 16
43  * bits are the same as bit 47.
44  */
45 #define LG_VADDR 48
46 
47 /* Defined if C11 atomics are available. */
48 #define JEMALLOC_C11_ATOMICS 1
49 
50 /* Defined if GCC __atomic atomics are available. */
51 #define JEMALLOC_GCC_ATOMIC_ATOMICS 1
52 /* and the 8-bit variant support. */
53 #define JEMALLOC_GCC_U8_ATOMIC_ATOMICS 1
54 
55 /* Defined if GCC __sync atomics are available. */
56 #define JEMALLOC_GCC_SYNC_ATOMICS 1
57 /* and the 8-bit variant support. */
58 #define JEMALLOC_GCC_U8_SYNC_ATOMICS 1
59 
60 /*
61  * Defined if __builtin_clz() and __builtin_clzl() are available.
62  */
63 #define JEMALLOC_HAVE_BUILTIN_CLZ
64 
65 /*
66  * Defined if os_unfair_lock_*() functions are available, as provided by Darwin.
67  */
68 /* #undef JEMALLOC_OS_UNFAIR_LOCK */
69 
70 /* Defined if syscall(2) is usable. */
71 #define JEMALLOC_USE_SYSCALL
72 
73 /*
74  * Defined if secure_getenv(3) is available.
75  */
76 /* #undef JEMALLOC_HAVE_SECURE_GETENV */
77 
78 /*
79  * Defined if issetugid(2) is available.
80  */
81 #define JEMALLOC_HAVE_ISSETUGID
82 
83 /* Defined if pthread_atfork(3) is available. */
84 #define JEMALLOC_HAVE_PTHREAD_ATFORK
85 
86 /* Defined if pthread_setname_np(3) is available. */
87 /* #undef JEMALLOC_HAVE_PTHREAD_SETNAME_NP */
88 
89 /*
90  * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
91  */
92 /* #undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE */
93 
94 /*
95  * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.
96  */
97 #define JEMALLOC_HAVE_CLOCK_MONOTONIC 1
98 
99 /*
100  * Defined if mach_absolute_time() is available.
101  */
102 /* #undef JEMALLOC_HAVE_MACH_ABSOLUTE_TIME */
103 
104 /*
105  * Defined if _malloc_thread_cleanup() exists.  At least in the case of
106  * FreeBSD, pthread_key_create() allocates, which if used during malloc
107  * bootstrapping will cause recursion into the pthreads library.  Therefore, if
108  * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
109  * malloc_tsd.
110  */
111 #define JEMALLOC_MALLOC_THREAD_CLEANUP
112 
113 /*
114  * Defined if threaded initialization is known to be safe on this platform.
115  * Among other things, it must be possible to initialize a mutex without
116  * triggering allocation in order for threaded allocation to be safe.
117  */
118 /* #undef JEMALLOC_THREADED_INIT */
119 
120 /*
121  * Defined if the pthreads implementation defines
122  * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
123  * to avoid recursive allocation during mutex initialization.
124  */
125 #define JEMALLOC_MUTEX_INIT_CB 1
126 
127 /* Non-empty if the tls_model attribute is supported. */
128 #define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
129 
130 /*
131  * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
132  * inline functions.
133  */
134 /* #undef JEMALLOC_DEBUG */
135 
136 /* JEMALLOC_STATS enables statistics calculation. */
137 #define JEMALLOC_STATS
138 
139 /* JEMALLOC_EXPERIMENTAL_SMALLOCX_API enables experimental smallocx API. */
140 /* #undef JEMALLOC_EXPERIMENTAL_SMALLOCX_API */
141 
142 /* JEMALLOC_PROF enables allocation profiling. */
143 /* #undef JEMALLOC_PROF */
144 
145 /* Use libunwind for profile backtracing if defined. */
146 /* #undef JEMALLOC_PROF_LIBUNWIND */
147 
148 /* Use libgcc for profile backtracing if defined. */
149 /* #undef JEMALLOC_PROF_LIBGCC */
150 
151 /* Use gcc intrinsics for profile backtracing if defined. */
152 /* #undef JEMALLOC_PROF_GCC */
153 
154 /*
155  * JEMALLOC_DSS enables use of sbrk(2) to allocate extents from the data storage
156  * segment (DSS).
157  */
158 #define JEMALLOC_DSS
159 
160 /* Support memory filling (junk/zero). */
161 #define JEMALLOC_FILL
162 
163 /* Support utrace(2)-based tracing. */
164 #define JEMALLOC_UTRACE
165 
166 /* Support optional abort() on OOM. */
167 #define JEMALLOC_XMALLOC
168 
169 /* Support lazy locking (avoid locking unless a second thread is launched). */
170 #define JEMALLOC_LAZY_LOCK
171 
172 /*
173  * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
174  * classes).
175  */
176 /* #undef LG_QUANTUM */
177 
178 /* One page is 2^LG_PAGE bytes. */
179 #define LG_PAGE 12
180 
181 /*
182  * One huge page is 2^LG_HUGEPAGE bytes.  Note that this is defined even if the
183  * system does not explicitly support huge pages; system calls that require
184  * explicit huge page support are separately configured.
185  */
186 #define LG_HUGEPAGE 21
187 
188 /*
189  * If defined, adjacent virtual memory mappings with identical attributes
190  * automatically coalesce, and they fragment when changes are made to subranges.
191  * This is the normal order of things for mmap()/munmap(), but on Windows
192  * VirtualAlloc()/VirtualFree() operations must be precisely matched, i.e.
193  * mappings do *not* coalesce/fragment.
194  */
195 #define JEMALLOC_MAPS_COALESCE
196 
197 /*
198  * If defined, retain memory for later reuse by default rather than using e.g.
199  * munmap() to unmap freed extents.  This is enabled on 64-bit Linux because
200  * common sequences of mmap()/munmap() calls will cause virtual memory map
201  * holes.
202  */
203 /* #undef JEMALLOC_RETAIN */
204 
205 /* TLS is used to map arenas and magazine caches to threads. */
206 #define JEMALLOC_TLS
207 
208 /*
209  * Used to mark unreachable code to quiet "end of non-void" compiler warnings.
210  * Don't use this directly; instead use unreachable() from util.h
211  */
212 #define JEMALLOC_INTERNAL_UNREACHABLE __builtin_unreachable
213 
214 /*
215  * ffs*() functions to use for bitmapping.  Don't use these directly; instead,
216  * use ffs_*() from util.h.
217  */
218 #define JEMALLOC_INTERNAL_FFSLL __builtin_ffsll
219 #define JEMALLOC_INTERNAL_FFSL __builtin_ffsl
220 #define JEMALLOC_INTERNAL_FFS __builtin_ffs
221 
222 /*
223  * popcount*() functions to use for bitmapping.
224  */
225 #define JEMALLOC_INTERNAL_POPCOUNTL __builtin_popcountl
226 #define JEMALLOC_INTERNAL_POPCOUNT __builtin_popcount
227 
228 /*
229  * If defined, explicitly attempt to more uniformly distribute large allocation
230  * pointer alignments across all cache indices.
231  */
232 #define JEMALLOC_CACHE_OBLIVIOUS
233 
234 /*
235  * If defined, enable logging facilities.  We make this a configure option to
236  * avoid taking extra branches everywhere.
237  */
238 /* #undef JEMALLOC_LOG */
239 
240 /*
241  * If defined, use readlinkat() (instead of readlink()) to follow
242  * /etc/malloc_conf.
243  */
244 /* #undef JEMALLOC_READLINKAT */
245 
246 /*
247  * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
248  */
249 /* #undef JEMALLOC_ZONE */
250 
251 /*
252  * Methods for determining whether the OS overcommits.
253  * JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY: Linux's
254  *                                         /proc/sys/vm.overcommit_memory file.
255  * JEMALLOC_SYSCTL_VM_OVERCOMMIT: FreeBSD's vm.overcommit sysctl.
256  */
257 #define JEMALLOC_SYSCTL_VM_OVERCOMMIT
258 /* #undef JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY */
259 
260 /* Defined if madvise(2) is available. */
261 #define JEMALLOC_HAVE_MADVISE
262 
263 /*
264  * Defined if transparent huge pages are supported via the MADV_[NO]HUGEPAGE
265  * arguments to madvise(2).
266  */
267 /* #undef JEMALLOC_HAVE_MADVISE_HUGE */
268 
269 /*
270  * Methods for purging unused pages differ between operating systems.
271  *
272  *   madvise(..., MADV_FREE) : This marks pages as being unused, such that they
273  *                             will be discarded rather than swapped out.
274  *   madvise(..., MADV_DONTNEED) : If JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS is
275  *                                 defined, this immediately discards pages,
276  *                                 such that new pages will be demand-zeroed if
277  *                                 the address region is later touched;
278  *                                 otherwise this behaves similarly to
279  *                                 MADV_FREE, though typically with higher
280  *                                 system overhead.
281  */
282 #define JEMALLOC_PURGE_MADVISE_FREE
283 #define JEMALLOC_PURGE_MADVISE_DONTNEED
284 /* #undef JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS */
285 
286 /* Defined if madvise(2) is available but MADV_FREE is not (x86 Linux only). */
287 /* #undef JEMALLOC_DEFINE_MADVISE_FREE */
288 
289 /*
290  * Defined if MADV_DO[NT]DUMP is supported as an argument to madvise.
291  */
292 /* #undef JEMALLOC_MADVISE_DONTDUMP */
293 
294 /*
295  * Defined if transparent huge pages (THPs) are supported via the
296  * MADV_[NO]HUGEPAGE arguments to madvise(2), and THP support is enabled.
297  */
298 /* #undef JEMALLOC_THP */
299 
300 /* Define if operating system has alloca.h header. */
301 /* #undef JEMALLOC_HAS_ALLOCA_H */
302 
303 /* C99 restrict keyword supported. */
304 #define JEMALLOC_HAS_RESTRICT 1
305 
306 /* For use by hash code. */
307 /* #undef JEMALLOC_BIG_ENDIAN */
308 
309 /* sizeof(int) == 2^LG_SIZEOF_INT. */
310 #define LG_SIZEOF_INT 2
311 
312 /* sizeof(long) == 2^LG_SIZEOF_LONG. */
313 #define LG_SIZEOF_LONG 3
314 
315 /* sizeof(long long) == 2^LG_SIZEOF_LONG_LONG. */
316 #define LG_SIZEOF_LONG_LONG 3
317 
318 /* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
319 #define LG_SIZEOF_INTMAX_T 3
320 
321 /* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */
322 /* #undef JEMALLOC_GLIBC_MALLOC_HOOK */
323 
324 /* glibc memalign hook. */
325 /* #undef JEMALLOC_GLIBC_MEMALIGN_HOOK */
326 
327 /* pthread support */
328 #define JEMALLOC_HAVE_PTHREAD
329 
330 /* dlsym() support */
331 #define JEMALLOC_HAVE_DLSYM
332 
333 /* Adaptive mutex support in pthreads. */
334 #define JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
335 
336 /* GNU specific sched_getcpu support */
337 /* #undef JEMALLOC_HAVE_SCHED_GETCPU */
338 
339 /* GNU specific sched_setaffinity support */
340 /* #undef JEMALLOC_HAVE_SCHED_SETAFFINITY */
341 
342 /*
343  * If defined, all the features necessary for background threads are present.
344  */
345 #define JEMALLOC_BACKGROUND_THREAD 1
346 
347 /*
348  * If defined, jemalloc symbols are not exported (doesn't work when
349  * JEMALLOC_PREFIX is not defined).
350  */
351 /* #undef JEMALLOC_EXPORT */
352 
353 /* config.malloc_conf options string. */
354 #define JEMALLOC_CONFIG_MALLOC_CONF "abort_conf:false"
355 
356 /* If defined, jemalloc takes the malloc/free/etc. symbol names. */
357 #define JEMALLOC_IS_MALLOC 1
358 
359 /*
360  * Defined if strerror_r returns char * if _GNU_SOURCE is defined.
361  */
362 /* #undef JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE */
363 
364 /* Performs additional safety checks when defined. */
365 /* #undef JEMALLOC_OPT_SAFETY_CHECKS */
366 
367 #endif /* JEMALLOC_INTERNAL_DEFS_H_ */
368