diff options
author | Ryan Newton <rrnewton@gmail.com> | 2013-08-03 20:19:46 -0400 |
---|---|---|
committer | Ryan Newton <rrnewton@gmail.com> | 2013-08-21 00:02:30 -0400 |
commit | 8750d549d4d7aca3e397de3e217b7cca9e1c1d43 (patch) | |
tree | 85a3b4850f92ed117b5062dd0739dfe181e87c9f /rts/PrimOps.cmm | |
parent | fa278381cca92c895ddf14e6a92f78e9786fec48 (diff) | |
download | haskell-8750d549d4d7aca3e397de3e217b7cca9e1c1d43.tar.gz |
Add PrimOp fetchAddIntArray# plus supporting C function atomic_inc_by.
Diffstat (limited to 'rts/PrimOps.cmm')
-rw-r--r-- | rts/PrimOps.cmm | 14 |
1 files changed, 13 insertions, 1 deletions
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; |