summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Backpack.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-05-07 20:04:44 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-13 02:13:02 -0400
commitf6be6e432e53108075905c1fc7785d8b1f18a33f (patch)
tree299c122f83b982f3edfd4b56bcf1967191e5cb48 /compiler/GHC/Driver/Backpack.hs
parent8dc71f5577a541168951371bd55b51a588b57813 (diff)
downloadhaskell-f6be6e432e53108075905c1fc7785d8b1f18a33f.tar.gz
Add allowVirtualUnits field in PackageState
Instead of always querying DynFlags to know whether we are allowed to use virtual units (i.e. instantiated on-the-fly, cf Note [About units] in GHC.Unit), we store it once for all in `PackageState.allowVirtualUnits`. This avoids using DynFlags too much (cf #17957) and is preliminary work for #14335.
Diffstat (limited to 'compiler/GHC/Driver/Backpack.hs')
-rw-r--r--compiler/GHC/Driver/Backpack.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Driver/Backpack.hs b/compiler/GHC/Driver/Backpack.hs
index 177a601425..2c04fb8b37 100644
--- a/compiler/GHC/Driver/Backpack.hs
+++ b/compiler/GHC/Driver/Backpack.hs
@@ -396,13 +396,13 @@ addPackage pkg = do
compileInclude :: Int -> (Int, Unit) -> BkpM ()
compileInclude n (i, uid) = do
hsc_env <- getSession
- let dflags = hsc_dflags hsc_env
+ let pkgs = pkgState (hsc_dflags hsc_env)
msgInclude (i, n) uid
-- Check if we've compiled it already
case uid of
HoleUnit -> return ()
RealUnit _ -> return ()
- VirtUnit i -> case lookupUnit dflags uid of
+ VirtUnit i -> case lookupUnit pkgs uid of
Nothing -> innerBkpM $ compileUnit (instUnitInstanceOf i) (instUnitInsts i)
Just _ -> return ()