summaryrefslogtreecommitdiff
path: root/compiler/GHC
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-05-24 00:15:31 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-28 16:25:53 -0400
commitaef95f11f946f7d3f2c4c9b695d632cbfc4a993d (patch)
treec611a723c1d517b1f9fb7ad5381dab55f167d034 /compiler/GHC
parent08dab5f74e021ad054112cc5f6bb7e55d8796cd7 (diff)
downloadhaskell-aef95f11f946f7d3f2c4c9b695d632cbfc4a993d.tar.gz
Ticky-ticky: Record DataCon name in ticker name
This makes it significantly easier to spot the nature of allocations regressions and comes at a reasonably low cost.
Diffstat (limited to 'compiler/GHC')
-rw-r--r--compiler/GHC/StgToCmm/Bind.hs2
-rw-r--r--compiler/GHC/StgToCmm/Ticky.hs9
2 files changed, 7 insertions, 4 deletions
diff --git a/compiler/GHC/StgToCmm/Bind.hs b/compiler/GHC/StgToCmm/Bind.hs
index 9d3b12a631..839d34b0e4 100644
--- a/compiler/GHC/StgToCmm/Bind.hs
+++ b/compiler/GHC/StgToCmm/Bind.hs
@@ -201,7 +201,7 @@ cgRhs :: Id
)
cgRhs id (StgRhsCon cc con args)
- = withNewTickyCounterCon (idName id) $
+ = withNewTickyCounterCon (idName id) con $
buildDynCon id True cc con (assertNonVoidStgArgs args)
-- con args are always non-void,
-- see Note [Post-unarisation invariants] in GHC.Stg.Unarise
diff --git a/compiler/GHC/StgToCmm/Ticky.hs b/compiler/GHC/StgToCmm/Ticky.hs
index 6ec96325a3..cffd08b28f 100644
--- a/compiler/GHC/StgToCmm/Ticky.hs
+++ b/compiler/GHC/StgToCmm/Ticky.hs
@@ -128,6 +128,7 @@ import GHC.Driver.Session
-- Turgid imports for showTypeCategory
import GHC.Builtin.Names
import GHC.Tc.Utils.TcType
+import GHC.Core.DataCon
import GHC.Core.TyCon
import GHC.Core.Predicate
@@ -145,6 +146,7 @@ data TickyClosureType
= TickyFun
Bool -- True <-> single entry
| TickyCon
+ DataCon -- the allocated constructor
| TickyThunk
Bool -- True <-> updateable
Bool -- True <-> standard thunk (AP or selector), has no entry counter
@@ -188,13 +190,14 @@ withNewTickyCounterStdThunk isUpdatable name code = do
withNewTickyCounterCon
:: Name
+ -> DataCon
-> FCode a
-> FCode a
-withNewTickyCounterCon name code = do
+withNewTickyCounterCon name datacon code = do
has_ctr <- thunkHasCounter False
if not has_ctr
then code
- else withNewTickyCounter TickyCon name [] code
+ else withNewTickyCounter (TickyCon datacon) name [] code
-- args does not include the void arguments
withNewTickyCounter :: TickyClosureType -> Name -> [NonVoid Id] -> FCode a -> FCode a
@@ -222,7 +225,7 @@ emitTickyCounter cloType name args
ext = case cloType of
TickyFun single_entry -> parens $ hcat $ punctuate comma $
[text "fun"] ++ [text "se"|single_entry]
- TickyCon -> parens (text "con")
+ TickyCon datacon -> parens (text "con:" <+> ppr (dataConName datacon))
TickyThunk upd std -> parens $ hcat $ punctuate comma $
[text "thk"] ++ [text "se"|not upd] ++ [text "std"|std]
TickyLNE | isInternalName name -> parens (text "LNE")