summaryrefslogtreecommitdiff
path: root/compiler/main/InteractiveEval.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/InteractiveEval.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/InteractiveEval.hs')
-rw-r--r--compiler/main/InteractiveEval.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
index 6ca5d24351..5d0d7e75f8 100644
--- a/compiler/main/InteractiveEval.hs
+++ b/compiler/main/InteractiveEval.hs
@@ -80,7 +80,6 @@ import MonadUtils
import Module
import PrelNames ( toDynName, pretendNameIsInScope )
import Panic
-import UniqFM
import Maybes
import ErrUtils
import SrcLoc
@@ -118,7 +117,7 @@ getHistoryModule = breakInfo_module . historyBreakInfo
getHistorySpan :: HscEnv -> History -> SrcSpan
getHistorySpan hsc_env History{..} =
let BreakInfo{..} = historyBreakInfo in
- case lookupUFM (hsc_HPT hsc_env) (moduleName breakInfo_module) of
+ case lookupHpt (hsc_HPT hsc_env) (moduleName breakInfo_module) of
Just hmi -> modBreaks_locs (getModBreaks hmi) ! breakInfo_number
_ -> panic "getHistorySpan"
@@ -137,7 +136,7 @@ getModBreaks hmi
findEnclosingDecls :: HscEnv -> BreakInfo -> [String]
findEnclosingDecls hsc_env (BreakInfo modl ix) =
let hmi = expectJust "findEnclosingDecls" $
- lookupUFM (hsc_HPT hsc_env) (moduleName modl)
+ lookupHpt (hsc_HPT hsc_env) (moduleName modl)
mb = getModBreaks hmi
in modBreaks_decls mb ! ix
@@ -308,7 +307,8 @@ handleRunStatus step expr bindings final_ids status history
= do
hsc_env <- getSession
let hmi = expectJust "handleRunStatus" $
- lookupUFM (hsc_HPT hsc_env) (mkUniqueGrimily mod_uniq)
+ lookupHptDirectly (hsc_HPT hsc_env)
+ (mkUniqueGrimily mod_uniq)
modl = mi_module (hm_iface hmi)
breaks = getModBreaks hmi
@@ -338,7 +338,8 @@ handleRunStatus step expr bindings final_ids status history
resume_ctxt_fhv <- liftIO $ mkFinalizedHValue hsc_env resume_ctxt
apStack_fhv <- liftIO $ mkFinalizedHValue hsc_env apStack_ref
let hmi = expectJust "handleRunStatus" $
- lookupUFM (hsc_HPT hsc_env) (mkUniqueGrimily mod_uniq)
+ lookupHptDirectly (hsc_HPT hsc_env)
+ (mkUniqueGrimily mod_uniq)
modl = mi_module (hm_iface hmi)
bp | is_exception = Nothing
| otherwise = Just (BreakInfo modl ix)
@@ -509,7 +510,7 @@ bindLocalsAtBreakpoint hsc_env apStack Nothing = do
bindLocalsAtBreakpoint hsc_env apStack_fhv (Just BreakInfo{..}) = do
let
hmi = expectJust "bindLocalsAtBreakpoint" $
- lookupUFM (hsc_HPT hsc_env) (moduleName breakInfo_module)
+ lookupHpt (hsc_HPT hsc_env) (moduleName breakInfo_module)
breaks = getModBreaks hmi
info = expectJust "bindLocalsAtBreakpoint2" $
IntMap.lookup breakInfo_number (modBreaks_breakInfo breaks)
@@ -738,7 +739,7 @@ availsToGlobalRdrEnv mod_name avails
mkTopLevEnv :: HomePackageTable -> ModuleName -> Either String GlobalRdrEnv
mkTopLevEnv hpt modl
- = case lookupUFM hpt modl of
+ = case lookupHpt hpt modl of
Nothing -> Left "not a home module"
Just details ->
case mi_globals (hm_iface details) of
@@ -758,7 +759,7 @@ moduleIsInterpreted :: GhcMonad m => Module -> m Bool
moduleIsInterpreted modl = withSession $ \h ->
if moduleUnitId modl /= thisPackage (hsc_dflags h)
then return False
- else case lookupUFM (hsc_HPT h) (moduleName modl) of
+ else case lookupHpt (hsc_HPT h) (moduleName modl) of
Just details -> return (isJust (mi_globals (hm_iface details)))
_not_a_home_module -> return False
@@ -950,7 +951,7 @@ showModule mod_summary =
isModuleInterpreted :: GhcMonad m => ModSummary -> m Bool
isModuleInterpreted mod_summary = withSession $ \hsc_env ->
- case lookupUFM (hsc_HPT hsc_env) (ms_mod_name mod_summary) of
+ case lookupHpt (hsc_HPT hsc_env) (ms_mod_name mod_summary) of
Nothing -> panic "missing linkable"
Just mod_info -> return (not obj_linkable)
where