Wolfgang Jeltsch pushed to branch wip/jeltsch/textual-bytecode-output at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/ByteCode/Show.hs
    ... ... @@ -37,7 +37,12 @@ import GHC.Utils.Outputable
    37 37
                withPprStyle,
    
    38 38
                ppr
    
    39 39
            )
    
    40
    -import GHC.ByteCode.Types (UnlinkedBCO, ByteCodeHpcInfo, CompiledByteCode (..))
    
    40
    +import GHC.ByteCode.Types
    
    41
    +       (
    
    42
    +           UnlinkedBCO (UnlinkedBCO, UnlinkedStaticCon),
    
    43
    +           ByteCodeHpcInfo,
    
    44
    +           CompiledByteCode (..)
    
    45
    +       )
    
    41 46
     import GHC.ByteCode.Breakpoints (InternalModBreaks)
    
    42 47
     import GHC.ByteCode.Binary (OnDiskModuleByteCode (..))
    
    43 48
     import GHC.ByteCode.Serialize (readOnDiskModuleByteCode)
    
    ... ... @@ -78,17 +83,44 @@ pprCompiledByteCode CompiledByteCode {..}
    78 83
                    pprBreakPoints               bc_breaks,
    
    79 84
                    pprStaticPointerTableEntries bc_spt_entries,
    
    80 85
                    pprHPCInfo                   bc_hpc_info
    
    81
    -      ]
    
    86
    +           ]
    
    82 87
     
    
    83 88
     -- | […]
    
    84 89
     pprByteCodeObjects :: [UnlinkedBCO] -> SDoc
    
    85
    -pprByteCodeObjects = multiLineEntry (text "bytecode objects") .
    
    86
    -                     vcatOrNone                               .
    
    90
    +pprByteCodeObjects = multiLineEntry (text "bytecode objects:") .
    
    91
    +                     vcatOrNone                                .
    
    87 92
                          map pprByteCodeObject
    
    88 93
     
    
    89 94
     -- | […]
    
    90 95
     pprByteCodeObject :: UnlinkedBCO -> SDoc
    
    91
    -pprByteCodeObject = pprByteCodeObject
    
    96
    +pprByteCodeObject UnlinkedBCO {{-..-}}
    
    97
    +    = multiLineEntry (text "ordinary bytecode object:") $
    
    98
    +      vcat [
    
    99
    +               {-
    
    100
    +                   unlinkedBCOName   :: !Name,
    
    101
    +                   unlinkedBCOArity  :: {-# UNPACK #-} !Int,
    
    102
    +                   unlinkedBCOInstrs :: !(BCOByteArray Word16),  -- insns
    
    103
    +                   unlinkedBCOBitmap :: !(BCOByteArray Word),    -- bitmap
    
    104
    +                   unlinkedBCOLits   :: !(FlatBag BCONPtr),      -- non-ptrs
    
    105
    +                   unlinkedBCOPtrs   :: !(FlatBag BCOPtr)        -- ptrs
    
    106
    +               -}
    
    107
    +           ]
    
    108
    +pprByteCodeObject UnlinkedStaticCon {{-..-}}
    
    109
    +    = multiLineEntry (text "static constructor object:") $
    
    110
    +      vcat [
    
    111
    +               {-
    
    112
    +                   unlinkedStaticConName :: !Name,
    
    113
    +                   -- ^ The name to which this static constructor is bound, not to be
    
    114
    +                   -- confused with the name of the static constructor itself
    
    115
    +                   -- ('unlinkedStaticConDataConName')
    
    116
    +                   unlinkedStaticConDataConName :: !Name,
    
    117
    +                   unlinkedStaticConLits :: !(FlatBag BCONPtr),
    
    118
    +                   -- ^ non-ptrs full words, where sub-word literals have already been
    
    119
    +                   -- packed into full words as needed
    
    120
    +                   unlinkedStaticConPtrs :: !(FlatBag BCOPtr),  -- ptrs
    
    121
    +                   unlinkedStaticConIsUnlifted :: !Bool
    
    122
    +               -}
    
    123
    +           ]
    
    92 124
     
    
    93 125
     -- | […]
    
    94 126
     pprDataConstructorInfoTables :: [(Name, ConInfoTable)] -> SDoc