diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-10-18 15:44:33 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-20 17:49:42 -0400 |
commit | 9ded1b17f97ba3bd01757a0764ed022f7ed99e9b (patch) | |
tree | abe1c5c624dc52e3568432076bf7870d22fef451 /compiler/GHC/Driver | |
parent | a901a1ae6709b8e241cb93a9013b41f48fe3ecca (diff) | |
download | haskell-9ded1b17f97ba3bd01757a0764ed022f7ed99e9b.tar.gz |
Make sure ModIface values are still forced even if not written
When we are not writing a ModIface to disk then the result can retain a
lot of stuff. For example, in the case I was debugging the DocDeclsMap
field was holding onto the entire HomePackageTable due to a single
unforced thunk. Therefore, now if we're not going to write the interface
then we still force deeply it in order to remove these thunks.
The fields in the data structure are not made strict because when we
read the field from the interface we don't want to load it immediately
as there are parts of an interface which are unused a lot of the time.
Also added a note to explain why not all the fields in a ModIface field
are strict.
The result of this is being able to load Agda in ghci and not leaking
information across subsequent reloads.
Diffstat (limited to 'compiler/GHC/Driver')
-rw-r--r-- | compiler/GHC/Driver/Main.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs index 365807fad8..80d50a4589 100644 --- a/compiler/GHC/Driver/Main.hs +++ b/compiler/GHC/Driver/Main.hs @@ -972,7 +972,7 @@ hscMaybeWriteIface logger dflags is_simple iface old_iface mod_location = do (const ()) (writeIface logger profile iface_name iface) - when (write_interface || force_write_interface) $ do + if (write_interface || force_write_interface) then do -- FIXME: with -dynamic-too, "no_change" is only meaningful for the -- non-dynamic interface, not for the dynamic one. We should have another @@ -1027,6 +1027,9 @@ hscMaybeWriteIface logger dflags is_simple iface old_iface mod_location = do let hie_file = ml_hie_file mod_location whenM (doesFileExist hie_file) $ GHC.SysTools.touch logger dflags "Touching hie file" hie_file + else + -- See Note [Strictness in ModIface] + forceModIface iface -------------------------------------------------------------- -- NoRecomp handlers |