summaryrefslogtreecommitdiff
path: root/compiler/main/GHC.hs
diff options
context:
space:
mode:
authorBartosz Nitka <niteria@gmail.com>2016-06-06 02:10:07 -0700
committerBartosz Nitka <niteria@gmail.com>2016-06-06 02:11:04 -0700
commit3042a9d8d55b4706d2ce366fee1712c7357d5a00 (patch)
tree3d8af3dd805288bbca7097a100acdb28949e4b2c /compiler/main/GHC.hs
parentf91d87df889fb612183b8f2d42b29d2edd7c1dbc (diff)
downloadhaskell-3042a9d8d55b4706d2ce366fee1712c7357d5a00.tar.gz
Use UniqDFM for HomePackageTable
This isn't strictly necessary for deterministic ABIs. The results of eltsHpt are consumed in two ways: 1) they determine the order of linking 2) if you track the data flow all the family instances get put in FamInstEnvs, so the nondeterministic order is forgotten. 3) same for VectInfo stuff 4) same for Annotations The problem is that I haven't found a nice way to do 2. in a local way and 1. is nice to have if we went for deterministic object files. Besides these maps are keyed on ModuleNames so they should be small relative to other things and the overhead should be negligible. As a bonus we also get more specific names. Test Plan: ./validate Reviewers: bgamari, austin, hvr, ezyang, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2300 GHC Trac Issues: #4012
Diffstat (limited to 'compiler/main/GHC.hs')
-rw-r--r--compiler/main/GHC.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index 0105607ffb..40aa7dfa01 100644
--- a/compiler/main/GHC.hs
+++ b/compiler/main/GHC.hs
@@ -329,7 +329,6 @@ import StaticFlags
import SysTools
import Annotations
import Module
-import UniqFM
import Panic
import Platform
import Bag ( unitBag )
@@ -943,7 +942,7 @@ loadModule tcm = do
hsc_env ms 1 1 Nothing mb_linkable
source_modified
- modifySession $ \e -> e{ hsc_HPT = addToUFM (hsc_HPT e) mod mod_info }
+ modifySession $ \e -> e{ hsc_HPT = addToHpt (hsc_HPT e) mod mod_info }
return tcm
@@ -1058,7 +1057,7 @@ needsTemplateHaskell ms =
-- | Return @True@ <==> module is loaded.
isLoaded :: GhcMonad m => ModuleName -> m Bool
isLoaded m = withSession $ \hsc_env ->
- return $! isJust (lookupUFM (hsc_HPT hsc_env) m)
+ return $! isJust (lookupHpt (hsc_HPT hsc_env) m)
-- | Return the bindings for the current interactive session.
getBindings :: GhcMonad m => m [TyThing]
@@ -1134,7 +1133,7 @@ getPackageModuleInfo _hsc_env _mdl = do
getHomeModuleInfo :: HscEnv -> Module -> IO (Maybe ModuleInfo)
getHomeModuleInfo hsc_env mdl =
- case lookupUFM (hsc_HPT hsc_env) (moduleName mdl) of
+ case lookupHpt (hsc_HPT hsc_env) (moduleName mdl) of
Nothing -> return Nothing
Just hmi -> do
let details = hm_details hmi
@@ -1419,7 +1418,7 @@ lookupModule mod_name Nothing = withSession $ \hsc_env -> do
lookupLoadedHomeModule :: GhcMonad m => ModuleName -> m (Maybe Module)
lookupLoadedHomeModule mod_name = withSession $ \hsc_env ->
- case lookupUFM (hsc_HPT hsc_env) mod_name of
+ case lookupHpt (hsc_HPT hsc_env) mod_name of
Just mod_info -> return (Just (mi_module (hm_iface mod_info)))
_not_a_home_module -> return Nothing