GHC.ByteCode.Types

ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
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 :: k) = 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 #

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 # |
Instance details Defined in GHC.ByteCode.Types Methods ppr :: CompiledByteCode -> SDoc #

seqCompiledByteCode :: CompiledByteCode -> () #

data BCOByteArray (a :: k) #

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) # |
Instance details Defined in GHCi.ResolvedBCO Methods put :: BCOByteArray a -> Put # get :: Get (BCOByteArray a) # putList :: [BCOByteArray a] -> Put #
Show (BCOByteArray Word16) # |
Instance details Defined in GHCi.ResolvedBCO Methods showsPrec :: Int -> BCOByteArray Word16 -> ShowS # show :: BCOByteArray Word16 -> String # showList :: [BCOByteArray Word16] -> ShowS #
Show (BCOByteArray Word) # |
Instance details Defined in GHCi.ResolvedBCO Methods showsPrec :: Int -> BCOByteArray Word -> ShowS # show :: BCOByteArray Word -> String # showList :: [BCOByteArray Word] -> ShowS #

mkBCOByteArray :: UArray Int a -> BCOByteArray a #

data FFIInfo #

A libffi ffi_cif function prototype.

Constructors

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

#### Instances

Instances details

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

newtype RegBitmap #

Constructors

RegBitmap |
Fields unRegBitmap :: Word32

#### Instances

Instances details

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

data NativeCallType #

Constructors

NativePrimCall |
NativeTupleReturn |

#### Instances

Instances details

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

data NativeCallInfo #

Constructors

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

#### Instances

Instances details

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

voidTupleReturnInfo :: NativeCallInfo #

voidPrimCallInfo :: NativeCallInfo #

newtype ByteOff #

Constructors

ByteOff Int |

#### Instances

Instances details

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

newtype WordOff #

Constructors

WordOff Int |

#### Instances

Instances details

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

newtype HalfWord #

Constructors

HalfWord Word |

#### Instances

Instances details

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

data UnlinkedBCO #

Constructors

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

#### Instances

Instances details

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

data BCOPtr #

Constructors

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

#### Instances

Instances details

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

data BCONPtr #

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 # |
Instance details Defined in GHC.ByteCode.Types Methods rnf :: BCONPtr -> () #

type ItblEnv = NameEnv (Name, ItblPtr) #

newtype ItblPtr #

Constructors

ItblPtr (RemotePtr StgInfoTable) |

#### Instances

Instances details

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

type AddrEnv = NameEnv (Name, AddrPtr) #

newtype AddrPtr #

Constructors

AddrPtr (RemotePtr ()) |

#### Instances

Instances details

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

data FlatBag a #

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

sizeFlatBag :: FlatBag a -> Word #

Calculate the size of

fromSmallArray :: SmallArray a -> FlatBag a #

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] #

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

# Mod Breaks

data ModBreaks #

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 #

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

type BreakTickIndex = Int #

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

# Internal Mod Breaks

data InternalModBreaks #

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 #

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 # |
Instance details Defined in GHC.ByteCode.Breakpoints Methods ppr :: CgBreakInfo -> SDoc #

seqInternalModBreaks :: InternalModBreaks -> () #

Fully force an `InternalModBreaks` value

## Internal breakpoint identifier

data InternalBreakpointId #

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

type BreakInfoIndex = Int #

Internal breakpoint info index