[Git][ghc/ghc][wip/romes/graph-compact-easy] clean up
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Tue Jan 7 11:43:37 UTC 2025
Rodrigo Mesquita pushed to branch wip/romes/graph-compact-easy at Glasgow Haskell Compiler / GHC
Commits:
9e4eb447 by Rodrigo Mesquita at 2025-01-07T11:28:16+00:00
clean up
- - - - -
4 changed files:
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Unit/Env.hs
- compiler/GHC/Unit/Home/Graph.hs
Changes:
=====================================
compiler/GHC/Driver/Env.hs
=====================================
@@ -216,8 +216,6 @@ hscEPS hsc_env = readIORef (euc_eps (ue_eps (hsc_unit_env hsc_env)))
-- | Find all rules in modules that are in the transitive closure of the given
-- module.
---
--- $O(n)$ in the number of dependencies?
hugRulesBelow :: HscEnv -> UnitId -> ModuleNameWithIsBoot -> IO RuleBase
hugRulesBelow hsc uid mn = foldr (flip extendRuleBaseList) emptyRuleBase <$>
hugSomeThingsBelowUs (md_rules . hm_details) False hsc uid mn
@@ -225,8 +223,6 @@ hugRulesBelow hsc uid mn = foldr (flip extendRuleBaseList) emptyRuleBase <$>
-- | Get annotations from all modules "below" this one (in the dependency
-- sense) within the home units. If the module is @Nothing@, returns /all/
-- annotations in the home units.
---
--- $O(n)$ in the number of dependencies?
hugAnnsBelow :: HscEnv -> UnitId -> ModuleNameWithIsBoot -> IO AnnEnv
hugAnnsBelow hsc uid mn = foldr (flip extendAnnEnvList) emptyAnnEnv <$>
hugSomeThingsBelowUs (md_anns . hm_details) False hsc uid mn
@@ -234,7 +230,6 @@ hugAnnsBelow hsc uid mn = foldr (flip extendAnnEnvList) emptyAnnEnv <$>
-- | Find instances visible from the given set of imports
hugInstancesBelow :: HscEnv -> UnitId -> ModuleNameWithIsBoot -> IO (InstEnv, [FamInst])
hugInstancesBelow hsc_env uid mnwib = do
--- ouch... improve
let mn = gwib_mod mnwib
(insts, famInsts) <-
unzip . concat <$>
@@ -252,18 +247,7 @@ hugInstancesBelow hsc_env uid mnwib = do
-- | Get things from modules in the transitive closure of the given module.
--
--- Note: Don't expose this function. We can improve the interface further --
--- let's keep the queries on the HPT contained in this module so we can optimise
--- internally without breaking the API to the rest of GHC. This is a footgun if
--- exposed!
---
--- NOTE: We should be able to import this considerably with the reachability
--- index and caching?...
---
--- For example, easiest to go through all modules and filter out the ones in the
--- hpt via the module graph.........
---
--- TODO: This include_hi_boot business is also pretty weird. Do we need it at all?
+-- Note: Don't expose this function. This is a footgun if exposed!
hugSomeThingsBelowUs :: (HomeModInfo -> [a]) -> Bool -> HscEnv -> UnitId -> ModuleNameWithIsBoot -> IO [[a]]
hugSomeThingsBelowUs extract include_hi_boot hsc_env uid mn
= let hug = hsc_HUG hsc_env
=====================================
compiler/GHC/Driver/Make.hs
=====================================
@@ -774,7 +774,6 @@ load' mhmi_cache how_much diag_wrapper mHscMessage mod_graph = do
-- write an empty HPT to allow the old HPT to be GC'd.
let pruneHomeUnitEnv hme = do
- -- set to empty rather than panic because it will be again inserted to during upsweep (below).
emptyHPT <- liftIO emptyHomePackageTable
pure $! hme{ homeUnitEnv_hpt = emptyHPT }
hug' <- traverse pruneHomeUnitEnv (ue_home_unit_graph $ hsc_unit_env hsc_env)
=====================================
compiler/GHC/Unit/Env.hs
=====================================
@@ -101,7 +101,6 @@ module GHC.Unit.Env
, hugAllInstances
, hugAllAnns
-
-- * Legacy API
--
-- | This API is deprecated!
=====================================
compiler/GHC/Unit/Home/Graph.hs
=====================================
@@ -193,8 +193,6 @@ restrictHug deps hug = unitEnv_foldWithKey (\k uid hue -> restrict_one uid hue >
restrict_one uid hue =
restrictHpt (homeUnitEnv_hpt hue) (Map.findWithDefault [] uid deps_map)
-
-
-- | Rename a unit id in the 'HomeUnitGraph'
--
-- @'renameUnitId' oldUnit newUnit hug@, if @oldUnit@ is not found in @hug@, returns 'Nothing'.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9e4eb44726001f1d8d59a7c1773802723ba2b889
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9e4eb44726001f1d8d59a7c1773802723ba2b889
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250107/fd13d94e/attachment-0001.html>
More information about the ghc-commits
mailing list