From 1d94a59fbadd56efec78680c89946eb425eef418 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 26 Jul 2022 11:20:39 +0100 Subject: Store interfaces in ModIfaceCache more directly I realised hydration was completely irrelavant for this cache because the ModDetails are pruned from the result. So now it simplifies things a lot to just store the ModIface and Linkable, which we can put into the cache straight away rather than wait for the final version of a HomeModInfo to appear. --- ghc/GHCi/UI.hs | 10 +++++----- ghc/GHCi/UI/Monad.hs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ghc') diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index 3de05f707d..b19939e9ac 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -51,7 +51,7 @@ import GHC.Driver.Session as DynFlags import GHC.Driver.Ppr hiding (printForUser) import GHC.Utils.Error hiding (traceCmd) import GHC.Driver.Monad ( modifySession ) -import GHC.Driver.Make ( newHomeModInfoCache, HomeModInfoCache(..) ) +import GHC.Driver.Make ( newIfaceCache, ModIfaceCache(..) ) import GHC.Driver.Config.Parser (initParserOpts) import GHC.Driver.Config.Diagnostic import qualified GHC @@ -542,7 +542,7 @@ interactiveUI config srcs maybe_exprs = do let prelude_import = simpleImportDecl preludeModuleName hsc_env <- GHC.getSession let in_multi = length (hsc_all_home_unit_ids hsc_env) > 1 - empty_cache <- liftIO newHomeModInfoCache + empty_cache <- liftIO newIfaceCache startGHCi (runGHCi srcs maybe_exprs) GHCiState{ progname = default_progname, args = default_args, @@ -577,7 +577,7 @@ interactiveUI config srcs maybe_exprs = do mod_infos = M.empty, flushStdHandles = flush, noBuffering = nobuffering, - hmiCache = empty_cache + ifaceCache = empty_cache } return () @@ -2150,7 +2150,7 @@ doLoad retain_context howmuch = do (\_ -> liftIO $ do hSetBuffering stdout NoBuffering hSetBuffering stderr NoBuffering) $ \_ -> do - hmis <- hmiCache <$> getGHCiState + hmis <- ifaceCache <$> getGHCiState ok <- trySuccess $ GHC.loadWithCache (Just hmis) howmuch afterLoad ok retain_context return ok @@ -4447,7 +4447,7 @@ discardActiveBreakPoints = do discardInterfaceCache :: GhciMonad m => m () discardInterfaceCache = - void (liftIO . hmi_clearCache . hmiCache =<< getGHCiState) + void (liftIO . iface_clearCache . ifaceCache =<< getGHCiState) clearHPTs :: GhciMonad m => m () clearHPTs = do diff --git a/ghc/GHCi/UI/Monad.hs b/ghc/GHCi/UI/Monad.hs index ee0edb1837..01f8f65831 100644 --- a/ghc/GHCi/UI/Monad.hs +++ b/ghc/GHCi/UI/Monad.hs @@ -47,7 +47,7 @@ import GHC.Data.FastString import GHC.Driver.Env import GHC.Types.SrcLoc import GHC.Types.SafeHaskell -import GHC.Driver.Make (HomeModInfoCache(..)) +import GHC.Driver.Make (ModIfaceCache(..)) import GHC.Unit import GHC.Types.Name.Reader as RdrName (mkOrig) import GHC.Builtin.Names (gHC_GHCI_HELPERS) @@ -164,7 +164,7 @@ data GHCiState = GHCiState -- ^ @hFlush stdout; hFlush stderr@ in the interpreter noBuffering :: ForeignHValue, -- ^ @hSetBuffering NoBuffering@ for stdin/stdout/stderr - hmiCache :: HomeModInfoCache + ifaceCache :: ModIfaceCache } type TickArray = Array Int [(GHC.BreakIndex,RealSrcSpan)] -- cgit v1.2.1