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