diff options
Diffstat (limited to 'compiler/utils')
-rw-r--r-- | compiler/utils/FastString.hs | 8 | ||||
-rw-r--r-- | compiler/utils/IOEnv.hs | 7 | ||||
-rw-r--r-- | compiler/utils/Util.hs | 4 |
3 files changed, 8 insertions, 11 deletions
diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs index 9607d24823..40c3882b87 100644 --- a/compiler/utils/FastString.hs +++ b/compiler/utils/FastString.hs @@ -109,7 +109,7 @@ import ExtsCompat46 import System.IO import System.IO.Unsafe ( unsafePerformIO ) import Data.Data -import Data.IORef ( IORef, newIORef, readIORef, atomicModifyIORef ) +import Data.IORef ( IORef, newIORef, readIORef, atomicModifyIORef' ) import Data.Maybe ( isJust ) import Data.Char import Data.List ( elemIndex ) @@ -340,7 +340,7 @@ mkFastStringWith mk_fs !ptr !len = do n <- get_uid new_fs <- mk_fs n - atomicModifyIORef bucket $ \ls2 -> + atomicModifyIORef' bucket $ \ls2 -> -- Note [Double-checking the bucket] let delta_ls = case ls1 of [] -> ls2 @@ -357,7 +357,7 @@ mkFastStringWith mk_fs !ptr !len = do where !(FastStringTable uid _arr) = string_table - get_uid = atomicModifyIORef uid $ \n -> (n+1,n) + get_uid = atomicModifyIORef' uid $ \n -> (n+1,n) mkFastStringBytes :: Ptr Word8 -> Int -> FastString mkFastStringBytes !ptr !len = @@ -502,7 +502,7 @@ zEncodeFS fs@(FastString _ _ _ ref) = case m of Just zfs -> return zfs Nothing -> do - atomicModifyIORef ref $ \m' -> case m' of + atomicModifyIORef' ref $ \m' -> case m' of Nothing -> let zfs = mkZFastString (zEncodeString (unpackFS fs)) in (Just zfs, zfs) Just zfs -> (m', zfs) diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs index 46f6e467c1..fd98bad213 100644 --- a/compiler/utils/IOEnv.hs +++ b/compiler/utils/IOEnv.hs @@ -38,7 +38,7 @@ import Module import Panic import Data.IORef ( IORef, newIORef, readIORef, writeIORef, modifyIORef, - atomicModifyIORef ) + atomicModifyIORef, atomicModifyIORef' ) import Data.Typeable import System.IO.Unsafe ( unsafeInterleaveIO ) import System.IO ( fixIO ) @@ -194,10 +194,7 @@ atomicUpdMutVar var upd = liftIO (atomicModifyIORef var upd) -- | Strict variant of 'atomicUpdMutVar'. atomicUpdMutVar' :: IORef a -> (a -> (a, b)) -> IOEnv env b -atomicUpdMutVar' var upd = do - r <- atomicUpdMutVar var upd - _ <- liftIO . evaluate =<< readMutVar var - return r +atomicUpdMutVar' var upd = liftIO (atomicModifyIORef' var upd) ---------------------------------------------------------------------- -- Accessing the environment diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs index a1dacb45e5..ddcfe1117b 100644 --- a/compiler/utils/Util.hs +++ b/compiler/utils/Util.hs @@ -107,7 +107,7 @@ import Exception import Panic import Data.Data -import Data.IORef ( IORef, newIORef, atomicModifyIORef ) +import Data.IORef ( IORef, newIORef, atomicModifyIORef' ) import System.IO.Unsafe ( unsafePerformIO ) import Data.List hiding (group) @@ -808,7 +808,7 @@ global a = unsafePerformIO (newIORef a) consIORef :: IORef [a] -> a -> IO () consIORef var x = do - atomicModifyIORef var (\xs -> (x:xs,())) + atomicModifyIORef' var (\xs -> (x:xs,())) globalM :: IO a -> IORef a globalM ma = unsafePerformIO (ma >>= newIORef) |