[Git][ghc/ghc][wip/jeltsch/improve-closure-property-check.global-unit-info-map] Reuse the UnitIndexCache after initialising multiple home units
Hannes Siebenhandl pushed to branch wip/jeltsch/improve-closure-property-check.global-unit-info-map at Glasgow Haskell Compiler / GHC Commits: 44ebfb87 by fendor at 2026-08-26T15:39:12+02:00 Reuse the UnitIndexCache after initialising multiple home units - - - - - 1 changed file: - compiler/GHC/Driver/Session/Units.hs Changes: ===================================== compiler/GHC/Driver/Session/Units.hs ===================================== @@ -145,8 +145,15 @@ initMulti unitArgsFiles lintDynFlagsAndSrcs = do checkUnitCycles initial_dflags home_unit_graph let dflags = homeUnitEnv_dflags $ HUG.unitEnv_lookup mainUnitId home_unit_graph - unitEnv <- assertUnitEnvInvariant <$> (liftIO $ initUnitEnv mainUnitId home_unit_graph (ghcNameVersion dflags) (targetPlatform dflags)) - let final_hsc_env = hsc_env { hsc_unit_env = unitEnv } + newUnitEnv <- do + env <- liftIO $ initUnitEnv mainUnitId home_unit_graph (ghcNameVersion dflags) (targetPlatform dflags) + -- We need to reuse the 'UnitIndexCache' as we used it above in 'initUnits'. + -- See Note [Sharing 'UnitInfo's across the 'UnitEnv'] why this must be shared. + pure $ assertUnitEnvInvariant $ env + { ue_uic = hscUIC hsc_env + } + + let final_hsc_env = hsc_env { hsc_unit_env = newUnitEnv } GHC.setSession final_hsc_env View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/44ebfb87150d73288987bb944a6ed11f... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/44ebfb87150d73288987bb944a6ed11f... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Hannes Siebenhandl (@fendor)