
On 06/07/2014 12:25, Christopher Rodrigues wrote:
Investigating #9176 further, GHC does at least three different things with imported modules under -dynamic-too compilation. It probably should be changed to handle imports uniformly. It looks like dynamic-too support was bolted on to a system designed for one-pass compilation, and I'm not clear on how to restructure it. Guidance would be appreciated, as it would cut down the time I need to figure out how the driver works.
Here are the three things that can happen:
1. When compiling in one-shot mode, with -c, GHC will do what Igloo described. If normal and dynamic interface hashes don't match, it will compile the normal way, then compile again the dynamic way.
2. When compiling with --make and importing from a package, if normal and dynamic interface hashes don't match, GHC will disable dynamic-too, but it will not restart the pipeline. Only the normal .hi file is produced.
This does sound wrong.
3. When compiling with --make and importing from a non-package module, GHC will not check interface hashes. It will proceed as if normal and dynamic interface hashes match.
This might be OK if we have already compiled all the modules in this compilation pass. If some were compiled previously, then it is possible that we have some non-matching .hi files, and in that case I think we should probably just consider the module out of date and recompile it, generating both dynamic and non-dynamic .hi files, which will be guaranteed to have the same hash. Cheers, Simon