GHC.ByteCode.Types

ghc-9.14.0.20251028: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.ByteCode.Types

Contents

- Mod Breaks
- Internal Mod Breaks
  - Internal breakpoint identifier

Description

Bytecode assembler types

Synopsis

- data CompiledByteCode = CompiledByteCode {
  - bc_bcos :: FlatBag UnlinkedBCO
  - bc_itbls :: [(Name, ConInfoTable)]
  - bc_strs :: [(Name, ByteString)]
  - bc_breaks :: Maybe InternalModBreaks
  - bc_spt_entries :: ![SptEntry]
  }
- seqCompiledByteCode :: CompiledByteCode -> ()
- data BCOByteArray a = BCOByteArray {
  - getBCOByteArray :: !ByteArray#
  }
- mkBCOByteArray :: UArray Int a -> BCOByteArray a
- data FFIInfo = FFIInfo {
  - ffiInfoArgs :: ![FFIType]
  - ffiInfoRet :: !FFIType
  }
- newtype RegBitmap = RegBitmap {
  - unRegBitmap :: Word32
  }
- data NativeCallType
  - = NativePrimCall
  - | NativeTupleReturn
- data NativeCallInfo = NativeCallInfo {
  - nativeCallType :: !NativeCallType
  - nativeCallSize :: !WordOff
  - nativeCallRegs :: !GlobalRegSet
  - nativeCallStackSpillSize :: !WordOff
  }
- voidTupleReturnInfo :: NativeCallInfo
- voidPrimCallInfo :: NativeCallInfo
- newtype ByteOff = ByteOff Int
- newtype WordOff = WordOff Int
- newtype HalfWord = HalfWord Word
- data UnlinkedBCO = UnlinkedBCO {
  - unlinkedBCOName :: !Name
  - unlinkedBCOArity :: !Int
  - unlinkedBCOInstrs :: !(BCOByteArray Word16)
  - unlinkedBCOBitmap :: !(BCOByteArray Word)
  - unlinkedBCOLits :: !(FlatBag BCONPtr)
  - unlinkedBCOPtrs :: !(FlatBag BCOPtr)
  }
- data BCOPtr
  - = BCOPtrName !Name
  - | BCOPtrPrimOp !PrimOp
  - | BCOPtrBCO !UnlinkedBCO
  - | BCOPtrBreakArray !Module
- data BCONPtr
  - = BCONPtrWord !Word
  - | BCONPtrLbl !FastString
  - | BCONPtrItbl !Name
  - | BCONPtrAddr !Name
  - | BCONPtrStr !ByteString
  - | BCONPtrFS !FastString
  - | BCONPtrFFIInfo !FFIInfo
  - | BCONPtrCostCentre !InternalBreakpointId
- type ItblEnv = NameEnv (Name, ItblPtr)
- newtype ItblPtr = ItblPtr (RemotePtr StgInfoTable)
- type AddrEnv = NameEnv (Name, AddrPtr)
- newtype AddrPtr = AddrPtr (RemotePtr ())
- data FlatBag a
- sizeFlatBag :: FlatBag a -> Word
- fromSmallArray :: SmallArray a -> FlatBag a
- elemsFlatBag :: FlatBag a -> [a]
- data ModBreaks = ModBreaks {
  - modBreaks_locs :: !(Array BreakTickIndex SrcSpan)
  - modBreaks_vars :: !(Array BreakTickIndex [OccName])
  - modBreaks_decls :: !(Array BreakTickIndex [String])
  - modBreaks_ccs :: !(Array BreakTickIndex (String, String))
  - modBreaks_module :: !Module
  }
- data BreakpointId = BreakpointId {
  - bi_tick_mod :: !Module
  - bi_tick_index :: !BreakTickIndex
  }
- type BreakTickIndex = Int
- data InternalModBreaks = InternalModBreaks {
  - imodBreaks_breakInfo :: !(IntMap CgBreakInfo)
  - imodBreaks_modBreaks :: !ModBreaks
  }
- data CgBreakInfo = CgBreakInfo {
  - cgb_tyvars :: ![IfaceTvBndr]
  - cgb_vars :: ![Maybe (IfaceIdBndr, Word)]
  - cgb_resty :: !IfaceType
  - cgb_tick_id :: !(Either InternalBreakLoc BreakpointId)
  }
