[Git][ghc/ghc][wip/jeltsch/textual-bytecode-output] Remove breakpoint-related cost center info from output
Wolfgang Jeltsch pushed to branch wip/jeltsch/textual-bytecode-output at Glasgow Haskell Compiler / GHC Commits: 8b2eaf94 by Wolfgang Jeltsch at 2026-07-10T16:32:26+03:00 Remove breakpoint-related cost center info from output - - - - - 1 changed file: - compiler/GHC/ByteCode/Show.hs Changes: ===================================== compiler/GHC/ByteCode/Show.hs ===================================== @@ -8,29 +8,16 @@ module GHC.ByteCode.Show (showByteCode) where import Prelude ((+), (-), Integral, div) import Control.Arrow ((>>>)) import Control.Exception (assert) -import Data.Eq (Eq, (==)) -import Data.Ord ((<=)) +import Data.Eq ((==)) import Data.Bits (FiniteBits, finiteBitSize) import Data.Function (($), id, (.)) -import Data.Tuple (fst, snd, uncurry) +import Data.Tuple (uncurry) import Data.Bool (Bool, otherwise, not) import Data.Int (Int) import Data.Word (Word) -import Data.Maybe (Maybe (Nothing, Just), maybe) +import Data.Maybe (Maybe, maybe) import Data.Either (Either, either) -import Data.List - ( - length, - (++), - repeat, - map, - zipWith, - zipWith5, - and, - take, - drop, - replicate - ) +import Data.List (length, (++), map, zipWith, zipWith4, take, drop, replicate) import Data.String (String) import Data.ByteString (ByteString, unpack) import Data.ByteString.Short (ShortByteString) @@ -57,7 +44,6 @@ import GHC.Utils.Outputable ( defaultDumpStyle, SDoc, - empty, text, (<>), (<+>), @@ -309,57 +295,32 @@ pprBreakpointsData currentModule InternalModBreaks {..} -- | […] pprBreakpointsInSource :: Module -> ModBreaks -> SDoc pprBreakpointsInSource currentModule ModBreaks {..} - = entry (text "breakpoints in source:") $ - assert (modBreaks_module == currentModule) $ - assert boundsAreConsistent $ - vcatOrNone $ - zipWith5 pprBreakpointInSource (indices modBreaks_locs_) + = entry (text "breakpoints in source:") $ + assert (modBreaks_module == currentModule) $ + assert (bounds modBreaks_locs_ == bounds modBreaks_decls) $ + assert (bounds modBreaks_locs_ == bounds modBreaks_vars) $ + vcatOrNone $ + zipWith4 pprBreakpointInSource (indices modBreaks_locs_) (elems modBreaks_locs_) (elems modBreaks_decls) (elems modBreaks_vars) - potentialCostCenterInfos - where - - costCenterInfoIsPresent :: Bool - costCenterInfoIsPresent = fst (bounds modBreaks_ccs) <= - snd (bounds modBreaks_ccs) - - boundsAreConsistent :: Bool - boundsAreConsistent - = allAreEqual $ - [ - bounds modBreaks_locs_, - bounds modBreaks_decls, - bounds modBreaks_vars - ] ++ if costCenterInfoIsPresent then [bounds modBreaks_ccs] else [] - where - - allAreEqual :: Eq a => [a] -> Bool - allAreEqual list = and $ zipWith (==) list (drop 1 list) - - potentialCostCenterInfos :: [Maybe (ShortByteString, ShortByteString)] - potentialCostCenterInfos - | costCenterInfoIsPresent = map Just (elems modBreaks_ccs) - | otherwise = repeat Nothing + -- The cost center infos in `modBreaks_ccs`, when present, just contain + -- textual representations of the declaration paths in `modBreaks_decls` + -- and the source spans in `modBreaks_locs_` and are therefore never + -- shown. -- | […] pprBreakpointInSource :: BreakTickIndex -> BinSrcSpan -> [String] -> [OccName] - -> Maybe (ShortByteString, ShortByteString) -> SDoc -pprBreakpointInSource ix - srcSpan - declarationPath - freeVars - potentialCostCenterInfo +pprBreakpointInSource ix srcSpan declarationPath freeVars = entry (text "breakpoint" <+> ppr ix <> text ":") $ vcat [ - pprSrcSpan $ srcSpan, - pprDeclarationPath $ declarationPath, - pprFreeVariables $ freeVars, - pprPotentialCostCenterInfo $ potentialCostCenterInfo + pprSrcSpan $ srcSpan, + pprDeclarationPath $ declarationPath, + pprFreeVariables $ freeVars ] -- | […] @@ -374,34 +335,6 @@ pprDeclarationPath = entry (text "declaration path:") . vcat . map text pprFreeVariables :: [OccName] -> SDoc pprFreeVariables = entry (text "free variables:") . hsep . map ppr --- | […] -pprPotentialCostCenterInfo :: Maybe (ShortByteString, ShortByteString) -> SDoc -pprPotentialCostCenterInfo Nothing - = empty -pprPotentialCostCenterInfo (Just costCenterInfo) - = vcat [ - pprCostCenterPath $ costCenterPath, - pprCostCenterLocation $ costCenterLocation - ] - where - - costCenterPath :: String - costCenterPath = utf8DecodeShortByteString (fst costCenterInfo) - - costCenterLocation :: String - costCenterLocation = utf8DecodeShortByteString (snd costCenterInfo) - - -- The structure of the cost center information is apparent from the - -- implementation of 'GHC.HsToCore.Breakpoints.mkModBreaks'. - --- | […] -pprCostCenterPath :: String -> SDoc -pprCostCenterPath = entry (text "cost center path:") . text - --- | […] -pprCostCenterLocation :: String -> SDoc -pprCostCenterLocation = entry (text "cost center location:") . text - -- | […] pprBreakpointsInByteCode :: Module -> IntMap CgBreakInfo -> SDoc pprBreakpointsInByteCode currentModule View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8b2eaf94227be5c7626c4048cb473b2c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8b2eaf94227be5c7626c4048cb473b2c... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Wolfgang Jeltsch (@jeltsch)