diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-05-05 14:02:37 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2021-06-03 08:46:47 +0100 |
commit | 25977ab542a30df4ae71d9699d015bcdd1ab7cfb (patch) | |
tree | fc2195f9ceb5651603aa5fed03580eb47e0412d7 /docs/users_guide | |
parent | 79d12d34ad7177d33b191305f2c0157349f97355 (diff) | |
download | haskell-25977ab542a30df4ae71d9699d015bcdd1ab7cfb.tar.gz |
Driver Rework Patch
This patch comprises of four different but closely related ideas. The
net result is fixing a large number of open issues with the driver
whilst making it simpler to understand.
1. Use the hash of the source file to determine whether the source file
has changed or not. This makes the recompilation checking more robust to
modern build systems which are liable to copy files around changing
their modification times.
2. Remove the concept of a "stable module", a stable module was one
where the object file was older than the source file, and all transitive
dependencies were also stable. Now we don't rely on the modification
time of the source file, the notion of stability is moot.
3. Fix TH/plugin recompilation after the removal of stable modules. The
TH recompilation check used to rely on stable modules. Now there is a
uniform and simple way, we directly track the linkables which were
loaded into the interpreter whilst compiling a module. This is an
over-approximation but more robust wrt package dependencies changing.
4. Fix recompilation checking for dynamic object files. Now we actually
check if the dynamic object file exists when compiling with -dynamic-too
Fixes #19774 #19771 #19758 #17434 #11556 #9121 #8211 #16495 #7277 #16093
Diffstat (limited to 'docs/users_guide')
-rw-r--r-- | docs/users_guide/separate_compilation.rst | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/docs/users_guide/separate_compilation.rst b/docs/users_guide/separate_compilation.rst index f5c53171ac..9d11830237 100644 --- a/docs/users_guide/separate_compilation.rst +++ b/docs/users_guide/separate_compilation.rst @@ -659,14 +659,15 @@ jot. So now… GHC calculates a fingerprint (in fact an MD5 hash) of each interface file, and of each declaration within the interface file. It also keeps in every interface file a list of the fingerprints of everything it used -when it last compiled the file. If the source file's modification date -is earlier than the ``.o`` file's date (i.e. the source hasn't changed -since the file was last compiled), and the recompilation checking is on, -GHC will be clever. It compares the fingerprints on the things it needs -this time with the fingerprints on the things it needed last time -(gleaned from the interface file of the module being compiled); if they -are all the same it stops compiling early in the process saying -“Compilation IS NOT required”. What a beautiful sight! +when it last compiled the file. If the MD5 hash of the source file +stored in the ``.hi`` file hasn't changed, the ``.o`` file's +modification date is greater than or equal to that of the ``.hi`` file, +and the recompilation checking is on, GHC will be clever. It compares +the fingerprints on the things it needs this time with the fingerprints +on the things it needed last time (gleaned from the interface file of +the module being compiled); if they are all the same it stops compiling +early in the process saying “Compilation IS NOT required”. What a +beautiful sight! You can read about :ghc-wiki:`how all this works <commentary/compiler/recompilation-avoidance>` in the GHC commentary. |