summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorRyan Newton <rrnewton@gmail.com>2013-08-03 20:19:46 -0400
committerRyan Newton <rrnewton@gmail.com>2013-08-21 00:02:30 -0400
commit8750d549d4d7aca3e397de3e217b7cca9e1c1d43 (patch)
tree85a3b4850f92ed117b5062dd0739dfe181e87c9f /rts
parentfa278381cca92c895ddf14e6a92f78e9786fec48 (diff)
downloadhaskell-8750d549d4d7aca3e397de3e217b7cca9e1c1d43.tar.gz
Add PrimOp fetchAddIntArray# plus supporting C function atomic_inc_by.
Diffstat (limited to 'rts')
-rw-r--r--rts/Linker.c1
-rw-r--r--rts/PrimOps.cmm14
2 files changed, 14 insertions, 1 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 0a0996a844..92194dfda8 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1148,6 +1148,7 @@ typedef struct _RtsSymbolVal {
SymI_HasProto(stg_newBCOzh) \
SymI_HasProto(stg_newByteArrayzh) \
SymI_HasProto(stg_casIntArrayzh) \
+ SymI_HasProto(stg_fetchAddIntArrayzh) \
SymI_HasProto_redirect(newCAF, newDynCAF) \
SymI_HasProto(stg_newMVarzh) \
SymI_HasProto(stg_newMutVarzh) \
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index cc22d2275f..b7177ca130 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -142,7 +142,6 @@ stg_newAlignedPinnedByteArrayzh ( W_ n, W_ alignment )
stg_casIntArrayzh( gcptr arr, W_ ind, W_ old, W_ new )
/* MutableByteArray# s -> Int# -> Int# -> Int# -> State# s -> (# State# s, Int# #) */
{
- W_ len;
gcptr p,h;
p = arr + SIZEOF_StgArrWords + WDS(ind);
@@ -151,6 +150,19 @@ stg_casIntArrayzh( gcptr arr, W_ ind, W_ old, W_ new )
return(h);
}
+
+stg_fetchAddIntArrayzh( gcptr arr, W_ ind, W_ incr )
+/* MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, Int# #) */
+{
+ gcptr p, h;
+
+ p = arr + SIZEOF_StgArrWords + WDS(ind);
+ (h) = ccall atomic_inc_by(p, incr);
+
+ return(h);
+}
+
+
stg_newArrayzh ( W_ n /* words */, gcptr init )
{
W_ words, size;