[Git][ghc/ghc][wip/24107] compiler: Add some strictness annotations to ImportSpec and related constructors

Zubin (@wz1000) gitlab at gitlab.haskell.org
Tue Nov 21 13:22:20 UTC 2023



Zubin pushed to branch wip/24107 at Glasgow Haskell Compiler / GHC


Commits:
588fea96 by Zubin Duggal at 2023-11-21T18:47:12+05:30
compiler: Add some strictness annotations to ImportSpec and related constructors
This prevents us from retain entire HscEnvs.

Fixes #24107

- - - - -


2 changed files:

- compiler/GHC/Rename/Names.hs
- compiler/GHC/Types/Name/Reader.hs


Changes:

=====================================
compiler/GHC/Rename/Names.hs
=====================================
@@ -1582,7 +1582,7 @@ gresFromIE decl_spec (L loc ie, gres)
         item_spec = ImpSome { is_explicit = is_explicit name
                             , is_iloc = locA loc }
     set_gre_imp gre@( GRE { gre_name = nm } )
-      = gre { gre_imp = unitBag $ prov_fn nm }
+      = gre { gre_imp = unitBag $! prov_fn nm }
 
 {-
 Note [Children for duplicate record fields]


=====================================
compiler/GHC/Types/Name/Reader.hs
=====================================
@@ -1916,8 +1916,8 @@ instance Semigroup ShadowedGREs where
 --
 -- The 'ImportSpec' of something says how it came to be imported
 -- It's quite elaborate so that we can give accurate unused-name warnings.
-data ImportSpec = ImpSpec { is_decl :: ImpDeclSpec,
-                            is_item :: ImpItemSpec }
+data ImportSpec = ImpSpec { is_decl :: !ImpDeclSpec,
+                            is_item :: !ImpItemSpec }
                 deriving( Eq, Data )
 
 -- | Import Declaration Specification
@@ -1926,15 +1926,15 @@ data ImportSpec = ImpSpec { is_decl :: ImpDeclSpec,
 -- shared among all the 'Provenance's for that decl
 data ImpDeclSpec
   = ImpDeclSpec {
-        is_mod      :: Module,     -- ^ Module imported, e.g. @import Muggle@
+        is_mod      :: !Module,     -- ^ Module imported, e.g. @import Muggle@
                                    -- Note the @Muggle@ may well not be
                                    -- the defining module for this thing!
 
                                    -- TODO: either should be Module, or there
                                    -- should be a Maybe UnitId here too.
-        is_as       :: ModuleName, -- ^ Import alias, e.g. from @as M@ (or @Muggle@ if there is no @as@ clause)
-        is_qual     :: Bool,       -- ^ Was this import qualified?
-        is_dloc     :: SrcSpan     -- ^ The location of the entire import declaration
+        is_as       :: !ModuleName, -- ^ Import alias, e.g. from @as M@ (or @Muggle@ if there is no @as@ clause)
+        is_qual     :: !Bool,       -- ^ Was this import qualified?
+        is_dloc     :: !SrcSpan     -- ^ The location of the entire import declaration
     } deriving (Eq, Data)
 
 -- | Import Item Specification
@@ -1945,8 +1945,8 @@ data ImpItemSpec
                         -- or had a hiding list
 
   | ImpSome {
-        is_explicit :: Bool,
-        is_iloc     :: SrcSpan  -- Location of the import item
+        is_explicit :: !Bool,
+        is_iloc     :: !SrcSpan  -- Location of the import item
     }   -- ^ The import had an import list.
         -- The 'is_explicit' field is @True@ iff the thing was named
         -- /explicitly/ in the import specs rather



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/588fea96ff79d74e7f9812a2aafe80122addfa15

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/588fea96ff79d74e7f9812a2aafe80122addfa15
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/20231121/56f9644d/attachment-0001.html>


More information about the ghc-commits mailing list