Implement "fat" interface files which can be directly compiled without source
|Reported by:||ezyang||Owned by:||ezyang|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
Description (last modified by )
A fat interface file is like a normal hi file, but with extra information so that GHC can *recompile* the associated module without having to parse, rename and typecheck the source code again. The proposed command-line interface is something like (subject to bikeshedding):
ghc -c A.hs -fno-code -fwrite-buildable-interface # produces a .hi-build file, then ghc -c A.hi-build # completes building, as if ghc -c A.hs had been called
The primary motivation for this is to support partially compiling indefinite packages, which cannot be compiled to object code due to the fact that some of the dependencies haven't been provided yet. However, there are some other cases where this might be useful:
- Supercompilation requires having the source of all bindings, buildable interfaces can make this information available, even beyond what storing inlinings might provide
- A buildable interface file can be used to build variants of a source, e.g. profiling and optimization, even "on the fly" by GHC if necessary.
- GHCi can take advantage of information from buildable interface files to give more detailed information about otherwise "compiled" modules
And maybe more we haven't thought of yet.
Note: we DO run the desugarer before we write out the buildable interface (so we are essentially serializing a
ModGuts, not a
TcGblEnv). This does mean that you can't rebuild a buildable interface with hpc (that's done during desugaring) but that seems like a small price to pay.
Question: should we tidy the Core bindings before serializing them out? This is only relevant for determining if
A.hi files need to be rebuilt if
A.hi-build changes: if we can avoid needless churn on
A.hi files may not need to be rebuilt. However, we'd have to be pretty bang-on certain that the extra tidying phase wouldn't cause change in how we end up compiling things, which is unclear because tidying will drop things that might have been profitable during simplification, but are no longer profitable now. So the answer is probably no.
Change History (27)
comment:5 Changed 19 months ago by
|Summary:||Implement "buildable" interface files which can be directly compiled without source → Implement "fat" interface files which can be directly compiled without source|