- seqInternalModBreaks :: InternalModBreaks -> ()
- data InternalBreakpointId = InternalBreakpointId {
  - ibi_info_mod :: !Module
  - ibi_info_index :: !BreakInfoIndex
  }
- type BreakInfoIndex = Int

# Documentation

data CompiledByteCode Source #

Constructors

CompiledByteCode |
Fields bc_bcos :: FlatBag UnlinkedBCO Bunch of interpretable bindings bc_itbls :: [(Name, ConInfoTable)] Mapping from DataCons to their info tables bc_strs :: [(Name, ByteString)] top-level strings (heap allocated) bc_breaks :: Maybe InternalModBreaks All breakpoint information (no information if breakpoints are disabled). This information is used when loading a bytecode object: we will construct the arrays to be used at runtime to trigger breakpoints at load time from it (in `allocateBreakArrays` and `allocateCCS` in `Loader`). bc_spt_entries :: ![SptEntry] Static pointer table entries which should be loaded along with the BCOs. See Note [Grand plan for static forms] in GHC.Iface.Tidy.StaticPtrTable.

#### Instances

Instances details

Outputable CompiledByteCode Source # |
Instance details Defined in GHC.ByteCode.Types Methods ppr :: CompiledByteCode -> SDoc Source #

seqCompiledByteCode :: CompiledByteCode -> () Source #

data BCOByteArray a Source #

Wrapper for a `ByteArray#`. The phantom type tells what elements are stored in the `ByteArray#`. Creating a `ByteArray#` can be achieved using `UArray'`s API, where the underlying `ByteArray#` can be unpacked.

Constructors

BCOByteArray |
Fields getBCOByteArray :: !ByteArray#

#### Instances

Instances details

(Binary a, Storable a, IArray UArray a) => Binary (BCOByteArray a) Source # |
Instance details Defined in GHCi.ResolvedBCO Methods put :: BCOByteArray a -> Put Source # get :: Get (BCOByteArray a) Source # putList :: [BCOByteArray a] -> Put Source #
Show (BCOByteArray Word16) Source # |
Instance details Defined in GHCi.ResolvedBCO Methods showsPrec :: Int -> BCOByteArray Word16 -> ShowS Source # show :: BCOByteArray Word16 -> String Source # showList :: [BCOByteArray Word16] -> ShowS Source #
Show (BCOByteArray Word) Source # |
Instance details Defined in GHCi.ResolvedBCO Methods showsPrec :: Int -> BCOByteArray Word -> ShowS Source # show :: BCOByteArray Word -> String Source # showList :: [BCOByteArray Word] -> ShowS Source #

mkBCOByteArray :: UArray Int a -> BCOByteArray a Source #

data FFIInfo Source #

A libffi ffi_cif function prototype.

Constructors

FFIInfo |
Fields ffiInfoArgs :: ![FFIType] ffiInfoRet :: !FFIType

#### Instances

Instances details

Show FFIInfo Source # |
Instance details Defined in GHC.ByteCode.Types Methods showsPrec :: Int -> FFIInfo -> ShowS Source # show :: FFIInfo -> String Source # showList :: [FFIInfo] -> ShowS Source #

newtype RegBitmap Source #

Constructors

RegBitmap |
Fields unRegBitmap :: Word32

#### Instances

Instances details

