summaryrefslogtreecommitdiff
path: root/compiler/main/Packages.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main/Packages.hs')
-rw-r--r--compiler/main/Packages.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
index 8c86f8df64..ccf42c588c 100644
--- a/compiler/main/Packages.hs
+++ b/compiler/main/Packages.hs
@@ -84,7 +84,8 @@ import CmdLineParser
import System.Environment ( getEnv )
import FastString
-import ErrUtils ( debugTraceMsg, MsgDoc, dumpIfSet_dyn, compilationProgressMsg )
+import ErrUtils ( debugTraceMsg, MsgDoc, dumpIfSet_dyn, compilationProgressMsg,
+ withTiming )
import Exception
import System.Directory
@@ -468,7 +469,9 @@ listPackageConfigMap dflags = eltsUDFM pkg_map
-- 'pkgState' in 'DynFlags' and return a list of packages to
-- link in.
initPackages :: DynFlags -> IO (DynFlags, [PreloadUnitId])
-initPackages dflags0 = do
+initPackages dflags0 = withTiming (return dflags0)
+ (text "initializing package database")
+ forcePkgDb $ do
dflags <- interpretPackageEnv dflags0
pkg_db <-
case pkgDatabase dflags of
@@ -481,6 +484,8 @@ initPackages dflags0 = do
pkgState = pkg_state,
thisUnitIdInsts_ = insts },
preload)
+ where
+ forcePkgDb (dflags, _) = pkgIdMap (pkgState dflags) `seq` ()
-- -----------------------------------------------------------------------------
-- Reading the package database(s)