{-# LINE 1 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE MagicHash #-}
module GHC.Exts.Heap.FFIClosures_ProfilingDisabled where
import Prelude
import Foreign
import GHC.Exts
import GHC.Exts.Heap.ProfInfo.PeekProfInfo
import GHC.Exts.Heap.ProfInfo.Types
import GHC.Exts.Heap.Closures(WhatNext(..), WhyBlocked(..), TsoFlags(..))
data TSOFields = TSOFields {
tso_what_next :: WhatNext,
tso_why_blocked :: WhyBlocked,
tso_flags :: [TsoFlags],
tso_threadId :: Word64,
tso_saved_errno :: Word32,
tso_dirty:: Word32,
tso_alloc_limit :: Int64,
tso_tot_stack_size :: Word32,
tso_prof :: Maybe StgTSOProfInfo
}
peekTSOFields :: (Ptr a -> IO (Maybe CostCentreStack)) -> Ptr tsoPtr -> IO TSOFields
peekTSOFields decodeCCS ptr = do
what_next' <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 36 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
why_blocked' <- ((\hsc_ptr -> peekByteOff hsc_ptr 34)) ptr
{-# LINE 37 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
flags' <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
{-# LINE 38 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
threadId' <- ((\hsc_ptr -> peekByteOff hsc_ptr 48)) ptr
{-# LINE 39 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
saved_errno' <- ((\hsc_ptr -> peekByteOff hsc_ptr 56)) ptr
{-# LINE 40 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
dirty' <- ((\hsc_ptr -> peekByteOff hsc_ptr 60)) ptr
{-# LINE 41 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
alloc_limit' <- ((\hsc_ptr -> peekByteOff hsc_ptr 104)) ptr
{-# LINE 42 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
tot_stack_size' <- ((\hsc_ptr -> peekByteOff hsc_ptr 112)) ptr
{-# LINE 43 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
tso_prof' <- peekStgTSOProfInfo decodeCCS ptr
return TSOFields {
tso_what_next = parseWhatNext what_next',
tso_why_blocked = parseWhyBlocked why_blocked',
tso_flags = parseTsoFlags flags',
tso_threadId = threadId',
tso_saved_errno = saved_errno',
tso_dirty = dirty',
tso_alloc_limit = alloc_limit',
tso_tot_stack_size = tot_stack_size',
tso_prof = tso_prof'
}
parseWhatNext :: Word16 -> WhatNext
parseWhatNext w = case w of
(1) -> ThreadRunGHC
{-# LINE 60 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(2) -> ThreadInterpret
{-# LINE 61 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(3) -> ThreadKilled
{-# LINE 62 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(4) -> ThreadComplete
{-# LINE 63 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
_ -> WhatNextUnknownValue w
parseWhyBlocked :: Word16 -> WhyBlocked
parseWhyBlocked w = case w of
(0) -> NotBlocked
{-# LINE 68 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(1) -> BlockedOnMVar
{-# LINE 69 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(14) -> BlockedOnMVarRead
{-# LINE 70 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(2) -> BlockedOnBlackHole
{-# LINE 71 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(3) -> BlockedOnRead
{-# LINE 72 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(4) -> BlockedOnWrite
{-# LINE 73 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(5) -> BlockedOnDelay
{-# LINE 74 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(6) -> BlockedOnSTM
{-# LINE 75 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(7) -> BlockedOnDoProc
{-# LINE 76 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(10) -> BlockedOnCCall
{-# LINE 77 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(11) -> BlockedOnCCall_Interruptible
{-# LINE 78 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(12) -> BlockedOnMsgThrowTo
{-# LINE 79 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
(13) -> ThreadMigrating
{-# LINE 80 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
{-# LINE 83 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
_ -> WhyBlockedUnknownValue w
parseTsoFlags :: Word32 -> [TsoFlags]
parseTsoFlags w | isSet (2) w = TsoLocked : parseTsoFlags (unset (2) w)
{-# LINE 87 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
| isSet (4) w = TsoBlockx : parseTsoFlags (unset (4) w)
{-# LINE 88 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
| isSet (8) w = TsoInterruptible : parseTsoFlags (unset (8) w)
{-# LINE 89 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
| isSet (16) w = TsoStoppedOnBreakpoint : parseTsoFlags (unset (16) w)
{-# LINE 90 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
| isSet (64) w = TsoMarked : parseTsoFlags (unset (64) w)
{-# LINE 91 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
| isSet (128) w = TsoSqueezed : parseTsoFlags (unset (128) w)
{-# LINE 92 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
| isSet (256) w = TsoAllocLimit : parseTsoFlags (unset (256) w)
{-# LINE 93 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
parseTsoFlags 0 = []
parseTsoFlags w = [TsoFlagsUnknownValue w]
isSet :: Word32 -> Word32 -> Bool
isSet bitMask w = w .&. bitMask /= 0
unset :: Word32 -> Word32 -> Word32
unset bitMask w = w `xor` bitMask
data StackFields = StackFields {
stack_size :: Word32,
stack_dirty :: Word8,
{-# LINE 106 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
stack_marking :: Word8,
{-# LINE 108 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
stack_sp :: Addr#
}
peekStackFields :: Ptr a -> IO StackFields
peekStackFields ptr = do
stack_size' <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr ::IO Word32
{-# LINE 115 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
dirty' <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 116 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
{-# LINE 117 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
marking' <- ((\hsc_ptr -> peekByteOff hsc_ptr 13)) ptr
{-# LINE 118 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
{-# LINE 119 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
Ptr sp' <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 120 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
return StackFields {
stack_size = stack_size',
stack_dirty = dirty',
{-# LINE 127 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
stack_marking = marking',
{-# LINE 129 "libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc" #-}
stack_sp = sp'
}