diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-03-29 18:15:03 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-04-01 00:40:07 -0400 |
commit | 7acfb61777caa5f44f5c34c79ef983c9b303191f (patch) | |
tree | 3d8a6b63b08bc8b0f672205005cbdd3c9cc1c7b0 /compiler/GHC/Unit | |
parent | 0219297c874659169507fa67c469d65bb9fabb1b (diff) | |
download | haskell-7acfb61777caa5f44f5c34c79ef983c9b303191f.tar.gz |
Move HPT in UnitEnv
Diffstat (limited to 'compiler/GHC/Unit')
-rw-r--r-- | compiler/GHC/Unit/Env.hs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/compiler/GHC/Unit/Env.hs b/compiler/GHC/Unit/Env.hs index 89e8d77586..8ba341cb6f 100644 --- a/compiler/GHC/Unit/Env.hs +++ b/compiler/GHC/Unit/Env.hs @@ -2,6 +2,7 @@ module GHC.Unit.Env ( UnitEnv (..) , initUnitEnv , unsafeGetHomeUnit + , updateHpt , preloadUnitsInfo , preloadUnitsInfo' ) @@ -12,6 +13,7 @@ import GHC.Prelude import GHC.Unit.State import GHC.Unit.Home import GHC.Unit.Types +import GHC.Unit.Home.ModInfo import GHC.Platform import GHC.Settings @@ -35,6 +37,26 @@ data UnitEnv = UnitEnv , ue_home_unit :: !(Maybe HomeUnit) -- ^ Home unit + , ue_hpt :: !HomePackageTable + -- ^ The home package table describes already-compiled + -- home-package modules, /excluding/ the module we + -- are compiling right now. + -- (In one-shot mode the current module is the only + -- home-package module, so hsc_HPT is empty. All other + -- modules count as \"external-package\" modules. + -- However, even in GHCi mode, hi-boot interfaces are + -- demand-loaded into the external-package table.) + -- + -- 'hsc_HPT' is not mutable because we only demand-load + -- external packages; the home package is eagerly + -- loaded, module by module, by the compilation manager. + -- + -- The HPT may contain modules compiled earlier by @--make@ + -- but not actually below the current module in the dependency + -- graph. + -- + -- (This changes a previous invariant: changed Jan 05.) + , ue_platform :: !Platform -- ^ Platform @@ -48,6 +70,7 @@ initUnitEnv namever platform = do { ue_units = emptyUnitState , ue_unit_dbs = Nothing , ue_home_unit = Nothing + , ue_hpt = emptyHomePackageTable , ue_platform = platform , ue_namever = namever } @@ -60,6 +83,9 @@ unsafeGetHomeUnit ue = case ue_home_unit ue of Nothing -> panic "unsafeGetHomeUnit: No home unit" Just h -> h +updateHpt :: (HomePackageTable -> HomePackageTable) -> UnitEnv -> UnitEnv +updateHpt f ue = ue { ue_hpt = f (ue_hpt ue) } + -- ----------------------------------------------------------------------------- -- Extracting information from the packages in scope |