Wolfgang Jeltsch pushed to branch wip/jeltsch/textual-bytecode-output at Glasgow Haskell Compiler / GHC Commits: e3a7a15d by Wolfgang Jeltsch at 2026-07-01T16:26:52+03:00 Remove output of instructions and bitmaps - - - - - 2 changed files: - compiler/GHC/ByteCode/Show.hs - libraries/ghci/GHCi/ResolvedBCO.hs Changes: ===================================== compiler/GHC/ByteCode/Show.hs ===================================== @@ -15,7 +15,7 @@ import Data.Function (($), id, (.)) import Data.Tuple (fst, snd, uncurry) import Data.Bool (Bool, otherwise, not, (&&)) import Data.Int (Int) -import Data.Word (Word, Word16) +import Data.Word (Word) import Data.Maybe (Maybe, maybe) import Data.Either (Either, either) import Data.List (length, (++), map, zipWith, take, drop, replicate) @@ -24,12 +24,10 @@ import Data.ByteString (ByteString, unpack) import Data.ByteString.Short (ShortByteString) import Data.IntMap (IntMap) import Data.IntMap qualified as IntMap (toList) -import Data.Array.IArray (IArray, bounds, indices, elems) -import Data.Array.Unboxed (UArray) +import Data.Array (bounds, indices, elems) import Numeric (showHex) import Text.Show (show) import System.IO (IO, FilePath) -import Foreign.Storable (Storable) import GHC.Data.Strict qualified as Strict (Maybe, maybe) import GHC.Data.FastString (unpackFS) import GHC.Data.FlatBag (FlatBag, elemsFlatBag) @@ -78,7 +76,6 @@ import GHC.ByteCode.Breakpoints import GHC.ByteCode.Binary (OnDiskModuleByteCode (..)) import GHC.ByteCode.Serialize (readOnDiskModuleByteCode) import GHC.Driver.Env.Types (HscEnv) -import GHCi.ResolvedBCO (BCOByteArray, fromBCOByteArray) import GHCi.FFI (FFIType) import GHCi.Message (ConInfoTable (..)) @@ -132,8 +129,6 @@ pprByteCodeObject currentModule byteCodeObject = case byteCodeObject of -> entry (text "ordinary object" <+> ppr unlinkedBCOName <> text ":") $ vcat [ pprArity $ unlinkedBCOArity, - pprInstructions $ unlinkedBCOInstrs, - pprBitmap $ unlinkedBCOBitmap, pprLiterals currentModule $ unlinkedBCOLits, pprPointers currentModule $ unlinkedBCOPtrs ] @@ -155,14 +150,6 @@ pprByteCodeObject currentModule byteCodeObject = case byteCodeObject of pprArity :: Int -> SDoc pprArity = entry (text "arity:") . ppr --- | […] -pprInstructions :: BCOByteArray Word16 -> SDoc -pprInstructions = entry (text "instructions:") . pprBCOByteArray - --- | […] -pprBitmap :: BCOByteArray Word -> SDoc -pprBitmap = entry (text "bitmap:") . pprBCOByteArray - -- | […] pprDataConstructorName :: Name -> SDoc pprDataConstructorName = entry (text "data constructor name:") . ppr @@ -530,11 +517,6 @@ pprObjectFileContent ix = entry (text "file" <+> ppr ix <> text ":") . pprByteString :: ByteString -> SDoc pprByteString = pprFixedSizeNaturalList . unpack --- | […] -pprBCOByteArray :: (Integral a, FiniteBits a, Storable a, IArray UArray a) => - BCOByteArray a -> SDoc -pprBCOByteArray = pprFixedSizeNaturalList . elems . fromBCOByteArray - -- | […] pprFixedSizeNaturalList :: (Integral a, FiniteBits a) => [a] -> SDoc pprFixedSizeNaturalList [] = text "<empty>" ===================================== libraries/ghci/GHCi/ResolvedBCO.hs ===================================== @@ -7,7 +7,6 @@ module GHCi.ResolvedBCO , isLittleEndian , BCOByteArray(..) , mkBCOByteArray - , fromBCOByteArray ) where #include "MachDeps.h" @@ -21,6 +20,7 @@ import GHCi.BreakArray import Control.Monad import Data.Array.Base (foldrArray, listArray) import Data.ByteString.Builder.Extra +import Foreign.Storable #endif import Data.Binary (Binary(..)) @@ -32,7 +32,6 @@ import GHC.Generics import GHC.Exts import Data.Array.Base (UArray(..)) -import Foreign.Storable import qualified GHC.Exts.Heap as Heap #include "MachDeps.h" @@ -92,11 +91,13 @@ data BCOByteArray a getBCOByteArray :: !ByteArray# } +#if SIZEOF_HSWORD == 4 fromBCOByteArray :: forall a . Storable a => BCOByteArray a -> UArray Int a fromBCOByteArray (BCOByteArray ba#) = UArray 0 (n - 1) n ba# where len# = sizeofByteArray# ba# n = (I# len#) `div` sizeOf (undefined :: a) +#endif mkBCOByteArray :: UArray Int a -> BCOByteArray a mkBCOByteArray (UArray _ _ _ arr) = BCOByteArray arr View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e3a7a15dd98945796f7260c0b18ed74b... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e3a7a15dd98945796f7260c0b18ed74b... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Wolfgang Jeltsch (@jeltsch)