Safe Haskell | Ignore |
---|---|
Language | GHC2021 |
GHC.Runtime.Heap.Layout
Synopsis
- type WordOff = Int
- type ByteOff = Int
- wordsToBytes :: Num a => Platform -> a -> a
- bytesToWordsRoundUp :: Platform -> ByteOff -> WordOff
- roundUpToWords :: Platform -> ByteOff -> ByteOff
- roundUpTo :: ByteOff -> ByteOff -> ByteOff
- data StgWord
- fromStgWord :: StgWord -> Integer
- toStgWord :: Platform -> Integer -> StgWord
- data StgHalfWord
- fromStgHalfWord :: StgHalfWord -> Integer
- toStgHalfWord :: Platform -> Integer -> StgHalfWord
- halfWordSize :: Platform -> ByteOff
- halfWordSizeInBits :: Platform -> Int
- data SMRep
- type IsStatic = Bool
- data ClosureTypeInfo
- = Constr ConTagZ ConstrDescription
- | Fun FunArity ArgDescr
- | Thunk
- | ThunkSelector SelectorOffset
- | BlackHole
- | IndStatic
- data ArgDescr
- = ArgSpec !Int
- | ArgGen Liveness
- | ArgUnknown
- type Liveness = [Bool]
- type ConstrDescription = ByteString
- mkHeapRep :: Profile -> IsStatic -> WordOff -> WordOff -> ClosureTypeInfo -> SMRep
- blackHoleRep :: SMRep
- indStaticRep :: SMRep
- mkStackRep :: [Bool] -> SMRep
- mkRTSRep :: Int -> SMRep -> SMRep
- arrPtrsRep :: Platform -> WordOff -> SMRep
- smallArrPtrsRep :: WordOff -> SMRep
- arrWordsRep :: Platform -> ByteOff -> SMRep
- isStaticRep :: SMRep -> IsStatic
- isConRep :: SMRep -> Bool
- isThunkRep :: SMRep -> Bool
- isFunRep :: SMRep -> Bool
- isStaticNoCafCon :: SMRep -> Bool
- isStackRep :: SMRep -> Bool
- heapClosureSizeW :: Profile -> SMRep -> WordOff
- fixedHdrSizeW :: Profile -> WordOff
- arrWordsHdrSize :: Profile -> ByteOff
- arrWordsHdrSizeW :: Profile -> WordOff
- arrPtrsHdrSize :: Profile -> ByteOff
- arrPtrsHdrSizeW :: Profile -> WordOff
- profHdrSize :: Profile -> WordOff
- thunkHdrSize :: Profile -> WordOff
- nonHdrSize :: Platform -> SMRep -> ByteOff
- nonHdrSizeW :: SMRep -> WordOff
- smallArrPtrsHdrSize :: Profile -> ByteOff
- smallArrPtrsHdrSizeW :: Profile -> WordOff
- hdrSize :: Profile -> SMRep -> ByteOff
- hdrSizeW :: Profile -> SMRep -> WordOff
- fixedHdrSize :: Profile -> ByteOff
- rtsClosureType :: SMRep -> Int
- rET_SMALL :: Int
- rET_BIG :: Int
- aRG_GEN :: Int
- aRG_GEN_BIG :: Int
- card :: Platform -> Int -> Int
- cardRoundUp :: Platform -> Int -> Int
- cardTableSizeB :: Platform -> Int -> ByteOff
- cardTableSizeW :: Platform -> Int -> WordOff
Words and bytes
wordsToBytes :: Num a => Platform -> a -> a #
Convert the given number of words to a number of bytes.
This function morally has type WordOff -> ByteOff
, but uses Num
a
to allow for overloading.
bytesToWordsRoundUp :: Platform -> ByteOff -> WordOff #
First round the given byte count up to a multiple of the machine's word size and then convert the result to words.
roundUpToWords :: Platform -> ByteOff -> ByteOff #
Round up the given byte count to the next byte count that's a multiple of the machine's word size.
Instances
Bits StgWord # | |
Defined in GHC.Runtime.Heap.Layout Methods (.&.) :: StgWord -> StgWord -> StgWord # (.|.) :: StgWord -> StgWord -> StgWord # xor :: StgWord -> StgWord -> StgWord # complement :: StgWord -> StgWord # shift :: StgWord -> Int -> StgWord # rotate :: StgWord -> Int -> StgWord # setBit :: StgWord -> Int -> StgWord # clearBit :: StgWord -> Int -> StgWord # complementBit :: StgWord -> Int -> StgWord # testBit :: StgWord -> Int -> Bool # bitSizeMaybe :: StgWord -> Maybe Int # shiftL :: StgWord -> Int -> StgWord # unsafeShiftL :: StgWord -> Int -> StgWord # shiftR :: StgWord -> Int -> StgWord # unsafeShiftR :: StgWord -> Int -> StgWord # rotateL :: StgWord -> Int -> StgWord # | |
Outputable StgWord # | |
Defined in GHC.Runtime.Heap.Layout | |
Eq StgWord # | |
fromStgWord :: StgWord -> Integer #
data StgHalfWord #
Instances
Outputable StgHalfWord # | |
Defined in GHC.Runtime.Heap.Layout Methods ppr :: StgHalfWord -> SDoc # | |
Eq StgHalfWord # | |
Defined in GHC.Runtime.Heap.Layout |
fromStgHalfWord :: StgHalfWord -> Integer #
toStgHalfWord :: Platform -> Integer -> StgHalfWord #
halfWordSize :: Platform -> ByteOff #
Half word size in bytes
halfWordSizeInBits :: Platform -> Int #
Closure representation
A description of the layout of a closure. Corresponds directly to the closure types in includes/rts/storage/ClosureTypes.h.
Constructors
HeapRep IsStatic !WordOff !WordOff ClosureTypeInfo | |
ArrayPtrsRep !WordOff !WordOff | |
SmallArrayPtrsRep !WordOff | |
ArrayWordsRep !WordOff | |
StackRep Liveness | |
RTSRep Int SMRep |
Instances
Outputable SMRep # | |
Defined in GHC.Runtime.Heap.Layout | |
Eq SMRep # | |
Ord SMRep # | |
True <=> This is a static closure. Affects how we garbage-collect it. Static closure have an extra static link field at the end. Constructors do not have a static variant; see Note [static constructors]
data ClosureTypeInfo #
Constructors
Constr ConTagZ ConstrDescription | |
Fun FunArity ArgDescr | |
Thunk | |
ThunkSelector SelectorOffset | |
BlackHole | |
IndStatic |
Instances
Outputable ClosureTypeInfo # | |
Defined in GHC.Runtime.Heap.Layout Methods ppr :: ClosureTypeInfo -> SDoc # | |
Eq ClosureTypeInfo # | |
Defined in GHC.Runtime.Heap.Layout Methods (==) :: ClosureTypeInfo -> ClosureTypeInfo -> Bool # (/=) :: ClosureTypeInfo -> ClosureTypeInfo -> Bool # | |
Ord ClosureTypeInfo # | |
Defined in GHC.Runtime.Heap.Layout Methods compare :: ClosureTypeInfo -> ClosureTypeInfo -> Ordering # (<) :: ClosureTypeInfo -> ClosureTypeInfo -> Bool # (<=) :: ClosureTypeInfo -> ClosureTypeInfo -> Bool # (>) :: ClosureTypeInfo -> ClosureTypeInfo -> Bool # (>=) :: ClosureTypeInfo -> ClosureTypeInfo -> Bool # max :: ClosureTypeInfo -> ClosureTypeInfo -> ClosureTypeInfo # min :: ClosureTypeInfo -> ClosureTypeInfo -> ClosureTypeInfo # |
An ArgDescr describes the argument pattern of a function
Constructors
ArgSpec !Int | |
ArgGen Liveness | |
ArgUnknown |
Instances
Outputable ArgDescr # | |
Defined in GHC.Runtime.Heap.Layout | |
Eq ArgDescr # | |
Ord ArgDescr # | |
Defined in GHC.Runtime.Heap.Layout |
We represent liveness bitmaps as a Bitmap (whose internal representation really is a bitmap). These are pinned onto case return vectors to indicate the state of the stack for the garbage collector.
In the compiled program, liveness bitmaps that fit inside a single word (StgWord) are stored as a single word, while larger bitmaps are stored as a pointer to an array of words.
type ConstrDescription = ByteString #
Construction
blackHoleRep :: SMRep #
indStaticRep :: SMRep #
mkStackRep :: [Bool] -> SMRep #
arrPtrsRep :: Platform -> WordOff -> SMRep #
smallArrPtrsRep :: WordOff -> SMRep #
arrWordsRep :: Platform -> ByteOff -> SMRep #
Predicates
isStaticRep :: SMRep -> IsStatic #
isThunkRep :: SMRep -> Bool #
isStaticNoCafCon :: SMRep -> Bool #
isStackRep :: SMRep -> Bool #
Size-related things
heapClosureSizeW :: Profile -> SMRep -> WordOff #
The total size of the closure, in words.
fixedHdrSizeW :: Profile -> WordOff #
Size of a closure header (StgHeader in includes/rts/storage/Closures.h)
arrWordsHdrSize :: Profile -> ByteOff #
arrWordsHdrSizeW :: Profile -> WordOff #
arrPtrsHdrSize :: Profile -> ByteOff #
arrPtrsHdrSizeW :: Profile -> WordOff #
profHdrSize :: Profile -> WordOff #
Size of the profiling part of a closure header (StgProfHeader in includes/rts/storage/Closures.h)
thunkHdrSize :: Profile -> WordOff #
nonHdrSize :: Platform -> SMRep -> ByteOff #
nonHdrSizeW :: SMRep -> WordOff #
smallArrPtrsHdrSize :: Profile -> ByteOff #
smallArrPtrsHdrSizeW :: Profile -> WordOff #
fixedHdrSize :: Profile -> ByteOff #
RTS closure types
rtsClosureType :: SMRep -> Int #
Derives the RTS closure type from an SMRep
aRG_GEN_BIG :: Int #
Arrays
cardRoundUp :: Platform -> Int -> Int #
Convert a number of elements to a number of cards, rounding up
cardTableSizeB :: Platform -> Int -> ByteOff #
The size of a card table, in bytes
cardTableSizeW :: Platform -> Int -> WordOff #
The size of a card table, in words