Outputable RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods ppr :: RegBitmap -> SDoc Source #
Bits RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods (.&.) :: RegBitmap -> RegBitmap -> RegBitmap Source # (.|.) :: RegBitmap -> RegBitmap -> RegBitmap Source # xor :: RegBitmap -> RegBitmap -> RegBitmap Source # complement :: RegBitmap -> RegBitmap Source # shift :: RegBitmap -> Int -> RegBitmap Source # rotate :: RegBitmap -> Int -> RegBitmap Source # zeroBits :: RegBitmap Source # bit :: Int -> RegBitmap Source # setBit :: RegBitmap -> Int -> RegBitmap Source # clearBit :: RegBitmap -> Int -> RegBitmap Source # complementBit :: RegBitmap -> Int -> RegBitmap Source # testBit :: RegBitmap -> Int -> Bool Source # bitSizeMaybe :: RegBitmap -> Maybe Int Source # bitSize :: RegBitmap -> Int Source # isSigned :: RegBitmap -> Bool Source # shiftL :: RegBitmap -> Int -> RegBitmap Source # unsafeShiftL :: RegBitmap -> Int -> RegBitmap Source # shiftR :: RegBitmap -> Int -> RegBitmap Source # unsafeShiftR :: RegBitmap -> Int -> RegBitmap Source # rotateL :: RegBitmap -> Int -> RegBitmap Source # rotateR :: RegBitmap -> Int -> RegBitmap Source # popCount :: RegBitmap -> Int Source #
FiniteBits RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods finiteBitSize :: RegBitmap -> Int Source # countLeadingZeros :: RegBitmap -> Int Source # countTrailingZeros :: RegBitmap -> Int Source #
Eq RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods (==) :: RegBitmap -> RegBitmap -> Bool Source # (/=) :: RegBitmap -> RegBitmap -> Bool Source #
Ord RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods compare :: RegBitmap -> RegBitmap -> Ordering Source # (<) :: RegBitmap -> RegBitmap -> Bool Source # (<=) :: RegBitmap -> RegBitmap -> Bool Source # (>) :: RegBitmap -> RegBitmap -> Bool Source # (>=) :: RegBitmap -> RegBitmap -> Bool Source # max :: RegBitmap -> RegBitmap -> RegBitmap Source # min :: RegBitmap -> RegBitmap -> RegBitmap Source #
Enum RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods succ :: RegBitmap -> RegBitmap Source # pred :: RegBitmap -> RegBitmap Source # toEnum :: Int -> RegBitmap Source # fromEnum :: RegBitmap -> Int Source # enumFrom :: RegBitmap -> [RegBitmap] Source # enumFromThen :: RegBitmap -> RegBitmap -> [RegBitmap] Source # enumFromTo :: RegBitmap -> RegBitmap -> [RegBitmap] Source # enumFromThenTo :: RegBitmap -> RegBitmap -> RegBitmap -> [RegBitmap] Source #
Num RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods (+) :: RegBitmap -> RegBitmap -> RegBitmap Source # (-) :: RegBitmap -> RegBitmap -> RegBitmap Source # (*) :: RegBitmap -> RegBitmap -> RegBitmap Source # negate :: RegBitmap -> RegBitmap Source # abs :: RegBitmap -> RegBitmap Source # signum :: RegBitmap -> RegBitmap Source # fromInteger :: Integer -> RegBitmap Source #
Integral RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods quot :: RegBitmap -> RegBitmap -> RegBitmap Source # rem :: RegBitmap -> RegBitmap -> RegBitmap Source # div :: RegBitmap -> RegBitmap -> RegBitmap Source # mod :: RegBitmap -> RegBitmap -> RegBitmap Source # quotRem :: RegBitmap -> RegBitmap -> (RegBitmap, RegBitmap) Source # divMod :: RegBitmap -> RegBitmap -> (RegBitmap, RegBitmap) Source # toInteger :: RegBitmap -> Integer Source #
Real RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods toRational :: RegBitmap -> Rational Source #
Show RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods showsPrec :: Int -> RegBitmap -> ShowS Source # show :: RegBitmap -> String Source # showList :: [RegBitmap] -> ShowS Source #

data NativeCallType Source #

Constructors

NativePrimCall |
NativeTupleReturn |

#### Instances

Instances details

Eq NativeCallType Source # |
Instance details Defined in GHC.ByteCode.Types Methods (==) :: NativeCallType -> NativeCallType -> Bool Source # (/=) :: NativeCallType -> NativeCallType -> Bool Source #

data NativeCallInfo Source #

Constructors

NativeCallInfo |
Fields nativeCallType :: !NativeCallType nativeCallSize :: !WordOff nativeCallRegs :: !GlobalRegSet nativeCallStackSpillSize :: !WordOff

#### Instances

Instances details

Outputable NativeCallInfo Source # |
Instance details Defined in GHC.ByteCode.Types Methods ppr :: NativeCallInfo -> SDoc Source #

voidTupleReturnInfo :: NativeCallInfo Source #

voidPrimCallInfo :: NativeCallInfo Source #

newtype ByteOff Source #

Constructors

ByteOff Int |

#### Instances

Instances details

