diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-05-20 16:36:23 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-13 02:13:03 -0400 |
commit | 4274688a6333abffdfe7c7bda252c566f947afdf (patch) | |
tree | de06603db94e3884ed68f74a862d732d52078c27 /compiler | |
parent | fca2d25ff76d442d0825847643ed7448492e0e55 (diff) | |
download | haskell-4274688a6333abffdfe7c7bda252c566f947afdf.tar.gz |
Move distrustAll into mkUnitState
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Unit/State.hs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/compiler/GHC/Unit/State.hs b/compiler/GHC/Unit/State.hs index e66e2a5e1e..f6ad6371af 100644 --- a/compiler/GHC/Unit/State.hs +++ b/compiler/GHC/Unit/State.hs @@ -570,7 +570,7 @@ initUnits :: DynFlags -> IO (DynFlags, [UnitId]) initUnits dflags = do let forceUnitInfoMap (state, _) = unitInfoMap state `seq` () - (state,raw_dbs) <- withTiming dflags + (state,dbs) <- withTiming dflags (text "initializing package database") forceUnitInfoMap $ do @@ -581,22 +581,14 @@ initUnits dflags = do let printer = debugTraceMsg dflags -- read the databases if they have not been already read - raw_dbs <- case unitDatabases dflags of + dbs <- case unitDatabases dflags of Nothing -> readUnitDatabases printer cfg Just dbs -> return dbs - -- distrust all units if the flag is set - let distrust_all db = db { unitDatabaseUnits = distrustAllUnits (unitDatabaseUnits db) } - dbs - | unitConfigDistrustAll cfg - = map distrust_all raw_dbs - | otherwise - = raw_dbs - -- create the UnitState state <- mkUnitState ctx (printer 2) cfg dbs - return (state, raw_dbs) + return (state, dbs) dumpIfSet_dyn (dflags { pprCols = 200 }) Opt_D_dump_mod_map "Mod Map" FormatText @@ -608,7 +600,7 @@ initUnits dflags = do unwiredInsts = homeUnitInstantiations dflags wiredInsts = map (fmap (upd_wired_in_mod wiringMap)) unwiredInsts - return (dflags{ unitDatabases = Just raw_dbs, + return (dflags{ unitDatabases = Just dbs, unitState = state, homeUnitInstantiations = wiredInsts }, (preloadUnits state)) @@ -1443,7 +1435,7 @@ mkUnitState -- the command line (later databases shadow earlier ones) -> [UnitDatabase UnitId] -> IO UnitState -mkUnitState ctx printer cfg dbs = do +mkUnitState ctx printer cfg raw_dbs = do {- Plan. @@ -1497,6 +1489,13 @@ mkUnitState ctx printer cfg dbs = do we build a mapping saying what every in scope module name points to. -} + + -- distrust all units if the flag is set + let distrust_all db = db { unitDatabaseUnits = distrustAllUnits (unitDatabaseUnits db) } + dbs | unitConfigDistrustAll cfg = map distrust_all raw_dbs + | otherwise = raw_dbs + + -- This, and the other reverse's that you will see, are due to the fact that -- packageFlags, pluginPackageFlags, etc. are all specified in *reverse* order -- than they are on the command line. |