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
    ... ... @@ -5,6 +5,7 @@
    5 5
     --   of bytecode files. It is the backbone of the @--show-byte-code@ option.
    
    6 6
     module GHC.ByteCode.Show (showByteCode) where
    
    7 7
     
    
    8
    +-- Prelude
    
    8 9
     import GHC.Prelude
    
    9 10
            (
    
    10 11
                (+), (-), Integral, div,                  -- Prelude
    
    ... ... @@ -23,14 +24,28 @@ import GHC.Prelude
    23 24
                show,                                     -- Text.Show
    
    24 25
                IO, FilePath                              -- System.IO
    
    25 26
            )
    
    26
    -import Control.Arrow ((>>>))
    
    27
    -import Data.List (zipWith4)
    
    28
    -import Data.ByteString (ByteString)
    
    29
    -import Data.ByteString.Short (ShortByteString)
    
    30
    -import Data.IntMap (IntMap)
    
    31
    -import Data.IntMap qualified as IntMap (toList)
    
    32
    -import Data.Array (bounds, indices, elems)
    
    33
    -import Numeric (showHex)
    
    27
    +
    
    28
    +-- Bytecode
    
    29
    +import GHC.ByteCode.Types
    
    30
    +       (
    
    31
    +           FFIInfo (..),
    
    32
    +           BCONPtr (..),
    
    33
    +           BCOPtr (..),
    
    34
    +           UnlinkedBCO (..),
    
    35
    +           ByteCodeHpcInfo (..),
    
    36
    +           CompiledByteCode (..)
    
    37
    +       )
    
    38
    +import GHC.ByteCode.Breakpoints
    
    39
    +       (
    
    40
    +           InternalBreakpointId (..),
    
    41
    +           InternalBreakLoc (..),
    
    42
    +           CgBreakInfo (..),
    
    43
    +           InternalModBreaks (..)
    
    44
    +       )
    
    45
    +import GHC.ByteCode.Binary (OnDiskModuleByteCode (..))
    
    46
    +import GHC.ByteCode.Serialize (readOnDiskModuleByteCode)
    
    47
    +
    
    48
    +-- GHC apart from bytecode
    
    34 49
     import GHC.Data.Strict qualified as Strict (Maybe, maybe)
    
    35 50
     import GHC.Data.FastString (unpackFS)
    
    36 51
     import GHC.Data.FlatBag (FlatBag, elemsFlatBag)
    
    ... ... @@ -62,28 +77,20 @@ import GHC.Utils.Outputable
    62 77
     import GHC.Unit.Types (Module)
    
    63 78
     import GHC.Iface.Type (IfaceType, IfaceTvBndr, IfaceIdBndr)
    
    64 79
     import GHC.HsToCore.Breakpoints (ModBreaks (..))
    
    65
    -import GHC.ByteCode.Types
    
    66
    -       (
    
    67
    -           FFIInfo (..),
    
    68
    -           BCONPtr (..),
    
    69
    -           BCOPtr (..),
    
    70
    -           UnlinkedBCO (..),
    
    71
    -           ByteCodeHpcInfo (..),
    
    72
    -           CompiledByteCode (..)
    
    73
    -       )
    
    74
    -import GHC.ByteCode.Breakpoints
    
    75
    -       (
    
    76
    -           InternalBreakpointId (..),
    
    77
    -           InternalBreakLoc (..),
    
    78
    -           CgBreakInfo (..),
    
    79
    -           InternalModBreaks (..)
    
    80
    -       )
    
    81
    -import GHC.ByteCode.Binary (OnDiskModuleByteCode (..))
    
    82
    -import GHC.ByteCode.Serialize (readOnDiskModuleByteCode)
    
    83 80
     import GHC.Driver.Env.Types (HscEnv)
    
    84 81
     import GHCi.FFI (FFIType)
    
    85 82
     import GHCi.Message (ConInfoTable (..))
    
    86 83
     
    
    84
    +-- Basic things
    
    85
    +import Control.Arrow ((>>>))
    
    86
    +import Data.List (zipWith4)
    
    87
    +import Data.ByteString (ByteString)
    
    88
    +import Data.ByteString.Short (ShortByteString)
    
    89
    +import Data.IntMap (IntMap)
    
    90
    +import Data.IntMap qualified as IntMap (toList)
    
    91
    +import Data.Array (bounds, indices, elems)
    
    92
    +import Numeric (showHex)
    
    93
    +
    
    87 94
     -- | Outputs textual information about the contents of a bytecode file.
    
    88 95
     showByteCode :: Logger -> HscEnv -> FilePath -> IO ()
    
    89 96
     showByteCode logger env path = do