Outputable ByteOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods ppr :: ByteOff -> SDoc Source #
Eq ByteOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods (==) :: ByteOff -> ByteOff -> Bool Source # (/=) :: ByteOff -> ByteOff -> Bool Source #
Ord ByteOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods compare :: ByteOff -> ByteOff -> Ordering Source # (<) :: ByteOff -> ByteOff -> Bool Source # (<=) :: ByteOff -> ByteOff -> Bool Source # (>) :: ByteOff -> ByteOff -> Bool Source # (>=) :: ByteOff -> ByteOff -> Bool Source # max :: ByteOff -> ByteOff -> ByteOff Source # min :: ByteOff -> ByteOff -> ByteOff Source #
Enum ByteOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods succ :: ByteOff -> ByteOff Source # pred :: ByteOff -> ByteOff Source # toEnum :: Int -> ByteOff Source # fromEnum :: ByteOff -> Int Source # enumFrom :: ByteOff -> [ByteOff] Source # enumFromThen :: ByteOff -> ByteOff -> [ByteOff] Source # enumFromTo :: ByteOff -> ByteOff -> [ByteOff] Source # enumFromThenTo :: ByteOff -> ByteOff -> ByteOff -> [ByteOff] Source #
Num ByteOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods (+) :: ByteOff -> ByteOff -> ByteOff Source # (-) :: ByteOff -> ByteOff -> ByteOff Source # (*) :: ByteOff -> ByteOff -> ByteOff Source # negate :: ByteOff -> ByteOff Source # abs :: ByteOff -> ByteOff Source # signum :: ByteOff -> ByteOff Source # fromInteger :: Integer -> ByteOff Source #
Integral ByteOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods quot :: ByteOff -> ByteOff -> ByteOff Source # rem :: ByteOff -> ByteOff -> ByteOff Source # div :: ByteOff -> ByteOff -> ByteOff Source # mod :: ByteOff -> ByteOff -> ByteOff Source # quotRem :: ByteOff -> ByteOff -> (ByteOff, ByteOff) Source # divMod :: ByteOff -> ByteOff -> (ByteOff, ByteOff) Source # toInteger :: ByteOff -> Integer Source #
Real ByteOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods toRational :: ByteOff -> Rational Source #
Show ByteOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods showsPrec :: Int -> ByteOff -> ShowS Source # show :: ByteOff -> String Source # showList :: [ByteOff] -> ShowS Source #

newtype WordOff Source #

Constructors

WordOff Int |

#### Instances

Instances details

Outputable WordOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods ppr :: WordOff -> SDoc Source #
Eq WordOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods (==) :: WordOff -> WordOff -> Bool Source # (/=) :: WordOff -> WordOff -> Bool Source #
Ord WordOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods compare :: WordOff -> WordOff -> Ordering Source # (<) :: WordOff -> WordOff -> Bool Source # (<=) :: WordOff -> WordOff -> Bool Source # (>) :: WordOff -> WordOff -> Bool Source # (>=) :: WordOff -> WordOff -> Bool Source # max :: WordOff -> WordOff -> WordOff Source # min :: WordOff -> WordOff -> WordOff Source #
Enum WordOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods succ :: WordOff -> WordOff Source # pred :: WordOff -> WordOff Source # toEnum :: Int -> WordOff Source # fromEnum :: WordOff -> Int Source # enumFrom :: WordOff -> [WordOff] Source # enumFromThen :: WordOff -> WordOff -> [WordOff] Source # enumFromTo :: WordOff -> WordOff -> [WordOff] Source # enumFromThenTo :: WordOff -> WordOff -> WordOff -> [WordOff] Source #
Num WordOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods (+) :: WordOff -> WordOff -> WordOff Source # (-) :: WordOff -> WordOff -> WordOff Source # (*) :: WordOff -> WordOff -> WordOff Source # negate :: WordOff -> WordOff Source # abs :: WordOff -> WordOff Source # signum :: WordOff -> WordOff Source # fromInteger :: Integer -> WordOff Source #
Integral WordOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods quot :: WordOff -> WordOff -> WordOff Source # rem :: WordOff -> WordOff -> WordOff Source # div :: WordOff -> WordOff -> WordOff Source # mod :: WordOff -> WordOff -> WordOff Source # quotRem :: WordOff -> WordOff -> (WordOff, WordOff) Source # divMod :: WordOff -> WordOff -> (WordOff, WordOff) Source # toInteger :: WordOff -> Integer Source #
Real WordOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods toRational :: WordOff -> Rational Source #
Show WordOff Source # |
Instance details Defined in GHC.ByteCode.Types Methods showsPrec :: Int -> WordOff -> ShowS Source # show :: WordOff -> String Source # showList :: [WordOff] -> ShowS Source #

