diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2020-11-18 11:55:55 +0000 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2021-03-03 19:09:34 +0000 |
commit | a7aac008f69ca48e5ab3d4186fdcb3214c6e1463 (patch) | |
tree | b41d57ca638eddfad54d9cfedf9b47c66106e34a /compiler/GHC/CoreToStg.hs | |
parent | 4b297979d25740d31241a9000e36068db112545a (diff) | |
download | haskell-a7aac008f69ca48e5ab3d4186fdcb3214c6e1463.tar.gz |
Add option to give each usage of a data constructor its own info table
The `-fdistinct-constructor-tables` flag will generate a fresh info
table for the usage of any data constructor. This is useful for
debugging as now by inspecting the info table, you can determine which
usage of a constructor caused that allocation rather than the old
situation where the info table always mapped to the definition site of
the data constructor which is useless.
In conjunction with `-hi` and `-finfo-table-map` this gives a more fine
grained understanding of where constructor allocations arise from in a
program.
Diffstat (limited to 'compiler/GHC/CoreToStg.hs')
-rw-r--r-- | compiler/GHC/CoreToStg.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/GHC/CoreToStg.hs b/compiler/GHC/CoreToStg.hs index 2f9e3816ef..1bcf5bdfe9 100644 --- a/compiler/GHC/CoreToStg.hs +++ b/compiler/GHC/CoreToStg.hs @@ -545,7 +545,7 @@ coreToStgApp f args ticks = do res_ty = exprType (mkApps (Var f) args) app = case idDetails f of DataConWorkId dc - | saturated -> StgConApp dc args' + | saturated -> StgConApp dc NoNumber args' (dropRuntimeRepArgs (fromMaybe [] (tyConAppArgs_maybe res_ty))) -- Some primitive operator that might be implemented as a library call. @@ -602,7 +602,7 @@ coreToStgArgs (arg : args) = do -- Non-type argument (aticks, arg'') = stripStgTicksTop tickishFloatable arg' stg_arg = case arg'' of StgApp v [] -> StgVarArg v - StgConApp con [] _ -> StgVarArg (dataConWorkId con) + StgConApp con _ [] _ -> StgVarArg (dataConWorkId con) StgLit lit -> StgLitArg lit _ -> pprPanic "coreToStgArgs" (ppr arg) @@ -719,13 +719,13 @@ mkTopStgRhs dflags this_mod ccs bndr (PreStgRhs bndrs rhs) -- After this point we know that `bndrs` is empty, -- so this is not a function binding - | StgConApp con args _ <- unticked_rhs + | StgConApp con mn args _ <- unticked_rhs , -- Dynamic StgConApps are updatable not (isDllConApp dflags this_mod con args) = -- CorePrep does this right, but just to make sure ASSERT2( not (isUnboxedTupleDataCon con || isUnboxedSumDataCon con) , ppr bndr $$ ppr con $$ ppr args) - ( StgRhsCon dontCareCCS con args, ccs ) + ( StgRhsCon dontCareCCS con mn ticks args, ccs ) -- Otherwise it's a CAF, see Note [Cost-centre initialization plan]. | gopt Opt_AutoSccsOnIndividualCafs dflags @@ -741,7 +741,7 @@ mkTopStgRhs dflags this_mod ccs bndr (PreStgRhs bndrs rhs) , ccs ) where - unticked_rhs = stripStgTicksTopE (not . tickishIsCode) rhs + (ticks, unticked_rhs) = stripStgTicksTop (not . tickishIsCode) rhs upd_flag | isUsedOnceDmd (idDemandInfo bndr) = SingleEntry | otherwise = Updatable @@ -777,15 +777,15 @@ mkStgRhs bndr (PreStgRhs bndrs rhs) ReEntrant -- ignored for LNE [] rhs - | StgConApp con args _ <- unticked_rhs - = StgRhsCon currentCCS con args + | StgConApp con mn args _ <- unticked_rhs + = StgRhsCon currentCCS con mn ticks args | otherwise = StgRhsClosure noExtFieldSilent currentCCS upd_flag [] rhs where - unticked_rhs = stripStgTicksTopE (not . tickishIsCode) rhs + (ticks, unticked_rhs) = stripStgTicksTop (not . tickishIsCode) rhs upd_flag | isUsedOnceDmd (idDemandInfo bndr) = SingleEntry | otherwise = Updatable |