Skip to content

Commit 7b8e74f

Browse files
committed
Revert "Define 64-bits atomics unconditionally"
This reverts commit af33e9a. This resolves jemalloc#495.
1 parent 5d6cb6e commit 7b8e74f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

include/jemalloc/internal/atomic.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ void atomic_write_u(unsigned *p, unsigned x);
6666
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_ATOMIC_C_))
6767
/******************************************************************************/
6868
/* 64-bit operations. */
69-
#if (defined(__amd64__) || defined(__x86_64__))
69+
#if (LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
70+
# if (defined(__amd64__) || defined(__x86_64__))
7071
JEMALLOC_INLINE uint64_t
7172
atomic_add_uint64(uint64_t *p, uint64_t x)
7273
{
@@ -124,7 +125,7 @@ atomic_write_uint64(uint64_t *p, uint64_t x)
124125
: "memory" /* Clobbers. */
125126
);
126127
}
127-
#elif (defined(JEMALLOC_C11ATOMICS))
128+
# elif (defined(JEMALLOC_C11ATOMICS))
128129
JEMALLOC_INLINE uint64_t
129130
atomic_add_uint64(uint64_t *p, uint64_t x)
130131
{
@@ -152,7 +153,7 @@ atomic_write_uint64(uint64_t *p, uint64_t x)
152153
volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
153154
atomic_store(a, x);
154155
}
155-
#elif (defined(JEMALLOC_ATOMIC9))
156+
# elif (defined(JEMALLOC_ATOMIC9))
156157
JEMALLOC_INLINE uint64_t
157158
atomic_add_uint64(uint64_t *p, uint64_t x)
158159
{
@@ -192,7 +193,7 @@ atomic_write_uint64(uint64_t *p, uint64_t x)
192193

193194
atomic_store_rel_long(p, x);
194195
}
195-
#elif (defined(JEMALLOC_OSATOMIC))
196+
# elif (defined(JEMALLOC_OSATOMIC))
196197
JEMALLOC_INLINE uint64_t
197198
atomic_add_uint64(uint64_t *p, uint64_t x)
198199
{
@@ -224,7 +225,7 @@ atomic_write_uint64(uint64_t *p, uint64_t x)
224225
o = atomic_read_uint64(p);
225226
} while (atomic_cas_uint64(p, o, x));
226227
}
227-
#elif (defined(_MSC_VER))
228+
# elif (defined(_MSC_VER))
228229
JEMALLOC_INLINE uint64_t
229230
atomic_add_uint64(uint64_t *p, uint64_t x)
230231
{
@@ -254,7 +255,7 @@ atomic_write_uint64(uint64_t *p, uint64_t x)
254255

255256
InterlockedExchange64(p, x);
256257
}
257-
#elif (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || \
258+
# elif (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || \
258259
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
259260
JEMALLOC_INLINE uint64_t
260261
atomic_add_uint64(uint64_t *p, uint64_t x)
@@ -283,8 +284,9 @@ atomic_write_uint64(uint64_t *p, uint64_t x)
283284

284285
__sync_lock_test_and_set(p, x);
285286
}
286-
#else
287-
# error "Missing implementation for 64-bit atomic operations"
287+
# else
288+
# error "Missing implementation for 64-bit atomic operations"
289+
# endif
288290
#endif
289291

290292
/******************************************************************************/

0 commit comments

Comments
 (0)