summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2014-07-02 08:54:35 -0500
committerAustin Seipp <austin@well-typed.com>2014-07-02 08:54:35 -0500
commit34bae1f737e1492c152ccaafd457697b621c606b (patch)
treefc37da3a8961a02ff19684971e66fe5ad310df5f /includes
parentdd3a7245d4d557b9e19bfa53b0fb2733c6fd4f88 (diff)
downloadhaskell-34bae1f737e1492c152ccaafd457697b621c606b.tar.gz
includes/stg/SMP.h: use 'NOSMP' instead of never defined 'WITHSMP' (Trac #8789)
Summary: git history does not contain state where 'WITHSMP' macro was ever defined. It should have always been '!NOSMP'. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: build tested Reviewers: austin, simonmar Reviewed By: austin, simonmar Subscribers: simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D33
Diffstat (limited to 'includes')
-rw-r--r--includes/stg/SMP.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/includes/stg/SMP.h b/includes/stg/SMP.h
index 01663dd86e..00608c707c 100644
--- a/includes/stg/SMP.h
+++ b/includes/stg/SMP.h
@@ -107,7 +107,10 @@ EXTERN_INLINE StgWord
xchg(StgPtr p, StgWord w)
{
StgWord result;
-#if i386_HOST_ARCH || x86_64_HOST_ARCH
+#if defined(NOSMP)
+ result = *p;
+ *p = w;
+#elif i386_HOST_ARCH || x86_64_HOST_ARCH
result = w;
__asm__ __volatile__ (
// NB: the xchg instruction is implicitly locked, so we do not
@@ -154,9 +157,6 @@ xchg(StgPtr p, StgWord w)
: "r" (w), "r" (p)
: "memory"
);
-#elif !defined(WITHSMP)
- result = *p;
- *p = w;
#else
#error xchg() unimplemented on this architecture
#endif
@@ -170,7 +170,14 @@ xchg(StgPtr p, StgWord w)
EXTERN_INLINE StgWord
cas(StgVolatilePtr p, StgWord o, StgWord n)
{
-#if i386_HOST_ARCH || x86_64_HOST_ARCH
+#if defined(NOSMP)
+ StgWord result;
+ result = *p;
+ if (result == o) {
+ *p = n;
+ }
+ return result;
+#elif i386_HOST_ARCH || x86_64_HOST_ARCH
__asm__ __volatile__ (
"lock\ncmpxchg %3,%1"
:"=a"(o), "+m" (*(volatile unsigned int *)p)
@@ -225,13 +232,6 @@ cas(StgVolatilePtr p, StgWord o, StgWord n)
: "cc","memory");
return result;
-#elif !defined(WITHSMP)
- StgWord result;
- result = *p;
- if (result == o) {
- *p = n;
- }
- return result;
#else
#error cas() unimplemented on this architecture
#endif
@@ -302,7 +302,9 @@ busy_wait_nop(void)
*/
EXTERN_INLINE void
write_barrier(void) {
-#if i386_HOST_ARCH || x86_64_HOST_ARCH
+#if defined(NOSMP)
+ return;
+#elif i386_HOST_ARCH || x86_64_HOST_ARCH
__asm__ __volatile__ ("" : : : "memory");
#elif powerpc_HOST_ARCH
__asm__ __volatile__ ("lwsync" : : : "memory");
@@ -313,8 +315,6 @@ write_barrier(void) {
__asm__ __volatile__ ("" : : : "memory");
#elif arm_HOST_ARCH && !defined(arm_HOST_ARCH_PRE_ARMv7)
__asm__ __volatile__ ("dmb st" : : : "memory");
-#elif !defined(WITHSMP)
- return;
#else
#error memory barriers unimplemented on this architecture
#endif
@@ -322,7 +322,9 @@ write_barrier(void) {
EXTERN_INLINE void
store_load_barrier(void) {
-#if i386_HOST_ARCH
+#if defined(NOSMP)
+ return;
+#elif i386_HOST_ARCH
__asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory");
#elif x86_64_HOST_ARCH
__asm__ __volatile__ ("lock; addq $0,0(%%rsp)" : : : "memory");
@@ -332,8 +334,6 @@ store_load_barrier(void) {
__asm__ __volatile__ ("membar #StoreLoad" : : : "memory");
#elif arm_HOST_ARCH && !defined(arm_HOST_ARCH_PRE_ARMv7)
__asm__ __volatile__ ("dmb" : : : "memory");
-#elif !defined(WITHSMP)
- return;
#else
#error memory barriers unimplemented on this architecture
#endif
@@ -341,7 +341,9 @@ store_load_barrier(void) {
EXTERN_INLINE void
load_load_barrier(void) {
-#if i386_HOST_ARCH
+#if defined(NOSMP)
+ return;
+#elif i386_HOST_ARCH
__asm__ __volatile__ ("" : : : "memory");
#elif x86_64_HOST_ARCH
__asm__ __volatile__ ("" : : : "memory");
@@ -352,8 +354,6 @@ load_load_barrier(void) {
__asm__ __volatile__ ("" : : : "memory");
#elif arm_HOST_ARCH && !defined(arm_HOST_ARCH_PRE_ARMv7)
__asm__ __volatile__ ("dmb" : : : "memory");
-#elif !defined(WITHSMP)
- return;
#else
#error memory barriers unimplemented on this architecture
#endif