[Git][ghc/ghc][master] 2 commits: Force in_multi to avoid retaining entire hsc_env
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Mon Apr 8 20:07:25 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
c6def949 by Matthew Pickering at 2024-04-08T16:06:51-04:00
Force in_multi to avoid retaining entire hsc_env
- - - - -
fbb91a63 by Fendor at 2024-04-08T16:06:51-04:00
Eliminate name thunk in declaration fingerprinting
Thunk analysis showed that we have about 100_000 thunks (in agda and
`-fwrite-simplified-core`) pointing to the name of the name decl.
Forcing this thunk fixes this issue.
The thunk created here is retained by the thunk created by forkM, it is
better to eagerly force this because the result (a `Name`) is already
retained indirectly via the `IfaceDecl`.
- - - - -
2 changed files:
- compiler/GHC/IfaceToCore.hs
- ghc/GHCi/UI.hs
Changes:
=====================================
compiler/GHC/IfaceToCore.hs
=====================================
@@ -956,7 +956,9 @@ tc_iface_decl_fingerprint :: Bool -- Don't load pragmas into
tc_iface_decl_fingerprint ignore_prags (_version, decl)
= do { -- Populate the name cache with final versions of all
-- the names associated with the decl
- let main_name = ifName decl
+ let !main_name = ifName decl
+ -- Force this field access, as `main_name` thunk will otherwise
+ -- be retained in the thunk created by `forkM`.
-- Typecheck the thing, lazily
-- NB. Firstly, the laziness is there in case we never need the
=====================================
ghc/GHCi/UI.hs
=====================================
@@ -557,7 +557,8 @@ interactiveUI config srcs maybe_exprs = do
-- Set to True because Prelude is implicitly imported.
impDecl at ImportDecl{ideclExt=ext} -> impDecl{ideclExt = ext{ideclImplicit=True}}
hsc_env <- GHC.getSession
- let in_multi = length (hsc_all_home_unit_ids hsc_env) > 1
+ let !in_multi = length (hsc_all_home_unit_ids hsc_env) > 1
+ -- We force this to make sure we don't retain the hsc_env when reloading
empty_cache <- liftIO newIfaceCache
startGHCi (runGHCi srcs maybe_exprs)
GHCiState{ progname = default_progname,
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f2cc1107790d42fee1a11d5b16bc282d31ea6f78...fbb91a6371308fffca926f0ab45ae0a14e7c6847
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f2cc1107790d42fee1a11d5b16bc282d31ea6f78...fbb91a6371308fffca926f0ab45ae0a14e7c6847
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240408/425d907d/attachment-0001.html>
More information about the ghc-commits
mailing list