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