diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-06-22 12:29:47 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-07-01 03:30:36 -0400 |
commit | 6d712150f8f9400397368b45a152a694ba9d5af4 (patch) | |
tree | 40a873281b87cc2d677f416ef0b7e87da465ebf7 /compiler/GHC/Tc/Utils/Monad.hs | |
parent | 6f097a8161dfc97be007b83fccbdb71350d786b1 (diff) | |
download | haskell-6d712150f8f9400397368b45a152a694ba9d5af4.tar.gz |
Dynflags: introduce DiagOpts
Use DiagOpts for diagnostic options instead of directly querying
DynFlags (#17957).
Surprising performance improvements on CI:
T4801(normal) ghc/alloc 313236344.0 306515216.0 -2.1% GOOD
T9961(normal) ghc/alloc 384502736.0 380584384.0 -1.0% GOOD
ManyAlternatives(normal) ghc/alloc 797356128.0 786644928.0 -1.3%
ManyConstructors(normal) ghc/alloc 4389732432.0 4317740880.0 -1.6%
T783(normal) ghc/alloc 408142680.0 402812176.0 -1.3%
Metric Decrease:
T4801
T9961
T783
ManyAlternatives
ManyConstructors
Bump haddock submodule
Diffstat (limited to 'compiler/GHC/Tc/Utils/Monad.hs')
-rw-r--r-- | compiler/GHC/Tc/Utils/Monad.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/GHC/Tc/Utils/Monad.hs b/compiler/GHC/Tc/Utils/Monad.hs index 0572ab00db..ea6b2f2ba5 100644 --- a/compiler/GHC/Tc/Utils/Monad.hs +++ b/compiler/GHC/Tc/Utils/Monad.hs @@ -175,6 +175,7 @@ import GHC.Core.FamInstEnv import GHC.Driver.Env import GHC.Driver.Session +import GHC.Driver.Config.Diagnostic import GHC.Runtime.Context @@ -1051,8 +1052,8 @@ mkTcRnMessage :: SrcSpan -> TcRn (MsgEnvelope TcRnMessage) mkTcRnMessage loc msg = do { printer <- getPrintUnqualified ; - dflags <- getDynFlags ; - return $ mkMsgEnvelope dflags loc printer msg } + diag_opts <- initDiagOpts <$> getDynFlags ; + return $ mkMsgEnvelope diag_opts loc printer msg } reportDiagnostics :: [MsgEnvelope TcRnMessage] -> TcM () reportDiagnostics = mapM_ reportDiagnostic @@ -1538,11 +1539,11 @@ addDetailedDiagnostic :: (ErrInfo -> TcRnMessage) -> TcM () addDetailedDiagnostic mkMsg = do loc <- getSrcSpanM printer <- getPrintUnqualified - dflags <- getDynFlags + !diag_opts <- initDiagOpts <$> getDynFlags env0 <- tcInitTidyEnv ctxt <- getErrCtxt err_info <- mkErrInfo env0 ctxt - reportDiagnostic (mkMsgEnvelope dflags loc printer (mkMsg (ErrInfo err_info empty))) + reportDiagnostic (mkMsgEnvelope diag_opts loc printer (mkMsg (ErrInfo err_info empty))) addTcRnDiagnostic :: TcRnMessage -> TcM () addTcRnDiagnostic msg = do |