summaryrefslogtreecommitdiff
path: root/compiler/GHC.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-05-20 18:29:14 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-13 02:13:03 -0400
commitbfd0a78cdd0287c26998a4d9419174e4dc305c6f (patch)
tree7f864f90f4561782929acee2141385c328ab0aa9 /compiler/GHC.hs
parentac964c8350ba41082e9dca9cf1b7ff02aea2a636 (diff)
downloadhaskell-bfd0a78cdd0287c26998a4d9419174e4dc305c6f.tar.gz
Don't return preload units when we set DyNFlags
Preload units can be retrieved in UnitState when needed (i.e. in GHCi)
Diffstat (limited to 'compiler/GHC.hs')
-rw-r--r--compiler/GHC.hs22
1 files changed, 12 insertions, 10 deletions
diff --git a/compiler/GHC.hs b/compiler/GHC.hs
index 9f9f2ad758..b619f0c14c 100644
--- a/compiler/GHC.hs
+++ b/compiler/GHC.hs
@@ -594,10 +594,10 @@ checkBrokenTablesNextToCode' dflags
-- flags. If you are not doing linking or doing static linking, you
-- can ignore the list of packages returned.
--
-setSessionDynFlags :: GhcMonad m => DynFlags -> m [UnitId]
+setSessionDynFlags :: GhcMonad m => DynFlags -> m ()
setSessionDynFlags dflags = do
dflags' <- checkNewDynFlags dflags
- (dflags''', preload) <- liftIO $ initUnits dflags'
+ dflags''' <- liftIO $ initUnits dflags'
-- Interpreter
interp <- if gopt Opt_ExternalInterpreter dflags
@@ -637,12 +637,14 @@ setSessionDynFlags dflags = do
-- already one set up
}
invalidateModSummaryCache
- return preload
-- | Sets the program 'DynFlags'. Note: this invalidates the internal
-- cached module graph, causing more work to be done the next time
-- 'load' is called.
-setProgramDynFlags :: GhcMonad m => DynFlags -> m [UnitId]
+--
+-- Returns a boolean indicating if preload units have changed and need to be
+-- reloaded.
+setProgramDynFlags :: GhcMonad m => DynFlags -> m Bool
setProgramDynFlags dflags = setProgramDynFlags_ True dflags
-- | Set the action taken when the compiler produces a message. This
@@ -654,17 +656,17 @@ setLogAction action = do
void $ setProgramDynFlags_ False $
dflags' { log_action = action }
-setProgramDynFlags_ :: GhcMonad m => Bool -> DynFlags -> m [UnitId]
+setProgramDynFlags_ :: GhcMonad m => Bool -> DynFlags -> m Bool
setProgramDynFlags_ invalidate_needed dflags = do
dflags' <- checkNewDynFlags dflags
dflags_prev <- getProgramDynFlags
- (dflags'', preload) <-
- if (packageFlagsChanged dflags_prev dflags')
- then liftIO $ initUnits dflags'
- else return (dflags', [])
+ let changed = packageFlagsChanged dflags_prev dflags'
+ dflags'' <- if changed
+ then liftIO $ initUnits dflags'
+ else return dflags'
modifySession $ \h -> h{ hsc_dflags = dflags'' }
when invalidate_needed $ invalidateModSummaryCache
- return preload
+ return changed
-- When changing the DynFlags, we want the changes to apply to future