summaryrefslogtreecommitdiff
path: root/compiler/GHC/Stg/Debug.hs
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2023-05-04 05:52:13 +0530
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-05-16 14:00:00 -0400
commitb70bc6900fcee7ff1e334bf8099283f610d6f9d4 (patch)
tree00b6c66159721fbedc9f59e12e3b61181937c584 /compiler/GHC/Stg/Debug.hs
parent90e69d5d167b9d6cd63b04e42f8af375dc4b307f (diff)
downloadhaskell-b70bc6900fcee7ff1e334bf8099283f610d6f9d4.tar.gz
compiler: Use compact representation/FastStrings for `SourceNote`s
`SourceNote`s should not be stored as [Char] as this is highly wasteful and in certain scenarios can be highly duplicated. Metric Decrease: hard_hole_fits
Diffstat (limited to 'compiler/GHC/Stg/Debug.hs')
-rw-r--r--compiler/GHC/Stg/Debug.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/GHC/Stg/Debug.hs b/compiler/GHC/Stg/Debug.hs
index 39a559cb73..fd3cbeea88 100644
--- a/compiler/GHC/Stg/Debug.hs
+++ b/compiler/GHC/Stg/Debug.hs
@@ -16,7 +16,7 @@ import GHC.Types.Tickish
import GHC.Core.DataCon
import GHC.Types.IPE
import GHC.Unit.Module
-import GHC.Types.Name ( getName, getOccName, occNameString, nameSrcSpan)
+import GHC.Types.Name ( getName, getOccName, occNameFS, nameSrcSpan)
import GHC.Data.FastString
import Control.Monad (when)
@@ -29,7 +29,7 @@ import Control.Applicative
import qualified Data.List.NonEmpty as NE
import Data.List.NonEmpty (NonEmpty(..))
-data SpanWithLabel = SpanWithLabel RealSrcSpan String
+data SpanWithLabel = SpanWithLabel RealSrcSpan LexicalFastString
data StgDebugOpts = StgDebugOpts
{ stgDebug_infoTableMap :: !Bool
@@ -74,7 +74,7 @@ collectStgRhs bndr (StgRhsClosure ext cc us bs e t) = do
-- If the name has a span, use that initially as the source position in-case
-- we don't get anything better.
with_span = case nameSrcSpan name of
- RealSrcSpan pos _ -> withSpan (pos, occNameString (getOccName name))
+ RealSrcSpan pos _ -> withSpan (pos, LexicalFastString $ occNameFS (getOccName name))
_ -> id
e' <- with_span $ collectExpr e
recordInfo bndr e'
@@ -92,7 +92,7 @@ recordInfo bndr new_rhs = do
-- A span from the ticks surrounding the new_rhs
best_span = quickSourcePos thisFile new_rhs
-- A back-up span if the bndr had a source position, many do not (think internally generated ids)
- bndr_span = (\s -> SpanWithLabel s (occNameString (getOccName bndr)))
+ bndr_span = (\s -> SpanWithLabel s (LexicalFastString $ occNameFS (getOccName bndr)))
<$> srcSpanToRealSrcSpan (nameSrcSpan (getName bndr))
recordStgIdPosition bndr best_span bndr_span