Provide a mechanism to notify build system when .hi file is ready
In one-shot mode GHC typically finishes writing the interface file around halfway through compilation. A dependent module (if it doesn't use Template Haskell) only needs the interface file to start building. If we could start building a module as soon as all its dependencies' interface files are ready, we would cut the critical path by about a factor of 2; and parallelism in the GHC build tree is currently low enough that this should give significantly lower build times even on only modestly parallel systems.
The first obstruction to doing this is that there isn't a good way to know when the interface file becomes ready. I propose the following simple and flexible mechanism:
- Add a GHC command-line argument
-finterface-file-finished=N,F,str
. When GHC has finished writing the interface file it uses thesend
system call to send the stringstr
to file descriptorN
using flagsF
.
The build system might then invoke GHC with file descriptor N
open to a UNIX datagram socket, for example, and generate a unique str
for each interface file dependency.
Alternative suggestions are more than welcome.
I tentatively milestoned this for 8.2 since it would be nice to have this available in the bootstrapping compiler when we switch to Hadrian, and the GHC-side implementation should be simple.
Trac metadata
Trac field | Value |
---|---|
Version | 8.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Driver |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | niteria, simonmar, thomie |
Operating system | |
Architecture |