atomic-primops 0.6.0.6 → 0.6.1
raw patch · 5 files changed
+19/−17 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Atomics: type Ticket a = Any a
- Data.Atomics.Internal: type Ticket a = Any a
+ Data.Atomics: data Ticket a
+ Data.Atomics.Internal: data Ticket a
- Data.Atomics.Internal: casIntArray# :: MutableByteArray# s -> Int# -> Int# -> Int# -> State# s -> (# State# s, Int# #)
+ Data.Atomics.Internal: casIntArray# :: MutableByteArray# d -> Int# -> Int# -> Int# -> State# d -> (# State# d, Int# #)
- Data.Atomics.Internal: fetchAddIntArray# :: MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, Int# #)
+ Data.Atomics.Internal: fetchAddIntArray# :: MutableByteArray# d -> Int# -> Int# -> State# d -> (# State# d, Int# #)
Files
- Data/Atomics.hs +1/−1
- Data/Atomics/Internal.hs +2/−4
- atomic-primops.cabal +2/−1
- testing/Test.hs +4/−8
- testing/test-atomic-primops.cabal +10/−3
Data/Atomics.hs view
@@ -241,7 +241,7 @@ writeBarrier :: IO () -- GHC 7.8 consistently exposes these symbols while linking:-#if MIN_VERSION_base(4,7,0) +#if MIN_VERSION_base(4,7,0) && !defined(_WIN32) && !defined(_WIN64) foreign import ccall unsafe "store_load_barrier" storeLoadBarrier :: IO ()
Data/Atomics/Internal.hs view
@@ -36,7 +36,7 @@ {-# NOINLINE casMutVarTicketed# #-} {-# NOINLINE casArrayTicketed# #-} #else-{-# INLINE casMutVarTicketed# #-}+-- {-# INLINE casMutVarTicketed# #-} {-# INLINE casArrayTicketed# #-} -- I *think* inlining may be ok here as long as casting happens on the arrow types: #endif@@ -67,14 +67,13 @@ -- on the other hand, is a first-class object that can be handled by the user, -- but will not have its pointer identity changed by compiler optimizations -- (but will of course, change addresses during garbage collection).-type Ticket a = Any a+newtype Ticket a = Ticket Any -- If we allow tickets to be a pointer type, then the garbage collector will update -- the pointer when the object moves. instance Show (Ticket a) where show _ = "<CAS_ticket>" - {-# NOINLINE ptrEq #-} ptrEq :: a -> a -> Bool ptrEq !x !y = I# (reallyUnsafePtrEquality# x y) == 1@@ -105,7 +104,6 @@ #else unsafeCoerce# casMutVar_TypeErased# #endif- -------------------------------------------------------------------------------- -- Type-erased versions that call the raw foreign primops:
atomic-primops.cabal view
@@ -1,5 +1,5 @@ Name: atomic-primops-Version: 0.6.0.6+Version: 0.6.1 License: BSD3 License-file: LICENSE Author: Ryan Newton@@ -33,6 +33,7 @@ -- 0.6 -- add atomicModifyIORefCAS, and bump due to prev bugfixes -- 0.6.0.1 -- minor ghc 7.8 fix -- 0.6.0.5 -- fix for GHC 7.8+-- 0.6.1 -- several bug fixes, mainly re: platform portability Synopsis: A safe approach to CAS and other atomic ops in Haskell.
testing/Test.hs view
@@ -1,15 +1,16 @@ {-# LANGUAGE MagicHash, UnboxedTuples, BangPatterns, ScopedTypeVariables, NamedFieldPuns, CPP #-} +module Test ( main,+ test_all_hammer_one ) where+ -- | This test has three different modes which can be toggled via the -- C preprocessor. Any subset of the three may be activated. import Control.Monad -- import Control.Monad.ST (stToIO) import Control.Exception (evaluate)-import Control.Concurrent.MVar import Data.IORef (modifyIORef') import Data.Int-import Data.Time.Clock import Data.Primitive.Array import Data.Word import qualified Data.Set as S@@ -19,16 +20,11 @@ import GHC.STRef import GHC.IORef import GHC.Stats (getGCStats, GCStats(..))-import GHC.IO (unsafePerformIO) import System.Random (randomIO, randomRIO) import Test.HUnit (Assertion, assertEqual, assertBool)-import Test.Framework (Test, defaultMain, testGroup)+import Test.Framework (defaultMain) import Test.Framework.Providers.HUnit (testCase) import System.Mem (performGC)-import System.Mem.StableName (makeStableName, hashStableName, StableName)-import System.Environment (getEnvironment)-import System.IO (stdout, stderr, hPutStrLn, hFlush)-import Debug.Trace (trace) ---------------------------------------- import Data.Atomics as A
testing/test-atomic-primops.cabal view
@@ -15,10 +15,11 @@ Description: Enable GHC threaded RTS. Default: True +-- The MAIN test suite: Test-Suite test-atomic-primops type: exitcode-stdio-1.0 main-is: Test.hs- ghc-options: -rtsopts+ ghc-options: -rtsopts -main-is Test.main if flag(opt) ghc-options: -O2 -funbox-strict-fields@@ -27,11 +28,9 @@ ghc-options: -rtsopts -with-rtsopts=-N4 -- Set it to always run with some parallelism.- build-depends: base, ghc-prim, primitive, containers, random, atomic-primops >= 0.6.0.5, -- For Testing: time, HUnit, test-framework, test-framework-hunit- -- Optional: Debugging generated code: -- ghc-options: -keep-tmp-files -dsuppress-module-prefixes -ddump-to-file -ddump-core-stats -ddump-simpl-stats -dcore-lint -dcmm-lint -- ghc-options: -ddump-ds -ddump-simpl -ddump-stg -ddump-asm -ddump-bcos -ddump-cmm -ddump-opt-cmm -ddump-inlinings@@ -75,3 +74,11 @@ -- Buildable: False -- } +Benchmark atomic-primops-MicroBench+ type: exitcode-stdio-1.0+ build-depends: base, ghc-prim, primitive, containers, random,+ atomic-primops >= 0.6.0.5, + deepseq >= 1.3, + time, HUnit, test-framework, test-framework-hunit+ build-depends: criterion >= 1.0+ main-is: MicroBench.hs