1#ifndef JEMALLOC_PREAMBLE_H 2#define JEMALLOC_PREAMBLE_H 3 4#include "jemalloc_internal_defs.h" 5#include "jemalloc/internal/jemalloc_internal_decls.h" 6 7#ifdef JEMALLOC_UTRACE 8#include <sys/ktrace.h> 9#endif 10 11#include "un-namespace.h" 12#include "libc_private.h" 13 14#define JEMALLOC_NO_DEMANGLE 15#ifdef JEMALLOC_JET 16# undef JEMALLOC_IS_MALLOC 17# define JEMALLOC_N(n) jet_##n 18# include "jemalloc/internal/public_namespace.h" 19# define JEMALLOC_NO_RENAME 20# include "../jemalloc.h" 21# undef JEMALLOC_NO_RENAME 22#else 23# define JEMALLOC_N(n) __je_##n 24# include "../jemalloc.h" 25#endif 26 27#if (defined(JEMALLOC_OSATOMIC) || defined(JEMALLOC_OSSPIN)) 28#include <libkern/OSAtomic.h> 29#endif 30 31#ifdef JEMALLOC_ZONE 32#include <mach/mach_error.h> 33#include <mach/mach_init.h> 34#include <mach/vm_map.h> 35#endif 36 37#include "jemalloc/internal/jemalloc_internal_macros.h" 38 39/* 40 * Note that the ordering matters here; the hook itself is name-mangled. We 41 * want the inclusion of hooks to happen early, so that we hook as much as 42 * possible. 43 */ 44#ifndef JEMALLOC_NO_PRIVATE_NAMESPACE 45# ifndef JEMALLOC_JET 46# include "jemalloc/internal/private_namespace.h" 47# else 48# include "jemalloc/internal/private_namespace_jet.h" 49# endif 50#endif 51#include "jemalloc/internal/hooks.h" 52 53#ifdef JEMALLOC_DEFINE_MADVISE_FREE 54# define JEMALLOC_MADV_FREE 8 55#endif 56 57static const bool config_debug = 58#ifdef JEMALLOC_DEBUG 59 true 60#else 61 false 62#endif 63 ; 64static const bool have_dss = 65#ifdef JEMALLOC_DSS 66 true 67#else 68 false 69#endif 70 ; 71static const bool have_madvise_huge = 72#ifdef JEMALLOC_HAVE_MADVISE_HUGE 73 true 74#else 75 false 76#endif 77 ; 78static const bool config_fill = 79#ifdef JEMALLOC_FILL 80 true 81#else 82 false 83#endif 84 ; 85static const bool config_lazy_lock = true; 86static const char * const config_malloc_conf = JEMALLOC_CONFIG_MALLOC_CONF; 87static const bool config_prof = 88#ifdef JEMALLOC_PROF 89 true 90#else 91 false 92#endif 93 ; 94static const bool config_prof_libgcc = 95#ifdef JEMALLOC_PROF_LIBGCC 96 true 97#else 98 false 99#endif 100 ; 101static const bool config_prof_libunwind = 102#ifdef JEMALLOC_PROF_LIBUNWIND 103 true 104#else 105 false 106#endif 107 ; 108static const bool maps_coalesce = 109#ifdef JEMALLOC_MAPS_COALESCE 110 true 111#else 112 false 113#endif 114 ; 115static const bool config_stats = 116#ifdef JEMALLOC_STATS 117 true 118#else 119 false 120#endif 121 ; 122static const bool config_tls = 123#ifdef JEMALLOC_TLS 124 true 125#else 126 false 127#endif 128 ; 129static const bool config_utrace = 130#ifdef JEMALLOC_UTRACE 131 true 132#else 133 false 134#endif 135 ; 136static const bool config_xmalloc = 137#ifdef JEMALLOC_XMALLOC 138 true 139#else 140 false 141#endif 142 ; 143static const bool config_cache_oblivious = 144#ifdef JEMALLOC_CACHE_OBLIVIOUS 145 true 146#else 147 false 148#endif 149 ; 150/* 151 * Undocumented, for jemalloc development use only at the moment. See the note 152 * in jemalloc/internal/log.h. 153 */ 154static const bool config_log = 155#ifdef JEMALLOC_LOG 156 true 157#else 158 false 159#endif 160 ; 161#ifdef JEMALLOC_HAVE_SCHED_GETCPU 162/* Currently percpu_arena depends on sched_getcpu. */ 163#define JEMALLOC_PERCPU_ARENA 164#endif 165static const bool have_percpu_arena = 166#ifdef JEMALLOC_PERCPU_ARENA 167 true 168#else 169 false 170#endif 171 ; 172/* 173 * Undocumented, and not recommended; the application should take full 174 * responsibility for tracking provenance. 175 */ 176static const bool force_ivsalloc = 177#ifdef JEMALLOC_FORCE_IVSALLOC 178 true 179#else 180 false 181#endif 182 ; 183static const bool have_background_thread = 184#ifdef JEMALLOC_BACKGROUND_THREAD 185 true 186#else 187 false 188#endif 189 ; 190 191#endif /* JEMALLOC_PREAMBLE_H */ 192