Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : ghc-7.4

http://hackage.haskell.org/trac/ghc/changeset/09a4cfcd3ba808dae6777ec6554a92658548ee0b

>---------------------------------------------------------------

commit 09a4cfcd3ba808dae6777ec6554a92658548ee0b
Author: Simon Marlow <[email protected]>
Date:   Thu Feb 16 09:34:43 2012 +0000

    Be less conservative about recompiling after changes to -main-is (#5878)
    
    MERGED from commits eda2c7316883e7d107755c08ad696e669ead0447 and
    444e2fedb951a94a289d909b843f3281b9d2dc0a

>---------------------------------------------------------------

 compiler/iface/FlagChecker.hs |    8 +++++---
 compiler/iface/MkIface.lhs    |    6 ++++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/compiler/iface/FlagChecker.hs b/compiler/iface/FlagChecker.hs
index 5e4a709..9398b6c 100644
--- a/compiler/iface/FlagChecker.hs
+++ b/compiler/iface/FlagChecker.hs
@@ -10,6 +10,7 @@ import Binary
 import BinIface ()
 import DynFlags
 import HscTypes
+import Module
 import Name
 import Fingerprint
 -- import Outputable
@@ -21,11 +22,12 @@ import System.FilePath (normalise)
 -- | Produce a fingerprint of a @DynFlags@ value. We only base
 -- the finger print on important fields in @DynFlags@ so that
 -- the recompilation checker can use this fingerprint.
-fingerprintDynFlags :: DynFlags -> (BinHandle -> Name -> IO ())
+fingerprintDynFlags :: DynFlags -> Module -> (BinHandle -> Name -> IO ())
                     -> IO Fingerprint
 
-fingerprintDynFlags DynFlags{..} nameio =
-    let mainis   = (mainModIs, mainFunIs)
+fingerprintDynFlags DynFlags{..} this_mod nameio =
+    let mainis   = if mainModIs == this_mod then Just mainFunIs else Nothing
+                      -- see #5878
         -- pkgopts  = (thisPackage dflags, sort $ packageFlags dflags)
         safeHs   = setSafeMode safeHaskell
         -- oflags   = sort $ filter filterOFlags $ flags dflags
diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs
index 8b5b665..0c76d6e 100644
--- a/compiler/iface/MkIface.lhs
+++ b/compiler/iface/MkIface.lhs
@@ -583,7 +583,7 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls
    --   - (some of) dflags
    -- it returns two hashes, one that shouldn't change
    -- the abi hash and one that should
-   flag_hash <- fingerprintDynFlags dflags putNameLiterally
+   flag_hash <- fingerprintDynFlags dflags this_mod putNameLiterally
 
    -- the ABI hash depends on:
    --   - decls
@@ -1208,7 +1208,9 @@ checkVersions hsc_env mod_summary iface
 checkFlagHash :: HscEnv -> ModIface -> IfG RecompileRequired
 checkFlagHash hsc_env iface = do
     let old_hash = mi_flag_hash iface
-    new_hash <- liftIO $ fingerprintDynFlags (hsc_dflags hsc_env) 
putNameLiterally
+    new_hash <- liftIO $ fingerprintDynFlags (hsc_dflags hsc_env)
+                                             (mi_module iface)
+                                             putNameLiterally
     case old_hash == new_hash of
         True  -> up_to_date (ptext $ sLit "Module flags unchanged")
         False -> out_of_date_hash (ptext $ sLit "  Module flags have changed")



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to