Re-run import authored by Tobias Dammers's avatar Tobias Dammers
......@@ -6,16 +6,30 @@ Atomic operations on basic numeric (and pointer) types can be used as a foundati
## The primops
The new primops are modeled after those provided by C11, C++11, GCC, and LLVM.
```
atomicReadIntArray#::MutableByteArray# s ->Int#->State# s ->(#State# s,Int##)atomicWriteIntArray#::MutableByteArray# s ->Int#->Int#->State# s ->State# s
fetchAddIntArray#::MutableByteArray#-- Array to modify->Int#-- Index, in words->Int#-- Amount to add->State# s
->(#State# s,Int##)-- Value held previouslyfetchSubIntArray#::MutableByteArray#->Int#->Int#->State# s ->(#State# s,Int##)fetchOrIntArray#::MutableByteArray#->Int#->Int#->State# s ->(#State# s,Int##)fetchXorIntArray#::MutableByteArray#->Int#->Int#->State# s ->(#State# s,Int##)fetchAndIntArray#::MutableByteArray#->Int#->Int#->State# s ->(#State# s,Int##)casIntArray#::MutableByteArray# s ->Int#->Int#->Int#->State# s ->(#State# s,Int##)
atomicReadIntArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)
atomicWriteIntArray# :: MutableByteArray# s -> Int# -> Int# -> State# s -> State# s
fetchAddIntArray#
:: MutableByteArray# -- Array to modify
-> Int# -- Index, in words
-> Int# -- Amount to add
-> State# s
-> (# State# s, Int# #) -- Value held previously
fetchSubIntArray# :: MutableByteArray# -> Int# -> Int# -> State# s -> (# State# s, Int# #)
fetchOrIntArray# :: MutableByteArray# -> Int# -> Int# -> State# s -> (# State# s, Int# #)
fetchXorIntArray# :: MutableByteArray# -> Int# -> Int# -> State# s -> (# State# s, Int# #)
fetchAndIntArray# :: MutableByteArray# -> Int# -> Int# -> State# s -> (# State# s, Int# #)
casIntArray# :: MutableByteArray# s -> Int# -> Int# -> Int# -> State# s -> (#State# s, Int##)
```
`fetchAddIntArray#` and `casIntArray#` already exist (but are implemented as out-of-line primops.)
## Implementation
......
......