summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-02-04 22:38:57 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-26 19:00:07 -0400
commit872a9444df4d38cd5dc0fbb7a249d89596e73ea2 (patch)
tree01a1ba920dfc7c5470bc2743e3bbc92413e4dd97 /compiler/GHC/Driver
parentd930fecb6d241c1eb13c30cf1126132766ff602e (diff)
downloadhaskell-872a9444df4d38cd5dc0fbb7a249d89596e73ea2.tar.gz
Refactor NameCache
* Make NameCache the mutable one and replace NameCacheUpdater with it * Remove NameCache related code duplicated into haddock Bump haddock submodule
Diffstat (limited to 'compiler/GHC/Driver')
-rw-r--r--compiler/GHC/Driver/Env/Types.hs7
-rw-r--r--compiler/GHC/Driver/Main.hs7
2 files changed, 6 insertions, 8 deletions
diff --git a/compiler/GHC/Driver/Env/Types.hs b/compiler/GHC/Driver/Env/Types.hs
index 94ba48c019..4465d206dd 100644
--- a/compiler/GHC/Driver/Env/Types.hs
+++ b/compiler/GHC/Driver/Env/Types.hs
@@ -102,10 +102,9 @@ data HscEnv
-- This is mutable because packages will be demand-loaded during
-- a compilation run as required.
- hsc_NC :: {-# UNPACK #-} !(IORef NameCache),
- -- ^ As with 'hsc_EPS', this is side-effected by compiling to
- -- reflect sucking in interface files. They cache the state of
- -- external interface files, in effect.
+ hsc_NC :: {-# UNPACK #-} !NameCache,
+ -- ^ Global Name cache so that each Name gets a single Unique.
+ -- Also track the origin of the Names.
hsc_FC :: {-# UNPACK #-} !(IORef FinderCache),
-- ^ The cached result of performing finding in the file system
diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs
index 0ef4f10719..f3ae968a6f 100644
--- a/compiler/GHC/Driver/Main.hs
+++ b/compiler/GHC/Driver/Main.hs
@@ -123,9 +123,8 @@ import GHC.Iface.Recomp
import GHC.Iface.Tidy
import GHC.Iface.Ext.Ast ( mkHieFile )
import GHC.Iface.Ext.Types ( getAsts, hie_asts, hie_module )
-import GHC.Iface.Ext.Binary ( readHieFile, writeHieFile , hie_file_result, NameCacheUpdater(..))
+import GHC.Iface.Ext.Binary ( readHieFile, writeHieFile , hie_file_result)
import GHC.Iface.Ext.Debug ( diffFile, validateScopes )
-import GHC.Iface.Env ( updNameCache )
import GHC.Core
import GHC.Core.Tidy ( tidyExpr )
@@ -245,7 +244,7 @@ newHscEnv dflags = do
-- allow `setSessionDynFlags` to be used to set unit db flags.
eps_var <- newIORef initExternalPackageState
us <- mkSplitUniqSupply 'r'
- nc_var <- newIORef (initNameCache us knownKeyNames)
+ nc_var <- initNameCache us knownKeyNames
fc_var <- newIORef emptyInstalledModuleEnv
logger <- initLogger
tmpfs <- initTmpFs
@@ -505,7 +504,7 @@ extract_renamed_stuff mod_summary tc_result = do
putMsg logger dflags $ text "Got invalid scopes"
mapM_ (putMsg logger dflags) xs
-- Roundtrip testing
- file' <- readHieFile (NCU $ updNameCache $ hsc_NC hs_env) out_file
+ file' <- readHieFile (hsc_NC hs_env) out_file
case diffFile hieFile (hie_file_result file') of
[] ->
putMsg logger dflags $ text "Got no roundtrip errors"