packages feed

dejafu 1.11.0.2 → 1.11.0.3

raw patch · 4 files changed

+34/−13 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Test.DejaFu.SCT.Internal.DPOR: updateCRState :: MemType -> ThreadAction -> Map IORefId Bool -> Map IORefId Bool
+ Test.DejaFu.SCT.Internal.DPOR: numBuffered :: DepState -> IORefId -> Int
+ Test.DejaFu.SCT.Internal.DPOR: updateIOState :: MemType -> ThreadAction -> Map IORefId Int -> Map IORefId Int
- Test.DejaFu.SCT.Internal.DPOR: DepState :: Map IORefId Bool -> Set MVarId -> Map ThreadId MaskingState -> DepState
+ Test.DejaFu.SCT.Internal.DPOR: DepState :: Map IORefId Int -> Set MVarId -> Map ThreadId MaskingState -> DepState
- Test.DejaFu.SCT.Internal.DPOR: [depIOState] :: DepState -> Map IORefId Bool
+ Test.DejaFu.SCT.Internal.DPOR: [depIOState] :: DepState -> Map IORefId Int

Files

CHANGELOG.rst view
@@ -7,6 +7,19 @@ .. _PVP: https://pvp.haskell.org/  +1.11.0.3 (2018-07-15)+---------------------++* Git: :tag:`dejafu-1.11.0.3`+* Hackage: :hackage:`dejafu-1.11.0.3`++Fixed+~~~~~++* (:issue:`275`) In trace simplification, only remove a commit if+  there are no other buffered writes for that same `IORef`.++ 1.11.0.2 (2018-07-08) --------------------- 
Test/DejaFu/SCT/Internal.hs view
@@ -244,8 +244,8 @@ dropCommits :: Bool -> MemType -> [(ThreadId, ThreadAction)] -> [(ThreadId, ThreadAction)] dropCommits _ SequentialConsistency = id dropCommits safeIO memtype = go initialDepState where-  go ds (t1@(tid1, ta1@(CommitIORef _ _)):t2@(tid2, ta2):trc)-    | isBarrier (simplifyAction ta2) = go ds (t2:trc)+  go ds (t1@(tid1, ta1@(CommitIORef _ iorefid)):t2@(tid2, ta2):trc)+    | isBarrier (simplifyAction ta2) && numBuffered ds iorefid == 1 = go ds (t2:trc)     | independent safeIO ds tid1 ta1 tid2 ta2 = t2 : go (updateDepState memtype ds tid2 ta2) (t1:trc)   go ds (t@(tid,ta):trc) = t : go (updateDepState memtype ds tid ta) trc   go _ [] = []
Test/DejaFu/SCT/Internal/DPOR.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE LambdaCase #-} {-# LANGUAGE ViewPatterns #-}  -- |@@ -9,7 +10,7 @@ -- License     : MIT -- Maintainer  : Michael Walker <mike@barrucadu.co.uk> -- Stability   : experimental--- Portability : DeriveAnyClass, DeriveGeneric, FlexibleContexts, ViewPatterns+-- Portability : DeriveAnyClass, DeriveGeneric, FlexibleContexts, LambdaCase, ViewPatterns -- -- Internal types and functions for SCT via dynamic partial-order -- reduction.  This module is NOT considered to form part of the@@ -680,7 +681,7 @@ -- ** Dependency function state  data DepState = DepState-  { depIOState :: Map IORefId Bool+  { depIOState :: Map IORefId Int   -- ^ Keep track of which @IORef@s have buffered writes.   , depMVState :: Set MVarId   -- ^ Keep track of which @MVar@s are full.@@ -705,18 +706,21 @@ -- happened. updateDepState :: MemType -> DepState -> ThreadId -> ThreadAction -> DepState updateDepState memtype depstate tid act = DepState-  { depIOState   = updateCRState memtype act $ depIOState   depstate+  { depIOState   = updateIOState memtype act $ depIOState   depstate   , depMVState   = updateMVState         act $ depMVState   depstate   , depMaskState = updateMaskState tid   act $ depMaskState depstate   }  -- | Update the @IORef@ buffer state with the action that has just -- happened.-updateCRState :: MemType -> ThreadAction -> Map IORefId Bool -> Map IORefId Bool-updateCRState SequentialConsistency _ = const M.empty-updateCRState _ (CommitIORef _ r) = M.delete r-updateCRState _ (WriteIORef    r) = M.insert r True-updateCRState _ ta+updateIOState :: MemType -> ThreadAction -> Map IORefId Int -> Map IORefId Int+updateIOState SequentialConsistency _ = const M.empty+updateIOState _ (CommitIORef _ r) = (`M.alter` r) $ \case+  Just 1  -> Nothing+  Just n  -> Just (n-1)+  Nothing -> Nothing+updateIOState _ (WriteIORef    r) = M.insertWith (+) r 1+updateIOState _ ta   | isBarrier $ simplifyAction ta = const M.empty   | otherwise = id @@ -745,7 +749,11 @@  -- | Check if a @IORef@ has a buffered write pending. isBuffered :: DepState -> IORefId -> Bool-isBuffered depstate r = M.findWithDefault False r (depIOState depstate)+isBuffered depstate r = numBuffered depstate r /= 0++-- | Check how many buffered writes an @IORef@ has.+numBuffered :: DepState -> IORefId -> Int+numBuffered depstate r = M.findWithDefault 0 r (depIOState depstate)  -- | Check if an @MVar@ is full. isFull :: DepState -> MVarId -> Bool
dejafu.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                dejafu-version:             1.11.0.2+version:             1.11.0.3 synopsis:            A library for unit-testing concurrent programs.  description:@@ -33,7 +33,7 @@ source-repository this   type:     git   location: https://github.com/barrucadu/dejafu.git-  tag:      dejafu-1.11.0.2+  tag:      dejafu-1.11.0.3  library   exposed-modules:     Test.DejaFu