newtype HalfWord Source #

Constructors

HalfWord Word |

#### Instances

Instances details

Outputable HalfWord Source # |
Instance details Defined in GHC.ByteCode.Types Methods ppr :: HalfWord -> SDoc Source #
Eq HalfWord Source # |
Instance details Defined in GHC.ByteCode.Types Methods (==) :: HalfWord -> HalfWord -> Bool Source # (/=) :: HalfWord -> HalfWord -> Bool Source #
Ord HalfWord Source # |
Instance details Defined in GHC.ByteCode.Types Methods compare :: HalfWord -> HalfWord -> Ordering Source # (<) :: HalfWord -> HalfWord -> Bool Source # (<=) :: HalfWord -> HalfWord -> Bool Source # (>) :: HalfWord -> HalfWord -> Bool Source # (>=) :: HalfWord -> HalfWord -> Bool Source # max :: HalfWord -> HalfWord -> HalfWord Source # min :: HalfWord -> HalfWord -> HalfWord Source #
Enum HalfWord Source # |
Instance details Defined in GHC.ByteCode.Types Methods succ :: HalfWord -> HalfWord Source # pred :: HalfWord -> HalfWord Source # toEnum :: Int -> HalfWord Source # fromEnum :: HalfWord -> Int Source # enumFrom :: HalfWord -> [HalfWord] Source # enumFromThen :: HalfWord -> HalfWord -> [HalfWord] Source # enumFromTo :: HalfWord -> HalfWord -> [HalfWord] Source # enumFromThenTo :: HalfWord -> HalfWord -> HalfWord -> [HalfWord] Source #
Num HalfWord Source # |
Instance details Defined in GHC.ByteCode.Types Methods (+) :: HalfWord -> HalfWord -> HalfWord Source # (-) :: HalfWord -> HalfWord -> HalfWord Source # (*) :: HalfWord -> HalfWord -> HalfWord Source # negate :: HalfWord -> HalfWord Source # abs :: HalfWord -> HalfWord Source # signum :: HalfWord -> HalfWord Source # fromInteger :: Integer -> HalfWord Source #
Integral HalfWord Source # |
Instance details Defined in GHC.ByteCode.Types Methods quot :: HalfWord -> HalfWord -> HalfWord Source # rem :: HalfWord -> HalfWord -> HalfWord Source # div :: HalfWord -> HalfWord -> HalfWord Source # mod :: HalfWord -> HalfWord -> HalfWord Source # quotRem :: HalfWord -> HalfWord -> (HalfWord, HalfWord) Source # divMod :: HalfWord -> HalfWord -> (HalfWord, HalfWord) Source # toInteger :: HalfWord -> Integer Source #
Real HalfWord Source # |
Instance details Defined in GHC.ByteCode.Types Methods toRational :: HalfWord -> Rational Source #
Show HalfWord Source # |
Instance details Defined in GHC.ByteCode.Types Methods showsPrec :: Int -> HalfWord -> ShowS Source # show :: HalfWord -> String Source # showList :: [HalfWord] -> ShowS Source #

data UnlinkedBCO Source #

Constructors

UnlinkedBCO |
Fields unlinkedBCOName :: !Name unlinkedBCOArity :: !Int unlinkedBCOInstrs :: !(BCOByteArray Word16) unlinkedBCOBitmap :: !(BCOByteArray Word) unlinkedBCOLits :: !(FlatBag BCONPtr) unlinkedBCOPtrs :: !(FlatBag BCOPtr)

#### Instances

Instances details

NFData UnlinkedBCO Source # |
Instance details Defined in GHC.ByteCode.Types Methods rnf :: UnlinkedBCO -> () Source #
Outputable UnlinkedBCO Source # |
Instance details Defined in GHC.ByteCode.Types Methods ppr :: UnlinkedBCO -> SDoc Source #

data BCOPtr Source #

Constructors

BCOPtrName !Name |
BCOPtrPrimOp !PrimOp |
BCOPtrBCO !UnlinkedBCO |
BCOPtrBreakArray !Module | Converted to the actual `BreakArray` remote pointer at link-time

#### Instances

Instances details

