ghc-9.4.8: The GHC API
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Runtime.Heap.Layout

Synopsis

Words and bytes

type WordOff = Int Source #

Word offset, or word count

type ByteOff = Int Source #

Byte offset, or byte count

wordsToBytes :: Num a => Platform -> a -> a Source #

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

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

Round up the given byte count to the next byte count that's a multiple of the machine's word size.

roundUpTo :: ByteOff -> ByteOff -> ByteOff Source #

Round up base to a multiple of size.

data StgHalfWord Source #

Instances

Instances details
Outputable StgHalfWord Source # 
Instance details

Defined in GHC.Runtime.Heap.Layout

Methods

ppr :: StgHalfWord -> SDoc Source #

Eq StgHalfWord Source # 
Instance details

Defined in GHC.Runtime.Heap.Layout

halfWordSize :: Platform -> ByteOff Source #

Half word size in bytes

Closure representation

data SMRep Source #

A description of the layout of a closure. Corresponds directly to the closure types in includes/rts/storage/ClosureTypes.h.

Instances

Instances details
Outputable SMRep Source # 
Instance details

Defined in GHC.Runtime.Heap.Layout

Methods

ppr :: SMRep -> SDoc Source #

Eq SMRep Source # 
Instance details

Defined in GHC.Runtime.Heap.Layout

Methods

(==) :: SMRep -> SMRep -> Bool #

(/=) :: SMRep -> SMRep -> Bool #

type IsStatic = Bool Source #

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

An ArgDescr describes the argument pattern of a function

Instances

Instances details
Outputable ArgDescr Source # 
Instance details

Defined in GHC.Runtime.Heap.Layout

Methods

ppr :: ArgDescr -> SDoc Source #

Eq ArgDescr Source # 
Instance details

Defined in GHC.Runtime.Heap.Layout

type Liveness = [Bool] Source #

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.

Construction

Predicates

Size-related things

heapClosureSizeW :: Profile -> SMRep -> WordOff Source #

The total size of the closure, in words.

fixedHdrSizeW :: Profile -> WordOff Source #

Size of a closure header (StgHeader in includes/rts/storage/Closures.h)

profHdrSize :: Profile -> WordOff Source #

Size of the profiling part of a closure header (StgProfHeader in includes/rts/storage/Closures.h)

RTS closure types

rtsClosureType :: SMRep -> Int Source #

Derives the RTS closure type from an SMRep

Arrays

card :: Platform -> Int -> Int Source #

The byte offset into the card table of the card for a given element

cardRoundUp :: Platform -> Int -> Int Source #

Convert a number of elements to a number of cards, rounding up

cardTableSizeB :: Platform -> Int -> ByteOff Source #

The size of a card table, in bytes

cardTableSizeW :: Platform -> Int -> WordOff Source #

The size of a card table, in words