Safe Haskell | None |
---|---|
Language | Haskell2010 |
GHC.Exts.Heap.Closures
Synopsis
- type Closure = GenClosure Box
- data GenClosure b
- = ConstrClosure { }
- | FunClosure {
- info :: !StgInfoTable
- ptrArgs :: ![b]
- dataArgs :: ![Word]
- | ThunkClosure {
- info :: !StgInfoTable
- ptrArgs :: ![b]
- dataArgs :: ![Word]
- | SelectorClosure {
- info :: !StgInfoTable
- selectee :: !b
- | PAPClosure { }
- | APClosure { }
- | APStackClosure {
- info :: !StgInfoTable
- fun :: !b
- payload :: ![b]
- | IndClosure {
- info :: !StgInfoTable
- indirectee :: !b
- | BCOClosure { }
- | BlackholeClosure {
- info :: !StgInfoTable
- indirectee :: !b
- | ArrWordsClosure { }
- | MutArrClosure {
- info :: !StgInfoTable
- mccPtrs :: !Word
- mccSize :: !Word
- mccPayload :: ![b]
- | MVarClosure {
- info :: !StgInfoTable
- queueHead :: !b
- queueTail :: !b
- value :: !b
- | MutVarClosure {
- info :: !StgInfoTable
- var :: !b
- | BlockingQueueClosure { }
- | IntClosure { }
- | WordClosure { }
- | Int64Closure { }
- | Word64Closure { }
- | AddrClosure { }
- | FloatClosure { }
- | DoubleClosure { }
- | OtherClosure {
- info :: !StgInfoTable
- hvalues :: ![b]
- rawWords :: ![Word]
- | UnsupportedClosure {
- info :: !StgInfoTable
- data PrimType
- allClosures :: GenClosure b -> [b]
- data Box = Box Any
- areBoxesEqual :: Box -> Box -> IO Bool
- asBox :: a -> Box
Closures
type Closure = GenClosure Box Source #
data GenClosure b Source #
This is the representation of a Haskell value on the heap. It reflects http://ghc.haskell.org/trac/ghc/browser/includes/rts/storage/Closures.h
The data type is parametrized by the type to store references in. Usually
this is a Box
with the type synonym Closure
.
All Heap objects have the same basic layout. A header containing a pointer
to the info table and a payload with various fields. The info
field below
always refers to the info table pointed to by the header. The remaining
fields are the payload.
See https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/HeapObjects for more information.
Constructors
ConstrClosure | A data constructor |
FunClosure | A function |
Fields
| |
ThunkClosure | A thunk, an expression not obviously in head normal form |
Fields
| |
SelectorClosure | A thunk which performs a simple selection operation |
Fields
| |
PAPClosure | An unsaturated function application |
Fields
| |
APClosure | A function application |
Fields
| |
APStackClosure | A suspended thunk evaluation |
Fields
| |
IndClosure | A pointer to another closure, introduced when a thunk is updated to point at its value |
Fields
| |
BCOClosure | A byte-code object (BCO) which can be interpreted by GHC's byte-code interpreter (e.g. as used by GHCi) |
Fields
| |
BlackholeClosure | A thunk under evaluation by another thread |
Fields
| |
ArrWordsClosure | A |
MutArrClosure | A |
Fields
| |
MVarClosure | An |
Fields
| |
MutVarClosure | A |
Fields
| |
BlockingQueueClosure | An STM blocking queue. |
IntClosure | Primitive Int |
WordClosure | Primitive Word |
Int64Closure | Primitive Int64 |
Word64Closure | Primitive Word64 |
AddrClosure | Primitive Addr |
FloatClosure | Primitive Float |
DoubleClosure | Primitive Double |
OtherClosure | Another kind of closure |
Fields
| |
UnsupportedClosure | |
Fields
|
Instances
Functor GenClosure Source # | |
Defined in GHC.Exts.Heap.Closures Methods fmap :: (a -> b) -> GenClosure a -> GenClosure b # (<$) :: a -> GenClosure b -> GenClosure a # | |
Foldable GenClosure Source # | |
Defined in GHC.Exts.Heap.Closures Methods fold :: Monoid m => GenClosure m -> m foldMap :: Monoid m => (a -> m) -> GenClosure a -> m # foldr :: (a -> b -> b) -> b -> GenClosure a -> b # foldr' :: (a -> b -> b) -> b -> GenClosure a -> b foldl :: (b -> a -> b) -> b -> GenClosure a -> b # foldl' :: (b -> a -> b) -> b -> GenClosure a -> b # foldr1 :: (a -> a -> a) -> GenClosure a -> a # foldl1 :: (a -> a -> a) -> GenClosure a -> a # toList :: GenClosure a -> [a] null :: GenClosure a -> Bool # length :: GenClosure a -> Int # elem :: Eq a => a -> GenClosure a -> Bool # maximum :: Ord a => GenClosure a -> a # minimum :: Ord a => GenClosure a -> a # sum :: Num a => GenClosure a -> a # product :: Num a => GenClosure a -> a # | |
Traversable GenClosure Source # | |
Defined in GHC.Exts.Heap.Closures Methods traverse :: Applicative f => (a -> f b) -> GenClosure a -> f (GenClosure b) # sequenceA :: Applicative f => GenClosure (f a) -> f (GenClosure a) # mapM :: Monad m => (a -> m b) -> GenClosure a -> m (GenClosure b) # sequence :: Monad m => GenClosure (m a) -> m (GenClosure a) # | |
Show b => Show (GenClosure b) Source # | |
Defined in GHC.Exts.Heap.Closures Methods showsPrec :: Int -> GenClosure b -> ShowS # show :: GenClosure b -> String # showList :: [GenClosure b] -> ShowS # | |
Generic (GenClosure b) Source # | |
Defined in GHC.Exts.Heap.Closures Associated Types type Rep (GenClosure b) :: Type -> Type | |
Binary a => Binary (GenClosure a) | |
Defined in GHCi.Message | |
type Rep (GenClosure b) Source # | |
Defined in GHC.Exts.Heap.Closures type Rep (GenClosure b) = D1 (MetaData "GenClosure" "GHC.Exts.Heap.Closures" "ghc-lib-parser-8.8.0.20190424-GE9eVYN6Su0EmJadpPOubE" False) ((((C1 (MetaCons "ConstrClosure" PrefixI True) ((S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: (S1 (MetaSel (Just "ptrArgs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [b]) :*: S1 (MetaSel (Just "dataArgs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [Word]))) :*: (S1 (MetaSel (Just "pkg") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 String) :*: (S1 (MetaSel (Just "modl") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 String) :*: S1 (MetaSel (Just "name") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 String)))) :+: (C1 (MetaCons "FunClosure" PrefixI True) (S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: (S1 (MetaSel (Just "ptrArgs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [b]) :*: S1 (MetaSel (Just "dataArgs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [Word]))) :+: C1 (MetaCons "ThunkClosure" PrefixI True) (S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: (S1 (MetaSel (Just "ptrArgs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [b]) :*: S1 (MetaSel (Just "dataArgs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [Word]))))) :+: (C1 (MetaCons "SelectorClosure" PrefixI True) (S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: S1 (MetaSel (Just "selectee") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b)) :+: (C1 (MetaCons "PAPClosure" PrefixI True) ((S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: S1 (MetaSel (Just "arity") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 HalfWord)) :*: (S1 (MetaSel (Just "n_args") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 HalfWord) :*: (S1 (MetaSel (Just "fun") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b) :*: S1 (MetaSel (Just "payload") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [b])))) :+: C1 (MetaCons "APClosure" PrefixI True) ((S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: S1 (MetaSel (Just "arity") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 HalfWord)) :*: (S1 (MetaSel (Just "n_args") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 HalfWord) :*: (S1 (MetaSel (Just "fun") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b) :*: S1 (MetaSel (Just "payload") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [b]))))))) :+: ((C1 (MetaCons "APStackClosure" PrefixI True) (S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: (S1 (MetaSel (Just "fun") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b) :*: S1 (MetaSel (Just "payload") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [b]))) :+: (C1 (MetaCons "IndClosure" PrefixI True) (S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: S1 (MetaSel (Just "indirectee") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b)) :+: C1 (MetaCons "BCOClosure" PrefixI True) ((S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: (S1 (MetaSel (Just "instrs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b) :*: S1 (MetaSel (Just "literals") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b))) :*: ((S1 (MetaSel (Just "bcoptrs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b) :*: S1 (MetaSel (Just "arity") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 HalfWord)) :*: (S1 (MetaSel (Just "size") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 HalfWord) :*: S1 (MetaSel (Just "bitmap") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [Word])))))) :+: (C1 (MetaCons "BlackholeClosure" PrefixI True) (S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: S1 (MetaSel (Just "indirectee") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b)) :+: (C1 (MetaCons "ArrWordsClosure" PrefixI True) (S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: (S1 (MetaSel (Just "bytes") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Word) :*: S1 (MetaSel (Just "arrWords") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [Word]))) :+: C1 (MetaCons "MutArrClosure" PrefixI True) ((S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: S1 (MetaSel (Just "mccPtrs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Word)) :*: (S1 (MetaSel (Just "mccSize") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Word) :*: S1 (MetaSel (Just "mccPayload") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [b]))))))) :+: (((C1 (MetaCons "MVarClosure" PrefixI True) ((S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: S1 (MetaSel (Just "queueHead") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b)) :*: (S1 (MetaSel (Just "queueTail") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b) :*: S1 (MetaSel (Just "value") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b))) :+: (C1 (MetaCons "MutVarClosure" PrefixI True) (S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: S1 (MetaSel (Just "var") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b)) :+: C1 (MetaCons "BlockingQueueClosure" PrefixI True) ((S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: S1 (MetaSel (Just "link") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b)) :*: (S1 (MetaSel (Just "blackHole") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b) :*: (S1 (MetaSel (Just "owner") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b) :*: S1 (MetaSel (Just "queue") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b)))))) :+: (C1 (MetaCons "IntClosure" PrefixI True) (S1 (MetaSel (Just "ptipe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PrimType) :*: S1 (MetaSel (Just "intVal") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int)) :+: (C1 (MetaCons "WordClosure" PrefixI True) (S1 (MetaSel (Just "ptipe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PrimType) :*: S1 (MetaSel (Just "wordVal") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Word)) :+: C1 (MetaCons "Int64Closure" PrefixI True) (S1 (MetaSel (Just "ptipe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PrimType) :*: S1 (MetaSel (Just "int64Val") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int64))))) :+: ((C1 (MetaCons "Word64Closure" PrefixI True) (S1 (MetaSel (Just "ptipe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PrimType) :*: S1 (MetaSel (Just "word64Val") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Word64)) :+: (C1 (MetaCons "AddrClosure" PrefixI True) (S1 (MetaSel (Just "ptipe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PrimType) :*: S1 (MetaSel (Just "addrVal") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int)) :+: C1 (MetaCons "FloatClosure" PrefixI True) (S1 (MetaSel (Just "ptipe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PrimType) :*: S1 (MetaSel (Just "floatVal") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Float)))) :+: (C1 (MetaCons "DoubleClosure" PrefixI True) (S1 (MetaSel (Just "ptipe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PrimType) :*: S1 (MetaSel (Just "doubleVal") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Double)) :+: (C1 (MetaCons "OtherClosure" PrefixI True) (S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable) :*: (S1 (MetaSel (Just "hvalues") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [b]) :*: S1 (MetaSel (Just "rawWords") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [Word]))) :+: C1 (MetaCons "UnsupportedClosure" PrefixI True) (S1 (MetaSel (Just "info") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 StgInfoTable))))))) |
Instances
Eq PrimType Source # | |
Show PrimType Source # | |
Generic PrimType Source # | |
Binary PrimType | |
type Rep PrimType Source # | |
Defined in GHC.Exts.Heap.Closures type Rep PrimType = D1 (MetaData "PrimType" "GHC.Exts.Heap.Closures" "ghc-lib-parser-8.8.0.20190424-GE9eVYN6Su0EmJadpPOubE" False) ((C1 (MetaCons "PInt" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "PWord" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "PInt64" PrefixI False) (U1 :: Type -> Type))) :+: ((C1 (MetaCons "PWord64" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "PAddr" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "PFloat" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "PDouble" PrefixI False) (U1 :: Type -> Type)))) |
allClosures :: GenClosure b -> [b] Source #
For generic code, this function returns all referenced closures.
Boxes
An arbitrary Haskell value in a safe Box. The point is that even
unevaluated thunks can safely be moved around inside the Box, and when
required, e.g. in getBoxedClosureData
, the function knows how far it has
to evaluate the argument.
Constructors
Box Any |