diff options
-rw-r--r-- | compiler/GHC/Driver/Make/Upsweep.hs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/compiler/GHC/Driver/Make/Upsweep.hs b/compiler/GHC/Driver/Make/Upsweep.hs index 9e9f4b8238..782d4a2717 100644 --- a/compiler/GHC/Driver/Make/Upsweep.hs +++ b/compiler/GHC/Driver/Make/Upsweep.hs @@ -279,24 +279,24 @@ interpretBuildPlan hug mhmi_cache old_hpt plan = do -- which would retain all the result variables, preventing us from collecting them -- after they are no longer used. !build_deps = getDependencies direct_deps build_map - let build_action (hug, deps) = - withCurrentUnit (moduleGraphNodeUnitId mod) $ do + let !build_action = case mod of - InstantiationNode uid iu -> do + InstantiationNode uid iu -> \(hug, deps) -> withCurrentUnit (moduleGraphNodeUnitId mod) $ do executeInstantiationNode mod_idx n_mods hug uid iu return (Nothing, deps) - ModuleNode _build_deps ms -> do + ModuleNode _build_deps ms -> let !old_hmi = M.lookup (msKey ms) old_hpt rehydrate_mods = mapMaybe nodeKeyModName <$> rehydrate_nodes - hmi <- executeCompileNode mod_idx n_mods old_hmi hug rehydrate_mods ms - -- Write the HMI to an external cache (if one exists) - -- See Note [Caching HomeModInfo] - liftIO $ forM_ mhmi_cache $ \hmi_cache -> addHmiToCache hmi_cache hmi - -- This global MVar is incrementally modified in order to avoid having to - -- recreate the HPT before compiling each module which leads to a quadratic amount of work. - liftIO $ modifyMVar_ hug_var (return . addHomeModInfoToHug hmi) - return (Just hmi, addToModuleNameSet (moduleGraphNodeUnitId mod) (ms_mod_name ms) deps ) - LinkNode _nks uid -> do + in \(hug, deps) -> withCurrentUnit (moduleGraphNodeUnitId mod) $ do + hmi <- executeCompileNode mod_idx n_mods old_hmi hug rehydrate_mods ms + -- Write the HMI to an external cache (if one exists) + -- See Note [Caching HomeModInfo] + liftIO $ forM_ mhmi_cache $ \hmi_cache -> addHmiToCache hmi_cache hmi + -- This global MVar is incrementally modified in order to avoid having to + -- recreate the HPT before compiling each module which leads to a quadratic amount of work. + liftIO $ modifyMVar_ hug_var (return . addHomeModInfoToHug hmi) + return (Just hmi, addToModuleNameSet (moduleGraphNodeUnitId mod) (ms_mod_name ms) deps ) + LinkNode _nks uid -> \(hug, deps) -> withCurrentUnit (moduleGraphNodeUnitId mod) $ do executeLinkNode hug (mod_idx, n_mods) uid direct_deps return (Nothing, deps) |