Copyright | (c) 2012 Joachim Breitner |
---|---|
License | BSD3 |
Maintainer | Joachim Breitner <mail@joachim-breitner.de> |
Safe Haskell | None |
Language | Haskell2010 |
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
- 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.
ConstrClosure | A data constructor |
FunClosure | A function |
| |
ThunkClosure | A thunk, an expression not obviously in head normal form |
| |
SelectorClosure | A thunk which performs a simple selection operation |
| |
PAPClosure | An unsaturated function application |
| |
APClosure | A function application |
| |
APStackClosure | A suspended thunk evaluation |
| |
IndClosure | A pointer to another closure, introduced when a thunk is updated to point at its value |
| |
BCOClosure | A byte-code object (BCO) which can be interpreted by GHC's byte-code interpreter (e.g. as used by GHCi) |
| |
BlackholeClosure | A thunk under evaluation by another thread |
| |
ArrWordsClosure | A |
MutArrClosure | A |
| |
SmallMutArrClosure | A Since: ghc-heap-8.10.1 |
| |
MVarClosure | An |
| |
IOPortClosure | An |
| |
MutVarClosure | A |
| |
BlockingQueueClosure | An STM blocking queue. |
WeakClosure | |
| |
TSOClosure | Representation of StgTSO: A Thread State Object. The values for
|
| |
StackClosure | Representation of StgStack: The 'tsoStack ' of a |
| |
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 |
| |
UnsupportedClosure | |
|
Instances
data ClosureType Source #
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 succ :: ClosureType -> ClosureType Source # pred :: ClosureType -> ClosureType Source # toEnum :: Int -> ClosureType Source # fromEnum :: ClosureType -> Int Source # enumFrom :: ClosureType -> [ClosureType] Source # enumFromThen :: ClosureType -> ClosureType -> [ClosureType] Source # enumFromTo :: ClosureType -> ClosureType -> [ClosureType] Source # enumFromThenTo :: ClosureType -> ClosureType -> ClosureType -> [ClosureType] Source # | |||||
Generic ClosureType Source # | |||||
Defined in GHC.Exts.Heap.ClosureTypes
from :: ClosureType -> Rep ClosureType x Source # to :: Rep ClosureType x -> ClosureType Source # | |||||
Show ClosureType Source # | |||||
Defined in GHC.Exts.Heap.ClosureTypes | |||||
Eq ClosureType Source # | |||||
Defined in GHC.Exts.Heap.ClosureTypes (==) :: ClosureType -> ClosureType -> Bool Source # (/=) :: ClosureType -> ClosureType -> Bool Source # | |||||
Ord ClosureType Source # | |||||
Defined in GHC.Exts.Heap.ClosureTypes compare :: ClosureType -> ClosureType -> Ordering Source # (<) :: ClosureType -> ClosureType -> Bool Source # (<=) :: ClosureType -> ClosureType -> Bool Source # (>) :: ClosureType -> ClosureType -> Bool Source # (>=) :: ClosureType -> ClosureType -> Bool Source # max :: ClosureType -> ClosureType -> ClosureType Source # min :: ClosureType -> ClosureType -> ClosureType Source # | |||||
type Rep ClosureType Source # | |||||
Defined in GHC.Exts.Heap.ClosureTypes type Rep ClosureType = D1 ('MetaData "ClosureType" "GHC.Exts.Heap.ClosureTypes" "ghc-heap-9.8.0.20230822-03b3" '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
| |||||
Show 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-heap-9.8.0.20230822-03b3" '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)))) |
ThreadRunGHC | |
ThreadInterpret | |
ThreadKilled | |
ThreadComplete | |
WhatNextUnknownValue Word16 | Please report this as a bug |
Instances
Generic WhatNext Source # | |||||
Defined in GHC.Exts.Heap.Closures
| |||||
Show 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-heap-9.8.0.20230822-03b3" '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 #
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
from :: WhyBlocked -> Rep WhyBlocked x Source # to :: Rep WhyBlocked x -> WhyBlocked Source # | |||||
Show WhyBlocked Source # | |||||
Defined in GHC.Exts.Heap.Closures | |||||
Eq WhyBlocked Source # | |||||
Defined in GHC.Exts.Heap.Closures (==) :: WhyBlocked -> WhyBlocked -> Bool Source # (/=) :: WhyBlocked -> WhyBlocked -> Bool Source # | |||||
Ord WhyBlocked Source # | |||||
Defined in GHC.Exts.Heap.Closures compare :: WhyBlocked -> WhyBlocked -> Ordering Source # (<) :: WhyBlocked -> WhyBlocked -> Bool Source # (<=) :: WhyBlocked -> WhyBlocked -> Bool Source # (>) :: WhyBlocked -> WhyBlocked -> Bool Source # (>=) :: WhyBlocked -> WhyBlocked -> Bool Source # max :: WhyBlocked -> WhyBlocked -> WhyBlocked Source # min :: WhyBlocked -> WhyBlocked -> WhyBlocked Source # | |||||
type Rep WhyBlocked Source # | |||||
Defined in GHC.Exts.Heap.Closures type Rep WhyBlocked = D1 ('MetaData "WhyBlocked" "GHC.Exts.Heap.Closures" "ghc-heap-9.8.0.20230822-03b3" '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)))))) |
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
| |||||
Show 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-heap-9.8.0.20230822-03b3" '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 #
Decode a closure to it's heap representation (GenClosure
).
Instances
Addr# ~ a => HasHeapRep (a :: TYPE 'AddrRep) Source # | |
Defined in GHC.Exts.Heap getClosureData :: a -> IO Closure Source # | |
Double# ~ a => HasHeapRep (a :: TYPE 'DoubleRep) Source # | |
Defined in GHC.Exts.Heap getClosureData :: a -> IO Closure Source # | |
Float# ~ a => HasHeapRep (a :: TYPE 'FloatRep) Source # | |
Defined in GHC.Exts.Heap getClosureData :: a -> IO Closure Source # | |
Int64# ~ a => HasHeapRep (a :: TYPE 'Int64Rep) Source # | |
Defined in GHC.Exts.Heap getClosureData :: a -> IO Closure Source # | |
Int# ~ a => HasHeapRep (a :: TYPE 'IntRep) Source # | |
Defined in GHC.Exts.Heap getClosureData :: a -> IO Closure Source # | |
HasHeapRep (a :: Type) Source # | |
Defined in GHC.Exts.Heap getClosureData :: a -> IO Closure Source # | |
HasHeapRep (a :: UnliftedType) Source # | |
Defined in GHC.Exts.Heap getClosureData :: a -> IO Closure Source # | |
Word64# ~ a => HasHeapRep (a :: TYPE 'Word64Rep) Source # | |
Defined in GHC.Exts.Heap getClosureData :: a -> IO Closure Source # | |
Word# ~ a => HasHeapRep (a :: TYPE 'WordRep) Source # | |
Defined in GHC.Exts.Heap 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 #
:: 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.
Instances
Generic StgInfoTable Source # | |||||
Defined in GHC.Exts.Heap.InfoTable.Types
from :: StgInfoTable -> Rep StgInfoTable x Source # to :: Rep StgInfoTable x -> StgInfoTable Source # | |||||
Show 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-heap-9.8.0.20230822-03b3" '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.
Instances
Generic StgTSOProfInfo Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types
from :: StgTSOProfInfo -> Rep StgTSOProfInfo x Source # to :: Rep StgTSOProfInfo x -> StgTSOProfInfo Source # | |||||
Show StgTSOProfInfo Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types | |||||
Eq StgTSOProfInfo Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types (==) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool Source # (/=) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool Source # | |||||
Ord StgTSOProfInfo Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types compare :: StgTSOProfInfo -> StgTSOProfInfo -> Ordering Source # (<) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool Source # (<=) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool Source # (>) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool Source # (>=) :: StgTSOProfInfo -> StgTSOProfInfo -> Bool Source # max :: StgTSOProfInfo -> StgTSOProfInfo -> StgTSOProfInfo Source # min :: StgTSOProfInfo -> StgTSOProfInfo -> StgTSOProfInfo Source # | |||||
type Rep StgTSOProfInfo Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types type Rep StgTSOProfInfo = D1 ('MetaData "StgTSOProfInfo" "GHC.Exts.Heap.ProfInfo.Types" "ghc-heap-9.8.0.20230822-03b3" '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.
IndexTable | |
|
Instances
Generic IndexTable Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types
from :: IndexTable -> Rep IndexTable x Source # to :: Rep IndexTable x -> IndexTable Source # | |||||
Show IndexTable Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types | |||||
Eq IndexTable Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types (==) :: IndexTable -> IndexTable -> Bool Source # (/=) :: IndexTable -> IndexTable -> Bool Source # | |||||
Ord IndexTable Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types compare :: IndexTable -> IndexTable -> Ordering Source # (<) :: IndexTable -> IndexTable -> Bool Source # (<=) :: IndexTable -> IndexTable -> Bool Source # (>) :: IndexTable -> IndexTable -> Bool Source # (>=) :: IndexTable -> IndexTable -> Bool Source # max :: IndexTable -> IndexTable -> IndexTable Source # min :: IndexTable -> IndexTable -> IndexTable Source # | |||||
type Rep IndexTable Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types type Rep IndexTable = D1 ('MetaData "IndexTable" "GHC.Exts.Heap.ProfInfo.Types" "ghc-heap-9.8.0.20230822-03b3" '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.
Instances
Generic CostCentre Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types
from :: CostCentre -> Rep CostCentre x Source # to :: Rep CostCentre x -> CostCentre Source # | |||||
Show CostCentre Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types | |||||
Eq CostCentre Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types (==) :: CostCentre -> CostCentre -> Bool Source # (/=) :: CostCentre -> CostCentre -> Bool Source # | |||||
Ord CostCentre Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types compare :: CostCentre -> CostCentre -> Ordering Source # (<) :: CostCentre -> CostCentre -> Bool Source # (<=) :: CostCentre -> CostCentre -> Bool Source # (>) :: CostCentre -> CostCentre -> Bool Source # (>=) :: CostCentre -> CostCentre -> Bool Source # max :: CostCentre -> CostCentre -> CostCentre Source # min :: CostCentre -> CostCentre -> CostCentre Source # | |||||
type Rep CostCentre Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types type Rep CostCentre = D1 ('MetaData "CostCentre" "GHC.Exts.Heap.ProfInfo.Types" "ghc-heap-9.8.0.20230822-03b3" '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.
CostCentreStack | |
|
Instances
Generic CostCentreStack Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types
from :: CostCentreStack -> Rep CostCentreStack x Source # to :: Rep CostCentreStack x -> CostCentreStack Source # | |||||
Show CostCentreStack Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types | |||||
Eq CostCentreStack Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types (==) :: CostCentreStack -> CostCentreStack -> Bool Source # (/=) :: CostCentreStack -> CostCentreStack -> Bool Source # | |||||
Ord CostCentreStack Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types compare :: CostCentreStack -> CostCentreStack -> Ordering Source # (<) :: CostCentreStack -> CostCentreStack -> Bool Source # (<=) :: CostCentreStack -> CostCentreStack -> Bool Source # (>) :: CostCentreStack -> CostCentreStack -> Bool Source # (>=) :: CostCentreStack -> CostCentreStack -> Bool Source # max :: CostCentreStack -> CostCentreStack -> CostCentreStack Source # min :: CostCentreStack -> CostCentreStack -> CostCentreStack Source # | |||||
type Rep CostCentreStack Source # | |||||
Defined in GHC.Exts.Heap.ProfInfo.Types type Rep CostCentreStack = D1 ('MetaData "CostCentreStack" "GHC.Exts.Heap.ProfInfo.Types" "ghc-heap-9.8.0.20230822-03b3" '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