diff options
Diffstat (limited to 'rts')
-rw-r--r-- | rts/Linker.c | 1 | ||||
-rw-r--r-- | rts/PrimOps.cmm | 14 |
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; |