summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2015-12-29 17:36:54 -0500
committerKeith Bostic <keith.bostic@mongodb.com>2015-12-29 17:36:54 -0500
commit5e48f18f85e670783af5f52137e1d5d0c031d5a3 (patch)
tree28898cd80f9caad00741cc058f136fd0339ac4e2
parent9a11102882b40e799846e53f434b8e5a395f5bec (diff)
parentf48819c746516445595cee28f3e0b442eb1fdcf6 (diff)
downloadmongo-5e48f18f85e670783af5f52137e1d5d0c031d5a3.tar.gz
Merge pull request #2418 from wiredtiger/wt-2311-sparc
WT-2311 Support Sparc
-rw-r--r--dist/s_string.ok6
-rw-r--r--src/include/gcc.h19
-rw-r--r--src/support/hash_city.c6
3 files changed, 31 insertions, 0 deletions
diff --git a/dist/s_string.ok b/dist/s_string.ok
index ba36b2b85bf..27583402259 100644
--- a/dist/s_string.ok
+++ b/dist/s_string.ok
@@ -181,6 +181,7 @@ LevelDB
Levyx
Llqr
Llqrt
+LoadLoad
LockFile
Lookaside
Lookup
@@ -285,10 +286,13 @@ Spinlock
Spinlocks
Split's
Stoica
+StoreLoad
+StoreStore
TAILQ
TCMalloc
TODO
TORTIOUS
+TSO
TXN
TXNC
Timespec
@@ -303,6 +307,7 @@ ULINE
URI
URIs
UTF
+UltraSparc
Unbuffered
UnixLib
Unmap
@@ -415,6 +420,7 @@ bzip
calloc
cas
catfmt
+ccr
cd
centric
cfg
diff --git a/src/include/gcc.h b/src/include/gcc.h
index 92efe19d7b4..bb80f8b738b 100644
--- a/src/include/gcc.h
+++ b/src/include/gcc.h
@@ -211,6 +211,25 @@ __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
diff --git a/src/support/hash_city.c b/src/support/hash_city.c
index 9a4a6464f40..33f4113c004 100644
--- a/src/support/hash_city.c
+++ b/src/support/hash_city.c
@@ -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