[project @ 2001-12-10 14:00:35 by simonmar]
authorsimonmar <unknown>
Mon, 10 Dec 2001 14:00:35 +0000 (14:00 +0000)
committersimonmar <unknown>
Mon, 10 Dec 2001 14:00:35 +0000 (14:00 +0000)
Make the OccName and SrcLoc fields of a Name strict, to eliminate
space leaks.  This doesn't hurt performance.

ghc/compiler/basicTypes/Name.lhs

index 2cd0ef0..c47d480 100644 (file)
@@ -52,11 +52,15 @@ import Outputable
 \begin{code}
 data Name = Name {
                n_sort :: NameSort,     -- What sort of name it is
-               n_occ  :: OccName,      -- Its occurrence name
+               n_occ  :: !OccName,     -- Its occurrence name
                n_uniq :: Unique,
-               n_loc  :: SrcLoc        -- Definition site
+               n_loc  :: !SrcLoc       -- Definition site
            }
 
+-- NOTE: we make the n_loc field strict to eliminate some potential
+-- (and real!) space leaks, due to the fact that we don't look at
+-- the SrcLoc in a Name all that often.
+
 data NameSort
   = Global Module      -- (a) TyCon, Class, their derived Ids, dfun Id
                        -- (b) Imported Id