[Git][ghc/ghc][wip/eras-profiling] 2 commits: user era
Zubin (@wz1000)
gitlab at gitlab.haskell.org
Mon Jan 8 09:39:39 UTC 2024
Zubin pushed to branch wip/eras-profiling at Glasgow Haskell Compiler / GHC
Commits:
76018d37 by Zubin Duggal at 2024-01-08T15:09:30+05:30
user era
- - - - -
9c9c11a8 by Zubin Duggal at 2024-01-08T15:09:30+05:30
Fix profiling for C++ and allow ghc-debug to be loaded into ghci
- - - - -
6 changed files:
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/Session.hs
- libraries/base/src/GHC/Profiling.hs
- rts/ProfHeap.c
- rts/RtsSymbols.c
- rts/include/rts/prof/Heap.h
Changes:
=====================================
compiler/GHC/Driver/Make.hs
=====================================
@@ -153,6 +153,7 @@ import GHC.Utils.Constants
import GHC.Types.Unique.DFM (udfmRestrictKeysSet)
import GHC.Types.Unique
import GHC.Iface.Errors.Types
+import GHC.Profiling
import qualified GHC.Data.Word64Set as W
@@ -702,6 +703,8 @@ load' mhmi_cache how_much diag_wrapper mHscMessage mod_graph = do
-- In normal usage plugins are initialised already by ghc/Main.hs this is protective
-- for any client who might interact with GHC via load'.
-- See Note [Timing of plugin initialization]
+ era <- liftIO getUserEra
+ liftIO $ setUserEra (era + 1)
initializeSessionPlugins
modifySession $ \hsc_env -> hsc_env { hsc_mod_graph = mod_graph }
guessOutputFile
=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -438,7 +438,8 @@ opt_c :: DynFlags -> [String]
opt_c dflags = concatMap (wayOptc (targetPlatform dflags)) (ways dflags)
++ toolSettings_opt_c (toolSettings dflags)
opt_cxx :: DynFlags -> [String]
-opt_cxx dflags= toolSettings_opt_cxx $ toolSettings dflags
+opt_cxx dflags= concatMap (wayOptc (targetPlatform dflags)) (ways dflags)
+ ++ toolSettings_opt_cxx (toolSettings dflags)
opt_a :: DynFlags -> [String]
opt_a dflags= toolSettings_opt_a $ toolSettings dflags
opt_l :: DynFlags -> [String]
=====================================
libraries/base/src/GHC/Profiling.hs
=====================================
@@ -10,6 +10,7 @@ module GHC.Profiling ( -- * Cost Centre Profiling
, stopHeapProfTimer
, requestHeapCensus
, setUserEra
+ , getUserEra
)where
import GHC.Base
@@ -56,3 +57,4 @@ foreign import ccall stopHeapProfTimer :: IO ()
-- counted. TODO: Move this into ghc-experimental to avoid CLC.
foreign import ccall setUserEra :: Word -> IO ()
+foreign import ccall getUserEra :: IO Word
=====================================
rts/ProfHeap.c
=====================================
@@ -150,6 +150,11 @@ setUserEra (StgWord w){
user_era = w;
}
+StgWord
+getUserEra (void){
+ return user_era;
+}
+
inline void
initLDVCtr( counter *ctr )
{
=====================================
rts/RtsSymbols.c
=====================================
@@ -507,6 +507,7 @@ extern char **environ;
SymI_HasDataProto(stg_block_takemvar) \
SymI_HasDataProto(stg_block_readmvar) \
SymI_HasDataProto(stg_block_putmvar) \
+ SymI_HasDataProto(stg_END_TSO_QUEUE_closure) \
MAIN_CAP_SYM \
SymI_HasProto(addDLL) \
SymI_HasProto(addLibrarySearchPath) \
@@ -923,6 +924,7 @@ extern char **environ;
SymI_HasProto(startHeapProfTimer) \
SymI_HasProto(stopHeapProfTimer) \
SymI_HasProto(setUserEra) \
+ SymI_HasProto(getUserEra) \
SymI_HasProto(requestHeapCensus) \
SymI_HasProto(atomic_inc) \
SymI_HasProto(atomic_inc64) \
@@ -948,6 +950,14 @@ extern char **environ;
SymI_HasProto(arenaAlloc) \
SymI_HasProto(arenaFree) \
SymI_HasProto(rts_clearMemory) \
+ SymI_HasProto(rts_pause) \
+ SymI_HasProto(rts_resume) \
+ SymI_HasProto(rts_listThreads) \
+ SymI_HasProto(rts_listMiscRoots) \
+ SymI_HasProto(closure_sizeW) \
+ SymI_HasProto(closure_sizeW_) \
+ SymI_HasProto(listAllBlocks) \
+ SymI_HasProto(generations) \
SymI_HasProto(setKeepCAFs) \
SymI_HasProto(rtsBadAlignmentBarf) \
SymI_HasProto(rtsOutOfBoundsAccess) \
=====================================
rts/include/rts/prof/Heap.h
=====================================
@@ -23,3 +23,4 @@ void requestHeapCensus ( void );
void startHeapProfTimer ( void );
void stopHeapProfTimer ( void );
void setUserEra ( StgWord w);
+StgWord getUserEra ( void );
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/761f5476141a48ef4065ee1ea6c481c82f481df2...9c9c11a855257d5e96ca12e95e78ba1610eed5d5
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/761f5476141a48ef4065ee1ea6c481c82f481df2...9c9c11a855257d5e96ca12e95e78ba1610eed5d5
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/20240108/c671663f/attachment-0001.html>
More information about the ghc-commits
mailing list