diff options
Diffstat (limited to 'ghc/GHCi/Leak.hs')
-rw-r--r-- | ghc/GHCi/Leak.hs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/ghc/GHCi/Leak.hs b/ghc/GHCi/Leak.hs index 6d1bc58265..aec1ab544e 100644 --- a/ghc/GHCi/Leak.hs +++ b/ghc/GHCi/Leak.hs @@ -10,15 +10,15 @@ import Data.Bits import DynFlags (settings, sTargetPlatform) import Foreign.Ptr (ptrToIntPtr, intPtrToPtr) import GHC -import GHC.Exts (anyToAddr#, State#, RealWorld) +import GHC.Exts (anyToAddr#) import GHC.Ptr (Ptr (..)) +import GHC.Types (IO (..)) import HscTypes import Outputable import Platform (target32Bit) import System.Mem import System.Mem.Weak import UniqDFM -import Unsafe.Coerce (unsafeCoerce) -- Checking for space leaks in GHCi. See #15111, and the -- -fghci-leak-check flag. @@ -63,15 +63,11 @@ checkLeakIndicators dflags (LeakIndicators leakmods) = do report :: String -> Maybe a -> IO () report _ Nothing = return () report msg (Just a) = do - addr <- mkIO (\s -> case anyToAddr# a s of - (# s', addr #) -> (# s', Ptr addr #)) :: IO (Ptr ()) + addr <- IO (\s -> case anyToAddr# a s of + (# s', addr #) -> (# s', Ptr addr #)) :: IO (Ptr ()) putStrLn ("-fghci-leak-check: " ++ msg ++ " is still alive at " ++ show (maskTagBits addr)) - -- We don't have access to ghc-prim here so using `unsafeCoerce` for `IO` - mkIO :: (State# RealWorld -> (# State# RealWorld, a #)) -> IO a - mkIO = unsafeCoerce - tagBits | target32Bit (sTargetPlatform (settings dflags)) = 2 | otherwise = 3 |