-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement fat interfaces, which can resume compilation. (#10871)
This commit implements fat interfaces files, which are like normal interface files except that they can be typechecked into a ModGuts instead of a ModDetails, and then properly simplified and code generated. In effect, fat interface files define an IR that has been renamed and typechecked, but not compiled. There are a few ways to use this: - -fwrite-fat-interface causes GHC to write out the fat interface file during compilation. Use it with -fno-code to just parse, typecheck, and desugar, and halt compilation. - One-shot compilation can take an fat interface file as an input, and finish compilation. NB: you must ensure that the import path does NOT include the directory that contains the fat interface files, or GHC will work strangely. - We also support --make compilation of a set of fat interface files, but you have to pass the -ffrom-fat-interface so that finder looks for hi files rather than hs files to compile. In both "compile fat interface" scenarios, it's highly recommended you set a distinct --outputdir, so as to not clobber the existing fat interface files. There are a large number of bits and bobs, but here are the highlights: - To make it easier to test, we've implemented a debugging only mode -fvia-fat-interface, which takes the output of the desugarer and sucks it through a fat interface, before continuing compilation. This is useful for catching bugs in the serialization process. There's a new testing way 'viafat' which applies this flag; there are a few tests which unconditionally test this way and you can run the entire test suite this way using WAY=viafat. - We taught MkIface how to serialize SpecInfos. - New IfaceDecl, an IfaceBinding, which is similar to an IfaceId; however, we can have IfaceBindings for local, unexported names, we save a different set of IdInfo, and finally there is always an unfolding present 'idRhs'. - There's a hack to deal with the root main name main::Main.main, which needs to be serialized (since we will code gen it.) - Computation of usage info has been pushed up to the desugarer, so that we don't need to serialize the components of this. A number of fields are consequently dropped from ModGuts. TODO: - Documentation - Fat interface files have NO useful fingerprints. This is suboptimal: we'd like to have recompilation avoidance apply to fat interface compilation in addition to the normal compilation. - The family instance environment is not properly initialized when compiling fat interface files, which could result in loss of specialization opportunities. Signed-off-by: Edward Z. Yang <[email protected]> Test Plan: validate Reviewers: simonpj, austin, hvr, goldfire, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1318
- Loading branch information
Showing
47 changed files
with
1,094 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.