[Git][ghc/ghc][wip/fendor/fix-thunks-name-and-ui] 2 commits: Force in_multi to avoid retaining entire hsc_env

Hannes Siebenhandl (@fendor) gitlab at gitlab.haskell.org
Tue Apr 2 15:27:44 UTC 2024



Hannes Siebenhandl pushed to branch wip/fendor/fix-thunks-name-and-ui at Glasgow Haskell Compiler / GHC


Commits:
5bdc5139 by Matthew Pickering at 2024-04-02T17:27:36+02:00
Force in_multi to avoid retaining entire hsc_env

- - - - -
b50ffd30 by Fendor at 2024-04-02T17:27:36+02: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.

- - - - -


2 changed files:

- compiler/GHC/IfaceToCore.hs
- ghc/GHCi/UI.hs


Changes:

=====================================
compiler/GHC/IfaceToCore.hs
=====================================
@@ -956,7 +956,7 @@ 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
 
         -- 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/34efd458aa5f7c42dc8608333d01d03900241fae...b50ffd3028952591290dd104c73dfda50756df4a

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/34efd458aa5f7c42dc8608333d01d03900241fae...b50ffd3028952591290dd104c73dfda50756df4a
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/20240402/7a2a963c/attachment-0001.html>


More information about the ghc-commits mailing list