[Git][ghc/ghc][wip/t24277] base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId

Finley McIlwaine (@FinleyMcIlwaine) gitlab at gitlab.haskell.org
Mon Mar 4 19:19:49 UTC 2024



Finley McIlwaine pushed to branch wip/t24277 at Glasgow Haskell Compiler / GHC


Commits:
f8217742 by Finley McIlwaine at 2024-03-04T11:19:20-08:00
base: Add CostCentreId, currentCallStackIds, ccsToIds, ccId

Add functions for gettings the IDs of cost centres to the interface of
`GHC.Stack` and `GHC.Exts`. Also add an opaque exposed type for cost center ids,
`CostCentreId`, with appropriate instances.

Implements CLC proposal 235.

Resolves #24277

- - - - -


9 changed files:

- libraries/base/src/GHC/Exts.hs
- libraries/base/src/GHC/Stack.hs
- libraries/ghc-internal/src/GHC/Internal/Exts.hs
- libraries/ghc-internal/src/GHC/Internal/Stack.hs
- libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32


Changes:

=====================================
libraries/base/src/GHC/Exts.hs
=====================================
@@ -84,6 +84,7 @@ module GHC.Exts
      traceEvent,
      -- **  The call stack
      currentCallStack,
+     currentCallStackIds,
      -- *  Ids with special behaviour
      inline,
      noinline,


=====================================
libraries/base/src/GHC/Stack.hs
=====================================
@@ -18,6 +18,7 @@ module GHC.Stack
     (errorWithStackTrace,
      -- *  Profiling call stacks
      currentCallStack,
+     currentCallStackIds,
      whoCreated,
      -- *  HasCallStack call stacks
      CallStack,
@@ -37,16 +38,19 @@ module GHC.Stack
      -- *  Internals
      CostCentreStack,
      CostCentre,
+     CostCentreId,
      getCurrentCCS,
      getCCSOf,
      clearCCS,
      ccsCC,
      ccsParent,
+     ccId,
      ccLabel,
      ccModule,
      ccSrcSpan,
+     ccsToIds,
      ccsToStrings,
      renderStack
      ) where
 
-import GHC.Internal.Stack
\ No newline at end of file
+import GHC.Internal.Stack


=====================================
libraries/ghc-internal/src/GHC/Internal/Exts.hs
=====================================
@@ -103,6 +103,8 @@ module GHC.Internal.Exts
 
         -- ** The call stack
         currentCallStack,
+        currentCallStackIds,
+        CostCentreId,
 
         -- * Ids with special behaviour
         inline, noinline, lazy, oneShot, considerAccessible,


=====================================
libraries/ghc-internal/src/GHC/Internal/Stack.hs
=====================================
@@ -2,6 +2,7 @@
 {-# LANGUAGE NoImplicitPrelude #-}
 {-# LANGUAGE RecordWildCards #-}
 {-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE Trustworthy #-}
 
 -----------------------------------------------------------------------------
@@ -24,6 +25,7 @@ module GHC.Internal.Stack (
 
     -- * Profiling call stacks
     currentCallStack,
+    currentCallStackIds,
     whoCreated,
 
     -- * HasCallStack call stacks
@@ -38,14 +40,17 @@ module GHC.Internal.Stack (
     -- * Internals
     CostCentreStack,
     CostCentre,
+    CostCentreId,
     getCurrentCCS,
     getCCSOf,
     clearCCS,
     ccsCC,
     ccsParent,
+    ccId,
     ccLabel,
     ccModule,
     ccSrcSpan,
+    ccsToIds,
     ccsToStrings,
     renderStack
   ) where


=====================================
libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc
=====================================
@@ -16,14 +16,17 @@
 -----------------------------------------------------------------------------
 
 {-# LANGUAGE UnboxedTuples, MagicHash, NoImplicitPrelude #-}
+{-# LANGUAGE DerivingStrategies, GeneralizedNewtypeDeriving #-}
 module GHC.Internal.Stack.CCS (
     -- * Call stacks
     currentCallStack,
+    currentCallStackIds,
     whoCreated,
 
     -- * Internals
     CostCentreStack,
     CostCentre,
+    CostCentreId,
     getCurrentCCS,
     getCCSOf,
     clearCCS,
@@ -31,7 +34,9 @@ module GHC.Internal.Stack.CCS (
     ccsParent,
     ccLabel,
     ccModule,
+    ccId,
     ccSrcSpan,
+    ccsToIds,
     ccsToStrings,
     renderStack,
   ) where
@@ -44,6 +49,12 @@ import GHC.Internal.Base
 import GHC.Internal.Ptr
 import GHC.Internal.IO.Encoding
 import GHC.Internal.List ( concatMap, reverse )
+import GHC.Internal.Word ( Word32 )
+import GHC.Internal.Show
+import GHC.Internal.Read
+import GHC.Internal.Enum
+import GHC.Internal.Real
+import GHC.Internal.Num
 
 #define PROFILING
 #include "Rts.h"
@@ -54,6 +65,13 @@ data CostCentreStack
 -- | A cost-centre from GHC's cost-center profiler.
 data CostCentre
 
+-- | Cost centre identifier
+--
+-- @since 4.20.0.0
+newtype CostCentreId = CostCentreId Word32
+  deriving (Show, Read)
+  deriving newtype (Eq, Ord, Bounded, Enum, Integral, Num, Real)
+
 -- | Returns the current 'CostCentreStack' (value is @nullPtr@ if the current
 -- program was not compiled with profiling support). Takes a dummy argument
 -- which can be used to avoid the call to @getCurrentCCS@ being floated out by
@@ -83,6 +101,12 @@ ccsCC p = peekByteOff p 4
 ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack)
 ccsParent p = peekByteOff p 8
 
+-- | Get the 'CostCentreId' of a 'CostCentre'.
+--
+-- @since 4.20.0.0
+ccId :: Ptr CostCentre -> IO Word32
+ccId p = fmap CostCentreId $ peekByteOff p 0
+
 ccLabel :: Ptr CostCentre -> IO CString
 ccLabel p = peekByteOff p 4
 
@@ -99,6 +123,12 @@ ccsCC p = (# peek CostCentreStack, cc) p
 ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack)
 ccsParent p = (# peek CostCentreStack, prevStack) p
 
+-- | Get the 'CostCentreId' of a 'CostCentre'.
+--
+-- @since 4.20.0.0
+ccId :: Ptr CostCentre -> IO CostCentreId
+ccId p = fmap CostCentreId $ (# peek CostCentre, ccID) p
+
 -- | Get the label of a 'CostCentre'.
 ccLabel :: Ptr CostCentre -> IO CString
 ccLabel p = (# peek CostCentre, label) p
@@ -125,6 +155,19 @@ ccSrcSpan p = (# peek CostCentre, srcloc) p
 currentCallStack :: IO [String]
 currentCallStack = ccsToStrings =<< getCurrentCCS ()
 
+-- | Returns a @[CostCentreId]@ representing the current call stack.  This
+-- can be useful for debugging.
+--
+-- The implementation uses the call-stack simulation maintained by the
+-- profiler, so it only works if the program was compiled with @-prof@
+-- and contains suitable SCC annotations (e.g. by using @-fprof-late@).
+-- Otherwise, the list returned is likely to be empty or
+-- uninformative.
+--
+-- @since 4.20.0.0
+currentCallStackIds :: IO [CostCentreId]
+currentCallStackIds = ccsToIds =<< getCurrentCCS ()
+
 -- | Format a 'CostCentreStack' as a list of lines.
 ccsToStrings :: Ptr CostCentreStack -> IO [String]
 ccsToStrings ccs0 = go ccs0 []
@@ -141,6 +184,24 @@ ccsToStrings ccs0 = go ccs0 []
            then return acc
            else go parent ((mdl ++ '.':lbl ++ ' ':'(':loc ++ ")") : acc)
 
+-- | Format a 'CostCentreStack' as a list of cost centre IDs.
+--
+-- @since 4.20.0.0
+ccsToIds :: Ptr CostCentreStack -> IO [CostCentreId]
+ccsToIds ccs0 = go ccs0 []
+  where
+    go ccs acc
+     | ccs == nullPtr = return acc
+     | otherwise = do
+        cc <- ccsCC ccs
+        cc_id <- ccId cc
+        lbl <- GHC.peekCString utf8 =<< ccLabel cc
+        mdl <- GHC.peekCString utf8 =<< ccModule cc
+        parent <- ccsParent ccs
+        if (mdl == "MAIN" && lbl == "MAIN")
+           then return acc
+           else go parent (cc_id : acc)
+
 -- | Get the stack trace attached to an object.
 --
 -- @since base-4.5.0.0


=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -5758,6 +5758,7 @@ module GHC.Exts where
   ctz64# :: Word64# -> Word#
   ctz8# :: Word# -> Word#
   currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String]
+  currentCallStackIds :: GHC.Types.IO [GHC.Internal.Stack.CCS.CostCentreId]
   deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #)
   deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #)
   decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #)
@@ -9302,6 +9303,8 @@ module GHC.Stack where
   data CallStack = ...
   type CostCentre :: *
   data CostCentre
+  type CostCentreId :: *
+  newtype CostCentreId = ...
   type CostCentreStack :: *
   data CostCentreStack
   type HasCallStack :: Constraint
@@ -9309,14 +9312,17 @@ module GHC.Stack where
   type SrcLoc :: *
   data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int}
   callStack :: HasCallStack => CallStack
+  ccId :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO CostCentreId
   ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre)
   ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
+  ccsToIds :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [CostCentreId]
   ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String]
   clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a
   currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String]
+  currentCallStackIds :: GHC.Types.IO [CostCentreId]
   emptyCallStack :: CallStack
   errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a
   freezeCallStack :: CallStack -> CallStack
@@ -11557,6 +11563,7 @@ instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CULong -- Define
 instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Enum.Bounded GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Enum.Bounded GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’
+instance GHC.Internal.Enum.Bounded GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’
 instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’
 instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.DecidedStrictness -- Defined in ‘GHC.Internal.Generics’
 instance GHC.Internal.Enum.Bounded GHC.Internal.Generics.SourceStrictness -- Defined in ‘GHC.Internal.Generics’
@@ -11632,6 +11639,7 @@ instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUSeconds -- Define
 instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Enum.Enum GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Enum.Enum GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’
+instance GHC.Internal.Enum.Enum GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’
 instance GHC.Internal.Enum.Enum GHC.Types.Double -- Defined in ‘GHC.Internal.Float’
 instance GHC.Internal.Enum.Enum GHC.Types.Float -- Defined in ‘GHC.Internal.Float’
 instance GHC.Internal.Enum.Enum GHC.Internal.Generics.Associativity -- Defined in ‘GHC.Internal.Generics’
@@ -12014,6 +12022,7 @@ instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CULong -- Defined in
 instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Num.Num GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
+instance GHC.Internal.Num.Num GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’
 instance GHC.Internal.Num.Num GHC.Types.Double -- Defined in ‘GHC.Internal.Float’
 instance GHC.Internal.Num.Num GHC.Types.Float -- Defined in ‘GHC.Internal.Float’
 instance GHC.Internal.Num.Num GHC.Types.Int -- Defined in ‘GHC.Internal.Num’
@@ -12125,6 +12134,7 @@ instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUSeconds -- Define
 instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Read.Read GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Read.Read GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’
+instance GHC.Internal.Read.Read GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’
 instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’
 instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Internal.Read.Read (f p), GHC.Internal.Read.Read (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’
 instance forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1). GHC.Internal.Read.Read (f (g p)) => GHC.Internal.Read.Read ((GHC.Internal.Generics.:.:) f g p) -- Defined in ‘GHC.Internal.Generics’
@@ -12198,6 +12208,7 @@ instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULLong -- Defi
 instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CULong -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Real.Integral GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
+instance GHC.Internal.Real.Integral GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’
 instance forall a k (b :: k). GHC.Internal.Real.Real a => GHC.Internal.Real.Real (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’
 instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Internal.Real.Real (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
 instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Internal.Real.Real (f (g a)) => GHC.Internal.Real.Real (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
@@ -12244,6 +12255,7 @@ instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CULong -- Defined i
 instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUSeconds -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CUShort -- Defined in ‘GHC.Internal.Foreign.C.Types’
 instance GHC.Internal.Real.Real GHC.Internal.Foreign.C.Types.CWchar -- Defined in ‘GHC.Internal.Foreign.C.Types’
+instance GHC.Internal.Real.Real GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’
 instance GHC.Internal.Real.Real GHC.Types.Double -- Defined in ‘GHC.Internal.Float’
 instance GHC.Internal.Real.Real GHC.Types.Float -- Defined in ‘GHC.Internal.Float’
 instance forall a k (b :: k). GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.Functor.Const’
@@ -12420,6 +12432,7 @@ instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Internal
 instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.FdKey -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’
 instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.Manager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.Manager’
 instance GHC.Internal.Show.Show ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’
+instance GHC.Internal.Show.Show GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’
 instance GHC.Internal.Show.Show GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’
 instance GHC.Internal.Show.Show GHC.Types.Double -- Defined in ‘GHC.Internal.Float’
 instance GHC.Internal.Show.Show GHC.Types.Float -- Defined in ‘GHC.Internal.Float’
@@ -12633,6 +12646,7 @@ instance GHC.Classes.Eq GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘G
 instance GHC.Classes.Eq ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager.State -- Defined in ‘ghc-internal-0.1.0.0:GHC.Internal.Event.TimerManager’
 instance GHC.Classes.Eq GHC.Internal.Stack.Types.SrcLoc -- Defined in ‘GHC.Internal.Stack.Types’
 instance GHC.Classes.Eq GHC.Internal.Exts.SpecConstrAnnotation -- Defined in ‘GHC.Internal.Exts’
+instance GHC.Classes.Eq GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’
 instance GHC.Classes.Eq GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’
 instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’
 instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’
@@ -12797,6 +12811,7 @@ instance forall a. GHC.Classes.Ord (GHC.Internal.Foreign.C.ConstPtr.ConstPtr a)
 instance forall i e. (GHC.Internal.Ix.Ix i, GHC.Classes.Ord e) => GHC.Classes.Ord (GHC.Internal.Arr.Array i e) -- Defined in ‘GHC.Internal.Arr’
 instance GHC.Classes.Ord GHC.Internal.ByteOrder.ByteOrder -- Defined in ‘GHC.Internal.ByteOrder’
 instance GHC.Classes.Ord GHC.Internal.Event.TimeOut.TimeoutKey -- Defined in ‘GHC.Internal.Event.TimeOut’
+instance GHC.Classes.Ord GHC.Internal.Stack.CCS.CostCentreId -- Defined in ‘GHC.Internal.Stack.CCS’
 instance GHC.Classes.Ord GHC.Internal.Fingerprint.Type.Fingerprint -- Defined in ‘GHC.Internal.Fingerprint.Type’
 instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:*:) f g p) -- Defined in ‘GHC.Internal.Generics’
 instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Internal.Generics.:+:) f g p) -- Defined in ‘GHC.Internal.Generics’


=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -5727,6 +5727,7 @@ module GHC.Exts where
   ctz64# :: Word64# -> Word#
   ctz8# :: Word# -> Word#
   currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String]
+  currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32]
   deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #)
   deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #)
   decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #)
@@ -12351,14 +12352,17 @@ module GHC.Stack where
   type SrcLoc :: *
   data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int}
   callStack :: HasCallStack => CallStack
+  ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32
   ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre)
   ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
+  ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32]
   ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String]
   clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a
   currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String]
+  currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32]
   emptyCallStack :: CallStack
   errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a
   freezeCallStack :: CallStack -> CallStack
@@ -12380,14 +12384,17 @@ module GHC.Stack.CCS where
   data CostCentre
   type CostCentreStack :: *
   data CostCentreStack
+  ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32
   ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre)
   ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
+  ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32]
   ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String]
   clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a
   currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String]
+  currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32]
   getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
   getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
   renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String


=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -5907,6 +5907,7 @@ module GHC.Exts where
   ctz64# :: Word64# -> Word#
   ctz8# :: Word# -> Word#
   currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String]
+  currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32]
   deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #)
   deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #)
   decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #)
@@ -9533,14 +9534,17 @@ module GHC.Stack where
   type SrcLoc :: *
   data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int}
   callStack :: HasCallStack => CallStack
+  ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32
   ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre)
   ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
+  ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32]
   ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String]
   clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a
   currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String]
+  currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32]
   emptyCallStack :: CallStack
   errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a
   freezeCallStack :: CallStack -> CallStack
@@ -9562,14 +9566,17 @@ module GHC.Stack.CCS where
   data CostCentre
   type CostCentreStack :: *
   data CostCentreStack
+  ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32
   ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre)
   ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
+  ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32]
   ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String]
   clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a
   currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String]
+  currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32]
   getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
   getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
   renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String


=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -5758,6 +5758,7 @@ module GHC.Exts where
   ctz64# :: Word64# -> Word#
   ctz8# :: Word# -> Word#
   currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String]
+  currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32]
   deRefStablePtr# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #)
   deRefWeak# :: forall {l :: Levity} (a :: TYPE (BoxedRep l)). Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #)
   decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #)
@@ -9309,14 +9310,17 @@ module GHC.Stack where
   type SrcLoc :: *
   data SrcLoc = SrcLoc {srcLocPackage :: [GHC.Types.Char], srcLocModule :: [GHC.Types.Char], srcLocFile :: [GHC.Types.Char], srcLocStartLine :: GHC.Types.Int, srcLocStartCol :: GHC.Types.Int, srcLocEndLine :: GHC.Types.Int, srcLocEndCol :: GHC.Types.Int}
   callStack :: HasCallStack => CallStack
+  ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32
   ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre)
   ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
+  ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32]
   ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String]
   clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a
   currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String]
+  currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32]
   emptyCallStack :: CallStack
   errorWithStackTrace :: forall a. GHC.Internal.Base.String -> a
   freezeCallStack :: CallStack -> CallStack
@@ -9338,14 +9342,17 @@ module GHC.Stack.CCS where
   data CostCentre
   type CostCentreStack :: *
   data CostCentreStack
+  ccId :: GHC.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Word.Word32
   ccLabel :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccModule :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccSrcSpan :: GHC.Internal.Ptr.Ptr CostCentre -> GHC.Types.IO GHC.Internal.Foreign.C.String.Encoding.CString
   ccsCC :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentre)
   ccsParent :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
+  ccsToIds :: GHC.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Word.Word32]
   ccsToStrings :: GHC.Internal.Ptr.Ptr CostCentreStack -> GHC.Types.IO [GHC.Internal.Base.String]
   clearCCS :: forall a. GHC.Types.IO a -> GHC.Types.IO a
   currentCallStack :: GHC.Types.IO [GHC.Internal.Base.String]
+  currentCallStackIds :: GHC.Types.IO [GHC.Word.Word32]
   getCCSOf :: forall a. a -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
   getCurrentCCS :: forall dummy. dummy -> GHC.Types.IO (GHC.Internal.Ptr.Ptr CostCentreStack)
   renderStack :: [GHC.Internal.Base.String] -> GHC.Internal.Base.String



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f82177424b1cae2da4d5acd797ad15f83fab5145

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f82177424b1cae2da4d5acd797ad15f83fab5145
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/20240304/134230f5/attachment-0001.html>


More information about the ghc-commits mailing list