summaryrefslogtreecommitdiff
path: root/ghc/compiler/compMan/CompManager.lhs
diff options
context:
space:
mode:
authorsimonmar <unknown>2001-03-01 14:26:01 +0000
committersimonmar <unknown>2001-03-01 14:26:01 +0000
commit18b24e64d6a9e3011a2437cec87ef09ad3e6f900 (patch)
treee0841079a2a21aa940cd09ce1b37941864f0c616 /ghc/compiler/compMan/CompManager.lhs
parent6ae3188bfc73775a857ecf600a8c16408cb2cadf (diff)
downloadhaskell-18b24e64d6a9e3011a2437cec87ef09ad3e6f900.tar.gz
[project @ 2001-03-01 14:26:00 by simonmar]
GHCi fixes: - expressions are now compiled in a pseudo-module "$Interactive", which avoids some problems with storage of demand-loaded declarations. - compilation manager now detects when it needs to read the interace for a module, even if it is already compiled. GHCi never demand-loads interfaces now. - (from Simon PJ) fix a problem with the recompilation checker, which meant that modules were sometimes not recompiled when they should have been. - ByteCodeGen/Link: move linker related stuff into ByteCodeLink.
Diffstat (limited to 'ghc/compiler/compMan/CompManager.lhs')
-rw-r--r--ghc/compiler/compMan/CompManager.lhs39
1 files changed, 21 insertions, 18 deletions
diff --git a/ghc/compiler/compMan/CompManager.lhs b/ghc/compiler/compMan/CompManager.lhs
index 8d711b20a1..4b41fe5e9a 100644
--- a/ghc/compiler/compMan/CompManager.lhs
+++ b/ghc/compiler/compMan/CompManager.lhs
@@ -50,8 +50,7 @@ import VarEnv ( emptyTidyEnv )
import HscTypes
import HscMain ( initPersistentCompilerState )
import Finder
-import UniqFM ( lookupUFM, addToUFM, delListFromUFM,
- UniqFM, listToUFM )
+import UniqFM
import Unique ( Uniquable )
import Digraph ( SCC(..), stronglyConnComp, flattenSCC )
import DriverFlags ( getDynFlags )
@@ -233,7 +232,7 @@ cmTypeOfExpr cmstate dflags expr
case names of
[name] -> do maybe_tystr <- cmTypeOfName new_cmstate name
return (new_cmstate, maybe_tystr)
- _other -> pprPanic "cmTypeOfExpr" (ppr names)
+ _other -> return (new_cmstate, Nothing)
#endif
-----------------------------------------------------------------------------
@@ -347,9 +346,6 @@ cmLoadModule cmstate1 rootname
let ghci_mode = gmode cmstate1 -- this never changes
-- Do the downsweep to reestablish the module graph
- -- then generate version 2's by retaining in HIT,HST,UI a
- -- stable set S of modules, as defined below.
-
dflags <- getDynFlags
let verb = verbosity dflags
@@ -387,8 +383,8 @@ cmLoadModule cmstate1 rootname
-- 1. All home imports of ms are either in ms or S
-- 2. A valid linkable exists for each module in ms
- stable_mods
- <- preUpsweep valid_linkables mg2unsorted_names [] mg2_with_srcimps
+ stable_mods <- preUpsweep valid_linkables hit1
+ mg2unsorted_names [] mg2_with_srcimps
let stable_summaries
= concatMap (findInSummaries mg2unsorted) stable_mods
@@ -585,10 +581,6 @@ getValidLinkable :: [Linkable] -> Bool -> [Linkable] -> ModSummary
getValidLinkable old_linkables objects_allowed new_linkables summary
= do let mod_name = name_of_summary summary
- -- we only look for objects on disk the first time around;
- -- if the user compiles a module on the side during a GHCi session,
- -- it won't be picked up until the next ":load". This is what the
- -- "null old_linkables" test below is.
maybe_disk_linkable
<- if (not objects_allowed)
then return Nothing
@@ -612,6 +604,10 @@ getValidLinkable old_linkables objects_allowed new_linkables summary
Nothing -> False
Just l_disk -> linkableTime l == linkableTime l_disk
+ -- we only look for objects on disk the first time around;
+ -- if the user compiles a module on the side during a GHCi session,
+ -- it won't be picked up until the next ":load". This is what the
+ -- "null old_linkables" test below is.
linkable | null old_linkables = maybeToList maybe_disk_linkable
| otherwise = maybeToList maybe_old_linkable
@@ -647,14 +643,20 @@ maybe_getFileLinkable mod_name obj_fn
-- Do a pre-upsweep without use of "compile", to establish a
-- (downward-closed) set of stable modules for which we won't call compile.
+-- a stable module:
+-- * has a valid linkable (see getValidLinkables above)
+-- * depends only on stable modules
+-- * has an interface in the HIT (interactive mode only)
+
preUpsweep :: [Linkable] -- new valid linkables
+ -> HomeIfaceTable
-> [ModuleName] -- names of all mods encountered in downsweep
-> [ModuleName] -- accumulating stable modules
-> [SCC ModSummary] -- scc-ified mod graph, including src imps
-> IO [ModuleName] -- stable modules
-preUpsweep valid_lis all_home_mods stable [] = return stable
-preUpsweep valid_lis all_home_mods stable (scc0:sccs)
+preUpsweep valid_lis hit all_home_mods stable [] = return stable
+preUpsweep valid_lis hit all_home_mods stable (scc0:sccs)
= do let scc = flattenSCC scc0
scc_allhomeimps :: [ModuleName]
scc_allhomeimps
@@ -672,14 +674,15 @@ preUpsweep valid_lis all_home_mods stable (scc0:sccs)
= isJust (findModuleLinkable_maybe valid_lis modname)
where modname = name_of_summary new_summary
+ has_interface summary = ms_mod summary `elemUFM` hit
+
scc_is_stable = all_imports_in_scc_or_stable
&& all has_valid_linkable scc
+ && all has_interface scc
if scc_is_stable
- then preUpsweep valid_lis all_home_mods (scc_names++stable) sccs
- else preUpsweep valid_lis all_home_mods stable sccs
-
- where
+ then preUpsweep valid_lis hit all_home_mods (scc_names++stable) sccs
+ else preUpsweep valid_lis hit all_home_mods stable sccs
-- Helper for preUpsweep. Assuming that new_summary's imports are all