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

Safe Haskell | Ignore
Language | GHC2021

GHC.ByteCode.Types

Description

Bytecode assembler types

Synopsis

- data CompiledByteCode = CompiledByteCode {
  - bc_bcos :: [UnlinkedBCO]
  - bc_itbls :: ItblEnv
  - bc_ffis :: [FFIInfo]
  - bc_strs :: AddrEnv
  - bc_breaks :: Maybe ModBreaks
  }
- seqCompiledByteCode :: CompiledByteCode -> ()
- newtype FFIInfo = FFIInfo (RemotePtr C_ffi_cif)
- 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 :: !(UArray Int Word16)
  - unlinkedBCOBitmap :: !(UArray Int Word64)
  - unlinkedBCOLits :: !(SizedSeq BCONPtr)
  - unlinkedBCOPtrs :: !(SizedSeq BCOPtr)
  }
- data BCOPtr
  - = BCOPtrName !Name
  - | BCOPtrPrimOp !PrimOp
  - | BCOPtrBCO !UnlinkedBCO
  - | BCOPtrBreakArray (ForeignRef BreakArray)
- data BCONPtr
  - = BCONPtrWord !Word
  - | BCONPtrLbl !FastString
  - | BCONPtrItbl !Name
  - | BCONPtrAddr !Name
  - | BCONPtrStr !ByteString
- type ItblEnv = NameEnv (Name, ItblPtr)
- newtype ItblPtr = ItblPtr (RemotePtr StgInfoTable)
- type AddrEnv = NameEnv (Name, AddrPtr)
- newtype AddrPtr = AddrPtr (RemotePtr ())
- data CgBreakInfo = CgBreakInfo {
  - cgb_tyvars :: ![IfaceTvBndr]
  - cgb_vars :: ![Maybe (IfaceIdBndr, Word)]
  - cgb_resty :: !IfaceType
  }
- data ModBreaks = ModBreaks {
  - modBreaks_flags :: ForeignRef BreakArray
  - modBreaks_locs :: !(Array BreakIndex SrcSpan)
  - modBreaks_vars :: !(Array BreakIndex [OccName])
  - modBreaks_decls :: !(Array BreakIndex [String])
  - modBreaks_ccs :: !(Array BreakIndex (RemotePtr CostCentre))
  - modBreaks_breakInfo :: IntMap CgBreakInfo
  - modBreaks_module :: RemotePtr ModuleName
  }
- type BreakIndex = Int
- emptyModBreaks :: ModBreaks
- data CCostCentre

# Documentation

data CompiledByteCode #

Constructors

CompiledByteCode |

Fields

- bc_bcos :: [UnlinkedBCO]
- bc_itbls :: ItblEnv
- bc_ffis :: [FFIInfo]
- bc_strs :: AddrEnv
- bc_breaks :: Maybe ModBreaks

#### Instances

Instances details

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

seqCompiledByteCode :: CompiledByteCode -> () #

newtype FFIInfo #

Constructors

FFIInfo (RemotePtr C_ffi_cif) |

#### Instances

Instances details

NFData FFIInfo # |
Instance details Defined in GHC.ByteCode.Types Methods rnf :: FFIInfo -> () #
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 :: !(UArray Int Word16)
- unlinkedBCOBitmap :: !(UArray Int Word64)
- unlinkedBCOLits :: !(SizedSeq BCONPtr)
- unlinkedBCOPtrs :: !(SizedSeq 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 (ForeignRef BreakArray) | a pointer to a breakpoint's module's BreakArray in GHCi's memory

#### 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 | Only used internally in the assembler in an intermediate representation; should never appear in a fully-assembled UnlinkedBCO. Also see Note [Allocating string literals] in GHC.ByteCode.Asm.

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

#### Instances

Instances details

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

data ModBreaks #

All the information about the breakpoints for a module

Constructors

ModBreaks |

Fields

- modBreaks_flags :: ForeignRef BreakArray

  The array of flags, one per breakpoint, indicating which breakpoints are enabled.

- modBreaks_locs :: !(Array BreakIndex SrcSpan)

  An array giving the source span of each breakpoint.

- modBreaks_vars :: !(Array BreakIndex [OccName])

  An array giving the names of the free variables at each breakpoint.

- modBreaks_decls :: !(Array BreakIndex [String])

  An array giving the names of the declarations enclosing each breakpoint. See Note [Field modBreaks_decls]

- modBreaks_ccs :: !(Array BreakIndex (RemotePtr CostCentre))

  Array pointing to cost centre for each breakpoint

- modBreaks_breakInfo :: IntMap CgBreakInfo

  info about each breakpoint from the bytecode generator

- modBreaks_module :: RemotePtr ModuleName

type BreakIndex = Int #

Breakpoint index

emptyModBreaks :: ModBreaks #

Construct an empty ModBreaks

data CCostCentre #

C CostCentre type