[Git][ghc/ghc][wip/romes/graph-compact-easy] unsafe counterpart ue_unitHomeUnit_maybe
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Mon Jan 6 17:16:32 UTC 2025
Rodrigo Mesquita pushed to branch wip/romes/graph-compact-easy at Glasgow Haskell Compiler / GHC
Commits:
1920c3ab by Rodrigo Mesquita at 2025-01-06T17:16:20+00:00
unsafe counterpart ue_unitHomeUnit_maybe
- - - - -
2 changed files:
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Unit/Env.hs
Changes:
=====================================
compiler/GHC/Driver/Make.hs
=====================================
@@ -1726,7 +1726,7 @@ downsweep_imports hsc_env old_summaries excl_mods allow_dup_roots (root_errs, ro
return (NodeKey_Module (msKey s) : other_deps, final_done, final_summarised)
where
cache_key = (home_uid, mb_pkg, unLoc <$> gwib)
- home_unit = expectJust "downsweep_imports" $ ue_unitHomeUnit_maybe home_uid (hsc_unit_env hsc_env)
+ home_unit = ue_unitHomeUnit home_uid (hsc_unit_env hsc_env)
GWIB { gwib_mod = L loc mod, gwib_isBoot = is_boot } = gwib
wanted_mod = L loc mod
@@ -1759,7 +1759,7 @@ getRootSummary excl_mods old_summary_map hsc_env target
_ -> Left (uid, moduleNotFoundErr modl)
where
Target {targetId, targetContents = maybe_buf, targetUnitId = uid} = target
- home_unit = expectJust "getRootSummary" $ ue_unitHomeUnit_maybe uid (hsc_unit_env hsc_env)
+ home_unit = ue_unitHomeUnit uid (hsc_unit_env hsc_env)
rootLoc = mkGeneralSrcSpan (fsLit "<command line>")
dflags = homeUnitEnv_dflags (ue_findHomeUnitEnv uid (hsc_unit_env hsc_env))
@@ -1970,7 +1970,7 @@ enableCodeGenWhen logger tmpfs staticLife dynLife unit_env mod_graph = do
not (backendGeneratesCode (backend dflags)) &&
-- Don't enable codegen for TH on indefinite packages; we
-- can't compile anything anyway! See #16219.
- isHomeUnitDefinite (expectJust "enableCodeGenWhen" $ ue_unitHomeUnit_maybe (ms_unitid ms) unit_env)
+ isHomeUnitDefinite (ue_unitHomeUnit (ms_unitid ms) unit_env)
bytecode_and_enable enable_spec ms =
-- In the situation where we **would** need to enable dynamic-too
=====================================
compiler/GHC/Unit/Env.hs
=====================================
@@ -51,6 +51,7 @@ module GHC.Unit.Env
, ue_setActiveUnit
, ue_currentUnit
, ue_findHomeUnitEnv
+ , ue_unitHomeUnit
, ue_unitHomeUnit_maybe
, ue_updateHomeUnitEnv
@@ -313,6 +314,9 @@ ue_unsafeHomeUnit ue = case ue_homeUnit ue of
Nothing -> panic "unsafeGetHomeUnit: No home unit"
Just h -> h
+ue_unitHomeUnit :: UnitId -> UnitEnv -> HomeUnit
+ue_unitHomeUnit uid = expectJust "ue_unitHomeUnit" . ue_unitHomeUnit_maybe uid
+
ue_unitHomeUnit_maybe :: UnitId -> UnitEnv -> Maybe HomeUnit
ue_unitHomeUnit_maybe uid ue_env =
HUG.homeUnitEnv_home_unit =<< HUG.lookupHugUnit uid (ue_home_unit_graph ue_env)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1920c3abf2542351f1bdcfe53d83c1c84aaa1bf6
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1920c3abf2542351f1bdcfe53d83c1c84aaa1bf6
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/20250106/85af6a49/attachment-0001.html>
More information about the ghc-commits
mailing list