NFData BCOPtr Source # |
Instance details Defined in GHC.ByteCode.Types Methods rnf :: BCOPtr -> () Source #

data BCONPtr Source #

Constructors

BCONPtrWord !Word |
BCONPtrLbl !FastString |
BCONPtrItbl !Name |
BCONPtrAddr !Name | A reference to a top-level string literal; see Note [Generating code for top-level string literal bindings] in GHC.StgToByteCode.
BCONPtrStr !ByteString | A top-level string literal. Also see Note [Allocating string literals] in GHC.ByteCode.Asm.
BCONPtrFS !FastString | Same as `BCONPtrStr` but with benefits of `FastString` interning logic.
BCONPtrFFIInfo !FFIInfo | A libffi ffi_cif function prototype.
BCONPtrCostCentre !InternalBreakpointId | A `CostCentre` remote pointer array's respective `BreakpointId`

#### Instances

Instances details

NFData BCONPtr Source # |
Instance details Defined in GHC.ByteCode.Types Methods rnf :: BCONPtr -> () Source #

type ItblEnv = NameEnv (Name, ItblPtr) Source #

newtype ItblPtr Source #

Constructors

ItblPtr (RemotePtr StgInfoTable) |

#### Instances

Instances details

NFData ItblPtr Source # |
Instance details Defined in GHC.ByteCode.Types Methods rnf :: ItblPtr -> () Source #
Show ItblPtr Source # |
Instance details Defined in GHC.ByteCode.Types Methods showsPrec :: Int -> ItblPtr -> ShowS Source # show :: ItblPtr -> String Source # showList :: [ItblPtr] -> ShowS Source #

type AddrEnv = NameEnv (Name, AddrPtr) Source #

newtype AddrPtr Source #

Constructors

AddrPtr (RemotePtr ()) |

#### Instances

Instances details

NFData AddrPtr Source # |
Instance details Defined in GHC.ByteCode.Types Methods rnf :: AddrPtr -> () Source #

data FlatBag a Source #

Store elements in a flattened representation.

A `FlatBag` is a data structure that stores an ordered list of elements in a flat structure, avoiding the overhead of a linked list. Use this data structure, if the code requires the following properties:

- Elements are stored in a long-lived object, and benefit from a flattened representation.
- The `FlatBag` will be traversed but not extended or filtered.
- The number of elements should be known.
- Sharing of the empty case improves memory behaviour.

A `FlagBag` aims to have as little overhead as possible to store its elements. To achieve that, it distinguishes between the empty case, singleton, tuple and general case. Thus, we only pay for the additional three words of an `Array` if we have at least three elements.

#### Instances

Instances details

Functor FlatBag Source # |
Instance details Defined in GHC.Data.FlatBag Methods fmap :: (a -> b) -> FlatBag a -> FlatBag b Source # (<$) :: a -> FlatBag b -> FlatBag a Source #
Foldable FlatBag Source # |
Instance details Defined in GHC.Data.FlatBag Methods fold :: Monoid m => FlatBag m -> m Source # foldMap :: Monoid m => (a -> m) -> FlatBag a -> m Source # foldMap' :: Monoid m => (a -> m) -> FlatBag a -> m Source # foldr :: (a -> b -> b) -> b -> FlatBag a -> b Source # foldr' :: (a -> b -> b) -> b -> FlatBag a -> b Source # foldl :: (b -> a -> b) -> b -> FlatBag a -> b Source # foldl' :: (b -> a -> b) -> b -> FlatBag a -> b Source # foldr1 :: (a -> a -> a) -> FlatBag a -> a Source # foldl1 :: (a -> a -> a) -> FlatBag a -> a Source # toList :: FlatBag a -> [a] Source # null :: FlatBag a -> Bool Source # length :: FlatBag a -> Int Source # elem :: Eq a => a -> FlatBag a -> Bool Source # maximum :: Ord a => FlatBag a -> a Source # minimum :: Ord a => FlatBag a -> a Source # sum :: Num a => FlatBag a -> a Source # product :: Num a => FlatBag a -> a Source #
Traversable FlatBag Source # |
Instance details Defined in GHC.Data.FlatBag Methods traverse :: Applicative f => (a -> f b) -> FlatBag a -> f (FlatBag b) Source # sequenceA :: Applicative f => FlatBag (f a) -> f (FlatBag a) Source # mapM :: Monad m => (a -> m b) -> FlatBag a -> m (FlatBag b) Source # sequence :: Monad m => FlatBag (m a) -> m (FlatBag a) Source #
NFData a => NFData (FlatBag a) Source # |
Instance details Defined in GHC.Data.FlatBag Methods rnf :: FlatBag a -> () Source #

