summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-05-05 16:13:21 -0700
committerDavid Terei <davidterei@gmail.com>2011-06-17 18:39:28 -0700
commit83dedf643d17959461478f25f30be5277636f0a3 (patch)
treeb5e0811c4a3d28a806c6173be7071e611e74e64a
parent3a8df61180ace3941ae3e680f4255b637a29ef05 (diff)
downloadhaskell-83dedf643d17959461478f25f30be5277636f0a3.tar.gz
SafeHaskell: Fix recompilation avoidance to take Safe into account.
-rw-r--r--compiler/iface/IfaceSyn.lhs2
-rw-r--r--compiler/iface/MkIface.lhs8
-rw-r--r--compiler/utils/Binary.hs9
3 files changed, 15 insertions, 4 deletions
diff --git a/compiler/iface/IfaceSyn.lhs b/compiler/iface/IfaceSyn.lhs
index 49fded9a59..21783813f8 100644
--- a/compiler/iface/IfaceSyn.lhs
+++ b/compiler/iface/IfaceSyn.lhs
@@ -341,7 +341,7 @@ and suppose we are compiling module X:
data T = ...
instance C S T where ...
-If we base the instance verion on T, I'm worried that changing S to S'
+If we base the instance version on T, I'm worried that changing S to S'
would change T's version, but not S or S'. But an importing module might
not depend on T, and so might not be recompiled even though the new instance
(C S' T) might be relevant. I have not been able to make a concrete example,
diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs
index a2d3eb1ba6..c2d740107a 100644
--- a/compiler/iface/MkIface.lhs
+++ b/compiler/iface/MkIface.lhs
@@ -298,8 +298,6 @@ mkIface_ hsc_env maybe_old_fingerprint
then return ( errs_and_warns, Nothing )
else do {
--- XXX ; when (dopt Opt_D_dump_hi_diffs dflags) (printDump pp_diffs)
-
-- Debug printing
; dumpIfSet_dyn dflags Opt_D_dump_hi "FINAL INTERFACE"
(pprModIface new_iface)
@@ -520,9 +518,13 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls
(mi_exports iface0,
orphan_hash,
dep_orphan_hashes,
- dep_pkgs (mi_deps iface0))
+ dep_pkgs (mi_deps iface0),
-- dep_pkgs: see "Package Version Changes" on
-- wiki/Commentary/Compiler/RecompilationAvoidance
+ mi_trust iface0)
+ -- TODO: Can probably make more fine grained. Only
+ -- really need to have recompilation for overlapping
+ -- instances.
-- put the declarations in a canonical order, sorted by OccName
let sorted_decls = Map.elems $ Map.fromList $
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index 3785957966..1981dc8428 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -435,6 +435,15 @@ instance (Binary a, Binary b, Binary c, Binary d) => Binary (a,b,c,d) where
d <- get bh
return (a,b,c,d)
+instance (Binary a, Binary b, Binary c, Binary d, Binary e) => Binary (a,b,c,d, e) where
+ put_ bh (a,b,c,d, e) = do put_ bh a; put_ bh b; put_ bh c; put_ bh d; put_ bh e;
+ get bh = do a <- get bh
+ b <- get bh
+ c <- get bh
+ d <- get bh
+ e <- get bh
+ return (a,b,c,d,e)
+
instance Binary a => Binary (Maybe a) where
put_ bh Nothing = putByte bh 0
put_ bh (Just a) = do putByte bh 1; put_ bh a