diff options
author | Zubin Duggal <zubin.duggal@gmail.com> | 2022-02-09 17:01:38 +0530 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-20 13:56:15 -0500 |
commit | 4b04f7e175a01b30e098af63dfabe6ea068e9b0b (patch) | |
tree | 559e4dc5ba03f5ac8fc8917dcccef9f7c71e6507 /compiler/GHC/Iface | |
parent | 67dd5724297094af93be1887ef000845722c6f2b (diff) | |
download | haskell-4b04f7e175a01b30e098af63dfabe6ea068e9b0b.tar.gz |
Track object file dependencies for TH accurately (#20604)
`hscCompileCoreExprHook` is changed to return a list of `Module`s required
by a splice. These modules are accumulated in the TcGblEnv (tcg_th_needed_mods).
Dependencies on the object files of these modules are recording in the
interface.
The data structures in `LoaderState` are replaced with more efficient versions
to keep track of all the information required. The
MultiLayerModulesTH_Make allocations increase slightly but runtime is
faster.
Fixes #20604
-------------------------
Metric Increase:
MultiLayerModulesTH_Make
-------------------------
Diffstat (limited to 'compiler/GHC/Iface')
-rw-r--r-- | compiler/GHC/Iface/Make.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/GHC/Iface/Make.hs b/compiler/GHC/Iface/Make.hs index c0471cd413..19739ff3e3 100644 --- a/compiler/GHC/Iface/Make.hs +++ b/compiler/GHC/Iface/Make.hs @@ -211,6 +211,7 @@ mkIfaceTc hsc_env safe_mode mod_details mod_summary let hpc_info = emptyHpcInfo other_hpc_info used_th <- readIORef tc_splice_used dep_files <- (readIORef dependent_files) + (needed_links, needed_pkgs) <- readIORef (tcg_th_needed_deps tc_result) -- Do NOT use semantic module here; this_mod in mkUsageInfo -- is used solely to decide if we should record a dependency -- or not. When we instantiate a signature, the semantic @@ -218,8 +219,8 @@ mkIfaceTc hsc_env safe_mode mod_details mod_summary -- but if you pass that in here, we'll decide it's the local -- module and does not need to be recorded as a dependency. -- See Note [Identity versus semantic module] - usages <- mkUsageInfo hsc_env this_mod hsc_src (imp_mods imports) used_names - dep_files merged + usages <- mkUsageInfo hsc_env this_mod (imp_mods imports) used_names + dep_files merged needed_links needed_pkgs (doc_hdr', doc_map, arg_map) <- extractDocs tc_result |