Hannes Siebenhandl pushed to branch wip/romes/27461 at Glasgow Haskell Compiler / GHC
Commits:
4 changed files:
- + changelog.d/T27461
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Unit/Env.hs
Changes:
| 1 | +section: compiler
|
|
| 2 | +issues: #27461
|
|
| 3 | +mrs: !16330
|
|
| 4 | +synopsis:
|
|
| 5 | + downsweep: make control flow simpler and cache correct
|
|
| 6 | +description: {
|
|
| 7 | + Extracts the control flow of downsweep into a single
|
|
| 8 | + function `dfsBuild`, which takes care of iteratively expanding and
|
|
| 9 | + traversing all nodes of the in-construction module graph necessary to
|
|
| 10 | + build a full `ModuleGraph`.
|
|
| 11 | + |
|
| 12 | + This avoids recomputing expensive operations, such summarising `Module`s into `ModuleSummary`s.
|
|
| 13 | + We greatly reduce the number of allocations for module graphs with lots of imports, especially
|
|
| 14 | + when multiple home units are involved.
|
|
| 15 | +}
|
|
| 16 | + |
|
| 17 | + |
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | {-# LANGUAGE BlockArguments #-}
|
| 7 | 7 | {-# LANGUAGE ViewPatterns #-}
|
| 8 | 8 | |
| 9 | --- | See Note [Downsweep and the ModuleGraph]
|
|
| 9 | +-- | See Note [The ModuleGraph]
|
|
| 10 | 10 | module GHC.Driver.Downsweep
|
| 11 | 11 | ( downsweep
|
| 12 | 12 | , downsweepThunk
|
| ... | ... | @@ -234,7 +234,7 @@ See also Note [Downsweep Control Flow and Caching] |
| 234 | 234 | -- It will also turn on code generation for any modules that need it by calling
|
| 235 | 235 | -- 'enableCodeGenForTH'.
|
| 236 | 236 | --
|
| 237 | --- See also Note [Downsweep and the ModuleGraph]
|
|
| 237 | +-- See also Note [The ModuleGraph]
|
|
| 238 | 238 | downsweep :: HscEnv
|
| 239 | 239 | -> (GhcMessage -> AnyGhcDiagnostic)
|
| 240 | 240 | -> Maybe Messager
|
| ... | ... | @@ -1858,5 +1858,5 @@ twice). |
| 1858 | 1858 | Note that (2) can't guarantee this alone: Two ModuleName imports in
|
| 1859 | 1859 | separate units can (and likely do) map to the same `Module`.
|
| 1860 | 1860 | |
| 1861 | -See also Note [Downsweep and the ModuleGraph]
|
|
| 1861 | +See also Note [The ModuleGraph]
|
|
| 1862 | 1862 | -} |
| ... | ... | @@ -270,7 +270,7 @@ hugSomeThingsBelowUs :: (HomeModInfo -> [a]) -> Bool -> HscEnv -> UnitId -> Modu |
| 270 | 270 | -- These things are currently stored in the EPS for home packages. (See #25795 for
|
| 271 | 271 | -- progress in removing these kind of checks; and making these functions of
|
| 272 | 272 | -- `UnitEnv` rather than `HscEnv`)
|
| 273 | --- See Note [Downsweep and the ModuleGraph]
|
|
| 273 | +-- See Note [The ModuleGraph]
|
|
| 274 | 274 | hugSomeThingsBelowUs _ _ hsc_env _ _ | isOneShot (ghcMode (hsc_dflags hsc_env)) = return []
|
| 275 | 275 | hugSomeThingsBelowUs extract include_hi_boot hsc_env uid mn
|
| 276 | 276 | = let hug = hsc_HUG hsc_env
|
| ... | ... | @@ -164,7 +164,7 @@ data UnitEnv = UnitEnv |
| 164 | 164 | |
| 165 | 165 | , ue_module_graph :: ModuleGraph
|
| 166 | 166 | -- ^ The module graph of the current session
|
| 167 | - -- See Note [Downsweep and the ModuleGraph] for when this is constructed.
|
|
| 167 | + -- See Note [The ModuleGraph] for when this is constructed.
|
|
| 168 | 168 | |
| 169 | 169 | , ue_home_unit_graph :: !HomeUnitGraph
|
| 170 | 170 | -- See Note [Multiple Home Units]
|