diff options
Diffstat (limited to 'compiler/GHC.hs')
-rw-r--r-- | compiler/GHC.hs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/compiler/GHC.hs b/compiler/GHC.hs index 308ea08780..3411eb87ca 100644 --- a/compiler/GHC.hs +++ b/compiler/GHC.hs @@ -3,6 +3,7 @@ {-# LANGUAGE TupleSections, NamedFieldPuns #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE TypeFamilies #-} +{-# OPTIONS_GHC -ddump-stg-final -ddump-to-file #-} -- ----------------------------------------------------------------------------- -- @@ -357,6 +358,7 @@ import GHC.Utils.Monad import GHC.Utils.Misc import GHC.Utils.Outputable import GHC.Utils.Panic +import GHC.Utils.Panic.Plain import GHC.Utils.Logger import GHC.Utils.Fingerprint @@ -557,7 +559,16 @@ withCleanupSession ghc = ghc `MC.finally` cleanup -- <http://hackage.haskell.org/package/ghc-paths>. initGhcMonad :: GhcMonad m => Maybe FilePath -> m () -initGhcMonad mb_top_dir = setSession =<< liftIO (initHscEnv mb_top_dir) +initGhcMonad mb_top_dir = setSession =<< liftIO ( do + -- The call to c_keepCAFsForGHCi must not be optimized away. Even in non-debug builds. + -- So we can't use assertM here. + -- See Note [keepCAFsForGHCi] in keepCAFsForGHCi.c for details about why. +-- #if MIN_VERSION_GLASGOW_HASKELL(9,7,0,0) + !keep_cafs <- c_keepCAFsForGHCi + massert keep_cafs +-- #endif + initHscEnv mb_top_dir + ) -- %************************************************************************ -- %* * @@ -1949,3 +1960,8 @@ instance Exception GhcApiError mkApiErr :: DynFlags -> SDoc -> GhcApiError mkApiErr dflags msg = GhcApiError (showSDoc dflags msg) + +-- +foreign import ccall unsafe "keepCAFsForGHCi" + c_keepCAFsForGHCi :: IO Bool + |