summaryrefslogtreecommitdiff
path: root/compiler/GHC.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-03-29 18:15:03 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-01 00:40:07 -0400
commit7acfb61777caa5f44f5c34c79ef983c9b303191f (patch)
tree3d8a6b63b08bc8b0f672205005cbdd3c9cc1c7b0 /compiler/GHC.hs
parent0219297c874659169507fa67c469d65bb9fabb1b (diff)
downloadhaskell-7acfb61777caa5f44f5c34c79ef983c9b303191f.tar.gz
Move HPT in UnitEnv
Diffstat (limited to 'compiler/GHC.hs')
-rw-r--r--compiler/GHC.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/GHC.hs b/compiler/GHC.hs
index 65716d0e95..23e74fb35a 100644
--- a/compiler/GHC.hs
+++ b/compiler/GHC.hs
@@ -641,7 +641,8 @@ setSessionDynFlags dflags0 = do
logger <- getLogger
dflags <- checkNewDynFlags logger dflags0
hsc_env <- getSession
- let cached_unit_dbs = ue_unit_dbs (hsc_unit_env hsc_env)
+ let old_unit_env = hsc_unit_env hsc_env
+ let cached_unit_dbs = ue_unit_dbs old_unit_env
(dbs,unit_state,home_unit) <- liftIO $ initUnits logger dflags cached_unit_dbs
-- Interpreter
@@ -684,6 +685,7 @@ setSessionDynFlags dflags0 = do
{ ue_platform = targetPlatform dflags
, ue_namever = ghcNameVersion dflags
, ue_home_unit = Just home_unit
+ , ue_hpt = ue_hpt old_unit_env
, ue_units = unit_state
, ue_unit_dbs = Just dbs
}
@@ -713,13 +715,14 @@ setProgramDynFlags_ invalidate_needed dflags = do
let changed = packageFlagsChanged dflags_prev dflags'
if changed
then do
- hsc_env <- getSession
- let cached_unit_dbs = ue_unit_dbs (hsc_unit_env hsc_env)
+ old_unit_env <- hsc_unit_env <$> getSession
+ let cached_unit_dbs = ue_unit_dbs old_unit_env
(dbs,unit_state,home_unit) <- liftIO $ initUnits logger dflags' cached_unit_dbs
let unit_env = UnitEnv
{ ue_platform = targetPlatform dflags'
, ue_namever = ghcNameVersion dflags'
, ue_home_unit = Just home_unit
+ , ue_hpt = ue_hpt old_unit_env
, ue_units = unit_state
, ue_unit_dbs = Just dbs
}
@@ -1211,7 +1214,7 @@ loadModule tcm = do
hsc_env ms 1 1 Nothing mb_linkable
source_modified
- modifySession $ \e -> e{ hsc_HPT = addToHpt (hsc_HPT e) mod mod_info }
+ modifySession $ hscUpdateHPT (\hpt -> addToHpt hpt mod mod_info)
return tcm