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