summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-11-03 12:04:53 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-21 01:14:09 -0500
commitecfd0278cb811c93853c176fe5df60222d1a8fb5 (patch)
tree7fc212d973a0d9e5e67e13011bf30907b1458228 /ghc
parent53ad67eacacde8fde452f1a323d5886183375182 (diff)
downloadhaskell-ecfd0278cb811c93853c176fe5df60222d1a8fb5.tar.gz
Move Plugins into HscEnv (#17957)
Loaded plugins have nothing to do in DynFlags so this patch moves them into HscEnv (session state). "DynFlags plugins" become "Driver plugins" to still be able to register static plugins. Bump haddock submodule
Diffstat (limited to 'ghc')
-rw-r--r--ghc/GHCi/UI.hs7
-rw-r--r--ghc/Main.hs16
2 files changed, 6 insertions, 17 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 025f82fa08..d44eb79bd1 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -81,8 +81,6 @@ import GHC.Unit.Module.ModSummary
import GHC.Data.StringBuffer
import GHC.Utils.Outputable
-import GHC.Runtime.Loader ( initializePlugins )
-
-- Other random utilities
import GHC.Types.Basic hiding ( isTopLevel )
import GHC.Settings.Config
@@ -2943,10 +2941,7 @@ newDynFlags interactive_only minus_opts = do
when (interactive_only && packageFlagsChanged idflags1 idflags0) $ do
liftIO $ hPutStrLn stderr "cannot set package flags with :seti; use :set"
- -- Load any new plugins
- hsc_env0 <- GHC.getSession
- idflags2 <- liftIO (initializePlugins hsc_env0 idflags1)
- GHC.setInteractiveDynFlags idflags2
+ GHC.setInteractiveDynFlags idflags1
installInteractivePrint (interactivePrint idflags1) False
dflags0 <- getDynFlags
diff --git a/ghc/Main.hs b/ghc/Main.hs
index b7992b10b8..db926fb85f 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -36,7 +36,6 @@ import GHC.Platform.Host
#if defined(HAVE_INTERNAL_INTERPRETER)
import GHCi.UI ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings )
-import GHC.Runtime.Loader ( initializePlugins )
#endif
import GHC.Runtime.Loader ( loadFrontendPlugin )
@@ -247,9 +246,8 @@ main' postLoadMode dflags0 args flagWarnings = do
DoMake -> doMake srcs
DoMkDependHS -> doMkDependHS (map fst srcs)
StopBefore p -> liftIO (oneShot hsc_env p srcs)
- DoInteractive -> ghciUI hsc_env dflags6 srcs Nothing
- DoEval exprs -> ghciUI hsc_env dflags6 srcs $ Just $
- reverse exprs
+ DoInteractive -> ghciUI srcs Nothing
+ DoEval exprs -> ghciUI srcs $ Just $ reverse exprs
DoAbiHash -> abiHash (map fst srcs)
ShowPackages -> liftIO $ showUnits dflags6
DoFrontend f -> doFrontend f srcs
@@ -257,16 +255,12 @@ main' postLoadMode dflags0 args flagWarnings = do
liftIO $ dumpFinalStats dflags6
-ghciUI :: HscEnv -> DynFlags -> [(FilePath, Maybe Phase)] -> Maybe [String]
- -> Ghc ()
+ghciUI :: [(FilePath, Maybe Phase)] -> Maybe [String] -> Ghc ()
#if !defined(HAVE_INTERNAL_INTERPRETER)
-ghciUI _ _ _ _ =
+ghciUI _ _ =
throwGhcException (CmdLineError "not built for interactive use")
#else
-ghciUI hsc_env dflags0 srcs maybe_expr = do
- dflags1 <- liftIO (initializePlugins hsc_env dflags0)
- _ <- GHC.setSessionDynFlags dflags1
- interactiveUI defaultGhciSettings srcs maybe_expr
+ghciUI srcs maybe_expr = interactiveUI defaultGhciSettings srcs maybe_expr
#endif