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 /docs/users_guide | |
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 'docs/users_guide')
-rw-r--r-- | docs/users_guide/separate_compilation.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/users_guide/separate_compilation.rst b/docs/users_guide/separate_compilation.rst index ec33cddcd4..c43dcc1f2c 100644 --- a/docs/users_guide/separate_compilation.rst +++ b/docs/users_guide/separate_compilation.rst @@ -705,6 +705,24 @@ beautiful sight! You can read about :ghc-wiki:`how all this works <commentary/compiler/recompilation-avoidance>` in the GHC commentary. +Recompilation for Template Haskell and Plugins +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Recompilation checking gets a bit more complicated when using Template Haskell or +plugins. Both these features execute code at compile time and so if any of the +executed code changes then it's necessary to recompile the module. Consider the +top-level splice:: + + main = $(foo bar [| () |]) + +When the module is compiled ``foo bar [| () |]`` will be evaluated and the resulting +code placed into the program. The dependencies of the expression are calculated +and stored during module compilation. When the interface file is written, additional +dependencies are created on the object file dependencies of the expression. For instance, +if ``foo`` is from module ``A`` and ``bar`` is from module ``B``, the module will +now depend on ``A.o`` and ``B.o``, if either of these change then the module will +be recompiled. + .. _mutual-recursion: How to compile mutually recursive modules |