summaryrefslogtreecommitdiff
path: root/compiler/rename
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2019-08-21 17:31:49 +0300
committerAndreas Klebinger <klebinger.andreas@gmx.at>2019-09-28 11:47:05 +0200
commit4651095e3924e6643c9434f6ef0ba8310072b565 (patch)
tree3b848eae11ce34a6a6494071a6923913a92df424 /compiler/rename
parent4f81fab062e521b6b59f3f7b93bc410fd1111166 (diff)
downloadhaskell-wip/osa1/backend_refactoring.tar.gz
Refactor iface file generation:wip/osa1/backend_refactoring
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/rename')
-rw-r--r--compiler/rename/RnEnv.hs6
-rw-r--r--compiler/rename/RnFixity.hs2
-rw-r--r--compiler/rename/RnNames.hs4
3 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs
index d9dbbee891..c84e7bd328 100644
--- a/compiler/rename/RnEnv.hs
+++ b/compiler/rename/RnEnv.hs
@@ -1266,10 +1266,10 @@ warnIfDeprecated gre@(GRE { gre_name = name, gre_imp = iss })
lookupImpDeprec :: ModIface -> GlobalRdrElt -> Maybe WarningTxt
lookupImpDeprec iface gre
- = mi_warn_fn iface (greOccName gre) `mplus` -- Bleat if the thing,
+ = mi_warn_fn (mi_final_exts iface) (greOccName gre) `mplus` -- Bleat if the thing,
case gre_par gre of -- or its parent, is warn'd
- ParentIs p -> mi_warn_fn iface (nameOccName p)
- FldParent { par_is = p } -> mi_warn_fn iface (nameOccName p)
+ ParentIs p -> mi_warn_fn (mi_final_exts iface) (nameOccName p)
+ FldParent { par_is = p } -> mi_warn_fn (mi_final_exts iface) (nameOccName p)
NoParent -> Nothing
{-
diff --git a/compiler/rename/RnFixity.hs b/compiler/rename/RnFixity.hs
index 198a0441e5..68d1348871 100644
--- a/compiler/rename/RnFixity.hs
+++ b/compiler/rename/RnFixity.hs
@@ -157,7 +157,7 @@ lookupFixityRn_help' name occ
-- loadInterfaceForName will find B.hi even if B is a hidden module,
-- and that's what we want.
= do { iface <- loadInterfaceForName doc name
- ; let mb_fix = mi_fix_fn iface occ
+ ; let mb_fix = mi_fix_fn (mi_final_exts iface) occ
; let msg = case mb_fix of
Nothing ->
text "looking up name" <+> ppr name
diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs
index 738f4c6ab5..7b9a385e48 100644
--- a/compiler/rename/RnNames.hs
+++ b/compiler/rename/RnNames.hs
@@ -393,8 +393,8 @@ calculateAvails :: DynFlags
calculateAvails dflags iface mod_safe' want_boot imported_by =
let imp_mod = mi_module iface
imp_sem_mod= mi_semantic_module iface
- orph_iface = mi_orphan iface
- has_finsts = mi_finsts iface
+ orph_iface = mi_orphan (mi_final_exts iface)
+ has_finsts = mi_finsts (mi_final_exts iface)
deps = mi_deps iface
trust = getSafeMode $ mi_trust iface
trust_pkg = mi_trust_pkg iface