summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorViktor Dukhovni <ietf-dane@dukhovni.org>2020-10-05 01:43:26 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-05 00:50:23 -0500
commit17d5c51834d64f1762320b7abaa40c5686564f4d (patch)
tree0b7c681aa2968eb8611890868f69e57dde89ffd7 /libraries
parent81560981fd9af7ea21b2592c405e9e22af838aab (diff)
downloadhaskell-17d5c51834d64f1762320b7abaa40c5686564f4d.tar.gz
Naming, value types and tests for Addr# atomics
The atomic Exchange and CAS operations on integral types are updated to take and return more natural `Word#` rather than `Int#` values. These are bit-block not arithmetic operations, and the sign bit plays no special role. Standardises the names to `atomic<OpType><ValType>Addr#`, where `OpType` is one of `Cas` or `Exchange` and `ValType` is presently either `Word` or `Addr`. Eventually, variants for `Word32` and `Word64` can and should be added, once #11953 and related issues (e.g. #13825) are resolved. Adds tests for `Addr#` CAS that mirror existing tests for `MutableByteArray#`.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/GHC/Event/Internal.hs2
-rw-r--r--libraries/ghc-prim/changelog.md11
2 files changed, 9 insertions, 4 deletions
diff --git a/libraries/base/GHC/Event/Internal.hs b/libraries/base/GHC/Event/Internal.hs
index 0c3a98cdf9..32609b478b 100644
--- a/libraries/base/GHC/Event/Internal.hs
+++ b/libraries/base/GHC/Event/Internal.hs
@@ -109,5 +109,5 @@ throwErrnoIfMinus1NoRetry loc f = do
exchangePtr :: Ptr (Ptr a) -> Ptr a -> IO (Ptr a)
exchangePtr (Ptr dst) (Ptr val) =
IO $ \s ->
- case (atomicExchangeAddr# dst val s) of
+ case (atomicExchangeAddrAddr# dst val s) of
(# s2, old_val #) -> (# s2, Ptr old_val #)
diff --git a/libraries/ghc-prim/changelog.md b/libraries/ghc-prim/changelog.md
index e4fab631dc..e36ed57f4e 100644
--- a/libraries/ghc-prim/changelog.md
+++ b/libraries/ghc-prim/changelog.md
@@ -1,6 +1,6 @@
## 0.7.0 (edit as necessary)
-- Shipped with GHC 8.12.1
+- Shipped with GHC 9.0.1
- Add known-key `cstringLength#` to `GHC.CString`. This is just the
C function `strlen`, but a built-in rewrite rule allows GHC to
@@ -21,8 +21,13 @@
- Add primops for atomic exchange:
- atomicExchangeAddr# :: Addr# -> Addr# -> State# s -> (# State# s, Addr# #)
- atomicExchangeInt# :: Addr# -> Int# -> State# s -> (# State# s, Int# #)
+ atomicExchangeAddrAddr# :: Addr# -> Addr# -> State# s -> (# State# s, Addr# #)
+ atomicExchangeWordAddr# :: Addr# -> Word# -> State# s -> (# State# s, Word# #)
+
+- Add primops for atomic compare and swap at a given Addr#:
+
+ atomicCasAddrAddr# :: Addr# -> Addr# -> Addr# -> State# s -> (# State# s, Addr# #)
+ atomicCasWordAddr# :: Addr# -> Word# -> Word# -> State# s -> (# State# s, Word# #)
- Add an explicit fixity for `(~)` and `(~~)`: