]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/jemalloc/include/jemalloc/jemalloc_defs.h
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / jemalloc / include / jemalloc / jemalloc_defs.h
1 /* include/jemalloc/jemalloc_defs.h.  Generated from jemalloc_defs.h.in by configure.  */
2 /*
3  * If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all
4  * public APIs to be prefixed.  This makes it possible, with some care, to use
5  * multiple allocators simultaneously.
6  */
7 /* #undef JEMALLOC_PREFIX */
8 /* #undef JEMALLOC_CPREFIX */
9
10 /*
11  * Name mangling for public symbols is controlled by --with-mangling and
12  * --with-jemalloc-prefix.  With default settings the je_ prefix is stripped by
13  * these macro definitions.
14  */
15 #define je_malloc_conf malloc_conf
16 #define je_malloc_message malloc_message
17 #define je_malloc malloc
18 #define je_calloc calloc
19 #define je_posix_memalign posix_memalign
20 #define je_aligned_alloc aligned_alloc
21 #define je_realloc realloc
22 #define je_free free
23 #define je_malloc_usable_size malloc_usable_size
24 #define je_malloc_stats_print malloc_stats_print
25 #define je_mallctl mallctl
26 #define je_mallctlnametomib mallctlnametomib
27 #define je_mallctlbymib mallctlbymib
28 /* #undef je_memalign */
29 #define je_valloc valloc
30 #define je_allocm allocm
31 #define je_rallocm rallocm
32 #define je_sallocm sallocm
33 #define je_dallocm dallocm
34 #define je_nallocm nallocm
35
36 /*
37  * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs.
38  * For shared libraries, symbol visibility mechanisms prevent these symbols
39  * from being exported, but for static libraries, naming collisions are a real
40  * possibility.
41  */
42 #define JEMALLOC_PRIVATE_NAMESPACE "__jemalloc_"
43 #define JEMALLOC_N(string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix) __jemalloc_##string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix
44
45 /*
46  * Hyper-threaded CPUs may need a special instruction inside spin loops in
47  * order to yield to another virtual CPU.
48  */
49 #define CPU_SPINWAIT __asm__ volatile("pause")
50
51 /* Defined if the equivalent of FreeBSD's atomic(9) functions are available. */
52 #define JEMALLOC_ATOMIC9 1
53
54 /*
55  * Defined if OSAtomic*() functions are available, as provided by Darwin, and
56  * documented in the atomic(3) manual page.
57  */
58 /* #undef JEMALLOC_OSATOMIC */
59
60 /*
61  * Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
62  * __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
63  * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
64  * functions are defined in libgcc instead of being inlines)
65  */
66 /* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4 */
67
68 /*
69  * Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
70  * __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
71  * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
72  * functions are defined in libgcc instead of being inlines)
73  */
74 /* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8 */
75
76 /*
77  * Defined if OSSpin*() functions are available, as provided by Darwin, and
78  * documented in the spinlock(3) manual page.
79  */
80 /* #undef JEMALLOC_OSSPIN */
81
82 /*
83  * Defined if _malloc_thread_cleanup() exists.  At least in the case of
84  * FreeBSD, pthread_key_create() allocates, which if used during malloc
85  * bootstrapping will cause recursion into the pthreads library.  Therefore, if
86  * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
87  * malloc_tsd.
88  */
89 #define JEMALLOC_MALLOC_THREAD_CLEANUP 
90
91 /*
92  * Defined if threaded initialization is known to be safe on this platform.
93  * Among other things, it must be possible to initialize a mutex without
94  * triggering allocation in order for threaded allocation to be safe.
95  */
96 /* #undef JEMALLOC_THREADED_INIT */
97
98 /*
99  * Defined if the pthreads implementation defines
100  * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
101  * to avoid recursive allocation during mutex initialization.
102  */
103 #define JEMALLOC_MUTEX_INIT_CB 1
104
105 /* Defined if __attribute__((...)) syntax is supported. */
106 #define JEMALLOC_HAVE_ATTR 
107 #ifdef JEMALLOC_HAVE_ATTR
108 #  define JEMALLOC_ATTR(s) __attribute__((s))
109 #  define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
110 #  define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
111 #  define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
112 #  define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
113 #elif _MSC_VER
114 #  define JEMALLOC_ATTR(s)
115 #  ifdef DLLEXPORT
116 #    define JEMALLOC_EXPORT __declspec(dllexport)
117 #  else
118 #    define JEMALLOC_EXPORT __declspec(dllimport)
119 #  endif
120 #  define JEMALLOC_ALIGNED(s) __declspec(align(s))
121 #  define JEMALLOC_SECTION(s) __declspec(allocate(s))
122 #  define JEMALLOC_NOINLINE __declspec(noinline)
123 #else
124 #  define JEMALLOC_ATTR(s)
125 #  define JEMALLOC_EXPORT
126 #  define JEMALLOC_ALIGNED(s)
127 #  define JEMALLOC_SECTION(s)
128 #  define JEMALLOC_NOINLINE
129 #endif
130
131 /* Defined if sbrk() is supported. */
132 #define JEMALLOC_HAVE_SBRK 
133
134 /* Non-empty if the tls_model attribute is supported. */
135 #define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
136
137 /* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
138 #define JEMALLOC_CC_SILENCE 
139
140 /*
141  * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
142  * inline functions.
143  */
144 /* #undef JEMALLOC_DEBUG */
145
146 /* JEMALLOC_STATS enables statistics calculation. */
147 #define JEMALLOC_STATS 
148
149 /* JEMALLOC_PROF enables allocation profiling. */
150 /* #undef JEMALLOC_PROF */
151
152 /* Use libunwind for profile backtracing if defined. */
153 /* #undef JEMALLOC_PROF_LIBUNWIND */
154
155 /* Use libgcc for profile backtracing if defined. */
156 /* #undef JEMALLOC_PROF_LIBGCC */
157
158 /* Use gcc intrinsics for profile backtracing if defined. */
159 /* #undef JEMALLOC_PROF_GCC */
160
161 /*
162  * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
163  * This makes it possible to allocate/deallocate objects without any locking
164  * when the cache is in the steady state.
165  */
166 #define JEMALLOC_TCACHE 
167
168 /*
169  * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
170  * segment (DSS).
171  */
172 #define JEMALLOC_DSS 
173
174 /* Support memory filling (junk/zero/quarantine/redzone). */
175 #define JEMALLOC_FILL 
176
177 /* Support the experimental API. */
178 #define JEMALLOC_EXPERIMENTAL 
179
180 /* Support utrace(2)-based tracing. */
181 #define JEMALLOC_UTRACE 
182
183 /* Support Valgrind. */
184 /* #undef JEMALLOC_VALGRIND */
185
186 /* Support optional abort() on OOM. */
187 #define JEMALLOC_XMALLOC 
188
189 /* Support lazy locking (avoid locking unless a second thread is launched). */
190 #define JEMALLOC_LAZY_LOCK 
191
192 /* One page is 2^STATIC_PAGE_SHIFT bytes. */
193 #define STATIC_PAGE_SHIFT 12
194
195 /*
196  * If defined, use munmap() to unmap freed chunks, rather than storing them for
197  * later reuse.  This is disabled by default on Linux because common sequences
198  * of mmap()/munmap() calls will cause virtual memory map holes.
199  */
200 #define JEMALLOC_MUNMAP 
201
202 /*
203  * If defined, use mremap(...MREMAP_FIXED...) for huge realloc().  This is
204  * disabled by default because it is Linux-specific and it will cause virtual
205  * memory map holes, much like munmap(2) does.
206  */
207 /* #undef JEMALLOC_MREMAP */
208
209 /* TLS is used to map arenas and magazine caches to threads. */
210 #define JEMALLOC_TLS 
211
212 /*
213  * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
214  * within jemalloc-owned chunks before dereferencing them.
215  */
216 /* #undef JEMALLOC_IVSALLOC */
217
218 /*
219  * Define overrides for non-standard allocator-related functions if they
220  * are present on the system.
221  */
222 /* #undef JEMALLOC_OVERRIDE_MEMALIGN */
223 #define JEMALLOC_OVERRIDE_VALLOC 
224
225 /*
226  * At least Linux omits the "const" in:
227  *
228  *   size_t malloc_usable_size(const void *ptr);
229  *
230  * Match the operating system's prototype.
231  */
232 #define JEMALLOC_USABLE_SIZE_CONST const
233
234 /*
235  * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
236  */
237 /* #undef JEMALLOC_ZONE */
238 /* #undef JEMALLOC_ZONE_VERSION */
239
240 /*
241  * Methods for purging unused pages differ between operating systems.
242  *
243  *   madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages,
244  *                                 such that new pages will be demand-zeroed if
245  *                                 the address region is later touched.
246  *   madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being
247  *                             unused, such that they will be discarded rather
248  *                             than swapped out.
249  */
250 /* #undef JEMALLOC_PURGE_MADVISE_DONTNEED */
251 #define JEMALLOC_PURGE_MADVISE_FREE 
252
253 /*
254  * Define if operating system has alloca.h header.
255  */
256 /* #undef JEMALLOC_HAS_ALLOCA_H */
257
258 /* sizeof(void *) == 2^LG_SIZEOF_PTR. */
259 #define LG_SIZEOF_PTR 3
260
261 /* sizeof(int) == 2^LG_SIZEOF_INT. */
262 #define LG_SIZEOF_INT 2
263
264 /* sizeof(long) == 2^LG_SIZEOF_LONG. */
265 #define LG_SIZEOF_LONG 3
266
267 /* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
268 #define LG_SIZEOF_INTMAX_T 3