sizeFlatBag :: FlatBag a -> Word Source #

Calculate the size of

fromSmallArray :: SmallArray a -> FlatBag a Source #

Convert a `SizedSeq` into its flattened representation. A 'FlatBag a' is more memory efficient than '[a]', if no further modification is necessary.

elemsFlatBag :: FlatBag a -> [a] Source #

Get all elements that are stored in the `FlatBag`.

# Mod Breaks

data ModBreaks Source #

All the information about the source-relevant breakpoints for a module

This information is constructed once during desugaring (with `mkModBreaks`) from breakpoint ticks and fixed/unchanged from there on forward. It could be exported as an abstract datatype because it should never be updated after construction, only queried.

The arrays can be indexed using the int in the corresponding `BreakpointId` (i.e. the `BreakpointId` whose `Module` matches the `Module` corresponding to these `ModBreaks`) with the accessors `modBreaks_locs`, `modBreaks_vars`, and `modBreaks_decls`.

Constructors

ModBreaks |
Fields modBreaks_locs :: !(Array BreakTickIndex SrcSpan) An array giving the source span of each breakpoint. modBreaks_vars :: !(Array BreakTickIndex [OccName]) An array giving the names of the free variables at each breakpoint. modBreaks_decls :: !(Array BreakTickIndex [String]) An array giving the names of the declarations enclosing each breakpoint. See Note [Field modBreaks_decls] modBreaks_ccs :: !(Array BreakTickIndex (String, String)) Array pointing to cost centre info for each breakpoint; actual `CostCentre` allocation is done at link-time. modBreaks_module :: !Module The module to which this ModBreaks is associated. We also cache this here for internal sanity checks.

data BreakpointId Source #

Breakpoint identifier.

Indexes into the structures in the ``ModBreaks`` created during desugaring (after inserting the breakpoint ticks in the expressions). See Note [Breakpoint identifiers]

Constructors

BreakpointId |
Fields bi_tick_mod :: !Module Breakpoint tick module bi_tick_index :: !BreakTickIndex Breakpoint tick index

#### Instances

Instances details

NFData BreakpointId Source # |
Instance details Defined in GHC.Types.Tickish Methods rnf :: BreakpointId -> () Source #
Outputable BreakpointId Source # |
Instance details Defined in GHC.Types.Tickish Methods ppr :: BreakpointId -> SDoc Source #
Eq BreakpointId Source # |
Instance details Defined in GHC.Types.Tickish Methods (==) :: BreakpointId -> BreakpointId -> Bool Source # (/=) :: BreakpointId -> BreakpointId -> Bool Source #
Ord BreakpointId Source # |
Instance details Defined in GHC.Types.Tickish Methods compare :: BreakpointId -> BreakpointId -> Ordering Source # (<) :: BreakpointId -> BreakpointId -> Bool Source # (<=) :: BreakpointId -> BreakpointId -> Bool Source # (>) :: BreakpointId -> BreakpointId -> Bool Source # (>=) :: BreakpointId -> BreakpointId -> Bool Source # max :: BreakpointId -> BreakpointId -> BreakpointId Source # min :: BreakpointId -> BreakpointId -> BreakpointId Source #
Data BreakpointId Source # |
Instance details Defined in GHC.Types.Tickish Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BreakpointId -> c BreakpointId Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c BreakpointId Source # toConstr :: BreakpointId -> Constr Source # dataTypeOf :: BreakpointId -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c BreakpointId) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BreakpointId) Source # gmapT :: (forall b. Data b => b -> b) -> BreakpointId -> BreakpointId Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BreakpointId -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BreakpointId -> r Source # gmapQ :: (forall d. Data d => d -> u) -> BreakpointId -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> BreakpointId -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> BreakpointId -> m BreakpointId Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BreakpointId -> m BreakpointId Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BreakpointId -> m BreakpointId Source #

type BreakTickIndex = Int Source #

Breakpoint tick index newtype BreakTickIndex = BreakTickIndex Int deriving (Eq, Ord, Data, Ix, NFData, Outputable)

