summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Marianiello <andremarianiello@users.noreply.github.com>2022-06-12 18:20:48 -0400
committerAndre Marianiello <andremarianiello@users.noreply.github.com>2022-06-12 18:31:27 -0400
commit94b14fa533f2d575f155ab00d7bea8c7fc0b6c73 (patch)
treee8cfd8a29475f076fc3c2d54293e3e12f2f69254
parent9f210ae542233e77be3efc4d4ab6163cc2ef0b27 (diff)
downloadhaskell-wip/count-hs-boot-deps.tar.gz
temporary debug statementswip/count-hs-boot-deps
-rw-r--r--compiler/GHC/Driver/Make.hs18
-rw-r--r--compiler/GHC/Unit/Finder.hs12
2 files changed, 24 insertions, 6 deletions
diff --git a/compiler/GHC/Driver/Make.hs b/compiler/GHC/Driver/Make.hs
index efaefd84f5..bf8aa7848b 100644
--- a/compiler/GHC/Driver/Make.hs
+++ b/compiler/GHC/Driver/Make.hs
@@ -1564,8 +1564,12 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots
= loopSummaries next (done, pkgs, summarised)
-- Didn't work out what the imports mean yet, now do that.
| otherwise = do
+ putStr "loopSummaries1: "
+ print (moduleName $ ms_mod ms)
(final_deps, pkgs1, done', summarised') <- loopImports (calcDeps ms) done summarised
-- This has the effect of finding a .hs file if we are looking at the .hs-boot file.
+ putStr "loopSummaries2: "
+ putStrLn (showPprUnsafe final_deps)
(_, _, done'', summarised'') <- loopImports (maybeToList hs_file_for_boot) done' summarised'
loopSummaries next (M.insert k (ModuleNode final_deps ms) done'', pkgs1 `Set.union` pkgs, summarised'')
where
@@ -1603,19 +1607,29 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots
loopImports ss done summarised
| otherwise
= do
+ putStr "loopImports: "
+ print mod
mb_s <- summariseModule hsc_env home_unit old_summary_map
is_boot wanted_mod mb_pkg
Nothing excl_mods
case mb_s of
- NotThere -> loopImports ss done summarised
+ NotThere -> do
+ putStrLn "loopImports: NotThere"
+ loopImports ss done summarised
External uid -> do
+ putStrLn "loopImports: External"
(other_deps, pkgs, done', summarised') <- loopImports ss done summarised
return (other_deps, Set.insert (homeUnitId home_unit, uid) pkgs, done', summarised')
FoundInstantiation iud -> do
+ putStrLn "loopImports: FoundInstantiation"
(other_deps, pkgs, done', summarised') <- loopImports ss done summarised
return (NodeKey_Unit iud : other_deps, pkgs, done', summarised')
- FoundHomeWithError (_uid, e) -> loopImports ss done (Map.insert cache_key [(Left e)] summarised)
+ FoundHomeWithError (_uid, e) -> do
+ putStrLn "loopImports: FoundHomeWithError"
+ loopImports ss done (Map.insert cache_key [(Left e)] summarised)
FoundHome s -> do
+ putStrLn "loopImports: FoundHome"
+ putStrLn (showPprUnsafe s)
(done', pkgs1, summarised') <-
loopSummaries [s] (done, Set.empty, Map.insert cache_key [Right s] summarised)
(other_deps, pkgs2, final_done, final_summarised) <- loopImports ss done' summarised'
diff --git a/compiler/GHC/Unit/Finder.hs b/compiler/GHC/Unit/Finder.hs
index 45057d13e2..17e0b32210 100644
--- a/compiler/GHC/Unit/Finder.hs
+++ b/compiler/GHC/Unit/Finder.hs
@@ -154,11 +154,11 @@ findImportedModuleNoHsc
-> IO FindResult
findImportedModuleNoHsc fc fopts ue mhome_unit mod_name mb_pkg =
case mb_pkg of
- NoPkgQual -> unqual_import
+ NoPkgQual -> putStrLn "findImportedModuleNoHsc: NoPkgQual" >> unqual_import
ThisPkg uid | (homeUnitId <$> mhome_unit) == Just uid -> home_import
| Just os <- lookup uid other_fopts -> home_pkg_import (uid, os)
| otherwise -> pprPanic "findImportModule" (ppr mod_name $$ ppr mb_pkg $$ ppr (homeUnitId <$> mhome_unit) $$ ppr uid $$ ppr (map fst all_opts))
- OtherPkg _ -> pkg_import
+ OtherPkg _ -> putStrLn "findImportedModuleNoHsc: OtherPkg" >> pkg_import
where
all_opts = case mhome_unit of
Nothing -> other_fopts
@@ -166,7 +166,7 @@ findImportedModuleNoHsc fc fopts ue mhome_unit mod_name mb_pkg =
home_import = case mhome_unit of
- Just home_unit -> findHomeModule fc fopts home_unit mod_name
+ Just home_unit -> putStrLn "findImportedModuleNoHsc: home_import" >> findHomeModule fc fopts home_unit mod_name
Nothing -> pure $ NoPackage (panic "findImportedModule: no home-unit")
@@ -349,6 +349,8 @@ uncacheModule fc home_unit mod_name = do
findHomeModule :: FinderCache -> FinderOpts -> HomeUnit -> ModuleName -> IO FindResult
findHomeModule fc fopts home_unit mod_name = do
let uid = homeUnitAsUnit home_unit
+ putStr "findHomeModule: "
+ putStrLn (showPprUnsafe $ homeUnitId home_unit)
r <- findInstalledHomeModule fc fopts (homeUnitId home_unit) mod_name
return $ case r of
InstalledFound loc _ -> Found loc (mkHomeModule home_unit mod_name)
@@ -406,6 +408,8 @@ findHomePackageModule fc fopts home_unit mod_name = do
-- call this.)
findInstalledHomeModule :: FinderCache -> FinderOpts -> UnitId -> ModuleName -> IO InstalledFindResult
findInstalledHomeModule fc fopts home_unit mod_name = do
+ putStr "findInstalledHomeModule: "
+ print fopts
homeSearchCache fc home_unit mod_name $
let
maybe_working_dir = finder_workingDirectory fopts
@@ -518,7 +522,7 @@ searchPathExts :: [FilePath] -- paths to search
]
-> IO InstalledFindResult
-searchPathExts paths mod exts = search to_search
+searchPathExts paths mod exts = putStr "searchPathExts: " >> print paths >> search to_search
where
basename = moduleNameSlashes (moduleName mod)