[GHC] #14769: The RecompBecause [TH] check is not resume-build-safe
GHC
ghc-devs at haskell.org
Thu Feb 8 08:56:18 UTC 2018
#14769: The RecompBecause [TH] check is not resume-build-safe
-------------------------------------+-------------------------------------
Reporter: nh2 | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: #481 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonmar):
The relevant bit of code is this in HscMain:
{{{
-- If the module used TH splices when it was last
-- compiled, then the recompilation check is not
-- accurate enough (#481) and we must ignore
-- it. However, if the module is stable (none of
-- the modules it depends on, directly or
-- indirectly, changed), then we *can* skip
-- recompilation. This is why the SourceModified
-- type contains SourceUnmodifiedAndStable, and
-- it's pretty important: otherwise ghc --make
-- would always recompile TH modules, even if
-- nothing at all has changed. Stability is just
-- the same check that make is doing for us in
-- one-shot mode.
case m_tc_result of
Nothing
| mi_used_th iface && not stable ->
compile mb_old_hash (RecompBecause "TH")
_ ->
skip iface
}}}
I think the `&& not stable` is wrong. After interrupting the first
compilation, the second compilation finds some modules to be stable and
this overrides the TH check.
Unfortunately if we just delete this condition, then TH will cause a *lot*
of recompilation. Just re-running `ghc --make` on something you just
recompiled will recompile all the TH modules and everything that depends
on them.
The stable check was always a bit of a hack though, to get around the fact
that we don't have the information we really need, which is "did the
object file change". Perhaps we just need to be more clever and store
hashes of object files as dependencies when we're using TH.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14769#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list