Wolfgang Jeltsch pushed to branch wip/jeltsch/more-efficient-home-unit-imports-finding at Glasgow Haskell Compiler / GHC
Commits:
-
cd32e98b
by Wolfgang Jeltsch at 2026-04-28T22:21:02+03:00
1 changed file:
Changes:
| ... | ... | @@ -252,10 +252,7 @@ findImportedModuleNoHsc fc fopts ue home_module_name_providers_map mb_home_unit |
| 252 | 252 | hpt_deps :: Set.Set UnitId
|
| 253 | 253 | hpt_deps = homeUnitDepends units
|
| 254 | 254 | |
| 255 | - -- TODO: this predicate is wrong, we need something more focused
|
|
| 256 | - sorted_deps = if finder_lookupHomeInterfaces fopts
|
|
| 257 | - then Set.toList hpt_deps
|
|
| 258 | - else sortHomeUnitsByLikelihoodFor home_module_name_providers_map mb_home_unit_id mod_name hpt_deps
|
|
| 255 | + sorted_deps = sortHomeUnitsByLikelihoodFor home_module_name_providers_map mb_home_unit_id mod_name hpt_deps
|
|
| 259 | 256 | |
| 260 | 257 | other_fopts =
|
| 261 | 258 | [ (uid, initFinderOpts (homeUnitEnv_dflags (ue_findHomeUnitEnv uid ue)))
|
| ... | ... | @@ -263,6 +260,11 @@ findImportedModuleNoHsc fc fopts ue home_module_name_providers_map mb_home_unit |
| 263 | 260 | ]
|
| 264 | 261 | |
| 265 | 262 | sortHomeUnitsByLikelihoodFor :: HomeModuleNameProvidersMap -> Maybe UnitId -> ModuleName -> Set.Set UnitId -> [UnitId]
|
| 263 | +sortHomeUnitsByLikelihoodFor _ _ _ hpt_deps | Set.null hpt_deps = []
|
|
| 264 | +{-
|
|
| 265 | + With the above shortcut, evaluation of the module graph will not be
|
|
| 266 | + triggered.
|
|
| 267 | +-}
|
|
| 266 | 268 | sortHomeUnitsByLikelihoodFor home_module_name_providers_map mb_home_unit_id mod_name hpt_deps =
|
| 267 | 269 | let
|
| 268 | 270 | cached_module_providers = lookupWithDefaultUniqMap home_module_name_providers_map Set.empty mod_name
|