
Torsten Schmits pushed to branch wip/torsten.schmits/worker-debug at Glasgow Haskell Compiler / GHC Commits: 66de4a3a by Torsten Schmits at 2025-06-13T16:11:51+02:00 Link package DB bytecode in make mode - - - - - 1 changed file: - compiler/GHC/Linker/Deps.hs Changes: ===================================== compiler/GHC/Linker/Deps.hs ===================================== @@ -156,9 +156,10 @@ get_link_deps opts pls maybe_normal_osuf span mods = do listToUDFM [(moduleName (mi_module (hm_iface m)), m) | m <- mmods] link_libs = uniqDSetToList (unionManyUniqDSets (init_pkg_set : pkgs)) + deps <- oneshot_deps opts link_libs pure $ LinkModules (LinkHomeModule <$> link_mods) : - (LinkLibrary <$> link_libs) + deps -- This code is used in `--make` mode to calculate the home package and unit dependencies -- for a set of modules. @@ -168,15 +169,15 @@ get_link_deps opts pls maybe_normal_osuf span mods = do -- It is also a matter of correctness to use the module graph so that dependencies between home units -- is resolved correctly. - make_deps_loop :: (UniqDSet UnitId, Set.Set NodeKey) -> [ModNodeKeyWithUid] -> (UniqDSet UnitId, Set.Set NodeKey) + make_deps_loop :: (UniqDSet Module, Set.Set NodeKey) -> [ModNodeKeyWithUid] -> (UniqDSet Module, Set.Set NodeKey) make_deps_loop found [] = found make_deps_loop found@(found_units, found_mods) (nk:nexts) | NodeKey_Module nk `Set.member` found_mods = make_deps_loop found nexts | otherwise = case fmap mkNodeKey <$> mgReachable mod_graph (NodeKey_Module nk) of Nothing -> - let (ModNodeKeyWithUid _ uid) = nk - in make_deps_loop (addOneToUniqDSet found_units uid, found_mods) nexts + let (ModNodeKeyWithUid GWIB {gwib_mod} uid) = nk + in make_deps_loop (addOneToUniqDSet found_units (Module (RealUnit (Definite uid)) gwib_mod), found_mods) nexts Just trans_deps -> let deps = Set.insert (NodeKey_Module nk) (Set.fromList trans_deps) -- See #936 and the ghci.prog007 test for why we have to continue traversing through @@ -195,7 +196,7 @@ get_link_deps opts pls maybe_normal_osuf span mods = do let iface = hm_iface hmi case mi_hsc_src iface of HsBootFile -> throwProgramError opts $ link_boot_mod_error (mi_module iface) - _ -> pure (mkUniqDSet $ Set.toList $ dep_direct_pkgs (mi_deps iface), hmi) + _ -> pure ( mkUniqDSet $ [usg_mod | UsagePackageModule {usg_mod} <- mi_usages iface], hmi) Nothing -> throwProgramError opts $ text "getLinkDeps: Home module not loaded" <+> ppr (gwib_mod gwib) <+> ppr uid View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66de4a3ad9b15d48c86c69269ba27963... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66de4a3ad9b15d48c86c69269ba27963... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Torsten Schmits (@torsten.schmits)