summaryrefslogtreecommitdiffstats
path: root/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
blob: 9c97a138007b69c044e542168df340fc89d1cdc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * Override settings that were generated in jemalloc_defs.h as necessary.
 */

#undef JEMALLOC_OVERRIDE_VALLOC

#ifndef MALLOC_PRODUCTION
#define	JEMALLOC_DEBUG
#endif

/*
 * The following are architecture-dependent, so conditionally define them for
 * each supported architecture.
 */
#undef CPU_SPINWAIT
#undef JEMALLOC_TLS_MODEL
#undef STATIC_PAGE_SHIFT
#undef LG_SIZEOF_PTR
#undef LG_SIZEOF_INT
#undef LG_SIZEOF_LONG
#undef LG_SIZEOF_INTMAX_T

#ifdef __i386__
#  define LG_SIZEOF_PTR		2
#  define CPU_SPINWAIT		__asm__ volatile("pause")
#  define JEMALLOC_TLS_MODEL	__attribute__((tls_model("initial-exec")))
#endif
#ifdef __ia64__
#  define LG_SIZEOF_PTR		3
#endif
#ifdef __sparc64__
#  define LG_SIZEOF_PTR		3
#  define JEMALLOC_TLS_MODEL	__attribute__((tls_model("initial-exec")))
#endif
#ifdef __amd64__
#  define LG_SIZEOF_PTR		3
#  define CPU_SPINWAIT		__asm__ volatile("pause")
#  define JEMALLOC_TLS_MODEL	__attribute__((tls_model("initial-exec")))
#endif
#ifdef __arm__
#  define LG_SIZEOF_PTR		2
#endif
#ifdef __mips__
#ifdef __mips_n64
#  define LG_SIZEOF_PTR		3
#else
#  define LG_SIZEOF_PTR		2
#endif
#endif
#ifdef __powerpc64__
#  define LG_SIZEOF_PTR		3
#elif defined(__powerpc__)
#  define LG_SIZEOF_PTR		2
#endif

#ifndef JEMALLOC_TLS_MODEL
#  define JEMALLOC_TLS_MODEL	/* Default. */
#endif

#define	STATIC_PAGE_SHIFT	PAGE_SHIFT
#define	LG_SIZEOF_INT		2
#define	LG_SIZEOF_LONG		LG_SIZEOF_PTR
#define	LG_SIZEOF_INTMAX_T	3

/* Disable lazy-lock machinery, mangle isthreaded, and adjust its type. */
#undef JEMALLOC_LAZY_LOCK
extern int __isthreaded;
#define	isthreaded		((bool)__isthreaded)

/* Mangle. */
#define	open			_open
#define	read			_read
#define	write			_write
#define	close			_close
#define	pthread_mutex_lock	_pthread_mutex_lock
#define	pthread_mutex_unlock	_pthread_mutex_unlock
OpenPOWER on IntegriCloud