# Internal Mod Breaks

data InternalModBreaks Source #

Internal mod breaks store the runtime-relevant information of breakpoints.

Importantly, it maps `InternalBreakpointId`s to `CgBreakInfo`.

`InternalModBreaks` are constructed during bytecode generation and stored in `CompiledByteCode` afterwards.

Constructors

InternalModBreaks |
Fields imodBreaks_breakInfo :: !(IntMap CgBreakInfo) Access code-gen time information about a breakpoint, indexed by `InternalBreakpointId`. imodBreaks_modBreaks :: !ModBreaks Store the ModBreaks for this module Recall Note [Breakpoint identifiers]: for some module A, an *occurrence* of a breakpoint in A may have been inlined from some breakpoint *defined* in module B. This `ModBreaks` contains information regarding all the breakpoints defined in the module this `InternalModBreaks` corresponds to. It does not necessarily have information regarding all the breakpoint occurrences registered in `imodBreaks_breakInfo`. Some of those occurrences may refer breakpoints inlined from other modules.

data CgBreakInfo Source #

Information about a breakpoint that we know at code-generation time In order to be used, this needs to be hydrated relative to the current HscEnv by `hydrateCgBreakInfo`. Everything here can be fully forced and that's critical for preventing space leaks (see #22530)

Constructors

CgBreakInfo |
Fields cgb_tyvars :: ![IfaceTvBndr] Type variables in scope at the breakpoint cgb_vars :: ![Maybe (IfaceIdBndr, Word)] cgb_resty :: !IfaceType cgb_tick_id :: !(Either InternalBreakLoc BreakpointId) This field records the original breakpoint tick identifier for this internal breakpoint info. It is used to convert a breakpoint *occurrence* index (`InternalBreakpointId`) into a *definition* index (`BreakpointId`). The modules of breakpoint occurrence and breakpoint definition are not necessarily the same: See Note [Breakpoint identifiers]. If there is no original tick identifier (that is, the breakpoint was created during code generation), we re-use the BreakpointId of something else. It would also be reasonable to have an `Either something BreakpointId` for `cgb_tick_id`, but currently we can always re-use a source-level BreakpointId. In the case of step-out, see Note [Debugger: Stepout internal break locs]

#### Instances

Instances details

Outputable CgBreakInfo Source # |
Instance details Defined in GHC.ByteCode.Breakpoints Methods ppr :: CgBreakInfo -> SDoc Source #

seqInternalModBreaks :: InternalModBreaks -> () Source #

Fully force an `InternalModBreaks` value

## Internal breakpoint identifier

data InternalBreakpointId Source #

Internal breakpoint identifier

Indexes into the structures in the ``InternalModBreaks`` produced during ByteCode generation. See Note [Breakpoint identifiers]

Constructors

InternalBreakpointId |
Fields ibi_info_mod :: !Module Breakpoint info module ibi_info_index :: !BreakInfoIndex Breakpoint info index

#### Instances

Instances details

NFData InternalBreakpointId Source # |
Instance details Defined in GHC.ByteCode.Breakpoints Methods rnf :: InternalBreakpointId -> () Source #
Outputable InternalBreakpointId Source # |
Instance details Defined in GHC.ByteCode.Breakpoints Methods ppr :: InternalBreakpointId -> SDoc Source #
Eq InternalBreakpointId Source # |
Instance details Defined in GHC.ByteCode.Breakpoints Methods (==) :: InternalBreakpointId -> InternalBreakpointId -> Bool Source # (/=) :: InternalBreakpointId -> InternalBreakpointId -> Bool Source #
Ord InternalBreakpointId Source # |
Instance details Defined in GHC.ByteCode.Breakpoints Methods compare :: InternalBreakpointId -> InternalBreakpointId -> Ordering Source # (<) :: InternalBreakpointId -> InternalBreakpointId -> Bool Source # (<=) :: InternalBreakpointId -> InternalBreakpointId -> Bool Source # (>) :: InternalBreakpointId -> InternalBreakpointId -> Bool Source # (>=) :: InternalBreakpointId -> InternalBreakpointId -> Bool Source # max :: InternalBreakpointId -> InternalBreakpointId -> InternalBreakpointId Source # min :: InternalBreakpointId -> InternalBreakpointId -> InternalBreakpointId Source #

type BreakInfoIndex = Int Source #

Internal breakpoint info index