summaryrefslogtreecommitdiff
path: root/compiler/GHC.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC.hs')
-rw-r--r--compiler/GHC.hs23
1 files changed, 14 insertions, 9 deletions
diff --git a/compiler/GHC.hs b/compiler/GHC.hs
index 134580c653..59f49453ed 100644
--- a/compiler/GHC.hs
+++ b/compiler/GHC.hs
@@ -639,11 +639,13 @@ checkBrokenTablesNextToCode' logger dflags
setSessionDynFlags :: GhcMonad m => DynFlags -> m ()
setSessionDynFlags dflags0 = do
logger <- getLogger
- dflags <- checkNewDynFlags logger dflags0
+ dflags1 <- checkNewDynFlags logger dflags0
hsc_env <- getSession
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
+ (dbs,unit_state,home_unit,mconstants) <- liftIO $ initUnits logger dflags1 cached_unit_dbs
+
+ dflags <- liftIO $ updatePlatformConstants dflags1 mconstants
-- Interpreter
interp <- if gopt Opt_ExternalInterpreter dflags
@@ -711,27 +713,30 @@ setProgramDynFlags dflags = setProgramDynFlags_ True dflags
setProgramDynFlags_ :: GhcMonad m => Bool -> DynFlags -> m Bool
setProgramDynFlags_ invalidate_needed dflags = do
logger <- getLogger
- dflags' <- checkNewDynFlags logger dflags
+ dflags0 <- checkNewDynFlags logger dflags
dflags_prev <- getProgramDynFlags
- let changed = packageFlagsChanged dflags_prev dflags'
+ let changed = packageFlagsChanged dflags_prev dflags0
if changed
then do
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
+ (dbs,unit_state,home_unit,mconstants) <- liftIO $ initUnits logger dflags0 cached_unit_dbs
+
+ dflags1 <- liftIO $ updatePlatformConstants dflags0 mconstants
+
let unit_env = UnitEnv
- { ue_platform = targetPlatform dflags'
- , ue_namever = ghcNameVersion dflags'
+ { ue_platform = targetPlatform dflags1
+ , ue_namever = ghcNameVersion dflags1
, ue_home_unit = Just home_unit
, ue_hpt = ue_hpt old_unit_env
, ue_eps = ue_eps old_unit_env
, ue_units = unit_state
, ue_unit_dbs = Just dbs
}
- modifySession $ \h -> h{ hsc_dflags = dflags'
+ modifySession $ \h -> h{ hsc_dflags = dflags1
, hsc_unit_env = unit_env
}
- else modifySession $ \h -> h{ hsc_dflags = dflags' }
+ else modifySession $ \h -> h{ hsc_dflags = dflags0 }
when invalidate_needed $ invalidateModSummaryCache
return changed