Skip to content

Commit

Permalink
WT-2311 Support Sparc
Browse files Browse the repository at this point in the history
  • Loading branch information
markbenvenuto committed Dec 29, 2015
1 parent 9a11102 commit 7974068
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dist/s_string.ok
Expand Up @@ -181,6 +181,7 @@ LevelDB
Levyx
Llqr
Llqrt
LoadLoad
LockFile
Lookaside
Lookup
Expand Down Expand Up @@ -285,10 +286,13 @@ Spinlock
Spinlocks
Split's
Stoica
StoreLoad
StoreStore
TAILQ
TCMalloc
TODO
TORTIOUS
TSO
TXN
TXNC
Timespec
Expand All @@ -303,6 +307,7 @@ ULINE
URI
URIs
UTF
UltraSparc
Unbuffered
UnixLib
Unmap
Expand Down Expand Up @@ -415,6 +420,7 @@ bzip
calloc
cas
catfmt
ccr
cd
centric
cfg
Expand Down
20 changes: 20 additions & 0 deletions src/include/gcc.h
Expand Up @@ -211,6 +211,26 @@ __wt_atomic_cas_ptr(void *vp, void *old, void *new)
#define WT_READ_BARRIER() WT_FULL_BARRIER()
#define WT_WRITE_BARRIER() WT_FULL_BARRIER()

#elif defined(__sparc__)

#define WT_PAUSE() __asm__ volatile("rd %%ccr, %%g0" ::: "memory")

#define WT_FULL_BARRIER() do { \
__asm__ volatile ("membar #StoreLoad" ::: "memory"); \
} while (0)

/*
* On UltraSparc machines, TSO is used, and so there is no need for membar.
* READ_BARRIER = #LoadLoad, and WRITE_BARRIER = #StoreStore are noop.
*/
#define WT_READ_BARRIER() do { \
__asm__ volatile ("" ::: "memory"); \
} while (0)

#define WT_WRITE_BARRIER() do { \
__asm__ volatile ("" ::: "memory"); \
} while (0)

#else
#error "No write barrier implementation for this hardware"
#endif
6 changes: 6 additions & 0 deletions src/support/hash_city.c
Expand Up @@ -99,6 +99,12 @@ static uint32_t UNALIGNED_LOAD32(const char *p) {
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)

#elif defined(__sun)

#include <sys/byteorder.h>
#define bswap_32 BSWAP_32
#define bswap_64 BSWAP_64

#else
#include <byteswap.h>
#endif
Expand Down

0 comments on commit 7974068

Please sign in to comment.