Open
Description
hs_atomic_read
and hs_atomic_write
aren't atomic at all on machines without strong memory models (total read and store ordering). To see an example of the kind of havoc this bad assumption can cause, see this (thankfully now fixed) GHC issue https://gitlab.haskell.org/ghc/ghc/-/issues/15449
Here's the aarch64 code that GCC 8.2 yields for these functions: https://godbolt.org/z/giVdtx No barriers or acq/rel lda/sta emitted...
I'm curious why C functions are used for these atomic operations at all. Are these functions really that much faster than atomicModifyIORef
?
Metadata
Metadata
Assignees
Labels
No labels