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