diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-05-05 13:48:19 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-19 23:33:02 -0400 |
commit | 38faeea1a94072ffd9f459d9fe570f06bc1da84a (patch) | |
tree | 00df888e529aa208e40589fe3f73790906324b8b /compiler/GHC/Linker | |
parent | c8564c639a9889d4d19c68f4b96c092f670b092c (diff) | |
download | haskell-38faeea1a94072ffd9f459d9fe570f06bc1da84a.tar.gz |
Remove transitive information about modules and packages from interface files
This commit modifies interface files so that *only* direct information
about modules and packages is stored in the interface file.
* Only direct module and direct package dependencies are stored in the
interface files.
* Trusted packages are now stored separately as they need to be checked
transitively.
* hs-boot files below the compiled module in the home module are stored
so that eps_is_boot can be calculated in one-shot mode without loading
all interface files in the home package.
* The transitive closure of signatures is stored separately
This is important for two reasons
* Less recompilation is needed, as motivated by #16885, a lot of
redundant compilation was triggered when adding new imports deep in the
module tree as all the parent interface files had to be redundantly
updated.
* Checking an interface file is cheaper because you don't have to
perform a transitive traversal to check the dependencies are up-to-date.
In the code, places where we would have used the transitive closure, we
instead compute the necessary transitive closure. The closure is not
computed very often, was already happening in checkDependencies, and
was already happening in getLinkDeps.
Fixes #16885
-------------------------
Metric Decrease:
MultiLayerModules
T13701
T13719
-------------------------
Diffstat (limited to 'compiler/GHC/Linker')
-rw-r--r-- | compiler/GHC/Linker/Loader.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/GHC/Linker/Loader.hs b/compiler/GHC/Linker/Loader.hs index 1258034fb5..ccd3879910 100644 --- a/compiler/GHC/Linker/Loader.hs +++ b/compiler/GHC/Linker/Loader.hs @@ -692,20 +692,20 @@ getLinkDeps hsc_env hpt pls replace_osuf span mods deps = mi_deps iface home_unit = hsc_home_unit hsc_env - pkg_deps = dep_pkgs deps - (boot_deps, mod_deps) = flip partitionWith (dep_mods deps) $ + pkg_deps = dep_direct_pkgs deps + (boot_deps, mod_deps) = flip partitionWith (dep_direct_mods deps) $ \ (GWIB { gwib_mod = m, gwib_isBoot = is_boot }) -> m & case is_boot of IsBoot -> Left NotBoot -> Right - boot_deps' = filter (not . (`elementOfUniqDSet` acc_mods)) boot_deps + mod_deps' = filter (not . (`elementOfUniqDSet` acc_mods)) (boot_deps ++ mod_deps) acc_mods' = addListToUniqDSet acc_mods (moduleName mod : mod_deps) - acc_pkgs' = addListToUniqDSet acc_pkgs $ map fst pkg_deps + acc_pkgs' = addListToUniqDSet acc_pkgs pkg_deps -- if not (isHomeUnit home_unit pkg) then follow_deps mods acc_mods (addOneToUniqDSet acc_pkgs' (toUnitId pkg)) - else follow_deps (map (mkHomeModule home_unit) boot_deps' ++ mods) + else follow_deps (map (mkHomeModule home_unit) mod_deps' ++ mods) acc_mods' acc_pkgs' where msg = text "need to link module" <+> ppr mod <+> |