Wolfgang Jeltsch pushed to branch wip/jeltsch/textual-bytecode-output at Glasgow Haskell Compiler / GHC Commits: 97ab9bcd by Wolfgang Jeltsch at 2026-07-21T17:11:08+03:00 Add support for textual output of bytecode file contents This resolves #26909. - - - - - 12 changed files: - compiler/GHC/ByteCode/Serialize.hs - + compiler/GHC/ByteCode/Show.hs - compiler/ghc.cabal.in - docs/users_guide/using.rst - ghc/GHC/Driver/Session/Mode.hs - ghc/Main.hs - + testsuite/tests/show-bytecode/Example.hs - + testsuite/tests/show-bytecode/Makefile - + testsuite/tests/show-bytecode/all.T - + testsuite/tests/show-bytecode/show-bytecode-breakpoints.stdout - + testsuite/tests/show-bytecode/show-bytecode-hpc.stdout - + testsuite/tests/show-bytecode/show-bytecode-vanilla.stdout Changes: ===================================== compiler/GHC/ByteCode/Serialize.hs ===================================== @@ -6,7 +6,7 @@ {- | This module implements the serialization of bytecode objects to and from disk. -} module GHC.ByteCode.Serialize - ( writeBinByteCode, readBinByteCode + ( writeBinByteCode, readBinByteCode, readOnDiskModuleByteCode , ModuleByteCode(..) , BytecodeLibX(..) , BytecodeLib ===================================== compiler/GHC/ByteCode/Show.hs ===================================== @@ -0,0 +1,531 @@ +{-# LANGUAGE ImportQualifiedPost #-} +{-# LANGUAGE RecordWildCards #-} + +-- | This module implements the output of textual information about the contents +-- of bytecode files. It is the backbone of the @--show-byte-code@ option. +module GHC.ByteCode.Show (showByteCode) where + +import Prelude ((+), (-), Integral, div) +import Control.Arrow ((>>>)) +import Control.Exception (assert) +import Data.Eq ((==)) +import Data.Ord ((>=)) +import Data.Bits (FiniteBits, finiteBitSize) +import Data.Function (($), id, (.)) +import Data.Tuple (fst, uncurry) +import Data.Bool (Bool, otherwise, not) +import Data.Int (Int) +import Data.Word (Word) +import Data.Maybe (Maybe, maybe) +import Data.Either (Either, either) +import Data.List (length, (++), map, zipWith4, take, drop, replicate) +import Data.String (String) +import Data.ByteString (ByteString) +import Data.ByteString.Short (ShortByteString) +import Data.IntMap (IntMap) +import Data.IntMap qualified as IntMap (toList) +import Data.Array (bounds, indices, elems) +import Numeric (showHex) +import Text.Show (show) +import System.IO (IO, FilePath) +import GHC.Data.Strict qualified as Strict (Maybe, maybe) +import GHC.Data.FastString (unpackFS) +import GHC.Data.FlatBag (FlatBag, elemsFlatBag) +import GHC.Fingerprint (Fingerprint) +import GHC.Types.SrcLoc (noSrcSpan) +import GHC.Types.Name (Name) +import GHC.Types.Name.Occurrence (OccName) +import GHC.Types.Tickish (BreakTickIndex, BreakpointId (..)) +import GHC.Types.SptEntry (SptEntry (..)) +import GHC.Types.Error (MessageClass (MCDump)) +import GHC.Utils.Logger (Logger, logMsg) +import GHC.Utils.Binary (BinSrcSpan (..)) +import GHC.Utils.Encoding.UTF8 (utf8DecodeShortByteString, utf8DecodeByteString) +import GHC.Utils.Outputable + ( + defaultDumpStyle, + SDoc, + text, + (<>), + (<+>), + quotes, + hsep, + vcat, + hang, + withPprStyle, + ppr + ) +import GHC.Unit.Types (Module) +import GHC.Iface.Type (IfaceType, IfaceTvBndr, IfaceIdBndr) +import GHC.HsToCore.Breakpoints (ModBreaks (..)) +import GHC.ByteCode.Types + ( + FFIInfo (..), + BCONPtr (..), + BCOPtr (..), + UnlinkedBCO (..), + ByteCodeHpcInfo (..), + CompiledByteCode (..) + ) +import GHC.ByteCode.Breakpoints + ( + InternalBreakpointId (..), + InternalBreakLoc (..), + CgBreakInfo (..), + InternalModBreaks (..) + ) +import GHC.ByteCode.Binary (OnDiskModuleByteCode (..)) +import GHC.ByteCode.Serialize (readOnDiskModuleByteCode) +import GHC.Driver.Env.Types (HscEnv) +import GHCi.FFI (FFIType) +import GHCi.Message (ConInfoTable (..)) + +-- | Outputs textual information about the contents of a bytecode file. +showByteCode :: Logger -> HscEnv -> FilePath -> IO () +showByteCode logger env path = do + byteCode <- readOnDiskModuleByteCode env path + logMsg logger + MCDump + noSrcSpan + (withPprStyle defaultDumpStyle $ pprOnDiskModuleByteCode byteCode) + +-- | Constructs textual information about the contents of a bytecode file. +pprOnDiskModuleByteCode :: OnDiskModuleByteCode -> SDoc +pprOnDiskModuleByteCode OnDiskModuleByteCode {..} + = vcat [ + pprModuleIdent $ odgbc_module, + pprOnDiskModuleByteCodeHash $ odgbc_hash, + pprCompiledByteCode odgbc_module $ odgbc_compiled_byte_code + ] + +-- | Constructs textual information about the name of a module. +pprModuleIdent :: Module -> SDoc +pprModuleIdent = entry (text "name") . ppr + +-- | Constructs textual information about the hash of a module. +pprOnDiskModuleByteCodeHash :: Fingerprint -> SDoc +pprOnDiskModuleByteCodeHash = entry (text "hash") . ppr + +-- | Constructs textual information about bytecode. +pprCompiledByteCode :: Module -- ^ The enclosing module + -> CompiledByteCode -- ^ The bytecode + -> SDoc -- ^ The textual information +pprCompiledByteCode currentModule CompiledByteCode {..} + = vcat [ + pprByteCodeObjects currentModule $ bc_bcos, + pprDataConstructorInfoTables $ bc_itbls, + pprTopLevelStrings $ bc_strs, + pprBreakpoints currentModule $ bc_breaks, + pprStaticPointerTableEntries $ bc_spt_entries, + pprHPCInfo $ bc_hpc_info + ] + +-- | Constructs textual information about bytecode objects. +pprByteCodeObjects :: Module -- ^ The enlosing module + -> FlatBag UnlinkedBCO -- ^ The bytecode objects + -> SDoc -- ^ The textual information +pprByteCodeObjects currentModule = entry (text "objects") . + vcatOrNone . + map (pprByteCodeObject currentModule) . + elemsFlatBag + +-- | Constructs textual information about a single bytecode object. +pprByteCodeObject :: Module -- ^ The enclosing module + -> UnlinkedBCO -- ^ The bytecode object + -> SDoc -- ^ The textual information +pprByteCodeObject currentModule byteCodeObject = case byteCodeObject of + UnlinkedBCO {..} + -> entry (text "ordinary object" <+> quotes (ppr unlinkedBCOName)) $ + vcat [ + pprArity $ unlinkedBCOArity, + pprLiterals currentModule $ unlinkedBCOLits, + pprPointers currentModule $ unlinkedBCOPtrs + ] + UnlinkedStaticCon {..} + -> entry ( + text "static-construction object" <+> + quotes (ppr unlinkedStaticConName) + ) + $ + vcat [ + pprDataConstructorName $ unlinkedStaticConDataConName, + pprLiftedness $ not unlinkedStaticConIsUnlifted, + pprLiterals currentModule $ unlinkedStaticConLits, + pprPointers currentModule $ unlinkedStaticConPtrs + ] + +-- | Constructs textual information about the arity of an ordinary bytecode +-- object. +pprArity :: Int -> SDoc +pprArity = entry (text "arity") . ppr + +-- | Constructs textual information about the data constructor name of a +-- static-construction bytecode object. +pprDataConstructorName :: Name -> SDoc +pprDataConstructorName = entry (text "data constructor name") . ppr + +-- | Constructs textual information about the liftedness of a +-- static-construction bytecode object. +pprLiftedness :: Bool -> SDoc +pprLiftedness = entry (text "lifted") . noOrYes + +-- | Constructs textual information about literals. +pprLiterals :: Module -- ^ The enclosing module + -> FlatBag BCONPtr -- ^ The literals + -> SDoc -- ^ The textual information +pprLiterals currentModule = entry (text "literals") . + vcatOrNone . + map (pprLiteral currentModule) . + elemsFlatBag + +-- | Constructs textual information about a single literal. +pprLiteral :: Module -- ^ The enclosing module + -> BCONPtr -- ^ The literal + -> SDoc -- ^ The textual information +pprLiteral currentModule literal = case literal of + BCONPtrWord word + -> text "word" <+> + ppr word + BCONPtrLbl label + -> text "label" <+> + quotes (ppr label) + BCONPtrItbl infoTableName + -> text "info table of" <+> + quotes (ppr infoTableName) + BCONPtrAddr addrName + -> text "address" <+> + quotes (ppr addrName) + BCONPtrStr encodedString + -> text "top-level string" <+> + text (show (utf8DecodeByteString encodedString)) + BCONPtrFS string + -> text "top-level string" <+> + text (show (unpackFS string)) + BCONPtrFFIInfo ffiInfo + -> text "foreign function" <+> + quotes (pprFFIInfo ffiInfo) + BCONPtrCostCentre breakpointID + -> text "cost center of breakpoint" <+> + pprInternalBreakpointID currentModule breakpointID + +-- | Constructs textual information about FFI info. +pprFFIInfo :: FFIInfo -> SDoc +pprFFIInfo FFIInfo {..} + = hsep (map (pprFFIType >>> (<+> text "->")) ffiInfoArgs) <+> + pprFFIType ffiInfoRet + +-- | Constructs textual information about an FFI type. +pprFFIType :: FFIType -> SDoc +pprFFIType ffiType = assert (take 3 ident == "FFI") $ text (drop 3 ident) where + + ident :: String + ident = show ffiType + +-- | Constructs textual information about the ID of a bytecode breakpoint. +pprInternalBreakpointID + :: Module -- ^ The enclosing module + -> InternalBreakpointId -- ^ The ID of the bytecode breakpoint + -> SDoc -- ^ The textual information +pprInternalBreakpointID currentModule InternalBreakpointId {..} + | ibi_info_mod == currentModule = indexDoc + | otherwise = indexDoc <+> + text "in" <+> + ppr ibi_info_mod + where + + indexDoc :: SDoc + indexDoc = ppr ibi_info_index + +-- | Constructs textual information about pointers. +pprPointers :: Module -- ^ The enclosing module + -> FlatBag BCOPtr -- ^ The pointers + -> SDoc -- ^ The textual information +pprPointers currentModule = entry (text "utilized items") . + vcatOrNone . + map (pprPointer currentModule) . + elemsFlatBag + +-- | Constructs textual information about a single pointer. +pprPointer :: Module -- ^ The enclosing module + -> BCOPtr -- ^ The pointer + -> SDoc -- ^ The textual information +pprPointer currentModule pointer = case pointer of + BCOPtrName name + -> text "item named" <+> quotes (ppr name) + BCOPtrPrimOp primOp + -> text "primitive operation" <+> quotes (ppr primOp) + BCOPtrBCO byteCodeObject + -> pprByteCodeObject currentModule byteCodeObject + BCOPtrBreakArray breakArrayModule + -> text "break array of module" <+> quotes (ppr breakArrayModule) + +-- | Constructs textual information about data constructor info tables. +pprDataConstructorInfoTables :: [(Name, ConInfoTable)] -> SDoc +pprDataConstructorInfoTables = entry (text "data constructor info tables") . + vcatOrNone . + map (uncurry pprDataConstructorInfoTable) + +-- | Constructs textual information about a single data constructor info table. +pprDataConstructorInfoTable :: Name -> ConInfoTable -> SDoc +pprDataConstructorInfoTable dataConstrName ConInfoTable {..} + = entry (text "info table of" <+> quotes (ppr dataConstrName)) $ + vcat [ + pprPointerWordCount $ conItblPtrs, + pprNonPointerWordCount $ conItblNPtrs + ] + +-- | Constructs textual information about a number of pointer words. +pprPointerWordCount :: Int -> SDoc +pprPointerWordCount = entry (text "number of words for pointers") . ppr + +-- | Constructs textual information about a number of non-pointer words. +pprNonPointerWordCount :: Int -> SDoc +pprNonPointerWordCount = entry (text "number of words for non-pointers") . ppr + +-- | Constructs textual information about top-level strings. +pprTopLevelStrings :: [(Name, ByteString)] -> SDoc +pprTopLevelStrings = entry (text "top-level strings") . + vcatOrNone . + map (uncurry pprTopLevelString) + +-- | Constructs textual information about a single top-level string. +pprTopLevelString :: Name -> ByteString -> SDoc +pprTopLevelString stringName encodedString = entry (ppr stringName) $ + text $ + show $ + utf8DecodeByteString $ + encodedString + +-- | Constructs textual information about breakpoints. +pprBreakpoints :: Module -- ^ The enclosing module + -> Maybe InternalModBreaks -- ^ The breakpoints + -> SDoc -- ^ The textual information +pprBreakpoints currentModule + = entry (text "breakpoints") . + maybe (text "<none>") (pprActualBreakpoints currentModule) + +-- | Constructs textual information about actual breakpoints. +pprActualBreakpoints :: Module -- ^ The enclosing module + -> InternalModBreaks -- ^ The actual breakpoints + -> SDoc -- ^ The textual information +pprActualBreakpoints currentModule InternalModBreaks {..} + = vcat [ + pprSourceBreakpoints currentModule $ imodBreaks_modBreaks, + pprByteCodeBreakpoints currentModule $ imodBreaks_breakInfo + ] + +-- | Constructs textual information about source breakpoints. +pprSourceBreakpoints :: Module -- ^ The enclosing module + -> ModBreaks -- ^ The source breakpoints + -> SDoc -- ^ The textual information +pprSourceBreakpoints currentModule ModBreaks {..} + = entry (text "source breakpoints") $ + assert (modBreaks_module == currentModule) $ + assert (bounds modBreaks_locs_ == bounds modBreaks_decls) $ + assert (bounds modBreaks_locs_ == bounds modBreaks_vars) $ + vcatOrNone $ + zipWith4 pprSourceBreakpoint (indices modBreaks_locs_) + (elems modBreaks_locs_) + (elems modBreaks_decls) + (elems modBreaks_vars) + -- 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. + +-- | Constructs textual information about a single source breakpoint. +pprSourceBreakpoint :: BreakTickIndex + -> BinSrcSpan + -> [String] + -> [OccName] + -> SDoc +pprSourceBreakpoint ix srcSpan declarationPath freeVars + = entry (text "source breakpoint" <+> ppr ix) $ + vcat [ + pprSrcSpan $ srcSpan, + pprDeclarationPath $ declarationPath, + pprFreeVariables $ freeVars + ] + +-- | Constructs textual information about a source span. +pprSrcSpan :: BinSrcSpan -> SDoc +pprSrcSpan = entry (text "source span") . ppr . unBinSrcSpan + +-- | Constructs textual information about a declaration path. +pprDeclarationPath :: [String] -> SDoc +pprDeclarationPath = entry (text "declaration path") . vcatOrEmpty . map text + +-- | Constructs textual information about free variables. +pprFreeVariables :: [OccName] -> SDoc +pprFreeVariables = entry (text "free variables") . vcatOrNone . map ppr + +-- | Constructs textual information about bytecode breakpoints. +pprByteCodeBreakpoints :: Module -- ^ The enclosing module + -> IntMap CgBreakInfo -- ^ The bytecode breakpoints + -> SDoc -- ^ The textual information +pprByteCodeBreakpoints currentModule + = entry (text "bytecode breakpoints") . + vcatOrNone . + map (uncurry (pprByteCodeBreakpoint currentModule)) . + IntMap.toList + +-- | Constructs textual information about a single bytecode breakpoint. +pprByteCodeBreakpoint :: Module -- ^ The enclosing module + -> Int -- ^ The index of the bytecode breakpoint + -> CgBreakInfo -- ^ The bytecode breakpoint + -> SDoc -- ^ The textual information +pprByteCodeBreakpoint currentModule ix CgBreakInfo {..} + = entry (text "bytecode breakpoint" <+> ppr ix) $ + vcat [ + pprType $ cgb_resty, + pprTypeVariables $ cgb_tyvars, + pprVariables $ cgb_vars, + pprCorrespondingSourceBreakpoint currentModule $ cgb_tick_id + ] + -- That the 'cgb_resty' field holds the type of the breakpoint is apparent + -- from the fact that this field is set by + -- 'GHC.StgToByteCode.dehydrateCgBreakInfo' using one of its arguments and + -- 'GHC.StgToByteCode.dehydrateCgBreakInfo' is always invoked with this + -- argument set to the extension field of 'Breakpoint', which in turn holds + -- the type of the breakpoint according to Note [Tickish passes] and the + -- comment on the instance declaration of @XBreakpoint 'TickishPassStg@. + +-- | Constructs textual information about a type. +pprType :: IfaceType -> SDoc +pprType = entry (text "type") . ppr + +-- | Constructs textual information about type variables. +pprTypeVariables :: [IfaceTvBndr] -> SDoc +pprTypeVariables = entry (text "type variables") . + vcatOrNone . + map pprTypeVariableBinder + +-- | Constructs textual information about a type variable binder. +pprTypeVariableBinder :: IfaceTvBndr -> SDoc +pprTypeVariableBinder (name, kind) = ppr name <+> text "::" <+> ppr kind + +-- | Constructs textual information about variables. +pprVariables :: [Maybe (IfaceIdBndr, Word)] -> SDoc +pprVariables = entry (text "variables") . vcatOrNone . map pprVariable + +-- | Constructs textual information about a single variable. +pprVariable :: Maybe (IfaceIdBndr, Word) -> SDoc +pprVariable = maybe (text "<unknown>") (pprVariableBinder . fst) + +-- | Constructs textual information about a variable binder. +pprVariableBinder :: IfaceIdBndr -> SDoc +pprVariableBinder (multiplicity, name, type_) + = text "%" <> ppr multiplicity <+> + ppr name <+> text "::" <+> ppr type_ + +-- | Constructs textual information about a source breakpoint corresponding to a +-- bytecode breakpoint. +pprCorrespondingSourceBreakpoint :: Module + -- ^ The enclosing module + -> Either InternalBreakLoc BreakpointId + -- ^ A reference to the source breakpoint + -> SDoc + -- ^ The textual information +pprCorrespondingSourceBreakpoint currentModule + = entry (text "corresponding source breakpoint") . + pprBreakpointID currentModule . + either internalBreakLoc id + +-- | Constructs textual information about the ID of a source breakpoint. +pprBreakpointID :: Module -- ^ The enclosing module + -> BreakpointId -- ^ The ID of the source breakpoint + -> SDoc -- ^ The textual information +pprBreakpointID currentModule BreakpointId {..} + | bi_tick_mod == currentModule = indexDoc + | otherwise = indexDoc <+> + text "in" <+> + quotes (ppr bi_tick_mod) + where + + indexDoc :: SDoc + indexDoc = ppr bi_tick_index + +-- | Constructs textual information about static-pointer table entries. +pprStaticPointerTableEntries :: [SptEntry] -> SDoc +pprStaticPointerTableEntries = entry (text "static-pointer table entries") . + vcatOrNone . + map pprStaticPointerTableEntry + +-- | Constructs textual information about a single static-pointer table entry. +pprStaticPointerTableEntry :: SptEntry -> SDoc +pprStaticPointerTableEntry (SptEntry name fingerprint) + = ppr fingerprint <> text ":" <+> ppr name + +-- | Constructs textual information about HPC info. +pprHPCInfo :: Strict.Maybe ByteCodeHpcInfo -> SDoc +pprHPCInfo = entry (text "HPC information") . + Strict.maybe (text "<none>") pprActualHPCInfo + +-- | Constructs textual information about actual HPC info. +pprActualHPCInfo :: ByteCodeHpcInfo -> SDoc +pprActualHPCInfo ByteCodeHpcInfo {..} + = vcat [ + pprHPCInfoHash $ bchi_hash, + pprModuleName $ bchi_module_name, + pprTickBoxName $ bchi_tickbox_name, + pprTickCount $ bchi_tick_count + ] + where + +-- | Constructs textual information about the hash of HPC info. +pprHPCInfoHash :: Int -> SDoc +pprHPCInfoHash = entry (text "hash") . pprFixedSizeNatural + +-- | Constructs textual information about a module name. +pprModuleName :: ShortByteString -> SDoc +pprModuleName = entry (text "module name") . + text . + utf8DecodeShortByteString + +-- | Constructs textual information about a tick box name. +pprTickBoxName :: ShortByteString -> SDoc +pprTickBoxName = entry (text "tick box name") . + text . + utf8DecodeShortByteString + +-- | Constructs textual information about a number of tick counts. +pprTickCount :: Int -> SDoc +pprTickCount = entry (text "number of ticks") . ppr + +-- | Constructs a hexadecimal representation of a natural number such that the +-- number of hexadecimal digits fits the number of bits used to represent the +-- natural number. +pprFixedSizeNatural :: (Integral a, FiniteBits a) => a -> SDoc +pprFixedSizeNatural num + = assert (num >= 0) $ + text $ replicate (digitCount - length unpadded) '0' ++ unpadded + where + + digitCount :: Int + digitCount = (finiteBitSize num + 3) `div` 4 + + unpadded :: String + unpadded = showHex num "" + +-- | Constructs a textual representation of a boolean, interpreting 'True' and +-- 'False' as “yes” and “no”, respectively. +noOrYes :: Bool -> SDoc +noOrYes bool = text (if bool then "yes" else "no") + +-- | Constructs an entry in a list of textual data representations. +entry :: SDoc -- ^ The title of the entry + -> SDoc -- ^ The contents of the entry + -> SDoc -- ^ The entry +entry title content = hang (title <> text ":") 2 content + +-- | Composes documents vertically in general, but presents an empty document +-- list as `<none`>. +vcatOrNone :: [SDoc] -> SDoc +vcatOrNone [] = text "<none>" +vcatOrNone docs = vcat docs + +-- | Composes documents vertically in general, but presents an empty document +-- list as `<empty`>. +vcatOrEmpty :: [SDoc] -> SDoc +vcatOrEmpty [] = text "<empty>" +vcatOrEmpty docs = vcat docs ===================================== compiler/ghc.cabal.in ===================================== @@ -217,6 +217,7 @@ Library GHC.ByteCode.Linker GHC.ByteCode.Recomp.Binary GHC.ByteCode.Serialize + GHC.ByteCode.Show GHC.ByteCode.Types GHC.Cmm GHC.Cmm.BlockId ===================================== docs/users_guide/using.rst ===================================== @@ -421,6 +421,13 @@ The available mode flags are: Read the interface in ⟨file⟩ and dump it as text to ``stdout``. For example ``ghc --show-iface M.hi``. +.. ghc-flag:: --show-byte-code ⟨file⟩ + :shortdesc: display contents of a bytecode file. + :type: mode + :category: modes + + Read a bytecode file and dump relevant parts of it as text to ``stdout``. + .. ghc-flag:: --supported-extensions --supported-languages :shortdesc: display the supported language extensions ===================================== ghc/GHC/Driver/Session/Mode.hs ===================================== @@ -77,6 +77,7 @@ isShowGhciUsageMode _ = False data PostLoadMode = ShowInterface FilePath -- ghc --show-iface + | ShowByteCode FilePath -- ghc --show-byte-code | DoMkDependHS -- ghc -M | StopBefore StopPhase -- ghc -E | -C | -S -- StopBefore StopLn is the default @@ -101,6 +102,9 @@ showUnitsMode = mkPostLoadMode ShowPackages showInterfaceMode :: FilePath -> Mode showInterfaceMode fp = mkPostLoadMode (ShowInterface fp) +showByteCodeMode :: FilePath -> Mode +showByteCodeMode fp = mkPostLoadMode (ShowByteCode fp) + stopBeforeMode :: StopPhase -> Mode stopBeforeMode phase = mkPostLoadMode (StopBefore phase) @@ -231,9 +235,11 @@ mode_flags = replaceSpace ' ' = '-' replaceSpace c = c ] ++ - ------- interfaces ---------------------------------------------------- - [ defFlag "-show-iface" (HasArg (\f -> setMode (showInterfaceMode f) + ------- textual output of generated data ----------------------------- + [ defFlag "-show-iface" (HasArg (\f -> setMode (showInterfaceMode f) "--show-iface")) + , defFlag "-show-byte-code" (HasArg (\f -> setMode (showByteCodeMode f) + "--show-byte-code")) ------- primary modes ------------------------------------------------ , defFlag "c" (PassFlag (\f -> do setMode (stopBeforeMode NoStop) f ===================================== ghc/Main.hs ===================================== @@ -73,6 +73,8 @@ import GHC.SysTools.BaseDir import GHC.Iface.Load import GHC.Iface.Recomp.Binary ( fingerprintBinMem ) +import GHC.ByteCode.Show ( showByteCode ) + import GHC.Tc.Utils.Monad ( initIfaceCheck ) import GHC.Iface.Errors.Ppr @@ -267,6 +269,7 @@ main' postLoadMode units dflags0 args flagWarnings = do (hsc_units hsc_env) (hsc_NC hsc_env) f + ShowByteCode f -> liftIO $ showByteCode logger hsc_env f DoMake -> doMake units srcs DoMkDependHS -> doMkDependHS (map fst srcs) StopBefore p -> liftIO (oneShot hsc_env p srcs) ===================================== testsuite/tests/show-bytecode/Example.hs ===================================== @@ -0,0 +1,31 @@ +{-# LANGUAGE StaticPointers #-} + +module Example where + +import Numeric.Natural (Natural) +import GHC.StaticPtr (StaticPtr) + +fibonaccis :: [Natural] +fibonaccis = 0 : positiveFibonaccis where + + positiveFibonaccis :: [Natural] + positiveFibonaccis = 1 : zipWith (+) fibonaccis positiveFibonaccis + +fibonaccisPtr :: StaticPtr [Natural] +fibonaccisPtr = static fibonaccis + +divides :: Integral a => a -> a -> Bool +k `divides` n = n `mod` k == 0 + +primes :: [Natural] +primes = 2 : filter isPrime [3 ..] where + + isPrime :: Natural -> Bool + isPrime n = not (any (`divides` n) (takeWhile ((<= n) . (^ 2)) primes)) + +primesPtr :: StaticPtr [Natural] +primesPtr = static primes + +data BinTree a b = Leaf a | Node (BinTree a b) b (BinTree a b) + +data PerfectTree a = PerfectTree a | Nested (PerfectTree (a, a)) ===================================== testsuite/tests/show-bytecode/Makefile ===================================== @@ -0,0 +1,23 @@ +TOP=../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +compile = '$(TEST_HC)' $(TEST_HC_OPTS) -fbyte-code -fwrite-byte-code -no-link +show = '$(TEST_HC)' $(TEST_HC_OPTS) --show-byte-code +normalize = sed -E -e ' \ + s/_r[[:alnum:]]+/_@name_suffix@/g; \ + s/[[:xdigit:]]{32}/@hash@/g; \ + s/word [[:digit:]]{4}[[:digit:]]*/word @large_word@/ \ + ' + +show-bytecode-vanilla: + $(compile) Example.hs + $(show) Example.gbc | $(normalize) + +show-bytecode-breakpoints: + $(compile) -fbreak-points Example.hs + $(show) Example.gbc | $(normalize) + +show-bytecode-hpc: + $(compile) -fhpc Example.hs + $(show) Example.gbc | $(normalize) ===================================== testsuite/tests/show-bytecode/all.T ===================================== @@ -0,0 +1,18 @@ +test( + 'show-bytecode-vanilla', + extra_files(['Example.hs']), + makefile_test, + [] +) +test( + 'show-bytecode-breakpoints', + extra_files(['Example.hs']), + makefile_test, + [] +) +test( + 'show-bytecode-hpc', + extra_files(['Example.hs']), + makefile_test, + [] +) ===================================== testsuite/tests/show-bytecode/show-bytecode-breakpoints.stdout ===================================== @@ -0,0 +1,828 @@ +[1 of 1] Compiling Example ( Example.hs, Example.gbc ) +name: Example +hash: @hash@ +objects: + ordinary object ‘primesPtr’: + arity: 0 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 0 + utilized items: + break array of module ‘Example’ + item named ‘static_ptr1’ + item named ‘$dTypeable2_@name_suffix@’ + item named ‘$fIsStaticStaticPtr’ + static-construction object ‘static_ptr1’: + data constructor name: StaticPtr + lifted: yes + literals: + word @large_word@ + word @large_word@ + utilized items: + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘primes’ + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: StaticPtrInfo + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘static_ptr1_sat_@name_suffix@’ + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: top-level string "main" + utilized items: + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: top-level string "Example" + utilized items: + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: (,) + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘static_ptr1_sat_@name_suffix@’ + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 27 + utilized items: <none> + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 20 + utilized items: <none> + ordinary object ‘primes’: + arity: 0 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 2 + info table of ‘:’ + utilized items: + break array of module ‘Example’ + ordinary object ‘primes_sat_@name_suffix@’: + arity: 0 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 1 + utilized items: + break array of module ‘Example’ + ordinary object ‘primes_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + ordinary object ‘primes_sat_@name_suffix@’: + arity: 0 + literals: + word 3 + info table of ‘IS’ + utilized items: + item named ‘$fNumNatural’ + item named ‘fromInteger’ + item named ‘$fEnumNatural’ + item named ‘enumFrom’ + item named ‘isPrime_@name_suffix@’ + item named ‘filter’ + ordinary object ‘primes_sat_@name_suffix@’: + arity: 0 + literals: + word 2 + info table of ‘IS’ + utilized items: + item named ‘$fNumNatural’ + item named ‘fromInteger’ + ordinary object ‘isPrime_@name_suffix@’: + arity: 1 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 9 + utilized items: + break array of module ‘Example’ + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 8 + utilized items: + break array of module ‘Example’ + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 7 + utilized items: + break array of module ‘Example’ + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 6 + utilized items: + break array of module ‘Example’ + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 0 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 5 + word 2 + info table of ‘IS’ + utilized items: + break array of module ‘Example’ + ordinary object ‘v_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘$fIntegralInteger’ + item named ‘$fNumNatural’ + item named ‘^’ + ordinary object ‘pap_@name_suffix@’: + arity: 3 + literals: <none> + utilized items: <none> + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 4 + utilized items: + break array of module ‘Example’ + ordinary object ‘v_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘$fOrdNatural’ + item named ‘<=’ + ordinary object ‘pap_@name_suffix@’: + arity: 3 + literals: <none> + utilized items: <none> + item named ‘.’ + item named ‘primes’ + item named ‘takeWhile’ + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 3 + utilized items: + break array of module ‘Example’ + ordinary object ‘pap_@name_suffix@’: + arity: 2 + literals: <none> + utilized items: + item named ‘$fIntegralNatural’ + item named ‘divides’ + item named ‘$fFoldableList’ + item named ‘any’ + item named ‘not’ + ordinary object ‘fibonaccisPtr’: + arity: 0 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 10 + utilized items: + break array of module ‘Example’ + item named ‘static_ptr’ + item named ‘$dTypeable2_@name_suffix@’ + item named ‘$fIsStaticStaticPtr’ + static-construction object ‘static_ptr’: + data constructor name: StaticPtr + lifted: yes + literals: + word @large_word@ + word @large_word@ + utilized items: + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘fibonaccis’ + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: StaticPtrInfo + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘static_ptr_sat_@name_suffix@’ + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: top-level string "main" + utilized items: + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: top-level string "Example" + utilized items: + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: (,) + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘static_ptr_sat_@name_suffix@’ + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 15 + utilized items: <none> + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 24 + utilized items: <none> + ordinary object ‘fibonaccis’: + arity: 0 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 11 + info table of ‘:’ + utilized items: + break array of module ‘Example’ + ordinary object ‘fibonaccis_sat_@name_suffix@’: + arity: 0 + literals: + word 0 + info table of ‘IS’ + utilized items: + item named ‘$fNumNatural’ + item named ‘fromInteger’ + item named ‘positiveFibonaccis_@name_suffix@’ + ordinary object ‘positiveFibonaccis_@name_suffix@’: + arity: 0 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 13 + info table of ‘:’ + utilized items: + break array of module ‘Example’ + ordinary object ‘positiveFibonaccis_sat_@name_suffix@’: + arity: 0 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 12 + utilized items: + break array of module ‘Example’ + ordinary object ‘positiveFibonaccis_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘$fNumNatural’ + item named ‘+’ + item named ‘positiveFibonaccis_@name_suffix@’ + item named ‘fibonaccis’ + item named ‘zipWith’ + ordinary object ‘positiveFibonaccis_sat_@name_suffix@’: + arity: 0 + literals: + word 1 + info table of ‘IS’ + utilized items: + item named ‘$fNumNatural’ + item named ‘fromInteger’ + ordinary object ‘$dTypeable2_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘$dTypeable_@name_suffix@’ + item named ‘$dTypeable1_@name_suffix@’ + item named ‘mkTrAppChecked’ + ordinary object ‘$dTypeable1_@name_suffix@’: + arity: 0 + literals: info table of ‘[]’ + utilized items: + item named ‘$tcList’ + item named ‘mkTrCon’ + ordinary object ‘$dTypeable_@name_suffix@’: + arity: 0 + literals: info table of ‘[]’ + utilized items: + item named ‘$tcNatural’ + item named ‘mkTrCon’ + static-construction object ‘$tc'Nested’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 1 + utilized items: + item named ‘$trModule’ + item named ‘$tc'Nested2_@name_suffix@’ + item named ‘$krep17_@name_suffix@’ + static-construction object ‘$tc'Nested2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'Nested1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep17_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep16_@name_suffix@’ + item named ‘$krep13_@name_suffix@’ + static-construction object ‘$krep16_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcPerfectTree’ + item named ‘$krep15_@name_suffix@’ + static-construction object ‘$krep15_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep4_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$tc'PerfectTree’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 1 + utilized items: + item named ‘$trModule’ + item named ‘$tc'PerfectTree2_@name_suffix@’ + item named ‘$krep14_@name_suffix@’ + static-construction object ‘$tc'PerfectTree2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'PerfectTree1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep14_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep13_@name_suffix@’ + static-construction object ‘$krep13_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcPerfectTree’ + item named ‘$krep12_@name_suffix@’ + static-construction object ‘$krep12_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$tcPerfectTree’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 0 + utilized items: + item named ‘$trModule’ + item named ‘$tcPerfectTree2_@name_suffix@’ + item named ‘krep$*Arr*’ + static-construction object ‘$tcPerfectTree2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tcPerfectTree1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$tc'Node’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 2 + utilized items: + item named ‘$trModule’ + item named ‘$tc'Node2_@name_suffix@’ + item named ‘$krep11_@name_suffix@’ + static-construction object ‘$tc'Node2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'Node1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep11_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep7_@name_suffix@’ + item named ‘$krep10_@name_suffix@’ + static-construction object ‘$krep10_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep_@name_suffix@’ + item named ‘$krep9_@name_suffix@’ + static-construction object ‘$krep9_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep7_@name_suffix@’ + item named ‘$krep7_@name_suffix@’ + static-construction object ‘$tc'Leaf’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 2 + utilized items: + item named ‘$trModule’ + item named ‘$tc'Leaf2_@name_suffix@’ + item named ‘$krep8_@name_suffix@’ + static-construction object ‘$tc'Leaf2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'Leaf1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep8_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep7_@name_suffix@’ + static-construction object ‘$krep7_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcBinTree’ + item named ‘$krep6_@name_suffix@’ + static-construction object ‘$krep6_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep5_@name_suffix@’ + static-construction object ‘$krep5_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$tcBinTree’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 0 + utilized items: + item named ‘$trModule’ + item named ‘$tcBinTree2_@name_suffix@’ + item named ‘krep$*->*->*’ + static-construction object ‘$tcBinTree2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tcBinTree1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep4_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcTuple2’ + item named ‘$krep3_@name_suffix@’ + static-construction object ‘$krep3_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep2_@name_suffix@’ + static-construction object ‘$krep2_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$krep1_@name_suffix@’: + data constructor name: KindRepVar + lifted: yes + literals: word 0 + utilized items: <none> + static-construction object ‘$krep_@name_suffix@’: + data constructor name: KindRepVar + lifted: yes + literals: word 1 + utilized items: <none> + static-construction object ‘$trModule’: + data constructor name: Module + lifted: yes + literals: <none> + utilized items: + item named ‘$trModule2_@name_suffix@’ + item named ‘$trModule4_@name_suffix@’ + static-construction object ‘$trModule4_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$trModule3_@name_suffix@’ + utilized items: <none> + static-construction object ‘$trModule2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$trModule1_@name_suffix@’ + utilized items: <none> + ordinary object ‘divides’: + arity: 3 + literals: <none> + utilized items: + ordinary object ‘$dReal_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + ordinary object ‘$dNum_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + ordinary object ‘$dEq_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + ordinary object ‘$dEq1_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + ordinary object ‘bcprep_@name_suffix@’: + arity: 5 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 15 + utilized items: + break array of module ‘Example’ + ordinary object ‘divides_sat_@name_suffix@’: + arity: 1 + literals: + word 0 + info table of ‘IS’ + utilized items: item named ‘fromInteger’ + ordinary object ‘divides_sat_@name_suffix@’: + arity: 3 + literals: + top-level string "Example" + top-level string "main" + cost center of breakpoint 14 + utilized items: + break array of module ‘Example’ + item named ‘mod’ + item named ‘==’ + item named ‘$p1Ord’ + item named ‘$p2Real’ + item named ‘$p1Real’ + item named ‘$p1Integral’ + ordinary object ‘Node’: + arity: 3 + literals: info table of ‘Node’ + utilized items: <none> + ordinary object ‘Leaf’: + arity: 1 + literals: info table of ‘Leaf’ + utilized items: <none> + ordinary object ‘Nested’: + arity: 1 + literals: info table of ‘Nested’ + utilized items: <none> + ordinary object ‘PerfectTree’: + arity: 1 + literals: info table of ‘PerfectTree’ + utilized items: <none> +data constructor info tables: + info table of ‘PerfectTree’: + number of words for pointers: 1 + number of words for non-pointers: 0 + info table of ‘Nested’: + number of words for pointers: 1 + number of words for non-pointers: 0 + info table of ‘Leaf’: + number of words for pointers: 1 + number of words for non-pointers: 0 + info table of ‘Node’: + number of words for pointers: 3 + number of words for non-pointers: 0 +top-level strings: + $tc'Nested1_@name_suffix@: "'Nested" + $tc'PerfectTree1_@name_suffix@: "'PerfectTree" + $tcPerfectTree1_@name_suffix@: "PerfectTree" + $tc'Node1_@name_suffix@: "'Node" + $tc'Leaf1_@name_suffix@: "'Leaf" + $tcBinTree1_@name_suffix@: "BinTree" + $trModule3_@name_suffix@: "Example" + $trModule1_@name_suffix@: "main" +breakpoints: + source breakpoints: + source breakpoint 0: + source span: Example.hs:18:17-25 + declaration path: divides + free variables: + k + n + source breakpoint 1: + source span: Example.hs:18:17-30 + declaration path: divides + free variables: + k + n + source breakpoint 2: + source span: Example.hs:24:27-37 + declaration path: + primes + isPrime + free variables: n + source breakpoint 3: + source span: Example.hs:24:53-56 + declaration path: + primes + isPrime + free variables: n + source breakpoint 4: + source span: Example.hs:24:62-64 + declaration path: + primes + isPrime + free variables: <none> + source breakpoint 5: + source span: Example.hs:24:52-65 + declaration path: + primes + isPrime + free variables: n + source breakpoint 6: + source span: Example.hs:24:41-73 + declaration path: + primes + isPrime + free variables: n + source breakpoint 7: + source span: Example.hs:24:22-74 + declaration path: + primes + isPrime + free variables: n + source breakpoint 8: + source span: Example.hs:24:17-75 + declaration path: + primes + isPrime + free variables: n + source breakpoint 9: + source span: Example.hs:21:14-34 + declaration path: primes + free variables: isPrime + source breakpoint 10: + source span: Example.hs:21:10-34 + declaration path: primes + free variables: isPrime + source breakpoint 11: + source span: Example.hs:27:13-25 + declaration path: primesPtr + free variables: <none> + source breakpoint 12: + source span: Example.hs:12:30-70 + declaration path: + fibonaccis + positiveFibonaccis + free variables: positiveFibonaccis + source breakpoint 13: + source span: Example.hs:12:26-70 + declaration path: + fibonaccis + positiveFibonaccis + free variables: positiveFibonaccis + source breakpoint 14: + source span: Example.hs:9:14-35 + declaration path: fibonaccis + free variables: positiveFibonaccis + source breakpoint 15: + source span: Example.hs:15:17-33 + declaration path: fibonaccisPtr + free variables: <none> + bytecode breakpoints: + bytecode breakpoint 0: + type: StaticPtr [Natural] + type variables: <none> + variables: <none> + corresponding source breakpoint: 11 + bytecode breakpoint 1: + type: [Natural] + type variables: <none> + variables: <unknown> + corresponding source breakpoint: 9 + bytecode breakpoint 2: + type: [Natural] + type variables: <none> + variables: <unknown> + corresponding source breakpoint: 10 + bytecode breakpoint 3: + type: Natural -> Bool + type variables: <none> + variables: %'Many n :: Natural + corresponding source breakpoint: 2 + bytecode breakpoint 4: + type: Natural -> Bool + type variables: <none> + variables: %'Many n :: Natural + corresponding source breakpoint: 3 + bytecode breakpoint 5: + type: Natural -> Natural + type variables: <none> + variables: <none> + corresponding source breakpoint: 4 + bytecode breakpoint 6: + type: Natural -> Bool + type variables: <none> + variables: %'Many n :: Natural + corresponding source breakpoint: 5 + bytecode breakpoint 7: + type: [Natural] + type variables: <none> + variables: %'Many n :: Natural + corresponding source breakpoint: 6 + bytecode breakpoint 8: + type: Bool + type variables: <none> + variables: %'Many n :: Natural + corresponding source breakpoint: 7 + bytecode breakpoint 9: + type: Bool + type variables: <none> + variables: %'Many n :: Natural + corresponding source breakpoint: 8 + bytecode breakpoint 10: + type: StaticPtr [Natural] + type variables: <none> + variables: <none> + corresponding source breakpoint: 15 + bytecode breakpoint 11: + type: [Natural] + type variables: <none> + variables: <unknown> + corresponding source breakpoint: 14 + bytecode breakpoint 12: + type: [Natural] + type variables: <none> + variables: <unknown> + corresponding source breakpoint: 12 + bytecode breakpoint 13: + type: [Natural] + type variables: <none> + variables: <unknown> + corresponding source breakpoint: 13 + bytecode breakpoint 14: + type: a + type variables: a :: * + variables: + %'Many eta :: a + %'Many eta1 :: a + corresponding source breakpoint: 0 + bytecode breakpoint 15: + type: Bool + type variables: a :: * + variables: + %'Many eta :: a + %'Many eta1 :: a + corresponding source breakpoint: 1 +static-pointer table entries: + @hash@: static_ptr + @hash@: static_ptr1 +HPC information: <none> + ===================================== testsuite/tests/show-bytecode/show-bytecode-hpc.stdout ===================================== @@ -0,0 +1,668 @@ +[1 of 1] Compiling Example ( Example.hs, Example.gbc ) +name: Example +hash: @hash@ +objects: + ordinary object ‘primesPtr’: + arity: 0 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + item named ‘static_ptr1’ + item named ‘$dTypeable2_@name_suffix@’ + item named ‘$fIsStaticStaticPtr’ + static-construction object ‘static_ptr1’: + data constructor name: StaticPtr + lifted: yes + literals: + word @large_word@ + word @large_word@ + utilized items: + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘static_ptr1_sat_@name_suffix@’ + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: StaticPtrInfo + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘static_ptr1_sat_@name_suffix@’ + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: top-level string "main" + utilized items: + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: top-level string "Example" + utilized items: + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: (,) + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘static_ptr1_sat_@name_suffix@’ + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 27 + utilized items: <none> + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 20 + utilized items: <none> + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: item named ‘primes’ + ordinary object ‘primes2_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘primes2_sat_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘primes2_sat_@name_suffix@’: + arity: 0 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + word 3 + info table of ‘IS’ + utilized items: + item named ‘$fNumNatural’ + item named ‘fromInteger’ + item named ‘$fEnumNatural’ + item named ‘enumFrom’ + ordinary object ‘primes2_sat_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: item named ‘isPrime_@name_suffix@’ + item named ‘filter’ + ordinary object ‘isPrime_@name_suffix@’: + arity: 1 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: item named ‘primes’ + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘v_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + item named ‘$fIntegralInteger’ + item named ‘$fNumNatural’ + item named ‘^’ + ordinary object ‘v1_@name_suffix@’: + arity: 0 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + word 2 + info table of ‘IS’ + utilized items: <none> + ordinary object ‘pap_@name_suffix@’: + arity: 3 + literals: <none> + utilized items: <none> + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘v_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + item named ‘$fOrdNatural’ + item named ‘<=’ + ordinary object ‘v1_@name_suffix@’: + arity: 1 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: <none> + ordinary object ‘pap_@name_suffix@’: + arity: 3 + literals: <none> + utilized items: <none> + item named ‘.’ + item named ‘takeWhile’ + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘v_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘pap_@name_suffix@’: + arity: 2 + literals: <none> + utilized items: + item named ‘$fIntegralNatural’ + item named ‘divides’ + ordinary object ‘v1_@name_suffix@’: + arity: 1 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: <none> + ordinary object ‘pap_@name_suffix@’: + arity: 3 + literals: <none> + utilized items: <none> + item named ‘$fFoldableList’ + item named ‘any’ + item named ‘not’ + ordinary object ‘primes’: + arity: 0 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + label ‘_hpc_tickboxes_Example_hpc’ + info table of ‘:’ + utilized items: + item named ‘primes2_@name_suffix@’ + item named ‘primes1_@name_suffix@’ + ordinary object ‘primes1_@name_suffix@’: + arity: 0 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + word 2 + info table of ‘IS’ + utilized items: + item named ‘$fNumNatural’ + item named ‘fromInteger’ + ordinary object ‘fibonaccisPtr’: + arity: 0 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + item named ‘static_ptr’ + item named ‘$dTypeable2_@name_suffix@’ + item named ‘$fIsStaticStaticPtr’ + static-construction object ‘static_ptr’: + data constructor name: StaticPtr + lifted: yes + literals: + word @large_word@ + word @large_word@ + utilized items: + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘static_ptr_sat_@name_suffix@’ + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: StaticPtrInfo + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘static_ptr_sat_@name_suffix@’ + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: top-level string "main" + utilized items: + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: top-level string "Example" + utilized items: + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: (,) + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘static_ptr_sat_@name_suffix@’ + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 15 + utilized items: <none> + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 24 + utilized items: <none> + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: item named ‘fibonaccis’ + ordinary object ‘positiveFibonaccis1_@name_suffix@’: + arity: 0 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + label ‘_hpc_tickboxes_Example_hpc’ + info table of ‘:’ + utilized items: + item named ‘positiveFibonaccis2_@name_suffix@’ + item named ‘positiveFibonaccis_@name_suffix@’ + ordinary object ‘positiveFibonaccis2_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘positiveFibonaccis2_sat_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: item named ‘positiveFibonaccis1_@name_suffix@’ + ordinary object ‘positiveFibonaccis2_sat_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: item named ‘fibonaccis’ + ordinary object ‘positiveFibonaccis2_sat_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + item named ‘$fNumNatural’ + item named ‘+’ + item named ‘zipWith’ + ordinary object ‘fibonaccis’: + arity: 0 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + label ‘_hpc_tickboxes_Example_hpc’ + info table of ‘:’ + utilized items: + item named ‘fibonaccis2_@name_suffix@’ + item named ‘fibonaccis1_@name_suffix@’ + ordinary object ‘fibonaccis2_@name_suffix@’: + arity: 0 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: item named ‘positiveFibonaccis1_@name_suffix@’ + ordinary object ‘positiveFibonaccis_@name_suffix@’: + arity: 0 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + word 1 + info table of ‘IS’ + utilized items: + item named ‘$fNumNatural’ + item named ‘fromInteger’ + ordinary object ‘fibonaccis1_@name_suffix@’: + arity: 0 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + word 0 + info table of ‘IS’ + utilized items: + item named ‘$fNumNatural’ + item named ‘fromInteger’ + ordinary object ‘$dTypeable2_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘$dTypeable_@name_suffix@’ + item named ‘$dTypeable1_@name_suffix@’ + item named ‘mkTrAppChecked’ + ordinary object ‘$dTypeable1_@name_suffix@’: + arity: 0 + literals: info table of ‘[]’ + utilized items: + item named ‘$tcList’ + item named ‘mkTrCon’ + ordinary object ‘$dTypeable_@name_suffix@’: + arity: 0 + literals: info table of ‘[]’ + utilized items: + item named ‘$tcNatural’ + item named ‘mkTrCon’ + static-construction object ‘$tc'Nested’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 1 + utilized items: + item named ‘$trModule’ + item named ‘$tc'Nested2_@name_suffix@’ + item named ‘$krep17_@name_suffix@’ + static-construction object ‘$tc'Nested2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'Nested1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep17_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep16_@name_suffix@’ + item named ‘$krep13_@name_suffix@’ + static-construction object ‘$krep16_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcPerfectTree’ + item named ‘$krep15_@name_suffix@’ + static-construction object ‘$krep15_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep4_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$tc'PerfectTree’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 1 + utilized items: + item named ‘$trModule’ + item named ‘$tc'PerfectTree2_@name_suffix@’ + item named ‘$krep14_@name_suffix@’ + static-construction object ‘$tc'PerfectTree2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'PerfectTree1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep14_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep13_@name_suffix@’ + static-construction object ‘$krep13_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcPerfectTree’ + item named ‘$krep12_@name_suffix@’ + static-construction object ‘$krep12_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$tcPerfectTree’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 0 + utilized items: + item named ‘$trModule’ + item named ‘$tcPerfectTree2_@name_suffix@’ + item named ‘krep$*Arr*’ + static-construction object ‘$tcPerfectTree2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tcPerfectTree1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$tc'Node’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 2 + utilized items: + item named ‘$trModule’ + item named ‘$tc'Node2_@name_suffix@’ + item named ‘$krep11_@name_suffix@’ + static-construction object ‘$tc'Node2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'Node1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep11_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep7_@name_suffix@’ + item named ‘$krep10_@name_suffix@’ + static-construction object ‘$krep10_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep_@name_suffix@’ + item named ‘$krep9_@name_suffix@’ + static-construction object ‘$krep9_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep7_@name_suffix@’ + item named ‘$krep7_@name_suffix@’ + static-construction object ‘$tc'Leaf’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 2 + utilized items: + item named ‘$trModule’ + item named ‘$tc'Leaf2_@name_suffix@’ + item named ‘$krep8_@name_suffix@’ + static-construction object ‘$tc'Leaf2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'Leaf1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep8_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep7_@name_suffix@’ + static-construction object ‘$krep7_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcBinTree’ + item named ‘$krep6_@name_suffix@’ + static-construction object ‘$krep6_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep5_@name_suffix@’ + static-construction object ‘$krep5_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$tcBinTree’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 0 + utilized items: + item named ‘$trModule’ + item named ‘$tcBinTree2_@name_suffix@’ + item named ‘krep$*->*->*’ + static-construction object ‘$tcBinTree2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tcBinTree1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep4_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcTuple2’ + item named ‘$krep3_@name_suffix@’ + static-construction object ‘$krep3_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep2_@name_suffix@’ + static-construction object ‘$krep2_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$krep1_@name_suffix@’: + data constructor name: KindRepVar + lifted: yes + literals: word 0 + utilized items: <none> + static-construction object ‘$krep_@name_suffix@’: + data constructor name: KindRepVar + lifted: yes + literals: word 1 + utilized items: <none> + static-construction object ‘$trModule’: + data constructor name: Module + lifted: yes + literals: <none> + utilized items: + item named ‘$trModule2_@name_suffix@’ + item named ‘$trModule4_@name_suffix@’ + static-construction object ‘$trModule4_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$trModule3_@name_suffix@’ + utilized items: <none> + static-construction object ‘$trModule2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$trModule1_@name_suffix@’ + utilized items: <none> + ordinary object ‘divides’: + arity: 3 + literals: <none> + utilized items: + ordinary object ‘$dReal_@name_suffix@’: + arity: 0 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘divides_sat_@name_suffix@’: + arity: 1 + literals: + label ‘_hpc_tickboxes_Example_hpc’ + word 0 + info table of ‘IS’ + utilized items: + ordinary object ‘divides_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘fromInteger’ + item named ‘$p1Real’ + ordinary object ‘divides_sat_@name_suffix@’: + arity: 3 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: + ordinary object ‘divides_sat_@name_suffix@’: + arity: 1 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: <none> + ordinary object ‘divides_sat_@name_suffix@’: + arity: 1 + literals: label ‘_hpc_tickboxes_Example_hpc’ + utilized items: <none> + item named ‘mod’ + ordinary object ‘divides_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + ordinary object ‘divides_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘==’ + item named ‘$p1Ord’ + item named ‘$p2Real’ + item named ‘$p1Integral’ + ordinary object ‘Node’: + arity: 3 + literals: info table of ‘Node’ + utilized items: <none> + ordinary object ‘Leaf’: + arity: 1 + literals: info table of ‘Leaf’ + utilized items: <none> + ordinary object ‘Nested’: + arity: 1 + literals: info table of ‘Nested’ + utilized items: <none> + ordinary object ‘PerfectTree’: + arity: 1 + literals: info table of ‘PerfectTree’ + utilized items: <none> +data constructor info tables: + info table of ‘PerfectTree’: + number of words for pointers: 1 + number of words for non-pointers: 0 + info table of ‘Nested’: + number of words for pointers: 1 + number of words for non-pointers: 0 + info table of ‘Leaf’: + number of words for pointers: 1 + number of words for non-pointers: 0 + info table of ‘Node’: + number of words for pointers: 3 + number of words for non-pointers: 0 +top-level strings: + $tc'Nested1_@name_suffix@: "'Nested" + $tc'PerfectTree1_@name_suffix@: "'PerfectTree" + $tcPerfectTree1_@name_suffix@: "PerfectTree" + $tc'Node1_@name_suffix@: "'Node" + $tc'Leaf1_@name_suffix@: "'Leaf" + $tcBinTree1_@name_suffix@: "BinTree" + $trModule3_@name_suffix@: "Example" + $trModule1_@name_suffix@: "main" +breakpoints: <none> +static-pointer table entries: + @hash@: static_ptr + @hash@: static_ptr1 +HPC information: + hash: 000000006110204f + module name: Example + tick box name: _hpc_tickboxes_Example_hpc + number of ticks: 45 + ===================================== testsuite/tests/show-bytecode/show-bytecode-vanilla.stdout ===================================== @@ -0,0 +1,593 @@ +[1 of 1] Compiling Example ( Example.hs, Example.gbc ) +name: Example +hash: @hash@ +objects: + ordinary object ‘primesPtr’: + arity: 0 + literals: <none> + utilized items: + item named ‘static_ptr1’ + item named ‘$dTypeable2_@name_suffix@’ + item named ‘$fIsStaticStaticPtr’ + static-construction object ‘static_ptr1’: + data constructor name: StaticPtr + lifted: yes + literals: + word @large_word@ + word @large_word@ + utilized items: + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘primes’ + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: StaticPtrInfo + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘static_ptr1_sat_@name_suffix@’ + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: top-level string "main" + utilized items: + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: top-level string "Example" + utilized items: + ordinary object ‘static_ptr1_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: (,) + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr1_sat_@name_suffix@’ + item named ‘static_ptr1_sat_@name_suffix@’ + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 27 + utilized items: <none> + static-construction object ‘static_ptr1_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 20 + utilized items: <none> + ordinary object ‘primes2_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘primes2_sat_@name_suffix@’ + item named ‘isPrime_@name_suffix@’ + item named ‘filter’ + ordinary object ‘isPrime_@name_suffix@’: + arity: 1 + literals: <none> + utilized items: + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: <none> + utilized items: + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: <none> + utilized items: + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 1 + literals: + word 2 + info table of ‘IS’ + utilized items: + ordinary object ‘v_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘$fIntegralInteger’ + item named ‘$fNumNatural’ + item named ‘^’ + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 3 + literals: <none> + utilized items: <none> + ordinary object ‘v_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘$fOrdNatural’ + item named ‘<=’ + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 3 + literals: <none> + utilized items: <none> + item named ‘.’ + item named ‘primes’ + item named ‘takeWhile’ + ordinary object ‘isPrime_sat_@name_suffix@’: + arity: 2 + literals: <none> + utilized items: + item named ‘$fIntegralNatural’ + item named ‘divides’ + item named ‘$fFoldableList’ + item named ‘any’ + item named ‘not’ + static-construction object ‘primes’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘primes1_@name_suffix@’ + item named ‘primes2_@name_suffix@’ + ordinary object ‘primes2_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + ordinary object ‘primes2_sat_@name_suffix@’: + arity: 0 + literals: + word 3 + info table of ‘IS’ + utilized items: + item named ‘$fNumNatural’ + item named ‘fromInteger’ + item named ‘$fEnumNatural’ + item named ‘enumFrom’ + ordinary object ‘primes1_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘primes1_sat_@name_suffix@’ + item named ‘$fNumNatural’ + item named ‘fromInteger’ + static-construction object ‘primes1_sat_@name_suffix@’: + data constructor name: IS + lifted: yes + literals: word 2 + utilized items: <none> + ordinary object ‘fibonaccisPtr’: + arity: 0 + literals: <none> + utilized items: + item named ‘static_ptr’ + item named ‘$dTypeable2_@name_suffix@’ + item named ‘$fIsStaticStaticPtr’ + static-construction object ‘static_ptr’: + data constructor name: StaticPtr + lifted: yes + literals: + word @large_word@ + word @large_word@ + utilized items: + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘fibonaccis’ + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: StaticPtrInfo + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘static_ptr_sat_@name_suffix@’ + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: top-level string "main" + utilized items: + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: top-level string "Example" + utilized items: + ordinary object ‘static_ptr_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘unpackCString#’ + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: (,) + lifted: yes + literals: <none> + utilized items: + item named ‘static_ptr_sat_@name_suffix@’ + item named ‘static_ptr_sat_@name_suffix@’ + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 15 + utilized items: <none> + static-construction object ‘static_ptr_sat_@name_suffix@’: + data constructor name: I# + lifted: yes + literals: word 24 + utilized items: <none> + ordinary object ‘positiveFibonaccis2_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘positiveFibonaccis1_@name_suffix@’ + item named ‘fibonaccis’ + item named ‘positiveFibonaccis2_sat_@name_suffix@’ + item named ‘zipWith’ + static-construction object ‘positiveFibonaccis1_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘positiveFibonaccis_@name_suffix@’ + item named ‘positiveFibonaccis2_@name_suffix@’ + static-construction object ‘fibonaccis’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘fibonaccis1_@name_suffix@’ + item named ‘positiveFibonaccis1_@name_suffix@’ + ordinary object ‘positiveFibonaccis2_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘$fNumNatural’ + item named ‘+’ + ordinary object ‘positiveFibonaccis_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘positiveFibonaccis_sat_@name_suffix@’ + item named ‘$fNumNatural’ + item named ‘fromInteger’ + static-construction object ‘positiveFibonaccis_sat_@name_suffix@’: + data constructor name: IS + lifted: yes + literals: word 1 + utilized items: <none> + ordinary object ‘fibonaccis1_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘fibonaccis1_sat_@name_suffix@’ + item named ‘$fNumNatural’ + item named ‘fromInteger’ + static-construction object ‘fibonaccis1_sat_@name_suffix@’: + data constructor name: IS + lifted: yes + literals: word 0 + utilized items: <none> + ordinary object ‘$dTypeable2_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + item named ‘$dTypeable_@name_suffix@’ + item named ‘$dTypeable1_@name_suffix@’ + item named ‘mkTrAppChecked’ + ordinary object ‘$dTypeable1_@name_suffix@’: + arity: 0 + literals: info table of ‘[]’ + utilized items: + item named ‘$tcList’ + item named ‘mkTrCon’ + ordinary object ‘$dTypeable_@name_suffix@’: + arity: 0 + literals: info table of ‘[]’ + utilized items: + item named ‘$tcNatural’ + item named ‘mkTrCon’ + static-construction object ‘$tc'Nested’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 1 + utilized items: + item named ‘$trModule’ + item named ‘$tc'Nested2_@name_suffix@’ + item named ‘$krep17_@name_suffix@’ + static-construction object ‘$tc'Nested2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'Nested1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep17_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep16_@name_suffix@’ + item named ‘$krep13_@name_suffix@’ + static-construction object ‘$krep16_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcPerfectTree’ + item named ‘$krep15_@name_suffix@’ + static-construction object ‘$krep15_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep4_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$tc'PerfectTree’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 1 + utilized items: + item named ‘$trModule’ + item named ‘$tc'PerfectTree2_@name_suffix@’ + item named ‘$krep14_@name_suffix@’ + static-construction object ‘$tc'PerfectTree2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'PerfectTree1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep14_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep13_@name_suffix@’ + static-construction object ‘$krep13_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcPerfectTree’ + item named ‘$krep12_@name_suffix@’ + static-construction object ‘$krep12_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$tcPerfectTree’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 0 + utilized items: + item named ‘$trModule’ + item named ‘$tcPerfectTree2_@name_suffix@’ + item named ‘krep$*Arr*’ + static-construction object ‘$tcPerfectTree2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tcPerfectTree1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$tc'Node’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 2 + utilized items: + item named ‘$trModule’ + item named ‘$tc'Node2_@name_suffix@’ + item named ‘$krep11_@name_suffix@’ + static-construction object ‘$tc'Node2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'Node1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep11_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep7_@name_suffix@’ + item named ‘$krep10_@name_suffix@’ + static-construction object ‘$krep10_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep_@name_suffix@’ + item named ‘$krep9_@name_suffix@’ + static-construction object ‘$krep9_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep7_@name_suffix@’ + item named ‘$krep7_@name_suffix@’ + static-construction object ‘$tc'Leaf’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 2 + utilized items: + item named ‘$trModule’ + item named ‘$tc'Leaf2_@name_suffix@’ + item named ‘$krep8_@name_suffix@’ + static-construction object ‘$tc'Leaf2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tc'Leaf1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep8_@name_suffix@’: + data constructor name: KindRepFun + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep7_@name_suffix@’ + static-construction object ‘$krep7_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcBinTree’ + item named ‘$krep6_@name_suffix@’ + static-construction object ‘$krep6_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep5_@name_suffix@’ + static-construction object ‘$krep5_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$tcBinTree’: + data constructor name: TyCon + lifted: yes + literals: + word @large_word@ + word @large_word@ + word 0 + utilized items: + item named ‘$trModule’ + item named ‘$tcBinTree2_@name_suffix@’ + item named ‘krep$*->*->*’ + static-construction object ‘$tcBinTree2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$tcBinTree1_@name_suffix@’ + utilized items: <none> + static-construction object ‘$krep4_@name_suffix@’: + data constructor name: KindRepTyConApp + lifted: yes + literals: <none> + utilized items: + item named ‘$tcTuple2’ + item named ‘$krep3_@name_suffix@’ + static-construction object ‘$krep3_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘$krep2_@name_suffix@’ + static-construction object ‘$krep2_@name_suffix@’: + data constructor name: : + lifted: yes + literals: <none> + utilized items: + item named ‘$krep1_@name_suffix@’ + item named ‘[]’ + static-construction object ‘$krep1_@name_suffix@’: + data constructor name: KindRepVar + lifted: yes + literals: word 0 + utilized items: <none> + static-construction object ‘$krep_@name_suffix@’: + data constructor name: KindRepVar + lifted: yes + literals: word 1 + utilized items: <none> + static-construction object ‘$trModule’: + data constructor name: Module + lifted: yes + literals: <none> + utilized items: + item named ‘$trModule2_@name_suffix@’ + item named ‘$trModule4_@name_suffix@’ + static-construction object ‘$trModule4_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$trModule3_@name_suffix@’ + utilized items: <none> + static-construction object ‘$trModule2_@name_suffix@’: + data constructor name: TrNameS + lifted: yes + literals: address ‘$trModule1_@name_suffix@’ + utilized items: <none> + ordinary object ‘divides’: + arity: 3 + literals: <none> + utilized items: + ordinary object ‘$dReal_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + ordinary object ‘divides_sat_@name_suffix@’: + arity: 1 + literals: + word 0 + info table of ‘IS’ + utilized items: + ordinary object ‘divides_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘fromInteger’ + item named ‘$p1Real’ + ordinary object ‘divides_sat_@name_suffix@’: + arity: 3 + literals: <none> + utilized items: item named ‘mod’ + ordinary object ‘divides_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: + ordinary object ‘divides_sat_@name_suffix@’: + arity: 0 + literals: <none> + utilized items: item named ‘==’ + item named ‘$p1Ord’ + item named ‘$p2Real’ + item named ‘$p1Integral’ + ordinary object ‘Node’: + arity: 3 + literals: info table of ‘Node’ + utilized items: <none> + ordinary object ‘Leaf’: + arity: 1 + literals: info table of ‘Leaf’ + utilized items: <none> + ordinary object ‘Nested’: + arity: 1 + literals: info table of ‘Nested’ + utilized items: <none> + ordinary object ‘PerfectTree’: + arity: 1 + literals: info table of ‘PerfectTree’ + utilized items: <none> +data constructor info tables: + info table of ‘PerfectTree’: + number of words for pointers: 1 + number of words for non-pointers: 0 + info table of ‘Nested’: + number of words for pointers: 1 + number of words for non-pointers: 0 + info table of ‘Leaf’: + number of words for pointers: 1 + number of words for non-pointers: 0 + info table of ‘Node’: + number of words for pointers: 3 + number of words for non-pointers: 0 +top-level strings: + $tc'Nested1_@name_suffix@: "'Nested" + $tc'PerfectTree1_@name_suffix@: "'PerfectTree" + $tcPerfectTree1_@name_suffix@: "PerfectTree" + $tc'Node1_@name_suffix@: "'Node" + $tc'Leaf1_@name_suffix@: "'Leaf" + $tcBinTree1_@name_suffix@: "BinTree" + $trModule3_@name_suffix@: "Example" + $trModule1_@name_suffix@: "main" +breakpoints: <none> +static-pointer table entries: + @hash@: static_ptr + @hash@: static_ptr1 +HPC information: <none> + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/97ab9bcd932d759d771c562f3ebae8d0... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/97ab9bcd932d759d771c562f3ebae8d0... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help