Skip to content

Remove transitive information from interface files

Matthew Pickering requested to merge wip/ghc-transitive-deps into master

This commit modifies interface files so that only direct information about dependencies is stored in the interface file. In particular, we now only store the direct module dependencies and direct package dependencies.

This is important for two reasons

  • Less recompilation is needed, as motivated by #16885 (closed), 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 checkDepedencies, and was already happening in getLinkDeps.

In --make mode the closure is computed just from the HPT. In -c mode the closure is computed once and stored in eps_is_boot. In future we think that by making -c mode prepopulate the HPT then the eps_is_boot field could be removed and reduce the amount of interface loading. See #19795

Fixes #16885 (closed)

Merge request reports