diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-04-28 11:20:52 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2021-04-28 11:20:52 +0100 |
commit | 53e0f3d3be01e6a9402e189f85ead411b3741f1c (patch) | |
tree | d6ce160d59b6d268f5a579fe6f5f74414ff027e8 | |
parent | 5b957132e782f9cf16586d6847eaf54c994ffded (diff) | |
download | haskell-53e0f3d3be01e6a9402e189f85ead411b3741f1c.tar.gz |
Add extra direct_deps field
-rw-r--r-- | compiler/GHC/HsToCore/Usage.hs | 3 | ||||
-rw-r--r-- | compiler/GHC/Iface/Recomp.hs | 1 | ||||
-rw-r--r-- | compiler/GHC/Unit/Module/Deps.hs | 8 |
3 files changed, 10 insertions, 2 deletions
diff --git a/compiler/GHC/HsToCore/Usage.hs b/compiler/GHC/HsToCore/Usage.hs index a0fadacb89..48ccbd5bd0 100644 --- a/compiler/GHC/HsToCore/Usage.hs +++ b/compiler/GHC/HsToCore/Usage.hs @@ -84,6 +84,8 @@ mkDependencies iuid pluginModules th_used <- readIORef th_var let dep_mods = modDepsElts (delFromUFM (imp_dep_mods imports) (moduleName mod)) + + direct_mods = filter (\x -> gwib_mod x `elem` (map moduleName $ moduleEnvKeys $ imp_mods imports)) dep_mods -- M.hi-boot can be in the imp_dep_mods, but we must remove -- it before recording the modules on which this one depends! -- (We want to retain M.hi-boot in imp_dep_mods so that @@ -107,6 +109,7 @@ mkDependencies iuid pluginModules dep_pkgs' = map (\x -> (x, x `Set.member` trust_pkgs)) sorted_pkgs return Deps { dep_mods = dep_mods, + dep_direct_mods = direct_mods, dep_pkgs = dep_pkgs', dep_orphs = dep_orphs, dep_plgins = dep_plgins, diff --git a/compiler/GHC/Iface/Recomp.hs b/compiler/GHC/Iface/Recomp.hs index 8463c36cae..d8b225060a 100644 --- a/compiler/GHC/Iface/Recomp.hs +++ b/compiler/GHC/Iface/Recomp.hs @@ -1256,6 +1256,7 @@ getOrphanHashes hsc_env mods = do sortDependencies :: Dependencies -> Dependencies sortDependencies d = Deps { dep_mods = sortBy (lexicalCompareFS `on` (moduleNameFS . gwib_mod)) (dep_mods d), + dep_direct_mods = sortBy (lexicalCompareFS `on` (moduleNameFS . gwib_mod)) (dep_direct_mods d), dep_pkgs = sortBy (compare `on` fst) (dep_pkgs d), dep_orphs = sortBy stableModuleCmp (dep_orphs d), dep_finsts = sortBy stableModuleCmp (dep_finsts d), diff --git a/compiler/GHC/Unit/Module/Deps.hs b/compiler/GHC/Unit/Module/Deps.hs index 5bdd23239b..f29ae20934 100644 --- a/compiler/GHC/Unit/Module/Deps.hs +++ b/compiler/GHC/Unit/Module/Deps.hs @@ -27,6 +27,7 @@ data Dependencies = Deps -- ^ All home-package modules transitively below this one -- I.e. modules that this one imports, or that are in the -- dep_mods of those directly-imported modules + , dep_direct_mods :: [ModuleNameWithIsBoot] , dep_pkgs :: [(UnitId, Bool)] -- ^ All packages transitively below this module @@ -62,21 +63,24 @@ data Dependencies = Deps instance Binary Dependencies where put_ bh deps = do put_ bh (dep_mods deps) + put_ bh (dep_direct_mods deps) put_ bh (dep_pkgs deps) put_ bh (dep_orphs deps) put_ bh (dep_finsts deps) put_ bh (dep_plgins deps) get bh = do ms <- get bh + dms <- get bh ps <- get bh os <- get bh fis <- get bh pl <- get bh - return (Deps { dep_mods = ms, dep_pkgs = ps, dep_orphs = os, + return (Deps { dep_mods = ms, dep_direct_mods = dms, dep_pkgs = ps, dep_orphs = os, dep_finsts = fis, dep_plgins = pl }) noDependencies :: Dependencies -noDependencies = Deps [] [] [] [] [] +noDependencies = Deps [] [] [] [] [] [] + -- | Records modules for which changes may force recompilation of this module -- See wiki: https://gitlab.haskell.org/ghc/ghc/wikis/commentary/compiler/recompilation-avoidance |