From: simonmar Date: Thu, 12 Aug 2004 11:19:44 +0000 (+0000) Subject: [project @ 2004-08-12 11:19:39 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~1755 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=6c06a48bba9bd87d8ca382e19a511ce4c93ca46d;hp=af621730109cadcb693063ac82ee2e0765b8bbe4;p=ghc-hetmet.git [project @ 2004-08-12 11:19:39 by simonmar] Take the timestamp of an interpreted linkable from the timestamp of the source file. This works better when the local clock is out of sync with the filesystem, and it's just as accurate. --- diff --git a/ghc/compiler/compMan/CompManager.lhs b/ghc/compiler/compMan/CompManager.lhs index 82183f1..e645cf2 100644 --- a/ghc/compiler/compMan/CompManager.lhs +++ b/ghc/compiler/compMan/CompManager.lhs @@ -948,7 +948,8 @@ upsweep_mod hsc_env oldUI summary1 reachable_inc_me | otherwise = False compresult <- compile hsc_env_strictDC this_mod location - source_unchanged have_object mb_old_iface + (ms_hs_date summary1) + source_unchanged have_object mb_old_iface case compresult of diff --git a/ghc/compiler/main/DriverPipeline.hs b/ghc/compiler/main/DriverPipeline.hs index 4521e34..072978a 100644 --- a/ghc/compiler/main/DriverPipeline.hs +++ b/ghc/compiler/main/DriverPipeline.hs @@ -52,9 +52,7 @@ import ParserCoreUtils ( getCoreModuleName ) import EXCEPTION import DATA_IOREF ( readIORef, writeIORef ) -#ifdef GHCI -import Time ( getClockTime ) -#endif +import Time ( ClockTime ) import Directory import System import IO @@ -99,6 +97,7 @@ preprocess filename = compile :: HscEnv -> Module -> ModLocation + -> ClockTime -- timestamp of original source file -> Bool -- True <=> source unchanged -> Bool -- True <=> have object -> Maybe ModIface -- old interface, if available @@ -116,7 +115,7 @@ data CompResult | CompErrs -compile hsc_env this_mod location +compile hsc_env this_mod location src_timestamp source_unchanged have_object old_iface = do @@ -182,8 +181,13 @@ compile hsc_env this_mod location HscInterpreted -> case maybe_interpreted_code of #ifdef GHCI - Just comp_bc -> do tm <- getClockTime - return ([BCOs comp_bc], tm) + Just comp_bc -> return ([BCOs comp_bc], src_timestamp) + -- Why do we use the timestamp of the source file here, + -- rather than the current time? This works better in + -- the case where the local clock is out of sync + -- with the filesystem's clock. It's just as accurate: + -- if the source is modified, then the linkable will + -- be out of date. #endif Nothing -> panic "compile: no interpreted code"