Sigh, recompilation checking in --make mdoe has been badly broken for
well, probably ever.
The problem is that in GHCi mode there's a restriction on the use of
object files, namely that an object file may only depend on other
up-to-date object files in order to be up-to-date itself, because we
don't have support for linking object code to interpreted code.
Unfortunately we were applying this restriction to --make compilations
too, with the result that far too much recompilation was happening.
MERGE TO STABLE
-- Sort out which linkables we wish to keep in the unlinked image.
-- See getValidLinkables below for details.
(valid_old_linkables, new_linkables)
-- Sort out which linkables we wish to keep in the unlinked image.
-- See getValidLinkables below for details.
(valid_old_linkables, new_linkables)
- <- getValidLinkables ui1 mg2unsorted_names mg2_with_srcimps
+ <- getValidLinkables ghci_mode ui1
+ mg2unsorted_names mg2_with_srcimps
-- putStrLn (showSDoc (vcat [ppr valid_old_linkables, ppr new_linkables]))
-- putStrLn (showSDoc (vcat [ppr valid_old_linkables, ppr new_linkables]))
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- For each module (or SCC of modules), we take:
--
-- For each module (or SCC of modules), we take:
--
--
-- - the old linkable, otherwise (and if one is available).
--
--
-- - the old linkable, otherwise (and if one is available).
--
--- and we throw away the linkable if it is older than the source
--- file. We ignore the on-disk linkables unless all of the dependents
--- of this SCC also have on-disk linkables.
+-- and we throw away the linkable if it is older than the source file.
+-- In interactive mode, we also ignore the on-disk linkables unless
+-- all of the dependents of this SCC also have on-disk linkables (we
+-- can't have dynamically loaded objects that depend on interpreted
+-- modules in GHCi).
--
-- If a module has a valid linkable, then it may be STABLE (see below),
-- and it is classified as SOURCE UNCHANGED for the purposes of calling
--
-- If a module has a valid linkable, then it may be STABLE (see below),
-- and it is classified as SOURCE UNCHANGED for the purposes of calling
-- ToDo: this pass could be merged with the preUpsweep.
getValidLinkables
-- ToDo: this pass could be merged with the preUpsweep.
getValidLinkables
- :: [Linkable] -- old linkables
+ :: GhciMode
+ -> [Linkable] -- old linkables
-> [ModuleName] -- all home modules
-> [SCC ModSummary] -- all modules in the program, dependency order
-> IO ( [Linkable], -- still-valid linkables
[Linkable] -- new linkables we just found
)
-> [ModuleName] -- all home modules
-> [SCC ModSummary] -- all modules in the program, dependency order
-> IO ( [Linkable], -- still-valid linkables
[Linkable] -- new linkables we just found
)
-getValidLinkables old_linkables all_home_mods module_graph = do
- ls <- foldM (getValidLinkablesSCC old_linkables all_home_mods)
+getValidLinkables mode old_linkables all_home_mods module_graph = do
+ ls <- foldM (getValidLinkablesSCC mode old_linkables all_home_mods)
[] module_graph
return (partition_it ls [] [])
where
[] module_graph
return (partition_it ls [] [])
where
| otherwise = partition_it ls (l:valid) new
| otherwise = partition_it ls (l:valid) new
-getValidLinkablesSCC old_linkables all_home_mods new_linkables scc0
+getValidLinkablesSCC mode old_linkables all_home_mods new_linkables scc0
= let
scc = flattenSCC scc0
scc_names = map modSummaryName scc
= let
scc = flattenSCC scc0
scc_names = map modSummaryName scc
Nothing -> False
Just l -> isObjectLinkable l
Nothing -> False
Just l -> isObjectLinkable l
- objects_allowed = all has_object scc_allhomeimps
+ objects_allowed = mode == Batch || all has_object scc_allhomeimps