2 #ifdef JEMALLOC_H_TYPES
6 #ifdef JEMALLOC_H_STRUCTS
10 #ifdef JEMALLOC_H_EXTERNS
12 #define atomic_read_uint64(p) atomic_add_uint64(p, 0)
13 #define atomic_read_uint32(p) atomic_add_uint32(p, 0)
14 #define atomic_read_z(p) atomic_add_z(p, 0)
15 #define atomic_read_u(p) atomic_add_u(p, 0)
19 #ifdef JEMALLOC_H_INLINES
21 #ifndef JEMALLOC_ENABLE_INLINE
32 #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_ATOMIC_C_))
35 #if (LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
36 # ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
41 return (__sync_add_and_fetch(p, x));
48 return (__sync_sub_and_fetch(p, x));
50 #elif (defined(_MSC_VER))
55 return (InterlockedExchangeAdd64(p, x));
62 return (InterlockedExchangeAdd64(p, -((
int64_t)x)));
64 #elif (defined(JEMALLOC_OSATOMIC))
78 # elif (defined(__amd64__) || defined(__x86_64__))
105 # elif (defined(JEMALLOC_ATOMIC9))
114 assert(
sizeof(
uint64_t) ==
sizeof(
unsigned long));
116 return (atomic_fetchadd_long(p, (
unsigned long)x) + x);
123 assert(
sizeof(
uint64_t) ==
sizeof(
unsigned long));
125 return (atomic_fetchadd_long(p, (
unsigned long)(-(
long)x)) - x);
127 # elif (defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
132 return (__sync_add_and_fetch(p, x));
139 return (__sync_sub_and_fetch(p, x));
142 # error "Missing implementation for 64-bit atomic operations"
148 #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
153 return (__sync_add_and_fetch(p, x));
160 return (__sync_sub_and_fetch(p, x));
162 #elif (defined(_MSC_VER))
167 return (InterlockedExchangeAdd(p, x));
174 return (InterlockedExchangeAdd(p, -((
int32_t)x)));
176 #elif (defined(JEMALLOC_OSATOMIC))
190 #elif (defined(__i386__) || defined(__amd64__) || defined(__x86_64__))
196 "lock; xaddl %0, %1;"
197 :
"+r" (
x),
"=m" (*p)
210 "lock; xaddl %0, %1;"
211 :
"+r" (
x),
"=m" (*p)
217 #elif (defined(JEMALLOC_ATOMIC9))
222 return (atomic_fetchadd_32(p, x) + x);
231 #elif (defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
236 return (__sync_add_and_fetch(p, x));
243 return (__sync_sub_and_fetch(p, x));
246 # error "Missing implementation for 32-bit atomic operations"
255 #if (LG_SIZEOF_PTR == 3)
257 #elif (LG_SIZEOF_PTR == 2)
266 #if (LG_SIZEOF_PTR == 3)
269 #elif (LG_SIZEOF_PTR == 2)
281 #if (LG_SIZEOF_INT == 3)
283 #elif (LG_SIZEOF_INT == 2)
292 #if (LG_SIZEOF_INT == 3)
295 #elif (LG_SIZEOF_INT == 2)
#define JEMALLOC_INLINE
Definition: jemalloc_internal.h:259
#define atomic_sub_uint32
Definition: private_namespace.h:82
signed __int64 int64_t
Definition: stdint.h:89
#define atomic_add_u
Definition: private_namespace.h:77
#define atomic_add_uint32
Definition: private_namespace.h:78
unsigned int uint32_t
Definition: stdint.h:80
#define atomic_add_z
Definition: private_namespace.h:80
#define atomic_sub_uint64
Definition: private_namespace.h:83
unsigned __int64 uint64_t
Definition: stdint.h:90
#define atomic_sub_u
Definition: private_namespace.h:81
#define atomic_add_uint64
Definition: private_namespace.h:79
signed int int32_t
Definition: stdint.h:77
G3D::int16 x
Definition: Vector2int16.h:37
#define atomic_sub_z
Definition: private_namespace.h:84