Commit 437ff69e authored by Ömer Sinan Ağacan's avatar Ömer Sinan Ağacan
Browse files

Add ghc-prim as dependency to ghc-bin

Remove unsafeCoerce introduced by a54c94f0

Reviewers: simonmar, bgamari

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4901
parent a54c94f0
...@@ -10,15 +10,15 @@ import Data.Bits ...@@ -10,15 +10,15 @@ import Data.Bits
import DynFlags (settings, sTargetPlatform) import DynFlags (settings, sTargetPlatform)
import Foreign.Ptr (ptrToIntPtr, intPtrToPtr) import Foreign.Ptr (ptrToIntPtr, intPtrToPtr)
import GHC import GHC
import GHC.Exts (anyToAddr#, State#, RealWorld) import GHC.Exts (anyToAddr#)
import GHC.Ptr (Ptr (..)) import GHC.Ptr (Ptr (..))
import GHC.Types (IO (..))
import HscTypes import HscTypes
import Outputable import Outputable
import Platform (target32Bit) import Platform (target32Bit)
import System.Mem import System.Mem
import System.Mem.Weak import System.Mem.Weak
import UniqDFM import UniqDFM
import Unsafe.Coerce (unsafeCoerce)
-- Checking for space leaks in GHCi. See #15111, and the -- Checking for space leaks in GHCi. See #15111, and the
-- -fghci-leak-check flag. -- -fghci-leak-check flag.
...@@ -63,15 +63,11 @@ checkLeakIndicators dflags (LeakIndicators leakmods) = do ...@@ -63,15 +63,11 @@ checkLeakIndicators dflags (LeakIndicators leakmods) = do
report :: String -> Maybe a -> IO () report :: String -> Maybe a -> IO ()
report _ Nothing = return () report _ Nothing = return ()
report msg (Just a) = do report msg (Just a) = do
addr <- mkIO (\s -> case anyToAddr# a s of addr <- IO (\s -> case anyToAddr# a s of
(# s', addr #) -> (# s', Ptr addr #)) :: IO (Ptr ()) (# s', addr #) -> (# s', Ptr addr #)) :: IO (Ptr ())
putStrLn ("-fghci-leak-check: " ++ msg ++ " is still alive at " ++ putStrLn ("-fghci-leak-check: " ++ msg ++ " is still alive at " ++
show (maskTagBits addr)) 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 tagBits
| target32Bit (sTargetPlatform (settings dflags)) = 2 | target32Bit (sTargetPlatform (settings dflags)) = 2
| otherwise = 3 | otherwise = 3
......
...@@ -54,6 +54,7 @@ Executable ghc ...@@ -54,6 +54,7 @@ Executable ghc
Build-depends: Build-depends:
containers >= 0.5 && < 0.7, containers >= 0.5 && < 0.7,
deepseq == 1.4.*, deepseq == 1.4.*,
ghc-prim == 0.5.*,
ghci == @ProjectVersionMunged@, ghci == @ProjectVersionMunged@,
haskeline == 0.7.*, haskeline == 0.7.*,
time == 1.8.*, time == 1.8.*,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment