[Git][ghc/ghc][wip/ghc-debug] 4 commits: Correct RtsAPI documentation

David Eichmann gitlab at gitlab.haskell.org
Thu Sep 24 15:36:50 UTC 2020



David Eichmann pushed to branch wip/ghc-debug at Glasgow Haskell Compiler / GHC


Commits:
961bc95a by David Eichmann at 2020-09-24T11:00:38+01:00
Correct RtsAPI documentation

- - - - -
21148cfb by David Eichmann at 2020-09-24T11:01:23+01:00
Remove transformers dependency from ghc-heap

- - - - -
fd03589e by David Eichmann at 2020-09-24T12:53:02+01:00
Move ptrToInt to GHC.Exts.Heap.ProfInfo.PeekProfInfo_ProfilingEnabled

- - - - -
8e097c8e by David Eichmann at 2020-09-24T15:29:13+01:00
Simplify getClosureDataX and rename to getClosureDataWith

- - - - -


6 changed files:

- includes/RtsAPI.h
- libraries/ghc-heap/GHC/Exts/Heap.hs
- libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/PeekProfInfo_ProfilingEnabled.hsc
- libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/Types.hs
- − libraries/ghc-heap/GHC/Exts/Heap/Ptr/Utils.hs
- libraries/ghc-heap/ghc-heap.cabal.in


Changes:

=====================================
includes/RtsAPI.h
=====================================
@@ -340,7 +340,8 @@ extern void (*exitFn)(int);
    ------------------------------------------------------------------------- */
 
 // acquires a token which may be used to create new objects and evaluate them.
-// Calling rts_lock in between rts_pause/rts_resume will cause a deadlock.
+// Calling rts_lock in between rts_pause/rts_resume on the same thread will
+// cause an error.
 Capability *rts_lock (void);
 
 // releases the token acquired with rts_lock().
@@ -494,8 +495,8 @@ SchedulerStatus rts_getSchedStatus (Capability *cap);
 // thread, then rts_pause will return immediately and have no effect. Returns a
 // token which may be used to create new objects and evaluate them (like
 // rts_lock) .This is different to rts_lock which only pauses a single
-// capability. Calling rts_pause in between rts_lock/rts_unlock will cause a
-// deadlock.
+// capability. Calling rts_pause in between rts_lock/rts_unlock on the same
+// thread will cause an error.
 Capability * rts_pause (void);
 
 // Counterpart of rts_pause: Continue from a pause. All capabilities are


=====================================
libraries/ghc-heap/GHC/Exts/Heap.hs
=====================================
@@ -31,7 +31,7 @@ module GHC.Exts.Heap (
     , WhatNext(..)
     , WhyBlocked(..)
     , TsoFlags(..)
-    , HasHeapRep(getClosureDataX)
+    , HasHeapRep(getClosureDataWith)
     , getClosureData
 
     -- * Info Table types
@@ -83,7 +83,6 @@ import qualified GHC.Exts.Heap.FFIClosures as FFIClosures
 
 import Control.Monad
 import Data.Bits
-import GHC.Arr
 import GHC.Exts
 import GHC.Int
 import GHC.Word
@@ -102,64 +101,65 @@ class HasHeapRep (a :: TYPE rep) where
 
     -- | Decode a closure to it's heap representation ('GenClosure').
     -- Inside a GHC context 'b' is usually a 'GHC.Exts.Heap.Closures.Box'
-    -- containing a thunk or an evaluated heap object. Outside it can be a
-    -- 'Word' for "raw" usage of pointers.
+    -- containing a thunk or an evaluated heap object. Outside it can be e.g.
+    -- a 'Word' for "raw" usage of pointers.
 
-    getClosureDataX ::
-        (forall c . c -> IO (Ptr StgInfoTable, [Word], [b]))
-        -- ^ Helper function to get info table, memory and pointers of the
-        -- closure. The order of @[b]@ is significant and determined by
-        -- @collect_pointers()@ in @rts/Heap.c at .
-        -> a -- ^ Closure to decode
-        -> IO (GenClosure b) -- ^ Heap representation of the closure
+    getClosureDataWith ::
+        (forall c . c -> b)
+        -- ^ Convert any closure to some pointer type.
+        -> a
+        -- ^ Closure to decode.
+        -> IO (GenClosure b)
+        -- ^ Heap representation of the closure.
 
 instance HasHeapRep (a :: TYPE 'LiftedRep) where
-    getClosureDataX = getClosureX
+    getClosureDataWith = getClosureWith
 
 instance HasHeapRep (a :: TYPE 'UnliftedRep) where
-    getClosureDataX k x = getClosureX (k . unsafeCoerce#) (unsafeCoerce# x)
+    getClosureDataWith k x = getClosureWith (k . unsafeCoerce#) (unsafeCoerce# x)
 
 instance Int# ~ a => HasHeapRep (a :: TYPE 'IntRep) where
-    getClosureDataX _ x = return $
+    getClosureDataWith _ x = return $
         IntClosure { ptipe = PInt, intVal = I# x }
 
 instance Word# ~ a => HasHeapRep (a :: TYPE 'WordRep) where
-    getClosureDataX _ x = return $
+    getClosureDataWith _ x = return $
         WordClosure { ptipe = PWord, wordVal = W# x }
 
 instance Int64# ~ a => HasHeapRep (a :: TYPE 'Int64Rep) where
-    getClosureDataX _ x = return $
+    getClosureDataWith _ x = return $
         Int64Closure { ptipe = PInt64, int64Val = I64# (unsafeCoerce# x) }
 
 instance Word64# ~ a => HasHeapRep (a :: TYPE 'Word64Rep) where
-    getClosureDataX _ x = return $
+    getClosureDataWith _ x = return $
         Word64Closure { ptipe = PWord64, word64Val = W64# (unsafeCoerce# x) }
 
 instance Addr# ~ a => HasHeapRep (a :: TYPE 'AddrRep) where
-    getClosureDataX _ x = return $
+    getClosureDataWith _ x = return $
         AddrClosure { ptipe = PAddr, addrVal = I# (unsafeCoerce# x) }
 
 instance Float# ~ a => HasHeapRep (a :: TYPE 'FloatRep) where
-    getClosureDataX _ x = return $
+    getClosureDataWith _ x = return $
         FloatClosure { ptipe = PFloat, floatVal = F# x }
 
 instance Double# ~ a => HasHeapRep (a :: TYPE 'DoubleRep) where
-    getClosureDataX _ x = return $
+    getClosureDataWith _ x = return $
         DoubleClosure { ptipe = PDouble, doubleVal = D# x }
 
--- From GHC.Runtime.Heap.Inspect
-amap' :: (t -> b) -> Array Int t -> [b]
-amap' f (Array i0 i _ arr#) = map g [0 .. i - i0]
-    where g (I# i#) = case indexArray# arr# i# of
-                          (# e #) -> f e
-
--- | Takes any value (closure) as parameter and returns a tuple of:
--- * A 'Ptr' to the info table
--- * The memory of the closure as @[Word]@
--- * Pointers of the closure's @struct@ (in C code) in a @[Box]@.
--- The pointers are collected in @Heap.c at .
-getClosureRaw :: a -> IO (Ptr StgInfoTable, [Word], [Box])
-getClosureRaw x = do
+-- | Deconstruct any closure's heap representation.
+getClosureRaw
+    :: (forall c . c -> b)
+    -- ^ Convert any closure to some pointer type.
+    -> a
+    -- ^ Closure to deconstruct.
+    -> IO (Ptr StgInfoTable, [Word], [b])
+    -- ^ Tuple of:
+    -- * A 'Ptr' to the info table
+    -- * Non-pointer data of the closure.
+    -- * Pointer data of the closure. These are the closures pointed to by the
+    --   input closure, boxed with the given function. The pointers are
+    --   collected in @Heap.c at .
+getClosureRaw asBoxish x = do
     case unpackClosure# x of
 -- This is a hack to cover the bootstrap compiler using the old version of
 -- 'unpackClosure'. The new 'unpackClosure' return values are not merely
@@ -172,37 +172,29 @@ getClosureRaw x = do
              let nelems = (I# (sizeofByteArray# dat)) `div` wORD_SIZE
                  end = fromIntegral nelems - 1
                  rawWds = [W# (indexWordArray# dat i) | I# i <- [0.. end] ]
-                 pelems = I# (sizeofArray# pointers)
-                 ptrList = amap' Box $ Array 0 (pelems - 1) pelems pointers
+                 ptrList = [case indexArray# pointers i of (# ptr #) -> asBoxish ptr
+                            | I# i <- [0..(I# (sizeofArray# pointers)) - 1]
+                            ]
              pure (Ptr iptr, rawWds, ptrList)
 
 getClosureData :: forall rep (a :: TYPE rep) . HasHeapRep a => a -> IO Closure
-getClosureData = getClosureDataX getClosureRaw
+getClosureData = getClosureDataWith asBox
 
-
--- | This function returns a parsed heap representation ('GenClosure') of the
--- closure _at this moment_, even if it is unevaluated or an indirection or
--- other exotic stuff. Beware when passing something to this function, the same
--- caveats as for 'asBox' apply.
---
--- Inside a GHC context 'b' is usually a 'GHC.Exts.Heap.Closures.Box'
--- containing a thunk or an evaluated heap object. Outside it can be a
--- 'Word' for "raw" usage of pointers.
---
--- 'get_closure_raw' should provide low level details of the closure's heap
--- respresentation. The order of @[b]@ is significant and determined by
--- @collect_pointers()@ in @rts/Heap.c at .
+-- | Get the heap representation of a closure _at this moment_, even if it is
+-- unevaluated or an indirection or other exotic stuff. Beware when passing
+-- something to this function, the same caveats as for
+-- 'GHC.Exts.Heap.Closures.asBox' apply.
 --
 -- For most use cases 'getClosureData' is an easier to use alternative.
-
-getClosureX :: forall a b.
-            (forall c . c -> IO (Ptr StgInfoTable, [Word], [b]))
-            -- ^ Helper function to get info table, memory and pointers of the
-            -- closure
-            -> a -- ^ Closure to decode
-            -> IO (GenClosure b) -- ^ Heap representation of the closure
-getClosureX get_closure_raw x = do
-    (iptr, wds, pts) <- get_closure_raw (unsafeCoerce# x)
+getClosureWith :: forall a b.
+    (forall c . c -> b)
+    -- ^ Convert any closure to some pointer type.
+    -> a
+    -- ^ Closure to decode.
+    -> IO (GenClosure b)
+    -- ^ Heap representation of the closure.
+getClosureWith asBoxish x = do
+    (iptr, wds, pts) <- getClosureRaw asBoxish (unsafeCoerce# x)
     itbl <- peekItbl iptr
     -- The remaining words after the header
     let rawWds = drop (closureTypeHeaderSize (tipe itbl)) wds
@@ -391,6 +383,6 @@ getClosureX get_closure_raw x = do
         _ ->
             pure $ UnsupportedClosure itbl
 
--- | Like 'getClosureDataX', but taking a 'Box', so it is easier to work with.
+-- | Like 'getClosureDataWith', but taking a 'Box', so it is easier to work with.
 getBoxedClosureData :: Box -> IO Closure
 getBoxedClosureData (Box a) = getClosureData a


=====================================
libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/PeekProfInfo_ProfilingEnabled.hsc
=====================================
@@ -1,4 +1,7 @@
-{-# LANGUAGE CPP, DeriveGeneric #-}
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE MagicHash #-}
+
 module GHC.Exts.Heap.ProfInfo.PeekProfInfo_ProfilingEnabled(
     peekStgTSOProfInfo
 ) where
@@ -17,37 +20,27 @@ module GHC.Exts.Heap.ProfInfo.PeekProfInfo_ProfilingEnabled(
 #undef BLOCKS_PER_MBLOCK
 #include "DerivedConstants.h"
 
-import Prelude
-import Foreign
-
-import Foreign.C.String
-import GHC.Exts.Heap.ProfInfo.Types
-
-import Data.IntMap.Strict (IntMap)
-import qualified Data.IntMap.Strict as IntMap
-
-import Data.IntSet (IntSet)
+import           Data.IntSet (IntSet)
 import qualified Data.IntSet as IntSet
-
-import Control.Monad.Trans.State
-import Control.Monad.IO.Class
-
-import GHC.Exts.Heap.Ptr.Utils
+import           Data.IntMap.Strict (IntMap)
+import qualified Data.IntMap.Strict as IntMap
+import           Data.IORef (IORef, newIORef, readIORef, writeIORef)
+import           Foreign
+import           Foreign.C.String
+import           GHC.Exts
+import           GHC.Exts.Heap.ProfInfo.Types
+import           Prelude
 
 -- Use Int based containers for pointers (addresses) for better performance.
 -- These will be queried a lot!
 type AddressSet = IntSet
 type AddressMap = IntMap
 
-data Cache = Cache {
-    ccCache :: AddressMap CostCentre
-}
-type DecoderMonad a = StateT Cache IO a
-
 peekStgTSOProfInfo :: Ptr a -> IO (Maybe StgTSOProfInfo)
 peekStgTSOProfInfo tsoPtr = do
     cccs_ptr <- peekByteOff tsoPtr cccsOffset
-    cccs' <- evalStateT (peekCostCentreStack IntSet.empty cccs_ptr) $ Cache IntMap.empty
+    costCenterCacheRef <- newIORef IntMap.empty
+    cccs' <- peekCostCentreStack IntSet.empty costCenterCacheRef cccs_ptr
 
     return $ Just StgTSOProfInfo {
         cccs = cccs'
@@ -56,27 +49,27 @@ peekStgTSOProfInfo tsoPtr = do
 cccsOffset :: Int
 cccsOffset = (#const OFFSET_StgTSO_cccs) + (#size StgHeader)
 
-peekCostCentreStack :: AddressSet -> Ptr costCentreStack -> DecoderMonad (Maybe CostCentreStack)
-peekCostCentreStack _ ptr | ptr == nullPtr = return Nothing
-peekCostCentreStack loopBreakers ptr | IntSet.member (ptrToInt ptr) loopBreakers = return Nothing
-peekCostCentreStack loopBreakers ptr = do
-        ccs_ccsID' <- liftIO $ (#peek struct CostCentreStack_, ccsID) ptr
-        ccs_cc_ptr <- liftIO $ (#peek struct CostCentreStack_, cc) ptr
-        ccs_cc' <- peekCostCentre ccs_cc_ptr
-        ccs_prevStack_ptr <- liftIO $ (#peek struct CostCentreStack_, prevStack) ptr
+peekCostCentreStack :: AddressSet -> IORef (AddressMap CostCentre) -> Ptr costCentreStack -> IO (Maybe CostCentreStack)
+peekCostCentreStack _ _ ptr | ptr == nullPtr = return Nothing
+peekCostCentreStack loopBreakers _ ptr | IntSet.member (ptrToInt ptr) loopBreakers = return Nothing
+peekCostCentreStack loopBreakers costCenterCacheRef ptr = do
+        ccs_ccsID' <- (#peek struct CostCentreStack_, ccsID) ptr
+        ccs_cc_ptr <- (#peek struct CostCentreStack_, cc) ptr
+        ccs_cc' <- peekCostCentre costCenterCacheRef ccs_cc_ptr
+        ccs_prevStack_ptr <- (#peek struct CostCentreStack_, prevStack) ptr
         let loopBreakers' = (IntSet.insert ptrAsInt loopBreakers)
-        ccs_prevStack' <- peekCostCentreStack loopBreakers' ccs_prevStack_ptr
-        ccs_indexTable_ptr <- liftIO $ (#peek struct CostCentreStack_, indexTable) ptr
-        ccs_indexTable' <- peekIndexTable loopBreakers' ccs_indexTable_ptr
-        ccs_root_ptr <- liftIO $ (#peek struct CostCentreStack_, root) ptr
-        ccs_root' <- peekCostCentreStack loopBreakers' ccs_root_ptr
-        ccs_depth' <- liftIO $ (#peek struct CostCentreStack_, depth) ptr
-        ccs_scc_count' <- liftIO $ (#peek struct CostCentreStack_, scc_count) ptr
-        ccs_selected' <- liftIO $ (#peek struct CostCentreStack_, selected) ptr
-        ccs_time_ticks' <- liftIO $ (#peek struct CostCentreStack_, time_ticks) ptr
-        ccs_mem_alloc' <- liftIO $ (#peek struct CostCentreStack_, mem_alloc) ptr
-        ccs_inherited_alloc' <- liftIO $ (#peek struct CostCentreStack_, inherited_alloc) ptr
-        ccs_inherited_ticks' <- liftIO $ (#peek struct CostCentreStack_, inherited_ticks) ptr
+        ccs_prevStack' <- peekCostCentreStack loopBreakers' costCenterCacheRef ccs_prevStack_ptr
+        ccs_indexTable_ptr <- (#peek struct CostCentreStack_, indexTable) ptr
+        ccs_indexTable' <- peekIndexTable loopBreakers' costCenterCacheRef ccs_indexTable_ptr
+        ccs_root_ptr <- (#peek struct CostCentreStack_, root) ptr
+        ccs_root' <- peekCostCentreStack loopBreakers' costCenterCacheRef ccs_root_ptr
+        ccs_depth' <- (#peek struct CostCentreStack_, depth) ptr
+        ccs_scc_count' <- (#peek struct CostCentreStack_, scc_count) ptr
+        ccs_selected' <- (#peek struct CostCentreStack_, selected) ptr
+        ccs_time_ticks' <- (#peek struct CostCentreStack_, time_ticks) ptr
+        ccs_mem_alloc' <- (#peek struct CostCentreStack_, mem_alloc) ptr
+        ccs_inherited_alloc' <- (#peek struct CostCentreStack_, inherited_alloc) ptr
+        ccs_inherited_ticks' <- (#peek struct CostCentreStack_, inherited_ticks) ptr
 
         return $ Just CostCentreStack {
             ccs_ccsID = ccs_ccsID',
@@ -95,31 +88,31 @@ peekCostCentreStack loopBreakers ptr = do
     where
         ptrAsInt = ptrToInt ptr
 
-peekCostCentre :: Ptr costCentre -> DecoderMonad CostCentre
-peekCostCentre ptr = do
-    cache <- get
-    case IntMap.lookup ptrAsInt (ccCache cache) of
+peekCostCentre :: IORef (AddressMap CostCentre) -> Ptr costCentre -> IO CostCentre
+peekCostCentre costCenterCacheRef ptr = do
+    costCenterCache <- readIORef costCenterCacheRef
+    case IntMap.lookup ptrAsInt costCenterCache of
         (Just a) -> return a
         Nothing -> do
-                    cc_ccID' <- liftIO $ (#peek struct CostCentre_, ccID) ptr
-                    cc_label_ptr <- liftIO $ (#peek struct CostCentre_, label) ptr
-                    cc_label' <- liftIO $ peekCString cc_label_ptr
-                    cc_module_ptr <- liftIO $ (#peek struct CostCentre_, module) ptr
-                    cc_module' <- liftIO $ peekCString cc_module_ptr
-                    cc_srcloc_ptr <- liftIO $ (#peek struct CostCentre_, srcloc) ptr
-                    cc_srcloc' <- liftIO $ do
+                    cc_ccID' <- (#peek struct CostCentre_, ccID) ptr
+                    cc_label_ptr <- (#peek struct CostCentre_, label) ptr
+                    cc_label' <- peekCString cc_label_ptr
+                    cc_module_ptr <- (#peek struct CostCentre_, module) ptr
+                    cc_module' <- peekCString cc_module_ptr
+                    cc_srcloc_ptr <- (#peek struct CostCentre_, srcloc) ptr
+                    cc_srcloc' <- do
                         if cc_srcloc_ptr == nullPtr then
                             return Nothing
                         else
                             fmap Just (peekCString cc_srcloc_ptr)
-                    cc_mem_alloc' <- liftIO $ (#peek struct CostCentre_, mem_alloc) ptr
-                    cc_time_ticks' <- liftIO $ (#peek struct CostCentre_, time_ticks) ptr
-                    cc_is_caf' <- liftIO $ (#peek struct CostCentre_, is_caf) ptr
-                    cc_link_ptr <- liftIO $ (#peek struct CostCentre_, link) ptr
+                    cc_mem_alloc' <- (#peek struct CostCentre_, mem_alloc) ptr
+                    cc_time_ticks' <- (#peek struct CostCentre_, time_ticks) ptr
+                    cc_is_caf' <- (#peek struct CostCentre_, is_caf) ptr
+                    cc_link_ptr <- (#peek struct CostCentre_, link) ptr
                     cc_link' <- if cc_link_ptr == nullPtr then
                         return Nothing
                     else
-                        fmap Just (peekCostCentre cc_link_ptr)
+                        fmap Just (peekCostCentre costCenterCacheRef cc_link_ptr)
 
                     let result = CostCentre {
                         cc_ccID = cc_ccID',
@@ -132,23 +125,22 @@ peekCostCentre ptr = do
                         cc_link = cc_link'
                     }
 
-                    let updatedCCCache = IntMap.insert ptrAsInt result (ccCache cache)
-                    put $ cache { ccCache = updatedCCCache }
+                    writeIORef costCenterCacheRef (IntMap.insert ptrAsInt result costCenterCache)
 
                     return result
     where
         ptrAsInt = ptrToInt ptr
 
-peekIndexTable :: AddressSet -> Ptr indexTable -> DecoderMonad (Maybe IndexTable)
-peekIndexTable _ ptr | ptr == nullPtr = return Nothing
-peekIndexTable loopBreakers ptr = do
-        it_cc_ptr <- liftIO $ (#peek struct IndexTable_, cc) ptr
-        it_cc' <- peekCostCentre it_cc_ptr
-        it_ccs_ptr <- liftIO $ (#peek struct IndexTable_, ccs) ptr
-        it_ccs' <- peekCostCentreStack loopBreakers it_ccs_ptr
-        it_next_ptr <- liftIO $ (#peek struct IndexTable_, next) ptr
-        it_next' <- peekIndexTable loopBreakers it_next_ptr
-        it_back_edge' <- liftIO $ (#peek struct IndexTable_, back_edge) ptr
+peekIndexTable :: AddressSet -> IORef (AddressMap CostCentre) -> Ptr indexTable -> IO (Maybe IndexTable)
+peekIndexTable _ _ ptr | ptr == nullPtr = return Nothing
+peekIndexTable loopBreakers costCenterCacheRef ptr = do
+        it_cc_ptr <- (#peek struct IndexTable_, cc) ptr
+        it_cc' <- peekCostCentre costCenterCacheRef it_cc_ptr
+        it_ccs_ptr <- (#peek struct IndexTable_, ccs) ptr
+        it_ccs' <- peekCostCentreStack loopBreakers costCenterCacheRef it_ccs_ptr
+        it_next_ptr <- (#peek struct IndexTable_, next) ptr
+        it_next' <- peekIndexTable loopBreakers costCenterCacheRef it_next_ptr
+        it_back_edge' <- (#peek struct IndexTable_, back_edge) ptr
 
         return $ Just IndexTable {
             it_cc = it_cc',
@@ -157,6 +149,10 @@ peekIndexTable loopBreakers ptr = do
             it_back_edge = it_back_edge'
         }
 
+-- | casts a @Ptr@ to an @Int@
+ptrToInt :: Ptr a -> Int
+ptrToInt (Ptr a##) = I## (addr2Int## a##)
+
 #else
 import Prelude
 import Foreign


=====================================
libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/Types.hs
=====================================
@@ -6,10 +6,16 @@ import Prelude
 import Data.Word
 import GHC.Generics
 
+-- | This is a somewhat faithful representation of StgTSOProfInfo. See
+-- <https://gitlab.haskell.org/ghc/ghc/blob/master/includes/rts/storage/TSO.h>
+-- for more details on this data structure.
 data StgTSOProfInfo = StgTSOProfInfo {
     cccs :: Maybe CostCentreStack
 } deriving (Show, Generic)
 
+-- | This is a somewhat faithful representation of CostCentreStack. See
+-- <https://gitlab.haskell.org/ghc/ghc/blob/master/includes/rts/prof/CCS.h>
+-- for more details on this data structure.
 data CostCentreStack = CostCentreStack {
     ccs_ccsID :: Int,
     ccs_cc :: CostCentre,
@@ -25,6 +31,9 @@ data CostCentreStack = CostCentreStack {
     ccs_inherited_ticks :: Word
 } deriving (Show, Generic, Eq)
 
+-- | This is a somewhat faithful representation of CostCentre. See
+-- <https://gitlab.haskell.org/ghc/ghc/blob/master/includes/rts/prof/CCS.h>
+-- for more details on this data structure.
 data CostCentre = CostCentre {
     cc_ccID :: Int,
     cc_label :: String,
@@ -36,6 +45,9 @@ data CostCentre = CostCentre {
     cc_link :: Maybe CostCentre
 } deriving (Show, Generic, Eq)
 
+-- | This is a somewhat faithful representation of IndexTable. See
+-- <https://gitlab.haskell.org/ghc/ghc/blob/master/includes/rts/prof/CCS.h>
+-- for more details on this data structure.
 data IndexTable = IndexTable {
     it_cc :: CostCentre,
     it_ccs :: Maybe CostCentreStack,


=====================================
libraries/ghc-heap/GHC/Exts/Heap/Ptr/Utils.hs deleted
=====================================
@@ -1,11 +0,0 @@
-{-# LANGUAGE CPP, DeriveGeneric, MagicHash #-}
-
-module GHC.Exts.Heap.Ptr.Utils where
-
-import Prelude
-import GHC.Ptr
-import GHC.Exts
-
--- | casts a @Ptr@ to an @Int@
-ptrToInt :: Ptr a -> Int
-ptrToInt (Ptr a#) = I# (addr2Int# a#)


=====================================
libraries/ghc-heap/ghc-heap.cabal.in
=====================================
@@ -26,7 +26,6 @@ library
                   , ghc-prim         > 0.2 && < 0.8
                   , rts              == 1.0.*
                   , containers       >= 0.6.2.1 && < 0.7
-                  , transformers     == 0.5.*
 
   ghc-options:      -Wall
   cmm-sources:      cbits/HeapPrim.cmm
@@ -45,4 +44,3 @@ library
                     GHC.Exts.Heap.ProfInfo.Types
                     GHC.Exts.Heap.ProfInfo.PeekProfInfo_ProfilingEnabled
                     GHC.Exts.Heap.ProfInfo.PeekProfInfo_ProfilingDisabled
-                    GHC.Exts.Heap.Ptr.Utils



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fcd2bb45fa2cbd1de83a7d233d87d0655b4cca7d...8e097c8edfcae9c83f10d69af032d34fd2f950dc

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fcd2bb45fa2cbd1de83a7d233d87d0655b4cca7d...8e097c8edfcae9c83f10d69af032d34fd2f950dc
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200924/4389fa61/attachment-0001.html>


More information about the ghc-commits mailing list