Copyright | (c) 2012 Joachim Breitner |
---|---|
License | BSD3 |
Maintainer | Joachim Breitner <mail@joachim-breitner.de> |
Safe Haskell | Ignore |
Language | GHC2021 |
GHC.Exts.Heap
Description
With this module, you can investigate the heap representation of Haskell values, i.e. to investigate sharing and lazy evaluation.
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]
- | SmallMutArrClosure {
- info :: !StgInfoTable
- mccPtrs :: !Word
- mccPayload :: ![b]
- | MVarClosure {
- info :: !StgInfoTable
- queueHead :: !b
- queueTail :: !b
- value :: !b
- | IOPortClosure {
- info :: !StgInfoTable
- queueHead :: !b
- queueTail :: !b
- value :: !b
- | MutVarClosure {
- info :: !StgInfoTable
- var :: !b
- | BlockingQueueClosure { }
- | WeakClosure {
- info :: !StgInfoTable
- cfinalizers :: !b
- key :: !b
- value :: !b
- finalizer :: !b
- weakLink :: !(Maybe b)
- | TSOClosure {
- info :: !StgInfoTable
- link :: !b
- global_link :: !b
- tsoStack :: !b
- trec :: !b
- blocked_exceptions :: !b
- bq :: !b
- thread_label :: !(Maybe b)
- what_next :: !WhatNext
- why_blocked :: !WhyBlocked
- flags :: ![TsoFlags]
- threadId :: !Word64
- saved_errno :: !Word32
- tso_dirty :: !Word32
- alloc_limit :: !Int64
- tot_stack_size :: !Word32
- prof :: !(Maybe StgTSOProfInfo)
- | StackClosure {
- info :: !StgInfoTable
- stack_size :: !Word32
- stack_dirty :: !Word8
- stack_marking :: !Word8
- | IntClosure { }
- | WordClosure { }
- | Int64Closure { }
- | Word64Closure { }
- | AddrClosure { }
- | FloatClosure { }
- | DoubleClosure { }
- | OtherClosure {
- info :: !StgInfoTable
- hvalues :: ![b]
- rawWords :: ![Word]
- | UnsupportedClosure {
- info :: !StgInfoTable
- | UnknownTypeWordSizedPrimitive { }
- data ClosureType
- = INVALID_OBJECT
- | CONSTR
- | CONSTR_1_0
- | CONSTR_0_1
- | CONSTR_2_0
- | CONSTR_1_1
- | CONSTR_0_2
- | CONSTR_NOCAF
- | FUN
- | FUN_1_0
- | FUN_0_1
- | FUN_2_0
- | FUN_1_1
- | FUN_0_2
- | FUN_STATIC
- | THUNK
- | THUNK_1_0
- | THUNK_0_1
- | THUNK_2_0
- | THUNK_1_1
- | THUNK_0_2
- | THUNK_STATIC
- | THUNK_SELECTOR
- | BCO
- | AP
- | PAP
- | AP_STACK
- | IND
- | IND_STATIC
- | RET_BCO
- | RET_SMALL
- | RET_BIG
- | RET_FUN
- | UPDATE_FRAME
- | CATCH_FRAME
- | UNDERFLOW_FRAME
- | STOP_FRAME
- | BLOCKING_QUEUE
- | BLACKHOLE
- | MVAR_CLEAN
- | MVAR_DIRTY
- | TVAR
- | ARR_WORDS
- | MUT_ARR_PTRS_CLEAN
- | MUT_ARR_PTRS_DIRTY
- | MUT_ARR_PTRS_FROZEN_DIRTY
- | MUT_ARR_PTRS_FROZEN_CLEAN
- | MUT_VAR_CLEAN
- | MUT_VAR_DIRTY
- | WEAK
- | PRIM
- | MUT_PRIM
- | TSO
- | STACK
- | TREC_CHUNK
- | ATOMICALLY_FRAME
- | CATCH_RETRY_FRAME
- | CATCH_STM_FRAME
- | WHITEHOLE
- | SMALL_MUT_ARR_PTRS_CLEAN
- | SMALL_MUT_ARR_PTRS_DIRTY
- | SMALL_MUT_ARR_PTRS_FROZEN_DIRTY
- | SMALL_MUT_ARR_PTRS_FROZEN_CLEAN
- | COMPACT_NFDATA
- | CONTINUATION
- | N_CLOSURE_TYPES
- data PrimType
- data WhatNext
- data WhyBlocked
- data TsoFlags
- class HasHeapRep (a :: TYPE rep) where
- getClosureData :: a -> IO Closure
- getClosureDataFromHeapRep :: ByteArray# -> Ptr StgInfoTable -> [b] -> IO (GenClosure b)
- getClosureDataFromHeapRepPrim :: IO (String, String, String) -> (Ptr a -> IO (Maybe CostCentreStack)) -> StgInfoTable -> ByteArray# -> [b] -> IO (GenClosure b)
- data StgInfoTable = StgInfoTable {}
- type EntryFunPtr = FunPtr (Ptr () -> IO (Ptr ()))
- type HalfWord = Word32
- type ItblCodes = Either [Word8] [Word32]
- itblSize :: Int
- peekItbl :: Ptr StgInfoTable -> IO StgInfoTable
- pokeItbl :: Ptr StgInfoTable -> StgInfoTable -> IO ()
- newtype StgTSOProfInfo = StgTSOProfInfo {}
- data IndexTable = IndexTable {}
- data CostCentre = CostCentre {}
- data CostCentreStack = CostCentreStack {
- ccs_ccsID :: Int
- ccs_cc :: CostCentre
- ccs_prevStack :: Maybe CostCentreStack
- ccs_indexTable :: Maybe IndexTable
- ccs_root :: Maybe CostCentreStack
- ccs_depth :: Word
- ccs_scc_count :: Word64
- ccs_selected :: Word
- ccs_time_ticks :: Word
- ccs_mem_alloc :: Word64
- ccs_inherited_alloc :: Word64
- ccs_inherited_ticks :: Word
- getBoxedClosureData :: Box -> IO Closure
- allClosures :: GenClosure b -> [b]
- data Box = Box (Any :: Type)
- asBox :: a -> Box
- areBoxesEqual :: Box -> Box -> IO Bool
Closure types
type Closure = GenClosure Box Source #
data GenClosure b Source #
This is the representation of a Haskell value on the heap. It reflects https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/storage/Closures.h
The data type is parametrized by b
: 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://gitlab.haskell.org/ghc/ghc/wikis/commentary/rts/storage/heap-objects 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
| |
SmallMutArrClosure | A Since: 8.10.1 |
Fields
| |
MVarClosure | An |
Fields
| |
IOPortClosure | An |
Fields
| |
MutVarClosure | A |
Fields
| |
BlockingQueueClosure | An STM blocking queue. |
WeakClosure | |
Fields
| |
TSOClosure | Representation of StgTSO: A Thread State Object. The values for
|
Fields
| |
StackClosure | Representation of StgStack: The 'tsoStack ' of a |
Fields
| |
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
| |
UnknownTypeWordSizedPrimitive | A primitive word from a bitmap encoded stack frame payload The type itself cannot be restored (i.e. it might represent a Word8# or an Int#). |
Instances
data ClosureType Source #
Constructors
INVALID_OBJECT | |
CONSTR | |
CONSTR_1_0 | |
CONSTR_0_1 | |
CONSTR_2_0 | |
CONSTR_1_1 | |
CONSTR_0_2 | |
CONSTR_NOCAF | |
FUN | |
FUN_1_0 | |
FUN_0_1 | |
FUN_2_0 | |
FUN_1_1 | |
FUN_0_2 | |
FUN_STATIC | |
THUNK | |
THUNK_1_0 | |
THUNK_0_1 | |
THUNK_2_0 | |
THUNK_1_1 | |
THUNK_0_2 | |
THUNK_STATIC | |
THUNK_SELECTOR | |
BCO | |
AP | |
PAP | |
AP_STACK | |
IND | |
IND_STATIC | |
RET_BCO | |
RET_SMALL | |
RET_BIG | |
RET_FUN | |
UPDATE_FRAME | |
CATCH_FRAME | |
UNDERFLOW_FRAME | |
STOP_FRAME | |
BLOCKING_QUEUE | |
BLACKHOLE | |
MVAR_CLEAN | |
MVAR_DIRTY | |
TVAR | |
ARR_WORDS | |
MUT_ARR_PTRS_CLEAN | |
MUT_ARR_PTRS_DIRTY | |
MUT_ARR_PTRS_FROZEN_DIRTY | |
MUT_ARR_PTRS_FROZEN_CLEAN | |
MUT_VAR_CLEAN | |
MUT_VAR_DIRTY | |
WEAK | |
PRIM | |
MUT_PRIM | |
TSO | |
STACK | |
TREC_CHUNK | |
ATOMICALLY_FRAME | |
CATCH_RETRY_FRAME | |
CATCH_STM_FRAME | |
WHITEHOLE | |
SMALL_MUT_ARR_PTRS_CLEAN | |
SMALL_MUT_ARR_PTRS_DIRTY | |
SMALL_MUT_ARR_PTRS_FROZEN_DIRTY | |
SMALL_MUT_ARR_PTRS_FROZEN_CLEAN | |
COMPACT_NFDATA | |
CONTINUATION | |
N_CLOSURE_TYPES |
Instances
Enum ClosureType Source # | |||||
Defined in GHC.Exts.Heap.ClosureTypes Methods succ :: ClosureType -> ClosureType # pred :: ClosureType -> ClosureType # toEnum :: Int -> ClosureType # fromEnum :: ClosureType -> Int # enumFrom :: ClosureType -> [ClosureType] # enumFromThen :: ClosureType -> ClosureType -> [ClosureType] # enumFromTo :: ClosureType -> ClosureType -> [ClosureType] # enumFromThenTo :: ClosureType -> ClosureType -> ClosureType -> [ClosureType] # | |||||
Generic ClosureType Source # | |||||
Defined in GHC.Exts.Heap.ClosureTypes Associated Types
| |||||
Show ClosureType Source # | |||||
Defined in GHC.Exts.Heap.ClosureTypes Methods showsPrec :: Int -> ClosureType -> ShowS # show :: ClosureType -> String # showList :: [ClosureType] -> ShowS # | |||||
Binary ClosureType Source # | |||||
Defined in GHCi.Message | |||||
Eq ClosureType Source # | |||||
Defined in GHC.Exts.Heap.ClosureTypes | |||||
Ord ClosureType Source # | |||||
Defined in GHC.Exts.Heap.ClosureTypes Methods compare :: ClosureType -> ClosureType -> Ordering # (<) :: ClosureType -> ClosureType -> Bool # (<=) :: ClosureType -> ClosureType -> Bool # (>) :: ClosureType -> ClosureType -> Bool # (>=) :: ClosureType -> ClosureType -> Bool # max :: ClosureType -> ClosureType -> ClosureType # min :: ClosureType -> ClosureType -> ClosureType # | |||||
type Rep ClosureType Source # | |||||
Defined in GHC.Exts.Heap.ClosureTypes type Rep ClosureType = D1 ('MetaData "ClosureType" "GHC.Exts.Heap.ClosureTypes" "ghc-lib-parser-9.10.2.20250515-IJK1D32DDxN9cJSpJAC8Wb" 'False) ((((((C1 ('MetaCons "INVALID_OBJECT" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CONSTR" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CONSTR_1_0" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CONSTR_0_1" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "CONSTR_2_0" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CONSTR_1_1" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CONSTR_0_2" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CONSTR_NOCAF" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "FUN" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FUN_1_0" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FUN_0_1" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FUN_2_0" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "FUN_1_1" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FUN_0_2" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FUN_STATIC" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "THUNK" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: ((((C1 ('MetaCons "THUNK_1_0" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "THUNK_0_1" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "THUNK_2_0" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "THUNK_1_1" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "THUNK_0_2" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "THUNK_STATIC" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "THUNK_SELECTOR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BCO" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "AP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PAP" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "AP_STACK" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IND" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "IND_STATIC" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RET_BCO" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "RET_SMALL" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "RET_BIG" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RET_FUN" 'PrefixI 'False) (U1 :: Type -> Type))))))) :+: (((((C1 ('MetaCons "UPDATE_FRAME" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CATCH_FRAME" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "UNDERFLOW_FRAME" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "STOP_FRAME" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "BLOCKING_QUEUE" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BLACKHOLE" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MVAR_CLEAN" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MVAR_DIRTY" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "TVAR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ARR_WORDS" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MUT_ARR_PTRS_CLEAN" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MUT_ARR_PTRS_DIRTY" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "MUT_ARR_PTRS_FROZEN_DIRTY" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MUT_ARR_PTRS_FROZEN_CLEAN" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MUT_VAR_CLEAN" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MUT_VAR_DIRTY" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: ((((C1 ('MetaCons "WEAK" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PRIM" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MUT_PRIM" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TSO" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "STACK" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TREC_CHUNK" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ATOMICALLY_FRAME" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CATCH_RETRY_FRAME" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "CATCH_STM_FRAME" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WHITEHOLE" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "SMALL_MUT_ARR_PTRS_CLEAN" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SMALL_MUT_ARR_PTRS_DIRTY" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "SMALL_MUT_ARR_PTRS_FROZEN_DIRTY" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SMALL_MUT_ARR_PTRS_FROZEN_CLEAN" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "COMPACT_NFDATA" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CONTINUATION" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "N_CLOSURE_TYPES" 'PrefixI 'False) (U1 :: Type -> Type)))))))) |
Instances
Generic PrimType Source # | |||||
Defined in GHC.Exts.Heap.Closures Associated Types
| |||||
Show PrimType Source # | |||||
Binary PrimType Source # | |||||
Eq PrimType Source # | |||||
Ord PrimType Source # | |||||
Defined in GHC.Exts.Heap.Closures | |||||
type Rep PrimType Source # | |||||
Defined in GHC.Exts.Heap.Closures type Rep PrimType = D1 ('MetaData "PrimType" "GHC.Exts.Heap.Closures" "ghc-lib-parser-9.10.2.20250515-IJK1D32DDxN9cJSpJAC8Wb" '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)))) |
Constructors
ThreadRunGHC | |
ThreadInterpret | |
ThreadKilled | |
ThreadComplete | |
WhatNextUnknownValue Word16 | Please report this as a bug |
Instances
Generic WhatNext Source # | |||||
Defined in GHC.Exts.Heap.Closures Associated Types
| |||||
Show WhatNext Source # | |||||
Binary WhatNext Source # | |||||
Eq WhatNext Source # | |||||
Ord WhatNext Source # | |||||
Defined in GHC.Exts.Heap.Closures | |||||
type Rep WhatNext Source # | |||||
Defined in GHC.Exts.Heap.Closures type Rep WhatNext = D1 ('MetaData "WhatNext" "GHC.Exts.Heap.Closures" "ghc-lib-parser-9.10.2.20250515-IJK1D32DDxN9cJSpJAC8Wb" 'False) ((C1 ('MetaCons "ThreadRunGHC" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ThreadInterpret" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ThreadKilled" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ThreadComplete" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WhatNextUnknownValue" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16))))) |
data WhyBlocked Source #
Constructors
NotBlocked | |
BlockedOnMVar | |
BlockedOnMVarRead | |
BlockedOnBlackHole | |
BlockedOnRead | |
BlockedOnWrite | |
BlockedOnDelay | |
BlockedOnSTM | |
BlockedOnDoProc | |
BlockedOnCCall | |
BlockedOnCCall_Interruptible | |
BlockedOnMsgThrowTo | |
ThreadMigrating | |
WhyBlockedUnknownValue Word16 | Please report this as a bug |
Instances
Generic WhyBlocked Source # | |||||
Defined in GHC.Exts.Heap.Closures Associated Types
| |||||
Show WhyBlocked Source # | |||||
Defined in GHC.Exts.Heap.Closures Methods showsPrec :: Int -> WhyBlocked -> ShowS # show :: WhyBlocked -> String # showList :: [WhyBlocked] -> ShowS # | |||||
Binary WhyBlocked Source # | |||||
Defined in GHCi.Message | |||||
Eq WhyBlocked Source # | |||||
Defined in GHC.Exts.Heap.Closures | |||||
Ord WhyBlocked Source # | |||||
Defined in GHC.Exts.Heap.Closures Methods compare :: WhyBlocked -> WhyBlocked -> Ordering # (<) :: WhyBlocked -> WhyBlocked -> Bool # (<=) :: WhyBlocked -> WhyBlocked -> Bool # (>) :: WhyBlocked -> WhyBlocked -> Bool # (>=) :: WhyBlocked -> WhyBlocked -> Bool # max :: WhyBlocked -> WhyBlocked -> WhyBlocked # min :: WhyBlocked -> WhyBlocked -> WhyBlocked # | |||||
type Rep WhyBlocked Source # | |||||
Defined in GHC.Exts.Heap.Closures type Rep WhyBlocked = D1 ('MetaData "WhyBlocked" "GHC.Exts.Heap.Closures" "ghc-lib-parser-9.10.2.20250515-IJK1D32DDxN9cJSpJAC8Wb" 'False) (((C1 ('MetaCons "NotBlocked" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BlockedOnMVar" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BlockedOnMVarRead" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "BlockedOnBlackHole" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BlockedOnRead" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "BlockedOnWrite" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BlockedOnDelay" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "BlockedOnSTM" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BlockedOnDoProc" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BlockedOnCCall" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "BlockedOnCCall_Interruptible" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BlockedOnMsgThrowTo" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ThreadMigrating" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WhyBlockedUnknownValue" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)))))) |
Constructors
TsoLocked | |
TsoBlockx | |
TsoInterruptible | |
TsoStoppedOnBreakpoint | |
TsoMarked | |
TsoSqueezed | |
TsoAllocLimit | |
TsoFlagsUnknownValue Word32 | Please report this as a bug |
Instances
Generic TsoFlags Source # | |||||
Defined in GHC.Exts.Heap.Closures Associated Types
| |||||
Show TsoFlags Source # | |||||
Binary TsoFlags Source # | |||||
Eq TsoFlags Source # | |||||
Ord TsoFlags Source # | |||||
Defined in GHC.Exts.Heap.Closures | |||||
type Rep TsoFlags Source # | |||||
Defined in GHC.Exts.Heap.Closures type Rep TsoFlags = D1 ('MetaData "TsoFlags" "GHC.Exts.Heap.Closures" "ghc-lib-parser-9.10.2.20250515-IJK1D32DDxN9cJSpJAC8Wb" 'False) (((C1 ('MetaCons "TsoLocked" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TsoBlockx" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "TsoInterruptible" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TsoStoppedOnBreakpoint" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "TsoMarked" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TsoSqueezed" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "TsoAllocLimit" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TsoFlagsUnknownValue" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word32))))) |
class HasHeapRep (a :: TYPE rep) where Source #
Methods
Decode a closure to it's heap representation (GenClosure
).
Instances
Addr# ~ a => HasHeapRep (a :: TYPE 'AddrRep) Source # | |
Defined in GHC.Exts.Heap Methods getClosureData :: a -> IO Closure Source # | |
Double# ~ a => HasHeapRep (a :: TYPE 'DoubleRep) Source # | |
Defined in GHC.Exts.Heap Methods getClosureData :: a -> IO Closure Source # | |
Float# ~ a => HasHeapRep (a :: TYPE 'FloatRep) Source # | |
Defined in GHC.Exts.Heap Methods getClosureData :: a -> IO Closure Source # | |
Int64# ~ a => HasHeapRep (a :: TYPE 'Int64Rep) Source # | |
Defined in GHC.Exts.Heap Methods getClosureData :: a -> IO Closure Source # | |
Int# ~ a => HasHeapRep (a :: TYPE 'IntRep) Source # | |
Defined in GHC.Exts.Heap Methods getClosureData :: a -> IO Closure Source # | |
HasHeapRep (a :: Type) Source # | |
Defined in GHC.Exts.Heap Methods getClosureData :: a -> IO Closure Source # | |
HasHeapRep (a :: UnliftedType) Source # | |
Defined in GHC.Exts.Heap Methods getClosureData :: a -> IO Closure Source # | |
Word64# ~ a => HasHeapRep (a :: TYPE 'Word64Rep) Source # | |
Defined in GHC.Exts.Heap Methods getClosureData :: a -> IO Closure Source # | |
Word# ~ a => HasHeapRep (a :: TYPE 'WordRep) Source # | |
Defined in GHC.Exts.Heap Methods getClosureData :: a -> IO Closure Source # |
getClosureDataFromHeapRep :: ByteArray# -> Ptr StgInfoTable -> [b] -> IO (GenClosure b) Source #
Convert an unpacked heap object, to a `GenClosure b`. The inputs to this
function can be generated from a heap object using unpackClosure#
.
getClosureDataFromHeapRepPrim Source #
Arguments
:: IO (String, String, String) | A continuation used to decode the constructor description field, in ghc-debug this code can lead to segfaults because dataConNames will dereference a random part of memory. |
-> (Ptr a -> IO (Maybe CostCentreStack)) | A continuation which is used to decode a cost centre stack
In ghc-debug, this code will need to call back into the debuggee to
fetch the representation of the CCS before decoding it. Using
|
-> StgInfoTable | The |
-> ByteArray# | Heap representation of the closure as returned by |
-> [b] | Pointers in the payload of the closure, extracted from the heap
representation as returned by `collect_pointers()` in |
-> IO (GenClosure b) | Heap representation of the closure. |
Info Table types
data StgInfoTable Source #
This is a somewhat faithful representation of an info table. See https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/storage/InfoTables.h for more details on this data structure.
Constructors
StgInfoTable | |
Instances
Generic StgInfoTable Source # | |||||
Defined in GHC.Exts.Heap.InfoTable.Types Associated Types
| |||||
Show StgInfoTable Source # | |||||
Defined in GHC.Exts.Heap.InfoTable.Types Methods showsPrec :: Int -> StgInfoTable -> ShowS # show :: StgInfoTable -> String # showList :: [StgInfoTable] -> ShowS # | |||||
Binary StgInfoTable Source # | |||||
Defined in GHCi.Message | |||||
Eq StgInfoTable Source # | |||||
Defined in GHC.Exts.Heap.InfoTable.Types | |||||
type Rep StgInfoTable Source # | |||||
Defined in GHC.Exts.Heap.InfoTable.Types type Rep StgInfoTable = D1 ('MetaData "StgInfoTable" "GHC.Exts.Heap.InfoTable.Types" "ghc-lib-parser-9.10.2.20250515-IJK1D32DDxN9cJSpJAC8Wb" 'False) (C1 ('MetaCons "StgInfoTable" 'PrefixI 'True) ((S1 ('MetaSel ('Just "entry") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe EntryFunPtr)) :*: (S1 ('MetaSel ('Just "ptrs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HalfWord) :*: S1 ('MetaSel ('Just "nptrs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HalfWord))) :*: (S1 ('MetaSel ('Just "tipe") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ClosureType) :*: (S1 ('MetaSel ('Just "srtlen") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HalfWord) :*: S1 ('MetaSel ('Just "code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ItblCodes)))))) |
peekItbl :: Ptr StgInfoTable -> IO StgInfoTable Source #
Read an InfoTable from the heap into a haskell type. WARNING: This code assumes it is passed a pointer to a "standard" info table. If tables_next_to_code is enabled, it will look 1 byte before the start for the entry field.
pokeItbl :: Ptr StgInfoTable -> StgInfoTable -> IO () Source #
Cost Centre (profiling) types
newtype StgTSOProfInfo Source #
This is a somewhat faithful representation of StgTSOProfInfo. See https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/storage/TSO.h for more details on this data structure.
Constructors
StgTSOProfInfo | |
Fields |
Instances
Generic StgTSOProfInfo Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Associated Types
Methods from :: StgTSOProfInfo -> Rep StgTSOProfInfo x # to :: Rep StgTSOProfInfo x -> StgTSOProfInfo # | |||||
Show StgTSOProfInfo Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Methods showsPrec :: Int -> StgTSOProfInfo -> ShowS # show :: StgTSOProfInfo -> String # showList :: [StgTSOProfInfo] -> ShowS # | |||||
Binary StgTSOProfInfo Source # | |||||
Defined in GHCi.Message Methods put :: StgTSOProfInfo -> Put # get :: Get StgTSOProfInfo # putList :: [StgTSOProfInfo] -> Put # | |||||
Eq StgTSOProfInfo Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Methods (==) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool # (/=) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool # | |||||
Ord StgTSOProfInfo Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Methods compare :: StgTSOProfInfo -> StgTSOProfInfo -> Ordering # (<) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool # (<=) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool # (>) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool # (>=) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool # max :: StgTSOProfInfo -> StgTSOProfInfo -> StgTSOProfInfo # min :: StgTSOProfInfo -> StgTSOProfInfo -> StgTSOProfInfo # | |||||
type Rep StgTSOProfInfo Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types type Rep StgTSOProfInfo = D1 ('MetaData "StgTSOProfInfo" "GHC.Exts.Heap.ProfInfo.Types" "ghc-lib-parser-9.10.2.20250515-IJK1D32DDxN9cJSpJAC8Wb" 'True) (C1 ('MetaCons "StgTSOProfInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "cccs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CostCentreStack)))) |
data IndexTable Source #
This is a somewhat faithful representation of IndexTable. See https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h for more details on this data structure.
Constructors
IndexTable | |
Fields
|
Instances
Generic IndexTable Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Associated Types
| |||||
Show IndexTable Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Methods showsPrec :: Int -> IndexTable -> ShowS # show :: IndexTable -> String # showList :: [IndexTable] -> ShowS # | |||||
Binary IndexTable Source # | |||||
Defined in GHCi.Message | |||||
Eq IndexTable Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types | |||||
Ord IndexTable Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Methods compare :: IndexTable -> IndexTable -> Ordering # (<) :: IndexTable -> IndexTable -> Bool # (<=) :: IndexTable -> IndexTable -> Bool # (>) :: IndexTable -> IndexTable -> Bool # (>=) :: IndexTable -> IndexTable -> Bool # max :: IndexTable -> IndexTable -> IndexTable # min :: IndexTable -> IndexTable -> IndexTable # | |||||
type Rep IndexTable Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types type Rep IndexTable = D1 ('MetaData "IndexTable" "GHC.Exts.Heap.ProfInfo.Types" "ghc-lib-parser-9.10.2.20250515-IJK1D32DDxN9cJSpJAC8Wb" 'False) (C1 ('MetaCons "IndexTable" 'PrefixI 'True) ((S1 ('MetaSel ('Just "it_cc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CostCentre) :*: S1 ('MetaSel ('Just "it_ccs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CostCentreStack))) :*: (S1 ('MetaSel ('Just "it_next") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe IndexTable)) :*: S1 ('MetaSel ('Just "it_back_edge") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))) |
data CostCentre Source #
This is a somewhat faithful representation of CostCentre. See https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h for more details on this data structure.
Constructors
CostCentre | |
Instances
Generic CostCentre Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Associated Types
| |||||
Show CostCentre Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Methods showsPrec :: Int -> CostCentre -> ShowS # show :: CostCentre -> String # showList :: [CostCentre] -> ShowS # | |||||
Binary CostCentre Source # | |||||
Defined in GHCi.Message | |||||
Eq CostCentre Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types | |||||
Ord CostCentre Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Methods compare :: CostCentre -> CostCentre -> Ordering # (<) :: CostCentre -> CostCentre -> Bool # (<=) :: CostCentre -> CostCentre -> Bool # (>) :: CostCentre -> CostCentre -> Bool # (>=) :: CostCentre -> CostCentre -> Bool # max :: CostCentre -> CostCentre -> CostCentre # min :: CostCentre -> CostCentre -> CostCentre # | |||||
type Rep CostCentre Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types type Rep CostCentre = D1 ('MetaData "CostCentre" "GHC.Exts.Heap.ProfInfo.Types" "ghc-lib-parser-9.10.2.20250515-IJK1D32DDxN9cJSpJAC8Wb" 'False) (C1 ('MetaCons "CostCentre" 'PrefixI 'True) (((S1 ('MetaSel ('Just "cc_ccID") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "cc_label") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "cc_module") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "cc_srcloc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)))) :*: ((S1 ('MetaSel ('Just "cc_mem_alloc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64) :*: S1 ('MetaSel ('Just "cc_time_ticks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :*: (S1 ('MetaSel ('Just "cc_is_caf") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "cc_link") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CostCentre)))))) |
data CostCentreStack Source #
This is a somewhat faithful representation of CostCentreStack. See https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h for more details on this data structure.
Constructors
CostCentreStack | |
Fields
|
Instances
Generic CostCentreStack Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Associated Types
Methods from :: CostCentreStack -> Rep CostCentreStack x # to :: Rep CostCentreStack x -> CostCentreStack # | |||||
Show CostCentreStack Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Methods showsPrec :: Int -> CostCentreStack -> ShowS # show :: CostCentreStack -> String # showList :: [CostCentreStack] -> ShowS # | |||||
Binary CostCentreStack Source # | |||||
Defined in GHCi.Message Methods put :: CostCentreStack -> Put # get :: Get CostCentreStack # putList :: [CostCentreStack] -> Put # | |||||
Eq CostCentreStack Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Methods (==) :: CostCentreStack -> CostCentreStack -> Bool # (/=) :: CostCentreStack -> CostCentreStack -> Bool # | |||||
Ord CostCentreStack Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types Methods compare :: CostCentreStack -> CostCentreStack -> Ordering # (<) :: CostCentreStack -> CostCentreStack -> Bool # (<=) :: CostCentreStack -> CostCentreStack -> Bool # (>) :: CostCentreStack -> CostCentreStack -> Bool # (>=) :: CostCentreStack -> CostCentreStack -> Bool # max :: CostCentreStack -> CostCentreStack -> CostCentreStack # min :: CostCentreStack -> CostCentreStack -> CostCentreStack # | |||||
type Rep CostCentreStack Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types type Rep CostCentreStack = D1 ('MetaData "CostCentreStack" "GHC.Exts.Heap.ProfInfo.Types" "ghc-lib-parser-9.10.2.20250515-IJK1D32DDxN9cJSpJAC8Wb" 'False) (C1 ('MetaCons "CostCentreStack" 'PrefixI 'True) (((S1 ('MetaSel ('Just "ccs_ccsID") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "ccs_cc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CostCentre) :*: S1 ('MetaSel ('Just "ccs_prevStack") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CostCentreStack)))) :*: (S1 ('MetaSel ('Just "ccs_indexTable") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe IndexTable)) :*: (S1 ('MetaSel ('Just "ccs_root") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CostCentreStack)) :*: S1 ('MetaSel ('Just "ccs_depth") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)))) :*: ((S1 ('MetaSel ('Just "ccs_scc_count") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64) :*: (S1 ('MetaSel ('Just "ccs_selected") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "ccs_time_ticks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word))) :*: (S1 ('MetaSel ('Just "ccs_mem_alloc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64) :*: (S1 ('MetaSel ('Just "ccs_inherited_alloc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64) :*: S1 ('MetaSel ('Just "ccs_inherited_ticks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)))))) |
Closure inspection
getBoxedClosureData :: Box -> IO Closure Source #
Like getClosureData
, but taking a Box
, so it is easier to work with.
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.
This takes an arbitrary value and puts it into a box. Note that calls like
asBox (head list)
will put the thunk "head list" into the box, not the element at the head of the list. For that, use careful case expressions:
case list of x:_ -> asBox x