diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-08-21 17:31:49 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-09-30 22:39:53 -0400 |
commit | f3cb8c7cb99e05feb0f62f5a076400dcf9f930a0 (patch) | |
tree | 9f3ec4b8040bcfb0b48a71367199a5f9ad46b768 /compiler/deSugar | |
parent | ce64b397777408731c6dd3f5c55ea8415f9f565b (diff) | |
download | haskell-f3cb8c7cb99e05feb0f62f5a076400dcf9f930a0.tar.gz |
Refactor iface file generation:
This commit refactors interface file generation to allow information
from the later passed (NCG, STG) to be stored in interface files.
We achieve this by splitting interface file generation into two parts:
* Partial interfaces, built based on the result of the core pipeline
* A fully instantiated interface, which also contains the final
fingerprints and can optionally contain information produced by the backend.
This change is required by !1304 and !1530.
-dynamic-too handling is refactored too: previously when generating code
we'd branch on -dynamic-too *before* code generation, but now we do it
after.
(Original code written by @AndreasK in !1530)
Performance
~~~~~~~~~~~
Before this patch interface files where created and immediately flushed
to disk which made space leaks impossible.
With this change we instead use NFData to force all iface related data
structures to avoid space leaks.
In the process of refactoring it was discovered that the code in the
ToIface Module allocated a lot of thunks which were immediately forced
when writing/forcing the interface file. So we made this module more
strict to avoid creating many of those thunks.
Bottom line is that allocations go down by about ~0.1% compared to
master.
Residency is not meaningfully different after this patch.
Runtime was not benchmarked.
Co-Authored-By: Andreas Klebinger <klebinger.andreas@gmx.at>
Co-Authored-By: Ömer Sinan Ağacan <omer@well-typed.com>
Diffstat (limited to 'compiler/deSugar')
-rw-r--r-- | compiler/deSugar/DsUsage.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/deSugar/DsUsage.hs b/compiler/deSugar/DsUsage.hs index 7c8e24bbec..f5f63934a3 100644 --- a/compiler/deSugar/DsUsage.hs +++ b/compiler/deSugar/DsUsage.hs @@ -319,10 +319,10 @@ mk_mod_usage_info pit hsc_env this_mod direct_imports used_names -- modules accumulate in the PIT not HPT. Sigh. Just iface = maybe_iface - finsts_mod = mi_finsts iface - hash_env = mi_hash_fn iface - mod_hash = mi_mod_hash iface - export_hash | depend_on_exports = Just (mi_exp_hash iface) + finsts_mod = mi_finsts (mi_final_exts iface) + hash_env = mi_hash_fn (mi_final_exts iface) + mod_hash = mi_mod_hash (mi_final_exts iface) + export_hash | depend_on_exports = Just (mi_exp_hash (mi_final_exts iface)) | otherwise = Nothing by_is_safe (ImportedByUser imv) = imv_is_safe imv |