[Git][ghc/ghc][wip/gdc-files] force loading of interface

Matthew Pickering pushed to branch wip/gdc-files at Glasgow Haskell Compiler / GHC Commits: 3f9b2c96 by Matthew Pickering at 2025-08-21T13:13:33+01:00 force loading of interface - - - - - 2 changed files: - compiler/GHC/HsToCore/Usage.hs - compiler/GHC/Linker/Loader.hs Changes: ===================================== compiler/GHC/HsToCore/Usage.hs ===================================== @@ -187,9 +187,7 @@ mkObjectUsage pit plugins fc hug th_links_needed th_pkgs_needed = do -- home package ifaces in the PIT. miface <- lookupIfaceByModule hug pit m case miface of - -- TODO: MP: This is wrong, a placeholder for now. - -- We need to work out what to do for bytecode linkables which are not loaded into HPT - Nothing -> return $ UsageHomeModuleInterface (moduleName m) (toUnitId $ moduleUnit m) fingerprint0 + Nothing -> pprPanic "linkableToUsage" (ppr m) Just iface -> return $ UsageHomeModuleInterface (moduleName m) (toUnitId $ moduleUnit m) (mi_iface_hash iface) ===================================== compiler/GHC/Linker/Loader.hs ===================================== @@ -647,12 +647,17 @@ findWholeCoreBindings hsc_env mod = do findBytecodeLinkableMaybe :: HscEnv -> Module -> ModLocation -> IO (Maybe Linkable) -findBytecodeLinkableMaybe hsc_env _mod locn = do +findBytecodeLinkableMaybe hsc_env mod locn = do let bytecode_fn = ml_bytecode_file locn maybe_bytecode_time <- modificationTimeIfExists bytecode_fn case maybe_bytecode_time of Nothing -> return Nothing Just bytecode_time -> do + -- Also load the interface, for reasons to do with recompilation avoidance. + -- See Note [Recompilation avoidance with bytecode objects] + _ <- initIfaceLoad hsc_env $ + loadInterface (text "get_reachable_nodes" <+> parens (ppr mod)) + mod ImportBySystem bco <- readBinByteCode hsc_env bytecode_fn Just <$> loadByteCodeObjectLinkable hsc_env bytecode_time locn bco View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3f9b2c96766fa2784dc358fec76f1326... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3f9b2c96766fa2784dc358fec76f1326... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Matthew Pickering (@mpickering)