1#include <stdlib.h> 2#include <stdbool.h> 3#include <stdint.h> 4#include <limits.h> 5#include <strings.h> 6 7#define JEMALLOC_VERSION "@jemalloc_version@" 8#define JEMALLOC_VERSION_MAJOR @jemalloc_version_major@ 9#define JEMALLOC_VERSION_MINOR @jemalloc_version_minor@ 10#define JEMALLOC_VERSION_BUGFIX @jemalloc_version_bugfix@ 11#define JEMALLOC_VERSION_NREV @jemalloc_version_nrev@ 12#define JEMALLOC_VERSION_GID "@jemalloc_version_gid@" 13 14# define MALLOCX_LG_ALIGN(la) (la) 15# if LG_SIZEOF_PTR == 2 16# define MALLOCX_ALIGN(a) (ffs(a)-1) 17# else 18# define MALLOCX_ALIGN(a) \ 19 ((a < (size_t)INT_MAX) ? ffs(a)-1 : ffs(a>>32)+31) 20# endif 21# define MALLOCX_ZERO ((int)0x40) 22/* 23 * Bias tcache index bits so that 0 encodes "automatic tcache management", and 1 24 * encodes MALLOCX_TCACHE_NONE. 25 */ 26# define MALLOCX_TCACHE(tc) ((int)(((tc)+2) << 8)) 27# define MALLOCX_TCACHE_NONE MALLOCX_TCACHE(-1) 28/* 29 * Bias arena index bits so that 0 encodes "use an automatically chosen arena". 30 */ 31# define MALLOCX_ARENA(a) ((int)(((a)+1) << 20)) 32 33#if defined(__cplusplus) && defined(JEMALLOC_USE_CXX_THROW) 34# define JEMALLOC_CXX_THROW throw() 35#else 36# define JEMALLOC_CXX_THROW 37#endif 38 39#ifdef JEMALLOC_HAVE_ATTR 40# define JEMALLOC_ATTR(s) __attribute__((s)) 41# define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s)) 42# ifdef JEMALLOC_HAVE_ATTR_ALLOC_SIZE 43# define JEMALLOC_ALLOC_SIZE(s) JEMALLOC_ATTR(alloc_size(s)) 44# define JEMALLOC_ALLOC_SIZE2(s1, s2) JEMALLOC_ATTR(alloc_size(s1, s2)) 45# else 46# define JEMALLOC_ALLOC_SIZE(s) 47# define JEMALLOC_ALLOC_SIZE2(s1, s2) 48# endif 49# ifndef JEMALLOC_EXPORT 50# define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default")) 51# endif 52# ifdef JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF 53# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(gnu_printf, s, i)) 54# elif defined(JEMALLOC_HAVE_ATTR_FORMAT_PRINTF) 55# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(printf, s, i)) 56# else 57# define JEMALLOC_FORMAT_PRINTF(s, i) 58# endif 59# define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline) 60# define JEMALLOC_NOTHROW JEMALLOC_ATTR(nothrow) 61# define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s)) 62# define JEMALLOC_RESTRICT_RETURN 63# define JEMALLOC_ALLOCATOR 64#elif _MSC_VER 65# define JEMALLOC_ATTR(s) 66# define JEMALLOC_ALIGNED(s) __declspec(align(s)) 67# define JEMALLOC_ALLOC_SIZE(s) 68# define JEMALLOC_ALLOC_SIZE2(s1, s2) 69# ifndef JEMALLOC_EXPORT 70# ifdef DLLEXPORT 71# define JEMALLOC_EXPORT __declspec(dllexport) 72# else 73# define JEMALLOC_EXPORT __declspec(dllimport) 74# endif 75# endif 76# define JEMALLOC_FORMAT_PRINTF(s, i) 77# define JEMALLOC_NOINLINE __declspec(noinline) 78# ifdef __cplusplus 79# define JEMALLOC_NOTHROW __declspec(nothrow) 80# else 81# define JEMALLOC_NOTHROW 82# endif 83# define JEMALLOC_SECTION(s) __declspec(allocate(s)) 84# define JEMALLOC_RESTRICT_RETURN __declspec(restrict) 85# if _MSC_VER >= 1900 && !defined(__EDG__) 86# define JEMALLOC_ALLOCATOR __declspec(allocator) 87# else 88# define JEMALLOC_ALLOCATOR 89# endif 90#else 91# define JEMALLOC_ATTR(s) 92# define JEMALLOC_ALIGNED(s) 93# define JEMALLOC_ALLOC_SIZE(s) 94# define JEMALLOC_ALLOC_SIZE2(s1, s2) 95# define JEMALLOC_EXPORT 96# define JEMALLOC_FORMAT_PRINTF(s, i) 97# define JEMALLOC_NOINLINE 98# define JEMALLOC_NOTHROW 99# define JEMALLOC_SECTION(s) 100# define JEMALLOC_RESTRICT_RETURN 101# define JEMALLOC_ALLOCATOR 102#endif 103