summaryrefslogtreecommitdiff
path: root/compiler/GHC/Unit/Module/Warnings.hs
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2023-05-04 05:30:13 +0530
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-05-16 14:00:00 -0400
commit90e69d5d167b9d6cd63b04e42f8af375dc4b307f (patch)
tree8ce2679872dbc4c4a5cc60025fe9564d36fc7772 /compiler/GHC/Unit/Module/Warnings.hs
parent5e3f9bb57680a40f6a9531e41dc2617c5f028e5c (diff)
downloadhaskell-90e69d5d167b9d6cd63b04e42f8af375dc4b307f.tar.gz
compiler: Use compact representation for SourceText
SourceText is serialized along with INLINE pragmas into interface files. Many of these SourceTexts are identical, for example "{-# INLINE#". When deserialized, each such SourceText was previously expanded out into a [Char], which is highly wasteful of memory, and each such instance of the text would allocate an independent list with its contents as deserializing breaks any sharing that might have existed. Instead, we use a `FastString` to represent these, so that each instance unique text will be interned and stored in a memory efficient manner.
Diffstat (limited to 'compiler/GHC/Unit/Module/Warnings.hs')
-rw-r--r--compiler/GHC/Unit/Module/Warnings.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Unit/Module/Warnings.hs b/compiler/GHC/Unit/Module/Warnings.hs
index 72f6586094..af07bf00cd 100644
--- a/compiler/GHC/Unit/Module/Warnings.hs
+++ b/compiler/GHC/Unit/Module/Warnings.hs
@@ -196,12 +196,12 @@ instance Outputable (WarningTxt pass) where
ppr (WarningTxt _ lsrc ws)
= case unLoc lsrc of
NoSourceText -> pp_ws ws
- SourceText src -> text src <+> pp_ws ws <+> text "#-}"
+ SourceText src -> ftext src <+> pp_ws ws <+> text "#-}"
ppr (DeprecatedTxt lsrc ds)
= case unLoc lsrc of
NoSourceText -> pp_ws ds
- SourceText src -> text src <+> pp_ws ds <+> text "#-}"
+ SourceText src -> ftext src <+> pp_ws ds <+> text "#-}"
instance Binary (WarningTxt GhcRn) where
put_ bh (WarningTxt c s w) = do