ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

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
- 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
- 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, Word16)]
  - 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
  }
- type BreakIndex = Int
- emptyModBreaks :: ModBreaks
- data CCostCentre

# Documentation

data CompiledByteCode Source #

Constructors

CompiledByteCode |

Fields

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

#### Instances

Instances details

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

seqCompiledByteCode :: CompiledByteCode -> () Source #

newtype FFIInfo Source #

Constructors

FFIInfo (RemotePtr C_ffi_cif) |

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

newtype RegBitmap Source #

Constructors

RegBitmap |

Fields

- unRegBitmap :: Word32

#### Instances

Instances details

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 #
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 #
Outputable RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods ppr :: RegBitmap -> SDoc Source #
Eq RegBitmap Source # |
Instance details Defined in GHC.ByteCode.Types Methods (==) :: RegBitmap -> RegBitmap -> Bool # (/=) :: RegBitmap -> RegBitmap -> Bool #
Ord RegBitmap Source # |
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 Source #

Constructors

NativePrimCall |
NativeTupleReturn |

#### Instances

Instances details

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

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

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 #
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 # (/=) :: ByteOff -> ByteOff -> Bool #
Ord ByteOff Source # |
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 Source #

Constructors

WordOff Int |

#### Instances

Instances details

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 #
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 # (/=) :: WordOff -> WordOff -> Bool #
Ord WordOff Source # |
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 #

data UnlinkedBCO Source #

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

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

Show ItblPtr Source # |
Instance details Defined in GHC.ByteCode.Types Methods showsPrec :: Int -> ItblPtr -> ShowS Source # show :: ItblPtr -> String Source # showList :: [ItblPtr] -> ShowS Source #
NFData ItblPtr Source # |
Instance details Defined in GHC.ByteCode.Types Methods rnf :: ItblPtr -> () 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 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, Word16)]
- cgb_resty :: !IfaceType

#### Instances

Instances details

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

data ModBreaks Source #

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

type BreakIndex = Int Source #

Breakpoint index

emptyModBreaks :: ModBreaks Source #

Construct an empty ModBreaks

data CCostCentre Source #

C CostCentre type