summaryrefslogtreecommitdiff
path: root/includes/stg/SMP.h
diff options
context:
space:
mode:
authorRyan Newton <rrnewton@gmail.com>2013-08-04 19:18:26 -0400
committerRyan Newton <rrnewton@gmail.com>2013-08-21 00:02:30 -0400
commit25ad01533aaaf1ccf69e1b7216e66de025b8131b (patch)
tree351e95dc5a87cee41f7a994bcc02f876977419f3 /includes/stg/SMP.h
parent8750d549d4d7aca3e397de3e217b7cca9e1c1d43 (diff)
downloadhaskell-25ad01533aaaf1ccf69e1b7216e66de025b8131b.tar.gz
Eliminate atomic_inc_by and instead medofiy atomic_inc.
Diffstat (limited to 'includes/stg/SMP.h')
-rw-r--r--includes/stg/SMP.h35
1 files changed, 8 insertions, 27 deletions
diff --git a/includes/stg/SMP.h b/includes/stg/SMP.h
index bdcaf55d3e..be28911fee 100644
--- a/includes/stg/SMP.h
+++ b/includes/stg/SMP.h
@@ -52,22 +52,13 @@ EXTERN_INLINE StgWord xchg(StgPtr p, StgWord w);
EXTERN_INLINE StgWord cas(StgVolatilePtr p, StgWord o, StgWord n);
/*
- * Atomic increment
- *
- * atomic_inc(p) {
- * return ++(*p);
- * }
- */
-EXTERN_INLINE StgWord atomic_inc(StgVolatilePtr p);
-
-/*
* Atomic addition by the provided quantity
*
- * atomic_inc_by(p, n) {
+ * atomic_inc(p, n) {
* return ((*p) += n);
* }
*/
-EXTERN_INLINE StgWord atomic_inc_by(StgVolatilePtr p, StgWord n);
+EXTERN_INLINE StgWord atomic_inc(StgVolatilePtr p, StgWord n);
/*
@@ -246,9 +237,10 @@ cas(StgVolatilePtr p, StgWord o, StgWord n)
#endif
}
-// RRN: Added to enable general fetch-and-add in Haskell code (fetchAddIntArray#).
+// RRN: Generalized to arbitrary increments to enable fetch-and-add in
+// Haskell code (fetchAddIntArray#).
EXTERN_INLINE StgWord
-atomic_inc_by(StgVolatilePtr p, StgWord incr)
+atomic_inc(StgVolatilePtr p, StgWord incr)
{
#if defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH)
StgWord r;
@@ -269,12 +261,6 @@ atomic_inc_by(StgVolatilePtr p, StgWord incr)
}
EXTERN_INLINE StgWord
-atomic_inc(StgVolatilePtr p)
-{
- return atomic_inc_by(p, 1);
-}
-
-EXTERN_INLINE StgWord
atomic_dec(StgVolatilePtr p)
{
#if defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH)
@@ -407,14 +393,9 @@ cas(StgVolatilePtr p, StgWord o, StgWord n)
return result;
}
-INLINE_HEADER StgWord
-atomic_inc(StgVolatilePtr p)
-{
- return ++(*p);
-}
-
-INLINE_HEADER StgWord
-atomic_inc_by(StgVolatilePtr p, StgWord incr)
+EXTERN_INLINE StgWord atomic_inc(StgVolatilePtr p, StgWord incr);
+EXTERN_INLINE StgWord
+atomic_inc(StgVolatilePtr p, StgWord incr)
{
return ((*p) += incr);
}