ghc-7.8.4: The GHC API

Safe Haskell | None
Language | Haskell98

SMRep

Contents

- Words and bytes
- Closure repesentation
  - Construction
  - Predicates
  - Size-related things
  - RTS closure types
- Operations over [Word8] strings that don't belong here

Synopsis

- data StgWord
- fromStgWord :: StgWord -> Integer
- toStgWord :: DynFlags -> Integer -> StgWord
- data StgHalfWord
- fromStgHalfWord :: StgHalfWord -> Integer
- toStgHalfWord :: DynFlags -> Integer -> StgHalfWord
- hALF_WORD_SIZE :: DynFlags -> ByteOff
- hALF_WORD_SIZE_IN_BITS :: DynFlags -> Int
- type WordOff = Int
- type ByteOff = Int
- roundUpToWords :: DynFlags -> ByteOff -> ByteOff
- data SMRep
  - = HeapRep IsStatic !WordOff !WordOff ClosureTypeInfo
  - | StackRep Liveness
  - | RTSRep Int SMRep
- type IsStatic = Bool
- data ClosureTypeInfo
  - = Constr ConstrTag ConstrDescription
  - | Fun FunArity ArgDescr
  - | Thunk
  - | ThunkSelector SelectorOffset
  - | BlackHole
  - | IndStatic
- data ArgDescr
  - = ArgSpec !Int
  - | ArgGen Liveness
- type Liveness = [Bool]
- type ConstrDescription = [Word8]
- mkHeapRep :: DynFlags -> IsStatic -> WordOff -> WordOff -> ClosureTypeInfo -> SMRep
- blackHoleRep :: SMRep
- indStaticRep :: SMRep
- mkStackRep :: [Bool] -> SMRep
- mkRTSRep :: Int -> SMRep -> SMRep
- isStaticRep :: SMRep -> IsStatic
- isConRep :: SMRep -> Bool
- isThunkRep :: SMRep -> Bool
- isFunRep :: SMRep -> Bool
- isStaticNoCafCon :: SMRep -> Bool
- isStackRep :: SMRep -> Bool
- heapClosureSize :: DynFlags -> SMRep -> WordOff
- fixedHdrSize :: DynFlags -> WordOff
- arrWordsHdrSize :: DynFlags -> ByteOff
- arrPtrsHdrSize :: DynFlags -> ByteOff
- profHdrSize :: DynFlags -> WordOff
- thunkHdrSize :: DynFlags -> WordOff
- nonHdrSize :: SMRep -> WordOff
- rtsClosureType :: SMRep -> Int
- rET_SMALL :: Int
- rET_BIG :: Int
- aRG_GEN :: Int
- aRG_GEN_BIG :: Int
- pprWord8String :: [Word8] -> SDoc
- stringToWord8s :: String -> [Word8]

# Words and bytes

data StgWord

Instances

Eq StgWord |
Bits StgWord |
Outputable StgWord |

fromStgWord :: StgWord -> Integer

toStgWord :: DynFlags -> Integer -> StgWord

data StgHalfWord

Instances

Eq StgHalfWord |
Outputable StgHalfWord |

fromStgHalfWord :: StgHalfWord -> Integer

toStgHalfWord :: DynFlags -> Integer -> StgHalfWord

hALF_WORD_SIZE :: DynFlags -> ByteOff

hALF_WORD_SIZE_IN_BITS :: DynFlags -> Int

type WordOff = Int

type ByteOff = Int

roundUpToWords :: DynFlags -> ByteOff -> ByteOff

# Closure repesentation

data SMRep

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

Constructors

HeapRep IsStatic !WordOff !WordOff ClosureTypeInfo |
StackRep Liveness |
RTSRep Int SMRep |

Instances

Outputable SMRep |

type IsStatic = Bool

True = This is a static closure. Affects how we garbage-collect it. Static closure have an extra static link field at the end.

data ClosureTypeInfo

Constructors

Constr ConstrTag ConstrDescription |
Fun FunArity ArgDescr |
Thunk |
ThunkSelector SelectorOffset |
BlackHole |
IndStatic |

Instances

Outputable ClosureTypeInfo |

data ArgDescr

Constructors

ArgSpec !Int |
ArgGen Liveness |

Instances

Outputable ArgDescr |

type Liveness = [Bool]

type ConstrDescription = [Word8]

## Construction

mkHeapRep :: DynFlags -> IsStatic -> WordOff -> WordOff -> ClosureTypeInfo -> SMRep

blackHoleRep :: SMRep

indStaticRep :: SMRep

mkStackRep :: [Bool] -> SMRep

mkRTSRep :: Int -> SMRep -> SMRep

## Predicates

isStaticRep :: SMRep -> IsStatic

isConRep :: SMRep -> Bool

isThunkRep :: SMRep -> Bool

isFunRep :: SMRep -> Bool

isStaticNoCafCon :: SMRep -> Bool

isStackRep :: SMRep -> Bool

## Size-related things

heapClosureSize :: DynFlags -> SMRep -> WordOff

fixedHdrSize :: DynFlags -> WordOff

Size of a closure header (StgHeader in includesrtsstorage/Closures.h)

arrWordsHdrSize :: DynFlags -> ByteOff

arrPtrsHdrSize :: DynFlags -> ByteOff

profHdrSize :: DynFlags -> WordOff

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

thunkHdrSize :: DynFlags -> WordOff

nonHdrSize :: SMRep -> WordOff

## RTS closure types

rtsClosureType :: SMRep -> Int

Derives the RTS closure type from an `SMRep`

rET_SMALL :: Int

rET_BIG :: Int

aRG_GEN :: Int

aRG_GEN_BIG :: Int

# Operations over [Word8] strings that don't belong here

pprWord8String :: [Word8] -> SDoc

stringToWord8s :: String -> [Word8]