]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
Merge ^/head r279893 through r279984.
[FreeBSD/FreeBSD.git] / contrib / jemalloc / include / jemalloc / jemalloc_FreeBSD.h
1 /*
2  * Override settings that were generated in jemalloc_defs.h as necessary.
3  */
4
5 #undef JEMALLOC_OVERRIDE_VALLOC
6
7 #ifndef MALLOC_PRODUCTION
8 #define JEMALLOC_DEBUG
9 #endif
10
11 /*
12  * The following are architecture-dependent, so conditionally define them for
13  * each supported architecture.
14  */
15 #undef CPU_SPINWAIT
16 #undef JEMALLOC_TLS_MODEL
17 #undef STATIC_PAGE_SHIFT
18 #undef LG_SIZEOF_PTR
19 #undef LG_SIZEOF_INT
20 #undef LG_SIZEOF_LONG
21 #undef LG_SIZEOF_INTMAX_T
22
23 #ifdef __i386__
24 #  define LG_SIZEOF_PTR         2
25 #  define CPU_SPINWAIT          __asm__ volatile("pause")
26 #  define JEMALLOC_TLS_MODEL    __attribute__((tls_model("initial-exec")))
27 #endif
28 #ifdef __ia64__
29 #  define LG_SIZEOF_PTR         3
30 #endif
31 #ifdef __sparc64__
32 #  define LG_SIZEOF_PTR         3
33 #  define JEMALLOC_TLS_MODEL    __attribute__((tls_model("initial-exec")))
34 #endif
35 #ifdef __amd64__
36 #  define LG_SIZEOF_PTR         3
37 #  define CPU_SPINWAIT          __asm__ volatile("pause")
38 #  define JEMALLOC_TLS_MODEL    __attribute__((tls_model("initial-exec")))
39 #endif
40 #ifdef __arm__
41 #  define LG_SIZEOF_PTR         2
42 #endif
43 #ifdef __aarch64__
44 #  define LG_SIZEOF_PTR         3
45 #endif
46 #ifdef __mips__
47 #ifdef __mips_n64
48 #  define LG_SIZEOF_PTR         3
49 #else
50 #  define LG_SIZEOF_PTR         2
51 #endif
52 #endif
53 #ifdef __powerpc64__
54 #  define LG_SIZEOF_PTR         3
55 #elif defined(__powerpc__)
56 #  define LG_SIZEOF_PTR         2
57 #endif
58
59 #ifndef JEMALLOC_TLS_MODEL
60 #  define JEMALLOC_TLS_MODEL    /* Default. */
61 #endif
62
63 #define STATIC_PAGE_SHIFT       PAGE_SHIFT
64 #define LG_SIZEOF_INT           2
65 #define LG_SIZEOF_LONG          LG_SIZEOF_PTR
66 #define LG_SIZEOF_INTMAX_T      3
67
68 /* Disable lazy-lock machinery, mangle isthreaded, and adjust its type. */
69 #undef JEMALLOC_LAZY_LOCK
70 extern int __isthreaded;
71 #define isthreaded              ((bool)__isthreaded)
72
73 /* Mangle. */
74 #undef je_malloc
75 #undef je_calloc
76 #undef je_realloc
77 #undef je_free
78 #undef je_posix_memalign
79 #undef je_malloc_usable_size
80 #undef je_mallocx
81 #undef je_rallocx
82 #undef je_xallocx
83 #undef je_sallocx
84 #undef je_dallocx
85 #undef je_nallocx
86 #undef je_allocm
87 #undef je_rallocm
88 #undef je_sallocm
89 #undef je_dallocm
90 #undef je_nallocm
91 #define je_malloc               __malloc
92 #define je_calloc               __calloc
93 #define je_realloc              __realloc
94 #define je_free                 __free
95 #define je_posix_memalign       __posix_memalign
96 #define je_malloc_usable_size   __malloc_usable_size
97 #define je_mallocx              __mallocx
98 #define je_rallocx              __rallocx
99 #define je_xallocx              __xallocx
100 #define je_sallocx              __sallocx
101 #define je_dallocx              __dallocx
102 #define je_nallocx              __nallocx
103 #define je_allocm               __allocm
104 #define je_rallocm              __rallocm
105 #define je_sallocm              __sallocm
106 #define je_dallocm              __dallocm
107 #define je_nallocm              __nallocm
108 #define open                    _open
109 #define read                    _read
110 #define write                   _write
111 #define close                   _close
112 #define pthread_mutex_lock      _pthread_mutex_lock
113 #define pthread_mutex_unlock    _pthread_mutex_unlock
114
115 #ifdef JEMALLOC_C_
116 /*
117  * Define 'weak' symbols so that an application can have its own versions
118  * of malloc, calloc, realloc, free, et al.
119  */
120 __weak_reference(__malloc, malloc);
121 __weak_reference(__calloc, calloc);
122 __weak_reference(__realloc, realloc);
123 __weak_reference(__free, free);
124 __weak_reference(__posix_memalign, posix_memalign);
125 __weak_reference(__malloc_usable_size, malloc_usable_size);
126 __weak_reference(__mallocx, mallocx);
127 __weak_reference(__rallocx, rallocx);
128 __weak_reference(__xallocx, xallocx);
129 __weak_reference(__sallocx, sallocx);
130 __weak_reference(__dallocx, dallocx);
131 __weak_reference(__nallocx, nallocx);
132 __weak_reference(__allocm, allocm);
133 __weak_reference(__rallocm, rallocm);
134 __weak_reference(__sallocm, sallocm);
135 __weak_reference(__dallocm, dallocm);
136 __weak_reference(__nallocm, nallocm);
137 #endif