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 madvise(2) is available.
60 */
61#undef JEMALLOC_HAVE_MADVISE
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/*
70 * Defined if secure_getenv(3) is available.
71 */
72#undef JEMALLOC_HAVE_SECURE_GETENV
73
74/*
75 * Defined if issetugid(2) is available.
76 */
77#undef JEMALLOC_HAVE_ISSETUGID
78
79/*
80 * Defined if _malloc_thread_cleanup() exists.  At least in the case of
81 * FreeBSD, pthread_key_create() allocates, which if used during malloc
82 * bootstrapping will cause recursion into the pthreads library.  Therefore, if
83 * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
84 * malloc_tsd.
85 */
86#undef JEMALLOC_MALLOC_THREAD_CLEANUP
87
88/*
89 * Defined if threaded initialization is known to be safe on this platform.
90 * Among other things, it must be possible to initialize a mutex without
91 * triggering allocation in order for threaded allocation to be safe.
92 */
93#undef JEMALLOC_THREADED_INIT
94
95/*
96 * Defined if the pthreads implementation defines
97 * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
98 * to avoid recursive allocation during mutex initialization.
99 */
100#undef JEMALLOC_MUTEX_INIT_CB
101
102/* Non-empty if the tls_model attribute is supported. */
103#undef JEMALLOC_TLS_MODEL
104
105/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
106#undef JEMALLOC_CC_SILENCE
107
108/* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */
109#undef JEMALLOC_CODE_COVERAGE
110
111/*
112 * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
113 * inline functions.
114 */
115#undef JEMALLOC_DEBUG
116
117/* JEMALLOC_STATS enables statistics calculation. */
118#undef JEMALLOC_STATS
119
120/* JEMALLOC_PROF enables allocation profiling. */
121#undef JEMALLOC_PROF
122
123/* Use libunwind for profile backtracing if defined. */
124#undef JEMALLOC_PROF_LIBUNWIND
125
126/* Use libgcc for profile backtracing if defined. */
127#undef JEMALLOC_PROF_LIBGCC
128
129/* Use gcc intrinsics for profile backtracing if defined. */
130#undef JEMALLOC_PROF_GCC
131
132/*
133 * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
134 * This makes it possible to allocate/deallocate objects without any locking
135 * when the cache is in the steady state.
136 */
137#undef JEMALLOC_TCACHE
138
139/*
140 * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
141 * segment (DSS).
142 */
143#undef JEMALLOC_DSS
144
145/* Support memory filling (junk/zero/quarantine/redzone). */
146#undef JEMALLOC_FILL
147
148/* Support utrace(2)-based tracing. */
149#undef JEMALLOC_UTRACE
150
151/* Support Valgrind. */
152#undef JEMALLOC_VALGRIND
153
154/* Support optional abort() on OOM. */
155#undef JEMALLOC_XMALLOC
156
157/* Support lazy locking (avoid locking unless a second thread is launched). */
158#undef JEMALLOC_LAZY_LOCK
159
160/* Minimum size class to support is 2^LG_TINY_MIN bytes. */
161#undef LG_TINY_MIN
162
163/*
164 * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
165 * classes).
166 */
167#undef LG_QUANTUM
168
169/* One page is 2^LG_PAGE bytes. */
170#undef LG_PAGE
171
172/*
173 * If defined, use munmap() to unmap freed chunks, rather than storing them for
174 * later reuse.  This is disabled by default on Linux because common sequences
175 * of mmap()/munmap() calls will cause virtual memory map holes.
176 */
177#undef JEMALLOC_MUNMAP
178
179/* TLS is used to map arenas and magazine caches to threads. */
180#undef JEMALLOC_TLS
181
182/*
183 * ffs()/ffsl() functions to use for bitmapping.  Don't use these directly;
184 * instead, use jemalloc_ffs() or jemalloc_ffsl() from util.h.
185 */
186#undef JEMALLOC_INTERNAL_FFSL
187#undef JEMALLOC_INTERNAL_FFS
188
189/*
190 * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
191 * within jemalloc-owned chunks before dereferencing them.
192 */
193#undef JEMALLOC_IVSALLOC
194
195/*
196 * If defined, explicitly attempt to more uniformly distribute large allocation
197 * pointer alignments across all cache indices.
198 */
199#undef JEMALLOC_CACHE_OBLIVIOUS
200
201/*
202 * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
203 */
204#undef JEMALLOC_ZONE
205#undef JEMALLOC_ZONE_VERSION
206
207/*
208 * Methods for purging unused pages differ between operating systems.
209 *
210 *   madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages,
211 *                                 such that new pages will be demand-zeroed if
212 *                                 the address region is later touched.
213 *   madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being
214 *                             unused, such that they will be discarded rather
215 *                             than swapped out.
216 */
217#undef JEMALLOC_PURGE_MADVISE_DONTNEED
218#undef JEMALLOC_PURGE_MADVISE_FREE
219
220/* Define if operating system has alloca.h header. */
221#undef JEMALLOC_HAS_ALLOCA_H
222
223/* C99 restrict keyword supported. */
224#undef JEMALLOC_HAS_RESTRICT
225
226/* For use by hash code. */
227#undef JEMALLOC_BIG_ENDIAN
228
229/* sizeof(int) == 2^LG_SIZEOF_INT. */
230#undef LG_SIZEOF_INT
231
232/* sizeof(long) == 2^LG_SIZEOF_LONG. */
233#undef LG_SIZEOF_LONG
234
235/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
236#undef LG_SIZEOF_INTMAX_T
237
238/* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */
239#undef JEMALLOC_GLIBC_MALLOC_HOOK
240
241/* glibc memalign hook. */
242#undef JEMALLOC_GLIBC_MEMALIGN_HOOK
243
244/* Adaptive mutex support in pthreads. */
245#undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
246
247/*
248 * If defined, jemalloc symbols are not exported (doesn't work when
249 * JEMALLOC_PREFIX is not defined).
250 */
251#undef JEMALLOC_EXPORT
252
253#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
254