Fix atomicread/write operations
authorPeter Trommler <ptrommler@acm.org>
Thu, 2 Nov 2017 17:34:41 +0000 (13:34 -0400)
committerBen Gamari <ben@smart-cactus.org>
Thu, 2 Nov 2017 18:32:57 +0000 (14:32 -0400)
commitbd765f4b1332b3d2a7908de3f9ff1d50da0e0b1d
tree7e2c829a2a4eeb046f0268deeb92950dcad44c6d
parentcbd6a4d05bf382641b108347218dfd534dc57558
Fix atomicread/write operations

In `libraries/ghc-prim/cbits/atomic.c` no barriers were issued for
atomic read and write operations. Starting with gcc 4.7 compiler
intrinsics are offered. The atomic intrinisics are also available in
clang. Use these to implement `hs_atomicread*` and `hs_atomicwrite`.

Test Plan: validate on OSX and Windows

Reviewers: austin, bgamari, simonmar, hvr, erikd, dfeuer

Reviewed By: bgamari

Subscribers: dfeuer, rwbarton, thomie

GHC Trac Issues: #14244

Differential Revision: https://phabricator.haskell.org/D4009
libraries/ghc-prim/cbits/atomic.c