diff options
Diffstat (limited to 'compiler/GHC.hs')
-rw-r--r-- | compiler/GHC.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/GHC.hs b/compiler/GHC.hs index dfdb1b6d42..2788a5dfb2 100644 --- a/compiler/GHC.hs +++ b/compiler/GHC.hs @@ -554,7 +554,12 @@ withCleanupSession ghc = ghc `MC.finally` cleanup initGhcMonad :: GhcMonad m => Maybe FilePath -> m () initGhcMonad mb_top_dir - = do { env <- 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. + !keep_cafs <- liftIO $ c_keepCAFsForGHCi + ; MASSERT( keep_cafs ) + ; env <- liftIO $ do { top_dir <- findTopDir mb_top_dir ; mySettings <- initSysTools top_dir ; myLlvmConfig <- lazyInitLlvmConfig top_dir @@ -600,7 +605,6 @@ checkBrokenTablesNextToCode' logger dflags arch = platformArch platform tablesNextToCode = platformTablesNextToCode platform - -- %************************************************************************ -- %* * -- Flags & settings @@ -1931,3 +1935,5 @@ instance Exception GhcApiError mkApiErr :: DynFlags -> SDoc -> GhcApiError mkApiErr dflags msg = GhcApiError (showSDoc dflags msg) +foreign import ccall unsafe "keepCAFsForGHCi" + c_keepCAFsForGHCi :: IO Bool |