summaryrefslogtreecommitdiff
path: root/compiler/iface/BinIface.hs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-08-20 12:12:08 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-08-20 12:12:08 +0000
commit740618f2b7d822f53528d271ccfb617c8ce84c55 (patch)
treeff756fcb49ae44d8d2ecf9ee28440db9ea9526c3 /compiler/iface/BinIface.hs
parentb0758d03f1a00ab0adf57f8157602ef22e8cdd13 (diff)
downloadhaskell-740618f2b7d822f53528d271ccfb617c8ce84c55.tar.gz
Make -dynamic a proper way, so we read the .dyn_hi files
Also, I cleaned up some of the way-related infrastructure, removing two global variables. There's more that could be done here, but it's a start. The way flags probably don't need to be static any more.
Diffstat (limited to 'compiler/iface/BinIface.hs')
-rw-r--r--compiler/iface/BinIface.hs20
1 files changed, 11 insertions, 9 deletions
diff --git a/compiler/iface/BinIface.hs b/compiler/iface/BinIface.hs
index 26613267c1..f09ce4f7d2 100644
--- a/compiler/iface/BinIface.hs
+++ b/compiler/iface/BinIface.hs
@@ -58,12 +58,13 @@ readBinIface :: CheckHiWay -> TraceBinIFaceReading -> FilePath
-> TcRnIf a b ModIface
readBinIface checkHiWay traceBinIFaceReading hi_path = do
update_nc <- mkNameCacheUpdater
- liftIO $ readBinIface_ checkHiWay traceBinIFaceReading hi_path update_nc
+ dflags <- getDOpts
+ liftIO $ readBinIface_ dflags checkHiWay traceBinIFaceReading hi_path update_nc
-readBinIface_ :: CheckHiWay -> TraceBinIFaceReading -> FilePath
+readBinIface_ :: DynFlags -> CheckHiWay -> TraceBinIFaceReading -> FilePath
-> NameCacheUpdater (Array Int Name)
-> IO ModIface
-readBinIface_ checkHiWay traceBinIFaceReading hi_path update_nc = do
+readBinIface_ dflags checkHiWay traceBinIFaceReading hi_path update_nc = do
let printer :: SDoc -> IO ()
printer = case traceBinIFaceReading of
TraceBinIFaceReading -> \sd -> printSDoc sd defaultDumpStyle
@@ -105,7 +106,7 @@ readBinIface_ checkHiWay traceBinIFaceReading hi_path update_nc = do
errorOnMismatch "mismatched interface file versions" our_ver check_ver
check_way <- get bh
- way_descr <- getWayDescr
+ let way_descr = getWayDescr dflags
wantedGot "Way" way_descr check_way
when (checkHiWay == CheckHiWay) $
errorOnMismatch "mismatched interface file ways" way_descr check_way
@@ -144,7 +145,7 @@ writeBinIface dflags hi_path mod_iface = do
-- The version and way descriptor go next
put_ bh (show opt_HiVersion)
- way_descr <- getWayDescr
+ let way_descr = getWayDescr dflags
put_ bh way_descr
-- Remember where the symbol table pointer will go
@@ -448,10 +449,11 @@ instance Binary ModIface where
mi_fix_fn = mkIfaceFixCache fixities,
mi_hash_fn = mkIfaceHashCache decls })
-getWayDescr :: IO String
-getWayDescr = do
- tag <- readIORef v_Build_tag
- if cGhcUnregisterised == "YES" then return ('u':tag) else return tag
+getWayDescr :: DynFlags -> String
+getWayDescr dflags
+ | cGhcUnregisterised == "YES" = 'u':tag
+ | otherwise = tag
+ where tag = buildTag dflags
-- if this is an unregisterised build, make sure our interfaces
-- can't be used by a registerised build.