summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Gen
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2022-02-09 17:01:38 +0530
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-20 13:56:15 -0500
commit4b04f7e175a01b30e098af63dfabe6ea068e9b0b (patch)
tree559e4dc5ba03f5ac8fc8917dcccef9f7c71e6507 /compiler/GHC/Tc/Gen
parent67dd5724297094af93be1887ef000845722c6f2b (diff)
downloadhaskell-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/Tc/Gen')
-rw-r--r--compiler/GHC/Tc/Gen/Splice.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Tc/Gen/Splice.hs b/compiler/GHC/Tc/Gen/Splice.hs
index 7264f2232a..f2efb93f2d 100644
--- a/compiler/GHC/Tc/Gen/Splice.hs
+++ b/compiler/GHC/Tc/Gen/Splice.hs
@@ -1011,13 +1011,12 @@ runMeta' show_code ppr_hs run_and_convert expr
-- Compile and link it; might fail if linking fails
; src_span <- getSrcSpanM
- ; mnwib <- getMnwib
; traceTc "About to run (desugared)" (ppr ds_expr)
; either_hval <- tryM $ liftIO $
- GHC.Driver.Main.hscCompileCoreExpr hsc_env (src_span, Just mnwib) ds_expr
+ GHC.Driver.Main.hscCompileCoreExpr hsc_env src_span ds_expr
; case either_hval of {
Left exn -> fail_with_exn "compile and link" exn ;
- Right hval -> do
+ Right (hval, needed_mods, needed_pkgs) -> do
{ -- Coerce it to Q t, and run it
@@ -1031,6 +1030,7 @@ runMeta' show_code ppr_hs run_and_convert expr
--
-- See Note [Exceptions in TH]
let expr_span = getLocA expr
+ ; recordThNeededRuntimeDeps needed_mods needed_pkgs
; either_tval <- tryAllM $
setSrcSpan expr_span $ -- Set the span so that qLocation can
-- see where this splice is