summaryrefslogtreecommitdiff
path: root/compiler/iface
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-12-11 20:41:18 +0000
committerIan Lynagh <ian@well-typed.com>2012-12-11 22:35:28 +0000
commitbd8f7fc56b84369f4e820263c0bcdc85760de6d4 (patch)
tree048f5a1b92979a599c5e2974e66639325ceaf6df /compiler/iface
parent8685535cfdfc68223162070c50d604072c3213b7 (diff)
downloadhaskell-bd8f7fc56b84369f4e820263c0bcdc85760de6d4.tar.gz
Implement the -dynamic-too optimised path for the NCG
We don't yet have the slow path, for when we have to fall back to separate compilation. We also only currently handle the case qhere we're compiling Haskell code with the NCG.
Diffstat (limited to 'compiler/iface')
-rw-r--r--compiler/iface/LoadIface.lhs28
-rw-r--r--compiler/iface/MkIface.lhs5
2 files changed, 15 insertions, 18 deletions
diff --git a/compiler/iface/LoadIface.lhs b/compiler/iface/LoadIface.lhs
index 2c36fa97f1..783a0e946c 100644
--- a/compiler/iface/LoadIface.lhs
+++ b/compiler/iface/LoadIface.lhs
@@ -558,22 +558,20 @@ findAndReadIface doc_str mod hi_boot_file
-- Don't forget to fill in the package name...
checkBuildDynamicToo (Succeeded (iface, filePath)) = do
dflags <- getDynFlags
- when (gopt Opt_BuildDynamicToo dflags) $ do
+ whenGeneratingDynamicToo dflags $ withDoDynamicToo $ do
let ref = canGenerateDynamicToo dflags
- b <- liftIO $ readIORef ref
- when b $ withDoDynamicToo $ do
- let dynFilePath = replaceExtension filePath (dynHiSuf dflags)
- r <- read_file dynFilePath
- case r of
- Succeeded (dynIface, _)
- | mi_mod_hash iface == mi_mod_hash dynIface ->
- return ()
- | otherwise ->
- do traceIf (text "Dynamic hash doesn't match")
- liftIO $ writeIORef ref False
- Failed err ->
- do traceIf (text "Failed to load dynamic interface file:" $$ err)
- liftIO $ writeIORef ref False
+ dynFilePath = replaceExtension filePath (dynHiSuf dflags)
+ r <- read_file dynFilePath
+ case r of
+ Succeeded (dynIface, _)
+ | mi_mod_hash iface == mi_mod_hash dynIface ->
+ return ()
+ | otherwise ->
+ do traceIf (text "Dynamic hash doesn't match")
+ liftIO $ writeIORef ref False
+ Failed err ->
+ do traceIf (text "Failed to load dynamic interface file:" $$ err)
+ liftIO $ writeIORef ref False
checkBuildDynamicToo _ = return ()
\end{code}
diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs
index c410cd770f..74a5acdeaa 100644
--- a/compiler/iface/MkIface.lhs
+++ b/compiler/iface/MkIface.lhs
@@ -387,11 +387,10 @@ mkIface_ hsc_env maybe_old_fingerprint
}
-----------------------------
-writeIfaceFile :: DynFlags -> ModLocation -> ModIface -> IO ()
-writeIfaceFile dflags location new_iface
+writeIfaceFile :: DynFlags -> FilePath -> ModIface -> IO ()
+writeIfaceFile dflags hi_file_path new_iface
= do createDirectoryIfMissing True (takeDirectory hi_file_path)
writeBinIface dflags hi_file_path new_iface
- where hi_file_path = ml_hi_file location
-- -----------------------------------------------------------------------------