X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fiface%2FMkIface.lhs;h=e569c4756f0865645ed76dfc5086ce061f360f8c;hb=362e638ed31492d936a7039d90dc8d1db286944c;hp=3c33647201dd34b582f4ba3f441ce9b0bc098c82;hpb=89cc39884310a8d1d60681a9c64f89f17848f17e;p=ghc-hetmet.git diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs index 3c33647..e569c47 100644 --- a/compiler/iface/MkIface.lhs +++ b/compiler/iface/MkIface.lhs @@ -131,7 +131,7 @@ We produce a line for every module B below the module, A, currently being compiled: import B ; to record the fact that A does import B indirectly. This is used to decide -to look to look for B.hi rather than B.hi-boot when compiling a module that +to look for B.hi rather than B.hi-boot when compiling a module that imports A. This line says that A imports B, but uses nothing in it. So we'll get an early bale-out when compiling A if B's version changes. @@ -181,6 +181,10 @@ code of A, and thereby haul in all the stuff reachable from it. haul in all the unfoldings for B, in case the module that imports A *is* compiled with -O. I think this is the case.] +SimonM [30/11/2007]: I believe the above is all out of date; the +current implementation doesn't do it this way. Instead, when any of +the dependencies of a declaration changes, the version of the +declaration itself changes. \begin{code} #include "HsVersions.h" @@ -409,7 +413,7 @@ mkIface_ hsc_env maybe_old_iface mi_fix_fn = mkIfaceFixCache fixities } -- Add version information - ; ext_ver_fn = mkParentVerFun hsc_env eps + ; ext_ver_fn = mkParentVerFun hsc_env eps ; (new_iface, no_change_at_all, pp_diffs, pp_orphs) = {-# SCC "versioninfo" #-} addVersionInfo ext_ver_fn maybe_old_iface @@ -704,15 +708,23 @@ computeChangedOccs ver_fn this_module old_usages eq_info -- return True if an external name has changed name_changed :: Name -> Bool name_changed nm - | Just ents <- lookupUFM usg_modmap (moduleName mod) - = case lookupUFM ents parent_occ of - Nothing -> pprTrace "WARNING: computeChangedOccs" (ppr nm) $ False - Just v -> v < new_version + | isWiredInName nm -- Wired-in things don't get into interface + = False -- files and hence don't get into the ver_fn + | Just ents <- lookupUFM usg_modmap (moduleName mod), + Just v <- lookupUFM ents parent_occ + = v < new_version + | modulePackageId mod == this_pkg + = WARN(True, ptext SLIT("computeChangedOccs") <+> ppr nm) True + -- should really be a panic, see #1959. The problem is that the usages doesn't + -- contain all the names that might be referred to by unfoldings. So as a + -- conservative workaround we just assume these names have changed. | otherwise = False -- must be in another package where mod = nameModule nm (parent_occ, new_version) = ver_fn nm + this_pkg = modulePackageId this_module + -- Turn the usages from the old ModIface into a mapping usg_modmap = listToUFM [ (usg_name usg, listToUFM (usg_entities usg)) | usg <- old_usages ] @@ -749,6 +761,11 @@ computeChangedOccs ver_fn this_module old_usages eq_info type OccIfaceEq = GenIfaceEq OccSet +instance Outputable OccIfaceEq where + ppr Equal = ptext SLIT("Equal") + ppr NotEqual = ptext SLIT("NotEqual") + ppr (EqBut occset) = ptext SLIT("EqBut") <+> ppr (occSetElts occset) + changedWrt :: OccSet -> OccIfaceEq -> Bool changedWrt so_far Equal = False changedWrt so_far NotEqual = True