From 1a0fea7d4bb8e33b016ea83bee649f4cd4140c7c Mon Sep 17 00:00:00 2001 From: David Mason Date: Tue, 28 Sep 2021 03:57:59 -0700 Subject: [PATCH 1/7] Change profilers to use thread local evacuation counters Change to prefix increment --- src/coreclr/inc/CrstTypes.def | 6 +- src/coreclr/inc/crsttypes.h | 5 +- src/coreclr/inc/profilepriv.h | 25 +-- src/coreclr/inc/profilepriv.inl | 238 +++++++++-------------- src/coreclr/vm/eetoprofinterfaceimpl.cpp | 28 ++- src/coreclr/vm/profilinghelper.cpp | 80 ++++++-- src/coreclr/vm/profilinghelper.h | 7 - src/coreclr/vm/proftoeeinterfaceimpl.cpp | 4 +- src/coreclr/vm/threads.cpp | 5 + src/coreclr/vm/threads.h | 42 ++++ 10 files changed, 237 insertions(+), 203 deletions(-) diff --git a/src/coreclr/inc/CrstTypes.def b/src/coreclr/inc/CrstTypes.def index c7266df7dbb012..d6fb713a98a1ec 100644 --- a/src/coreclr/inc/CrstTypes.def +++ b/src/coreclr/inc/CrstTypes.def @@ -381,6 +381,7 @@ End // between the thread executing DetachProfiler(), and the DetachThread // carrying out the evacuation order. Crst ProfilingAPIStatus + AcquiredBefore ThreadStore End Crst RCWCache @@ -496,9 +497,8 @@ End Crst ThreadStore AcquiredBefore AvailableParamTypes DeadlockDetection DebuggerController DebuggerHeapLock DebuggerJitInfo DynamicIL ExecuteManRangeLock HandleTable IbcProfile - JitGenericHandleCache JumpStubCache LoaderHeap ModuleLookupTable ProfilingAPIStatus - ProfilerGCRefDataFreeList SingleUseLock SyncBlockCache SystemDomainDelayedUnloadList - ThreadIdDispenser DebuggerMutex + JitGenericHandleCache JumpStubCache LoaderHeap ModuleLookupTable ProfilerGCRefDataFreeList + SingleUseLock SyncBlockCache SystemDomainDelayedUnloadList ThreadIdDispenser DebuggerMutex End Crst TypeIDMap diff --git a/src/coreclr/inc/crsttypes.h b/src/coreclr/inc/crsttypes.h index 7be482c48bb551..23070d7820d61d 100644 --- a/src/coreclr/inc/crsttypes.h +++ b/src/coreclr/inc/crsttypes.h @@ -1,6 +1,7 @@ // // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. // #ifndef __CRST_TYPES_INCLUDED @@ -10,7 +11,7 @@ // This file describes the range of Crst types available and their mapping to a numeric level (used by the // runtime in debug mode to validate we're deadlock free). To modify these settings edit the -// file:CrstTypes.def file and run the clr\artifacts\CrstTypeTool utility to generate a new version of this file. +// file:CrstTypes.def file and run the clr\bin\CrstTypeTool utility to generate a new version of this file. // Each Crst type is declared as a value in the following CrstType enum. enum CrstType @@ -230,7 +231,7 @@ int g_rgCrstLevelMap[] = 4, // CrstPgoData 0, // CrstPinnedByrefValidation 0, // CrstProfilerGCRefDataFreeList - 0, // CrstProfilingAPIStatus + 13, // CrstProfilingAPIStatus 4, // CrstRCWCache 0, // CrstRCWCleanupList 10, // CrstReadyToRunEntryPointToMethodDescMap diff --git a/src/coreclr/inc/profilepriv.h b/src/coreclr/inc/profilepriv.h index 4a77b65e8b24df..d057006f826f4f 100644 --- a/src/coreclr/inc/profilepriv.h +++ b/src/coreclr/inc/profilepriv.h @@ -109,16 +109,10 @@ class ProfilerInfo EventMask eventMask; - //--------------------------------------------------------------- - // dwProfilerEvacuationCounter keeps track of how many profiler - // callback calls remain on the stack - //--------------------------------------------------------------- - // Why volatile? - // See code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization. - Volatile dwProfilerEvacuationCounter; - Volatile inUse; + DWORD slot; + // Reset those variables that is only for the current attach session void ResetPerSessionStatus(); void Init(); @@ -150,19 +144,11 @@ class EvacuationCounterHolder { private: ProfilerInfo *m_pProfilerInfo; + Thread *m_pThread; public: - EvacuationCounterHolder(ProfilerInfo *pProfilerInfo) : - m_pProfilerInfo(pProfilerInfo) - { - _ASSERTE(m_pProfilerInfo != NULL); - InterlockedIncrement((LONG *)(m_pProfilerInfo->dwProfilerEvacuationCounter.GetPointer())); - } - - ~EvacuationCounterHolder() - { - InterlockedDecrement((LONG *)(m_pProfilerInfo->dwProfilerEvacuationCounter.GetPointer())); - } + EvacuationCounterHolder(ProfilerInfo *pProfilerInfo); + ~EvacuationCounterHolder(); }; struct StoredProfilerNode @@ -317,7 +303,6 @@ class ProfControlBlock BOOL IsCallback3Supported(); BOOL IsCallback5Supported(); - BOOL IsDisableTransparencySet(); BOOL RequiresGenericsContextForEnterLeave(); UINT_PTR EEFunctionIDMapper(FunctionID funcId, BOOL * pbHookFunction); diff --git a/src/coreclr/inc/profilepriv.inl b/src/coreclr/inc/profilepriv.inl index 80b09780e6319a..c0b4337a3eddf1 100644 --- a/src/coreclr/inc/profilepriv.inl +++ b/src/coreclr/inc/profilepriv.inl @@ -84,13 +84,12 @@ inline void ProfilerInfo::ResetPerSessionStatus() inline void ProfilerInfo::Init() { curProfStatus.Init(); - dwProfilerEvacuationCounter = 0; ResetPerSessionStatus(); inUse = FALSE; } template -inline BOOL AnyProfilerPassesCondition(ConditionFunc condition) +FORCEINLINE BOOL AnyProfilerPassesCondition(ConditionFunc condition) { BOOL anyPassed = FALSE; (&g_profControlBlock)->DoProfilerCallback(ProfilerCallbackType::ActiveOrInitializing, @@ -120,10 +119,13 @@ inline void ProfControlBlock::Init() CONTRACTL_END; mainProfilerInfo.Init(); + // Special magic value for the main one + mainProfilerInfo.slot = MAX_NOTIFICATION_PROFILERS; for (SIZE_T i = 0; i < MAX_NOTIFICATION_PROFILERS; ++i) { notificationOnlyProfilers[i].Init(); + notificationOnlyProfilers[i].slot = (DWORD)i; } globalEventMask.SetEventMask(COR_PRF_MONITOR_NONE); @@ -227,22 +229,17 @@ inline void ProfControlBlock::UpdateGlobalEventMask() } #endif // DACCESS_COMPILE -inline BOOL ProfControlBlock::IsCallback3Supported() +FORCEINLINE BOOL ProfControlBlock::IsCallback3Supported() { return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->pProfInterface->IsCallback3Supported(); }); } -inline BOOL ProfControlBlock::IsCallback5Supported() +FORCEINLINE BOOL ProfControlBlock::IsCallback5Supported() { return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->pProfInterface->IsCallback5Supported(); }); } -inline BOOL ProfControlBlock::IsDisableTransparencySet() -{ - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_DISABLE_TRANSPARENCY_CHECKS_UNDER_FULL_TRUST); }); -} - -inline BOOL ProfControlBlock::RequiresGenericsContextForEnterLeave() +FORCEINLINE BOOL ProfControlBlock::RequiresGenericsContextForEnterLeave() { return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->pProfInterface->RequiresGenericsContextForEnterLeave(); }); } @@ -1664,14 +1661,15 @@ inline void ProfControlBlock::EventPipeProviderCreated(EventPipeProvider *provid // and what features it enabled callbacks for. //--------------------------------------------------------------------------------------- -inline BOOL CORProfilerPresent() +FORCEINLINE BOOL CORProfilerPresent() { LIMITED_METHOD_DAC_CONTRACT; - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->curProfStatus.Get() >= kProfStatusActive; }); + return (&g_profControlBlock)->mainProfilerInfo.pProfInterface.Load() != NULL + || (&g_profControlBlock)->notificationProfilerCount.Load() > 0; } -inline BOOL CORMainProfilerPresent() +FORCEINLINE BOOL CORMainProfilerPresent() { LIMITED_METHOD_DAC_CONTRACT; @@ -1681,7 +1679,7 @@ inline BOOL CORMainProfilerPresent() // These return whether a CLR Profiler is actively loaded AND has requested the // specified callback or functionality -inline BOOL CORProfilerFunctionIDMapperEnabled() +FORCEINLINE BOOL CORProfilerFunctionIDMapperEnabled() { CONTRACTL { @@ -1698,7 +1696,7 @@ inline BOOL CORProfilerFunctionIDMapperEnabled() )); } -inline BOOL CORProfilerTrackJITInfo() +FORCEINLINE BOOL CORProfilerTrackJITInfo() { CONTRACTL { @@ -1708,11 +1706,10 @@ inline BOOL CORProfilerTrackJITInfo() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_JIT_COMPILATION)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_JIT_COMPILATION); } -inline BOOL CORProfilerTrackCacheSearches() +FORCEINLINE BOOL CORProfilerTrackCacheSearches() { CONTRACTL { @@ -1722,11 +1719,10 @@ inline BOOL CORProfilerTrackCacheSearches() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CACHE_SEARCHES)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CACHE_SEARCHES); } -inline BOOL CORProfilerTrackModuleLoads() +FORCEINLINE BOOL CORProfilerTrackModuleLoads() { CONTRACTL { @@ -1736,11 +1732,10 @@ inline BOOL CORProfilerTrackModuleLoads() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_MODULE_LOADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_MODULE_LOADS); } -inline BOOL CORProfilerTrackAssemblyLoads() +FORCEINLINE BOOL CORProfilerTrackAssemblyLoads() { CONTRACTL { @@ -1750,11 +1745,10 @@ inline BOOL CORProfilerTrackAssemblyLoads() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_ASSEMBLY_LOADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_ASSEMBLY_LOADS); } -inline BOOL CORProfilerTrackAppDomainLoads() +FORCEINLINE BOOL CORProfilerTrackAppDomainLoads() { CONTRACTL { @@ -1764,11 +1758,10 @@ inline BOOL CORProfilerTrackAppDomainLoads() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_APPDOMAIN_LOADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_APPDOMAIN_LOADS); } -inline BOOL CORProfilerTrackThreads() +FORCEINLINE BOOL CORProfilerTrackThreads() { CONTRACTL { @@ -1778,11 +1771,10 @@ inline BOOL CORProfilerTrackThreads() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_THREADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_THREADS); } -inline BOOL CORProfilerTrackClasses() +FORCEINLINE BOOL CORProfilerTrackClasses() { CONTRACTL { @@ -1792,11 +1784,10 @@ inline BOOL CORProfilerTrackClasses() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CLASS_LOADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CLASS_LOADS); } -inline BOOL CORProfilerTrackGC() +FORCEINLINE BOOL CORProfilerTrackGC() { CONTRACTL { @@ -1806,11 +1797,10 @@ inline BOOL CORProfilerTrackGC() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_GC)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_GC); } -inline BOOL CORProfilerTrackAllocationsEnabled() +FORCEINLINE BOOL CORProfilerTrackAllocationsEnabled() { CONTRACTL { @@ -1825,12 +1815,11 @@ inline BOOL CORProfilerTrackAllocationsEnabled() #ifdef PROF_TEST_ONLY_FORCE_OBJECT_ALLOCATED (&g_profControlBlock)->fTestOnlyForceObjectAllocated || #endif - (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_OBJECT_ALLOCATED)) + (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_OBJECT_ALLOCATED) ); } -inline BOOL CORProfilerTrackAllocations() +FORCEINLINE BOOL CORProfilerTrackAllocations() { CONTRACTL { @@ -1840,12 +1829,10 @@ inline BOOL CORProfilerTrackAllocations() } CONTRACTL_END; - return - (CORProfilerTrackAllocationsEnabled() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_OBJECT_ALLOCATED)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_OBJECT_ALLOCATED); } -inline BOOL CORProfilerTrackLargeAllocations() +FORCEINLINE BOOL CORProfilerTrackLargeAllocations() { CONTRACTL { @@ -1855,12 +1842,10 @@ inline BOOL CORProfilerTrackLargeAllocations() } CONTRACTL_END; - return - (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED); } -inline BOOL CORProfilerTrackPinnedAllocations() +FORCEINLINE BOOL CORProfilerTrackPinnedAllocations() { CONTRACTL { @@ -1870,12 +1855,10 @@ inline BOOL CORProfilerTrackPinnedAllocations() } CONTRACTL_END; - return - (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED); } -inline BOOL CORProfilerEnableRejit() +FORCEINLINE BOOL CORProfilerEnableRejit() { CONTRACTL { @@ -1885,11 +1868,10 @@ inline BOOL CORProfilerEnableRejit() } CONTRACTL_END; - return (CORMainProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_REJIT)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_REJIT); } -inline BOOL CORProfilerTrackExceptions() +FORCEINLINE BOOL CORProfilerTrackExceptions() { CONTRACTL { @@ -1899,11 +1881,10 @@ inline BOOL CORProfilerTrackExceptions() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_EXCEPTIONS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_EXCEPTIONS); } -inline BOOL CORProfilerTrackTransitions() +FORCEINLINE BOOL CORProfilerTrackTransitions() { CONTRACTL { @@ -1913,11 +1894,10 @@ inline BOOL CORProfilerTrackTransitions() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CODE_TRANSITIONS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CODE_TRANSITIONS); } -inline BOOL CORProfilerTrackEnterLeave() +FORCEINLINE BOOL CORProfilerTrackEnterLeave() { CONTRACTL { @@ -1932,11 +1912,10 @@ inline BOOL CORProfilerTrackEnterLeave() return TRUE; #endif // PROF_TEST_ONLY_FORCE_ELT - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_ENTERLEAVE)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_ENTERLEAVE); } -inline BOOL CORProfilerTrackCCW() +FORCEINLINE BOOL CORProfilerTrackCCW() { CONTRACTL { @@ -1946,11 +1925,10 @@ inline BOOL CORProfilerTrackCCW() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CCW)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CCW); } -inline BOOL CORProfilerTrackSuspends() +FORCEINLINE BOOL CORProfilerTrackSuspends() { CONTRACTL { @@ -1960,11 +1938,10 @@ inline BOOL CORProfilerTrackSuspends() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_SUSPENDS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_SUSPENDS); } -inline BOOL CORProfilerDisableInlining() +FORCEINLINE BOOL CORProfilerDisableInlining() { CONTRACTL { @@ -1974,11 +1951,10 @@ inline BOOL CORProfilerDisableInlining() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_INLINING)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_INLINING); } -inline BOOL CORProfilerDisableOptimizations() +FORCEINLINE BOOL CORProfilerDisableOptimizations() { CONTRACTL { @@ -1989,11 +1965,10 @@ inline BOOL CORProfilerDisableOptimizations() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_OPTIMIZATIONS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_OPTIMIZATIONS); } -inline BOOL CORProfilerUseProfileImages() +FORCEINLINE BOOL CORProfilerUseProfileImages() { CONTRACTL { @@ -2008,37 +1983,23 @@ inline BOOL CORProfilerUseProfileImages() return TRUE; #endif // PROF_TEST_ONLY_FORCE_ELT - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_REQUIRE_PROFILE_IMAGE)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_REQUIRE_PROFILE_IMAGE); } -inline BOOL CORProfilerDisableAllNGenImages() +FORCEINLINE BOOL CORProfilerDisableAllNGenImages() { LIMITED_METHOD_DAC_CONTRACT; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_ALL_NGEN_IMAGES)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_ALL_NGEN_IMAGES); } -inline BOOL CORProfilerTrackConditionalWeakTableElements() +FORCEINLINE BOOL CORProfilerTrackConditionalWeakTableElements() { LIMITED_METHOD_DAC_CONTRACT; return CORProfilerTrackGC() && (&g_profControlBlock)->IsCallback5Supported(); } -// CORProfilerPresentOrInitializing() returns nonzero iff a CLR Profiler is actively -// loaded and ready to receive callbacks OR a CLR Profiler has loaded just enough that it -// is ready to receive (or is currently executing inside) its Initialize() callback. -// Typically, you'll want to use code:CORProfilerPresent instead of this. But there is -// some internal profiling API code that wants to test for event flags for a profiler -// that may still be initializing, and this function is appropriate for that code. -inline BOOL CORProfilerPresentOrInitializing() -{ - LIMITED_METHOD_CONTRACT; - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->curProfStatus.Get() > kProfStatusDetaching; }); -} - // These return whether a CLR Profiler has requested the specified functionality. // // Note that, unlike the above functions, a profiler that's not done loading (and is @@ -2047,7 +2008,7 @@ inline BOOL CORProfilerPresentOrInitializing() // are used primarily during the initialization path to choose between slow / fast-path // ELT hooks (and later on as part of asserts). -inline BOOL CORProfilerELT3SlowPathEnabled() +FORCEINLINE BOOL CORProfilerELT3SlowPathEnabled() { CONTRACTL { @@ -2057,11 +2018,10 @@ inline BOOL CORProfilerELT3SlowPathEnabled() } CONTRACTL_END; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO))); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO)); } -inline BOOL CORProfilerELT3SlowPathEnterEnabled() +FORCEINLINE BOOL CORProfilerELT3SlowPathEnterEnabled() { CONTRACTL { @@ -2071,11 +2031,10 @@ inline BOOL CORProfilerELT3SlowPathEnterEnabled() } CONTRACTL_END; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO))); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO)); } -inline BOOL CORProfilerELT3SlowPathLeaveEnabled() +FORCEINLINE BOOL CORProfilerELT3SlowPathLeaveEnabled() { CONTRACTL { @@ -2085,11 +2044,10 @@ inline BOOL CORProfilerELT3SlowPathLeaveEnabled() } CONTRACTL_END; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO))); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO)); } -inline BOOL CORProfilerELT3SlowPathTailcallEnabled() +FORCEINLINE BOOL CORProfilerELT3SlowPathTailcallEnabled() { CONTRACTL { @@ -2099,11 +2057,10 @@ inline BOOL CORProfilerELT3SlowPathTailcallEnabled() } CONTRACTL_END; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FRAME_INFO))); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FRAME_INFO)); } -inline BOOL CORProfilerELT2FastPathEnterEnabled() +FORCEINLINE BOOL CORProfilerELT2FastPathEnterEnabled() { CONTRACTL { @@ -2113,11 +2070,10 @@ inline BOOL CORProfilerELT2FastPathEnterEnabled() } CONTRACTL_END; - return (CORProfilerPresentOrInitializing() && - !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO)))); + return !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO))); } -inline BOOL CORProfilerELT2FastPathLeaveEnabled() +FORCEINLINE BOOL CORProfilerELT2FastPathLeaveEnabled() { CONTRACTL { @@ -2127,11 +2083,10 @@ inline BOOL CORProfilerELT2FastPathLeaveEnabled() } CONTRACTL_END; - return (CORProfilerPresentOrInitializing() && - !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO)))); + return !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO))); } -inline BOOL CORProfilerELT2FastPathTailcallEnabled() +FORCEINLINE BOOL CORProfilerELT2FastPathTailcallEnabled() { CONTRACTL { @@ -2141,11 +2096,10 @@ inline BOOL CORProfilerELT2FastPathTailcallEnabled() } CONTRACTL_END; - return (CORProfilerPresentOrInitializing() && - !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FRAME_INFO)))); + return !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FRAME_INFO))); } -inline BOOL CORProfilerFunctionArgsEnabled() +FORCEINLINE BOOL CORProfilerFunctionArgsEnabled() { CONTRACTL { @@ -2155,11 +2109,10 @@ inline BOOL CORProfilerFunctionArgsEnabled() } CONTRACTL_END; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FUNCTION_ARGS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FUNCTION_ARGS); } -inline BOOL CORProfilerFunctionReturnValueEnabled() +FORCEINLINE BOOL CORProfilerFunctionReturnValueEnabled() { CONTRACTL { @@ -2169,11 +2122,10 @@ inline BOOL CORProfilerFunctionReturnValueEnabled() } CONTRACTL_END; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FUNCTION_RETVAL)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FUNCTION_RETVAL); } -inline BOOL CORProfilerFrameInfoEnabled() +FORCEINLINE BOOL CORProfilerFrameInfoEnabled() { CONTRACTL { @@ -2183,11 +2135,10 @@ inline BOOL CORProfilerFrameInfoEnabled() } CONTRACTL_END; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FRAME_INFO)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FRAME_INFO); } -inline BOOL CORProfilerStackSnapshotEnabled() +FORCEINLINE BOOL CORProfilerStackSnapshotEnabled() { CONTRACTL { @@ -2197,11 +2148,10 @@ inline BOOL CORProfilerStackSnapshotEnabled() } CONTRACTL_END; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_STACK_SNAPSHOT)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_STACK_SNAPSHOT); } -inline BOOL CORProfilerInMemorySymbolsUpdatesEnabled() +FORCEINLINE BOOL CORProfilerInMemorySymbolsUpdatesEnabled() { CONTRACTL { @@ -2211,11 +2161,10 @@ inline BOOL CORProfilerInMemorySymbolsUpdatesEnabled() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED); } -inline BOOL CORProfilerTrackDynamicFunctionUnloads() +FORCEINLINE BOOL CORProfilerTrackDynamicFunctionUnloads() { CONTRACTL { @@ -2225,11 +2174,10 @@ inline BOOL CORProfilerTrackDynamicFunctionUnloads() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_DYNAMIC_FUNCTION_UNLOADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_DYNAMIC_FUNCTION_UNLOADS); } -inline BOOL CORProfilerDisableTieredCompilation() +FORCEINLINE BOOL CORProfilerDisableTieredCompilation() { CONTRACTL { @@ -2240,11 +2188,10 @@ inline BOOL CORProfilerDisableTieredCompilation() CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_DISABLE_TIERED_COMPILATION)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_DISABLE_TIERED_COMPILATION); } -inline BOOL CORProfilerTrackBasicGC() +FORCEINLINE BOOL CORProfilerTrackBasicGC() { CONTRACTL { @@ -2254,11 +2201,10 @@ inline BOOL CORProfilerTrackBasicGC() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_BASIC_GC)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_BASIC_GC); } -inline BOOL CORProfilerTrackGCMovedObjects() +FORCEINLINE BOOL CORProfilerTrackGCMovedObjects() { CONTRACTL { @@ -2268,11 +2214,10 @@ inline BOOL CORProfilerTrackGCMovedObjects() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_GC_MOVED_OBJECTS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_GC_MOVED_OBJECTS); } -inline BOOL CORProfilerTrackEventPipe() +FORCEINLINE BOOL CORProfilerTrackEventPipe() { CONTRACTL { @@ -2282,8 +2227,7 @@ inline BOOL CORProfilerTrackEventPipe() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_EVENT_PIPE)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_EVENT_PIPE); } #if defined(PROFILING_SUPPORTED) diff --git a/src/coreclr/vm/eetoprofinterfaceimpl.cpp b/src/coreclr/vm/eetoprofinterfaceimpl.cpp index 78a85b964e27a2..0f48e80e499605 100644 --- a/src/coreclr/vm/eetoprofinterfaceimpl.cpp +++ b/src/coreclr/vm/eetoprofinterfaceimpl.cpp @@ -102,8 +102,32 @@ enum ClrToProfEntrypointFlags kEE2PNoTrigger = 0x00000004, }; -#define ASSERT_EVAC_COUNTER_NONZERO() \ - _ASSERTE(m_pProfilerInfo->dwProfilerEvacuationCounter.Load() > 0) +EvacuationCounterHolder::EvacuationCounterHolder(ProfilerInfo *pProfilerInfo) : + m_pProfilerInfo(pProfilerInfo), + m_pThread(GetThreadNULLOk()) +{ + _ASSERTE(m_pProfilerInfo != NULL); + if (m_pThread == NULL) + { + return; + } + + m_pThread->IncProfilerEvacuationCounter(m_pProfilerInfo->slot); +} + +EvacuationCounterHolder::~EvacuationCounterHolder() +{ + if (m_pThread == NULL) + { + return; + } + + m_pThread->DecProfilerEvacuationCounter(m_pProfilerInfo->slot); +} + +#define ASSERT_EVAC_COUNTER_NONZERO() \ + _ASSERTE((GetThreadNULLOk() == NULL) || \ + (GetThread()->GetProfilerEvacuationCounter(m_pProfilerInfo->slot) > 0)) #define CHECK_PROFILER_STATUS(ee2pFlags) \ /* If one of these asserts fires, perhaps you forgot to use */ \ diff --git a/src/coreclr/vm/profilinghelper.cpp b/src/coreclr/vm/profilinghelper.cpp index 7ea5d242cfc375..768f575f3dcf07 100644 --- a/src/coreclr/vm/profilinghelper.cpp +++ b/src/coreclr/vm/profilinghelper.cpp @@ -166,7 +166,9 @@ void CurrentProfilerStatus::Set(ProfilerStatus newProfStatus) break; case kProfStatusNone: - _ASSERTE(newProfStatus == kProfStatusPreInitialize); + _ASSERTE((newProfStatus == kProfStatusPreInitialize) || + (newProfStatus == kProfStatusInitializingForStartupLoad) || + (newProfStatus == kProfStatusInitializingForAttachLoad)); break; case kProfStatusDetaching: @@ -1088,8 +1090,6 @@ HRESULT ProfilingAPIUtility::LoadProfiler( _ASSERTE((pvClientData == NULL) || (loadType == kAttachLoad)); ProfilerInfo profilerInfo; - // RAII type that will deregister if we bail at any point - ProfilerInfoHolder profilerInfoHolder(&profilerInfo); profilerInfo.Init(); profilerInfo.inUse = TRUE; @@ -1163,7 +1163,6 @@ HRESULT ProfilingAPIUtility::LoadProfiler( // Check if this profiler is notification only and load as appropriate BOOL notificationOnly = FALSE; { - EvacuationCounterHolder holder(&profilerInfo); HRESULT callHr = profilerInfo.pProfInterface->LoadAsNotficationOnly(¬ificationOnly); if (FAILED(callHr)) { @@ -1179,8 +1178,6 @@ HRESULT ProfilingAPIUtility::LoadProfiler( LogProfError(IDS_E_PROF_NOTIFICATION_LIMIT_EXCEEDED); return CORPROF_E_PROFILER_ALREADY_ACTIVE; } - - *pProfilerInfo = profilerInfo; } else { @@ -1191,13 +1188,14 @@ HRESULT ProfilingAPIUtility::LoadProfiler( return CORPROF_E_PROFILER_ALREADY_ACTIVE; } - // This profiler cannot be a notification only profiler, copy it over to the - // main slot and the ProfilerInfoHolder above will clear out the notification slot - g_profControlBlock.mainProfilerInfo = profilerInfo; + // This profiler cannot be a notification only profiler pProfilerInfo = &(g_profControlBlock.mainProfilerInfo); } + pProfilerInfo->curProfStatus.Set(profilerInfo.curProfStatus.Get()); + pProfilerInfo->pProfInterface = profilerInfo.pProfInterface; pProfilerInfo->pProfInterface->SetProfilerInfo(pProfilerInfo); + pProfilerInfo->inUse = TRUE; } // Now that the profiler is officially loaded and in Init status, call into the @@ -1390,8 +1388,6 @@ HRESULT ProfilingAPIUtility::LoadProfiler( } } - // Yay, the profiler is started up. Don't deregister it if we get to this point - profilerInfoHolder.SuppressRelease(); return S_OK; } @@ -1438,16 +1434,60 @@ BOOL ProfilingAPIUtility::IsProfilerEvacuated(ProfilerInfo *pProfilerInfo) // // (see // code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization - // for details) - DWORD dwEvacCounter = pProfilerInfo->dwProfilerEvacuationCounter; - if (dwEvacCounter != 0) + // for details)Doing this under the thread store lock not only ensures we can + // iterate through the Thread objects safely, but also forces us to serialize with + // the GC. The latter is important, as server GC enters the profiler on non-EE + // Threads, and so no evacuation counters might be incremented during server GC even + // though control could be entering the profiler. { - LOG(( - LF_CORPROF, - LL_INFO100, - "**PROF: Profiler not yet evacuated because it has evac counter of %d (decimal).\n", - dwEvacCounter)); - return FALSE; + ThreadStoreLockHolder TSLockHolder; + + Thread * pThread = ThreadStore::GetAllThreadList( + NULL, // cursor thread; always NULL to begin with + 0, // mask to AND with Thread::m_State to filter returned threads + 0); // bits to match the result of the above AND. (m_State & 0 == 0, + // so we won't filter out any threads) + + // Note that, by not filtering out any of the threads, we're intentionally including + // stuff like TS_Dead or TS_Unstarted. But that keeps us on the safe + // side. If an EE Thread object exists, we want to check its counters to be + // absolutely certain it isn't executing in a profiler. + + while (pThread != NULL) + { + // Note that pThread is still in motion as we check its evacuation counter. + // This is ok, because we've already changed the profiler status to + // kProfStatusDetaching and flushed CPU buffers. So at this point the counter + // will typically only go down to 0 (and not increment anymore), with one + // small exception (below). So if we get a read of 0 below, the counter will + // typically stay there. Specifically: + // * pThread is most likely not about to increment its evacuation counter + // from 0 to 1 because pThread sees that the status is + // kProfStatusDetaching. + // * Note that there is a small race where pThread might actually + // increment its evac counter from 0 to 1 (if it dirty-read the + // profiler status a tad too early), but that implies that when + // pThread rechecks the profiler status (clean read) then pThread + // will immediately decrement the evac counter back to 0 and avoid + // calling into the EEToProfInterfaceImpl pointer. + // + // (see + // code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization + // for details) + DWORD dwEvacCounter = pThread->GetProfilerEvacuationCounter(pProfilerInfo->slot); + if (dwEvacCounter != 0) + { + LOG(( + LF_CORPROF, + LL_INFO100, + "**PROF: Profiler not yet evacuated because OS Thread ID 0x%x has evac counter of %d (decimal).\n", + pThread->GetOSThreadId(), + dwEvacCounter)); + return FALSE; + } + + pThread = ThreadStore::GetAllThreadList(pThread, 0, 0); + } } // FUTURE: When rejit feature crew complete, add code to verify all rejitted diff --git a/src/coreclr/vm/profilinghelper.h b/src/coreclr/vm/profilinghelper.h index 1cf7ea4ab50005..ab64ee8287473c 100644 --- a/src/coreclr/vm/profilinghelper.h +++ b/src/coreclr/vm/profilinghelper.h @@ -136,11 +136,4 @@ class SetCallbackStateFlagsHolder DWORD m_dwOriginalFullState; }; -FORCEINLINE void DeregisterProfilerIfNotificationOnly(ProfilerInfo *pProfilerInfo) -{ - g_profControlBlock.DeRegisterProfilerInfo(pProfilerInfo); -} - -typedef Wrapper ProfilerInfoHolder; - #endif //__PROFILING_HELPER_H__ diff --git a/src/coreclr/vm/proftoeeinterfaceimpl.cpp b/src/coreclr/vm/proftoeeinterfaceimpl.cpp index 4df33eb464dcc5..4f08f247da765f 100644 --- a/src/coreclr/vm/proftoeeinterfaceimpl.cpp +++ b/src/coreclr/vm/proftoeeinterfaceimpl.cpp @@ -1512,7 +1512,7 @@ HRESULT ProfToEEInterfaceImpl::SetEventMask(DWORD dwEventMask) "**PROF: SetEventMask 0x%08x.\n", dwEventMask)); - _ASSERTE(CORProfilerPresentOrInitializing()); + _ASSERTE(CORProfilerPresent()); return m_pProfilerInfo->pProfInterface->SetEventMask(dwEventMask, 0 /* No high bits */); } @@ -1544,7 +1544,7 @@ HRESULT ProfToEEInterfaceImpl::SetEventMask2(DWORD dwEventsLow, DWORD dwEventsHi "**PROF: SetEventMask2 0x%08x, 0x%08x.\n", dwEventsLow, dwEventsHigh)); - _ASSERTE(CORProfilerPresentOrInitializing()); + _ASSERTE(CORProfilerPresent()); return m_pProfilerInfo->pProfInterface->SetEventMask(dwEventsLow, dwEventsHigh); } diff --git a/src/coreclr/vm/threads.cpp b/src/coreclr/vm/threads.cpp index 05b70a215923ba..be14a7a8b883e0 100644 --- a/src/coreclr/vm/threads.cpp +++ b/src/coreclr/vm/threads.cpp @@ -1481,6 +1481,11 @@ Thread::Thread() m_fInteropDebuggingHijacked = FALSE; m_profilerCallbackState = 0; + for (int i = 0; i < MAX_NOTIFICATION_PROFILERS + 1; ++i) + { + m_dwProfilerEvacuationCounters[i] = 0; + } + m_pProfilerFilterContext = NULL; m_CacheStackBase = 0; diff --git a/src/coreclr/vm/threads.h b/src/coreclr/vm/threads.h index 19ef472ba56959..30fe5dcf09c331 100644 --- a/src/coreclr/vm/threads.h +++ b/src/coreclr/vm/threads.h @@ -3451,6 +3451,16 @@ class Thread //--------------------------------------------------------------- DWORD m_profilerCallbackState; +#if defined(PROFILING_SUPPORTED) || defined(PROFILING_SUPPORTED_DATA) + //--------------------------------------------------------------- + // m_dwProfilerEvacuationCounters keeps track of how many profiler + // callback calls remain on the stack + //--------------------------------------------------------------- + // Why volatile? + // See code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization. + Volatile m_dwProfilerEvacuationCounters[MAX_NOTIFICATION_PROFILERS + 1]; +#endif // defined(PROFILING_SUPPORTED) || defined(PROFILING_SUPPORTED_DATA) + private: UINT32 m_workerThreadPoolCompletionCount; static UINT64 s_workerThreadPoolCompletionCountOverflow; @@ -3583,6 +3593,38 @@ class Thread m_pProfilerFilterContext = pContext; } +#ifdef PROFILING_SUPPORTED + FORCEINLINE DWORD GetProfilerEvacuationCounter(size_t slot) + { + LIMITED_METHOD_CONTRACT; + _ASSERTE(slot >= 0 && slot <= MAX_NOTIFICATION_PROFILERS); + return m_dwProfilerEvacuationCounters[slot]; + } + + FORCEINLINE void IncProfilerEvacuationCounter(size_t slot) + { + LIMITED_METHOD_CONTRACT; + _ASSERTE(slot >= 0 && slot <= MAX_NOTIFICATION_PROFILERS); +#ifdef _DEBUG + DWORD newValue = +#endif // _DEBUG + ++m_dwProfilerEvacuationCounters[slot]; + _ASSERTE(newValue != 0U); + } + + FORCEINLINE void DecProfilerEvacuationCounter(size_t slot) + { + LIMITED_METHOD_CONTRACT; + _ASSERTE(slot >= 0 && slot <= MAX_NOTIFICATION_PROFILERS); +#ifdef _DEBUG + DWORD newValue = +#endif // _DEBUG + --m_dwProfilerEvacuationCounters[slot]; + _ASSERTE(newValue != (DWORD)-1); + } + +#endif // PROFILING_SUPPORTED + // Used by the profiler API to find which flags have been set on the Thread object, // in order to authorize a profiler's call into ICorProfilerInfo(2). DWORD GetProfilerCallbackFullState() From c30e4cc3d7f106c226c38d9df87968304f417fbc Mon Sep 17 00:00:00 2001 From: David Mason Date: Sat, 2 Oct 2021 04:06:03 -0700 Subject: [PATCH 2/7] get rid of lambdas --- src/coreclr/inc/profilepriv.h | 25 +- src/coreclr/inc/profilepriv.inl | 1083 ++++++++++++++---------- src/coreclr/vm/eetoprofinterfaceimpl.h | 4 + 3 files changed, 654 insertions(+), 458 deletions(-) diff --git a/src/coreclr/inc/profilepriv.h b/src/coreclr/inc/profilepriv.h index d057006f826f4f..e78ca30e362c2b 100644 --- a/src/coreclr/inc/profilepriv.h +++ b/src/coreclr/inc/profilepriv.h @@ -275,22 +275,25 @@ class ProfControlBlock BOOL IsMainProfiler(ProfToEEInterfaceImpl *pProfToEE); ProfilerInfo *GetProfilerInfo(ProfToEEInterfaceImpl *pProfToEE); + template + static void DoProfilerCallbackHelper(ProfilerInfo *pProfilerInfo, ConditionFunc condition, Data *additionalData, CallbackFunc callback, HRESULT *pHR, Args... args) + { + if (condition(pProfilerInfo)) + { + HRESULT innerHR = callback(additionalData, pProfilerInfo->pProfInterface, args...); + if (FAILED(innerHR)) + { + *pHR = innerHR; + } + } + } + template FORCEINLINE HRESULT DoProfilerCallback(ProfilerCallbackType callbackType, ConditionFunc condition, Data *additionalData, CallbackFunc callback, Args... args) { HRESULT hr = S_OK; IterateProfilers(callbackType, - [](ProfilerInfo *pProfilerInfo, ConditionFunc condition, Data *additionalData, CallbackFunc callback, HRESULT *pHR, Args... args) - { - if (condition(pProfilerInfo)) - { - HRESULT innerHR = callback(additionalData, pProfilerInfo->pProfInterface, args...); - if (FAILED(innerHR)) - { - *pHR = innerHR; - } - } - }, + &DoProfilerCallbackHelper, condition, additionalData, callback, &hr, args...); return hr; } diff --git a/src/coreclr/inc/profilepriv.inl b/src/coreclr/inc/profilepriv.inl index c0b4337a3eddf1..f7da3ee8b05662 100644 --- a/src/coreclr/inc/profilepriv.inl +++ b/src/coreclr/inc/profilepriv.inl @@ -88,6 +88,12 @@ inline void ProfilerInfo::Init() inUse = FALSE; } +inline HRESULT AnyProfilerPassesConditionHelper(BOOL *pAnyPassed, VolatilePtr profInterface) +{ + *pAnyPassed = TRUE; + return S_OK; +} + template FORCEINLINE BOOL AnyProfilerPassesCondition(ConditionFunc condition) { @@ -95,11 +101,7 @@ FORCEINLINE BOOL AnyProfilerPassesCondition(ConditionFunc condition) (&g_profControlBlock)->DoProfilerCallback(ProfilerCallbackType::ActiveOrInitializing, condition, &anyPassed, - [](BOOL *pAnyPassed, VolatilePtr profInterface) - { - *pAnyPassed = TRUE; - return S_OK; - }); + &AnyProfilerPassesConditionHelper); return anyPassed; } @@ -167,17 +169,19 @@ inline BOOL ProfControlBlock::IsMainProfiler(ProfToEEInterfaceImpl *pProfToEE) return pProfInterface != NULL && pProfInterface->m_pProfToEE == pProfToEE; } +inline void GetProfilerInfoHelper(ProfilerInfo *pProfilerInfo, ProfToEEInterfaceImpl *pProfToEE, ProfilerInfo **ppFoundProfilerInfo) +{ + if (pProfilerInfo->pProfInterface->GetProfToEE() == pProfToEE) + { + *ppFoundProfilerInfo = pProfilerInfo; + } +} + inline ProfilerInfo *ProfControlBlock::GetProfilerInfo(ProfToEEInterfaceImpl *pProfToEE) { ProfilerInfo *pProfilerInfo = NULL; IterateProfilers(ProfilerCallbackType::ActiveOrInitializing, - [](ProfilerInfo *pProfilerInfo, ProfToEEInterfaceImpl *pProfToEE, ProfilerInfo **ppFoundProfilerInfo) - { - if (pProfilerInfo->pProfInterface->m_pProfToEE == pProfToEE) - { - *ppFoundProfilerInfo = pProfilerInfo; - } - }, + &GetProfilerInfoHelper, pProfToEE, &pProfilerInfo); @@ -205,23 +209,47 @@ inline void ProfControlBlock::DeRegisterProfilerInfo(ProfilerInfo *pProfilerInfo InterlockedDecrement(notificationProfilerCount.GetPointer()); } +inline void UpdateGlobalEventMaskHelper(ProfilerInfo *pProfilerInfo, DWORD *pEventMask) +{ + *pEventMask |= pProfilerInfo->eventMask.GetEventMask(); +} + +inline void UpdateGlobalEventMaskHighHelper(ProfilerInfo *pProfilerInfo, DWORD *pEventMaskHigh) +{ + *pEventMaskHigh |= pProfilerInfo->eventMask.GetEventMaskHigh(); +} + inline void ProfControlBlock::UpdateGlobalEventMask() { while (true) { - UINT64 originalEventMask = globalEventMask.m_eventMask; - UINT64 qwEventMask = 0; + DWORD originalEventMask = globalEventMask.m_eventMask; + DWORD qwEventMask = 0; IterateProfilers(ProfilerCallbackType::ActiveOrInitializing, - [](ProfilerInfo *pProfilerInfo, UINT64 *pEventMask) - { - *pEventMask |= pProfilerInfo->eventMask.m_eventMask; - }, + &UpdateGlobalEventMaskHelper, &qwEventMask); // We are relying on the memory barrier introduced by InterlockedCompareExchange64 to observer any // change to the global event mask. - if ((UINT64)InterlockedCompareExchange64((LONG64 *)&(globalEventMask.m_eventMask), (LONG64)qwEventMask, (LONG64)originalEventMask) == originalEventMask) + if ((UINT64)InterlockedCompareExchange((DWORD *)&(globalEventMask.m_eventMask), qwEventMask, originalEventMask) == originalEventMask) + { + break; + } + } + + while (true) + { + DWORD originalEventMaskHigh = globalEventMask.m_eventMaskHigh; + DWORD qwEventMaskHigh = 0; + + IterateProfilers(ProfilerCallbackType::ActiveOrInitializing, + &UpdateGlobalEventMaskHighHelper, + &qwEventMaskHigh); + + // We are relying on the memory barrier introduced by InterlockedCompareExchange64 to observer any + // change to the global event mask. + if ((UINT64)InterlockedCompareExchange((DWORD *)&(globalEventMask.m_eventMaskHigh), qwEventMaskHigh, originalEventMaskHigh) == originalEventMaskHigh) { break; } @@ -229,48 +257,57 @@ inline void ProfControlBlock::UpdateGlobalEventMask() } #endif // DACCESS_COMPILE +inline BOOL IsCallback3SupportedHelper(ProfilerInfo *pProfilerInfo) +{ + return pProfilerInfo->pProfInterface->IsCallback3Supported(); +} + FORCEINLINE BOOL ProfControlBlock::IsCallback3Supported() { - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->pProfInterface->IsCallback3Supported(); }); + return AnyProfilerPassesCondition(&IsCallback3SupportedHelper); +} + +inline BOOL IsCallback5SupportedHelper(ProfilerInfo *pProfilerInfo) +{ + return pProfilerInfo->pProfInterface->IsCallback5Supported(); } FORCEINLINE BOOL ProfControlBlock::IsCallback5Supported() { - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->pProfInterface->IsCallback5Supported(); }); + return AnyProfilerPassesCondition(&IsCallback5SupportedHelper); +} + +inline BOOL RequiresGenericsContextForEnterLeaveHelper(ProfilerInfo *pProfilerInfo) +{ + return pProfilerInfo->pProfInterface->RequiresGenericsContextForEnterLeave(); } FORCEINLINE BOOL ProfControlBlock::RequiresGenericsContextForEnterLeave() { - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->pProfInterface->RequiresGenericsContextForEnterLeave(); }); + return AnyProfilerPassesCondition(&RequiresGenericsContextForEnterLeaveHelper); } inline bool DoesProfilerWantEEFunctionIDMapper(ProfilerInfo *pProfilerInfo) { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; - return ((pProfilerInfo->pProfInterface->GetFunctionIDMapper() != NULL) || (pProfilerInfo->pProfInterface->GetFunctionIDMapper2() != NULL)); } +inline void EEFunctionIDMapperHelper(ProfilerInfo *pProfilerInfo, FunctionID funcId, BOOL *pbHookFunction, UINT_PTR *pPtr) +{ + if (DoesProfilerWantEEFunctionIDMapper(pProfilerInfo)) + { + *pPtr = pProfilerInfo->pProfInterface->EEFunctionIDMapper(funcId, pbHookFunction); + } +} + inline UINT_PTR ProfControlBlock::EEFunctionIDMapper(FunctionID funcId, BOOL *pbHookFunction) { LIMITED_METHOD_CONTRACT; UINT_PTR ptr = NULL; DoOneProfilerIteration(&mainProfilerInfo, ProfilerCallbackType::Active, - [](ProfilerInfo *pProfilerInfo, FunctionID funcId, BOOL *pbHookFunction, UINT_PTR *pPtr) - { - if (DoesProfilerWantEEFunctionIDMapper(pProfilerInfo)) - { - *pPtr = pProfilerInfo->pProfInterface->EEFunctionIDMapper(funcId, pbHookFunction); - } - }, + &EEFunctionIDMapperHelper, funcId, pbHookFunction, &ptr); return ptr; @@ -289,6 +326,11 @@ inline BOOL IsProfilerTrackingThreads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_THREADS); } +inline HRESULT ThreadCreatedHelper(void *additionalData, VolatilePtr profInterface, ThreadID threadID) +{ + return profInterface->ThreadCreated(threadID); +} + inline void ProfControlBlock::ThreadCreated(ThreadID threadID) { LIMITED_METHOD_CONTRACT; @@ -296,11 +338,13 @@ inline void ProfControlBlock::ThreadCreated(ThreadID threadID) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID threadID) - { - return profInterface->ThreadCreated(threadID); - }, - threadID); + &ThreadCreatedHelper, + threadID); +} + +inline HRESULT ThreadDestroyedHelper(void *additionalData, VolatilePtr profInterface, ThreadID threadID) +{ + return profInterface->ThreadDestroyed(threadID); } inline void ProfControlBlock::ThreadDestroyed(ThreadID threadID) @@ -310,11 +354,13 @@ inline void ProfControlBlock::ThreadDestroyed(ThreadID threadID) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID threadID) - { - return profInterface->ThreadDestroyed(threadID); - }, - threadID); + &ThreadDestroyedHelper, + threadID); +} + +inline HRESULT ThreadAssignedToOSThreadHelper(void *additionalData, VolatilePtr profInterface, ThreadID managedThreadId, DWORD osThreadId) +{ + return profInterface->ThreadAssignedToOSThread(managedThreadId, osThreadId); } inline void ProfControlBlock::ThreadAssignedToOSThread(ThreadID managedThreadId, DWORD osThreadId) @@ -324,11 +370,13 @@ inline void ProfControlBlock::ThreadAssignedToOSThread(ThreadID managedThreadId, DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID managedThreadId, DWORD osThreadId) - { - return profInterface->ThreadAssignedToOSThread(managedThreadId, osThreadId); - }, - managedThreadId, osThreadId); + &ThreadAssignedToOSThreadHelper, + managedThreadId, osThreadId); +} + +inline HRESULT ThreadNameChangedHelper(void *additionalData, VolatilePtr profInterface, ThreadID managedThreadId, ULONG cchName, WCHAR name[]) +{ + return profInterface->ThreadNameChanged(managedThreadId, cchName, name); } inline void ProfControlBlock::ThreadNameChanged(ThreadID managedThreadId, ULONG cchName, WCHAR name[]) @@ -338,11 +386,13 @@ inline void ProfControlBlock::ThreadNameChanged(ThreadID managedThreadId, ULONG DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID managedThreadId, ULONG cchName, WCHAR name[]) - { - return profInterface->ThreadNameChanged(managedThreadId, cchName, name); - }, - managedThreadId, cchName, name); + &ThreadNameChangedHelper, + managedThreadId, cchName, name); +} + +inline HRESULT ShutdownHelper(void *additionalData, VolatilePtr profInterface) +{ + return profInterface->Shutdown(); } inline void ProfControlBlock::Shutdown() @@ -352,10 +402,7 @@ inline void ProfControlBlock::Shutdown() DoProfilerCallback(ProfilerCallbackType::Active, [](ProfilerInfo *pProfilerInfo) { return true; }, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->Shutdown(); - }); + &ShutdownHelper); } inline BOOL IsProfilerTrackingJITInfo(ProfilerInfo *pProfilerInfo) @@ -371,6 +418,11 @@ inline BOOL IsProfilerTrackingJITInfo(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_JIT_COMPILATION); } +inline HRESULT JITCompilationFinishedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) +{ + return profInterface->JITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); +} + inline void ProfControlBlock::JITCompilationFinished(FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) { LIMITED_METHOD_CONTRACT; @@ -378,11 +430,13 @@ inline void ProfControlBlock::JITCompilationFinished(FunctionID functionId, HRES DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) - { - return profInterface->JITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); - }, - functionId, hrStatus, fIsSafeToBlock); + &JITCompilationFinishedHelper, + functionId, hrStatus, fIsSafeToBlock); +} + +inline HRESULT JITCompilationStartedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, BOOL fIsSafeToBlock) +{ + return profInterface->JITCompilationStarted(functionId, fIsSafeToBlock); } inline void ProfControlBlock::JITCompilationStarted(FunctionID functionId, BOOL fIsSafeToBlock) @@ -392,11 +446,13 @@ inline void ProfControlBlock::JITCompilationStarted(FunctionID functionId, BOOL DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, BOOL fIsSafeToBlock) - { - return profInterface->JITCompilationStarted(functionId, fIsSafeToBlock); - }, - functionId, fIsSafeToBlock); + &JITCompilationStartedHelper, + functionId, fIsSafeToBlock); +} + +inline HRESULT DynamicMethodJITCompilationStartedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, BOOL fIsSafeToBlock, LPCBYTE pILHeader, ULONG cbILHeader) +{ + return profInterface->DynamicMethodJITCompilationStarted(functionId, fIsSafeToBlock, pILHeader, cbILHeader); } inline void ProfControlBlock::DynamicMethodJITCompilationStarted(FunctionID functionId, BOOL fIsSafeToBlock, LPCBYTE pILHeader, ULONG cbILHeader) @@ -406,11 +462,13 @@ inline void ProfControlBlock::DynamicMethodJITCompilationStarted(FunctionID func DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, BOOL fIsSafeToBlock, LPCBYTE pILHeader, ULONG cbILHeader) - { - return profInterface->DynamicMethodJITCompilationStarted(functionId, fIsSafeToBlock, pILHeader, cbILHeader); - }, - functionId, fIsSafeToBlock, pILHeader, cbILHeader); + &DynamicMethodJITCompilationStartedHelper, + functionId, fIsSafeToBlock, pILHeader, cbILHeader); +} + +inline HRESULT DynamicMethodJITCompilationFinishedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) +{ + return profInterface->DynamicMethodJITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); } inline void ProfControlBlock::DynamicMethodJITCompilationFinished(FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) @@ -420,11 +478,8 @@ inline void ProfControlBlock::DynamicMethodJITCompilationFinished(FunctionID fun DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) - { - return profInterface->DynamicMethodJITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); - }, - functionId, hrStatus, fIsSafeToBlock); + &DynamicMethodJITCompilationFinishedHelper, + functionId, hrStatus, fIsSafeToBlock); } inline BOOL IsProfilerMonitoringDynamicFunctionUnloads(ProfilerInfo *pProfilerInfo) @@ -440,6 +495,11 @@ inline BOOL IsProfilerMonitoringDynamicFunctionUnloads(ProfilerInfo *pProfilerIn return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_DYNAMIC_FUNCTION_UNLOADS); } +inline HRESULT DynamicMethodUnloadedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId) +{ + return profInterface->DynamicMethodUnloaded(functionId); +} + inline void ProfControlBlock::DynamicMethodUnloaded(FunctionID functionId) { LIMITED_METHOD_CONTRACT; @@ -447,11 +507,8 @@ inline void ProfControlBlock::DynamicMethodUnloaded(FunctionID functionId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerMonitoringDynamicFunctionUnloads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId) - { - return profInterface->DynamicMethodUnloaded(functionId); - }, - functionId); + &DynamicMethodUnloadedHelper, + functionId); } inline BOOL IsProfilerTrackingCacheSearches(ProfilerInfo *pProfilerInfo) @@ -467,6 +524,13 @@ inline BOOL IsProfilerTrackingCacheSearches(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CACHE_SEARCHES); } +inline HRESULT JITCachedFunctionSearchStartedHelper(BOOL *pAllTrue, VolatilePtr profInterface, FunctionID functionId, BOOL *pbUseCachedFunction) +{ + HRESULT hr = profInterface->JITCachedFunctionSearchStarted(functionId, pbUseCachedFunction); + *pAllTrue &= *pbUseCachedFunction; + return hr; +} + inline void ProfControlBlock::JITCachedFunctionSearchStarted(FunctionID functionId, BOOL *pbUseCachedFunction) { LIMITED_METHOD_CONTRACT; @@ -475,18 +539,18 @@ inline void ProfControlBlock::JITCachedFunctionSearchStarted(FunctionID function DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingCacheSearches, &allTrue, - [](BOOL *pAllTrue, VolatilePtr profInterface, FunctionID functionId, BOOL *pbUseCachedFunction) - { - HRESULT hr = profInterface->JITCachedFunctionSearchStarted(functionId, pbUseCachedFunction); - *pAllTrue &= *pbUseCachedFunction; - return hr; - }, - functionId, pbUseCachedFunction); + &JITCachedFunctionSearchStartedHelper, + functionId, pbUseCachedFunction); // If any reject it, consider it rejected. *pbUseCachedFunction = allTrue; } +inline HRESULT JITCachedFunctionSearchFinishedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_JIT_CACHE result) +{ + return profInterface->JITCachedFunctionSearchFinished(functionId, result); +} + inline void ProfControlBlock::JITCachedFunctionSearchFinished(FunctionID functionId, COR_PRF_JIT_CACHE result) { LIMITED_METHOD_CONTRACT; @@ -494,11 +558,15 @@ inline void ProfControlBlock::JITCachedFunctionSearchFinished(FunctionID functio DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingCacheSearches, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_JIT_CACHE result) - { - return profInterface->JITCachedFunctionSearchFinished(functionId, result); - }, - functionId, result); + &JITCachedFunctionSearchFinishedHelper, + functionId, result); +} + +inline HRESULT JITInliningHelper(BOOL *pAllTrue, VolatilePtr profInterface, FunctionID callerId, FunctionID calleeId, BOOL *pfShouldInline) +{ + HRESULT hr = profInterface->JITInlining(callerId, calleeId, pfShouldInline); + *pAllTrue &= *pfShouldInline; + return hr; } inline HRESULT ProfControlBlock::JITInlining(FunctionID callerId, FunctionID calleeId, BOOL *pfShouldInline) @@ -509,13 +577,8 @@ inline HRESULT ProfControlBlock::JITInlining(FunctionID callerId, FunctionID cal HRESULT hr = DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, &allTrue, - [](BOOL *pAllTrue, VolatilePtr profInterface, FunctionID callerId, FunctionID calleeId, BOOL *pfShouldInline) - { - HRESULT hr = profInterface->JITInlining(callerId, calleeId, pfShouldInline); - *pAllTrue &= *pfShouldInline; - return hr; - }, - callerId, calleeId, pfShouldInline); + &JITInliningHelper, + callerId, calleeId, pfShouldInline); // If any reject it, consider it rejected. *pfShouldInline = allTrue; @@ -527,65 +590,73 @@ inline BOOL IsRejitEnabled(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_ENABLE_REJIT); } +inline void ReJITCompilationStartedHelper(ProfilerInfo *pProfilerInfo, FunctionID functionId, ReJITID reJitId, BOOL fIsSafeToBlock) +{ + if (IsRejitEnabled(pProfilerInfo)) + { + pProfilerInfo->pProfInterface->ReJITCompilationStarted(functionId, reJitId, fIsSafeToBlock); + } +} + inline void ProfControlBlock::ReJITCompilationStarted(FunctionID functionId, ReJITID reJitId, BOOL fIsSafeToBlock) { LIMITED_METHOD_CONTRACT; DoOneProfilerIteration(&mainProfilerInfo, ProfilerCallbackType::Active, - [](ProfilerInfo *pProfilerInfo, FunctionID functionId, ReJITID reJitId, BOOL fIsSafeToBlock) - { - if (IsRejitEnabled(pProfilerInfo)) - { - pProfilerInfo->pProfInterface->ReJITCompilationStarted(functionId, reJitId, fIsSafeToBlock); - } - }, + &ReJITCompilationStartedHelper, functionId, reJitId, fIsSafeToBlock); } +inline void GetReJITParametersHelper(ProfilerInfo *pProfilerInfo, ModuleID moduleId, mdMethodDef methodId, ICorProfilerFunctionControl *pFunctionControl, HRESULT *pHr) +{ + if (IsRejitEnabled(pProfilerInfo)) + { + *pHr = pProfilerInfo->pProfInterface->GetReJITParameters(moduleId, methodId, pFunctionControl); + } +} + inline HRESULT ProfControlBlock::GetReJITParameters(ModuleID moduleId, mdMethodDef methodId, ICorProfilerFunctionControl *pFunctionControl) { LIMITED_METHOD_CONTRACT; HRESULT hr = S_OK; DoOneProfilerIteration(&mainProfilerInfo, ProfilerCallbackType::Active, - [](ProfilerInfo *pProfilerInfo, ModuleID moduleId, mdMethodDef methodId, ICorProfilerFunctionControl *pFunctionControl, HRESULT *pHr) - { - if (IsRejitEnabled(pProfilerInfo)) - { - *pHr = pProfilerInfo->pProfInterface->GetReJITParameters(moduleId, methodId, pFunctionControl); - } - }, + &GetReJITParametersHelper, moduleId, methodId, pFunctionControl, &hr); return hr; } +inline void ReJITCompilationFinishedHelper(ProfilerInfo *pProfilerInfo, FunctionID functionId, ReJITID reJitId, HRESULT hrStatus, BOOL fIsSafeToBlock) +{ + if (IsRejitEnabled(pProfilerInfo)) + { + pProfilerInfo->pProfInterface->ReJITCompilationFinished(functionId, reJitId, hrStatus, fIsSafeToBlock); + } +} + inline void ProfControlBlock::ReJITCompilationFinished(FunctionID functionId, ReJITID reJitId, HRESULT hrStatus, BOOL fIsSafeToBlock) { LIMITED_METHOD_CONTRACT; DoOneProfilerIteration(&mainProfilerInfo, ProfilerCallbackType::Active, - [](ProfilerInfo *pProfilerInfo, FunctionID functionId, ReJITID reJitId, HRESULT hrStatus, BOOL fIsSafeToBlock) - { - if (IsRejitEnabled(pProfilerInfo)) - { - pProfilerInfo->pProfInterface->ReJITCompilationFinished(functionId, reJitId, hrStatus, fIsSafeToBlock); - } - }, + &ReJITCompilationFinishedHelper, functionId, reJitId, hrStatus, fIsSafeToBlock); } +inline void ReJITErrorHelper(ProfilerInfo *pProfilerInfo, ModuleID moduleId, mdMethodDef methodId, FunctionID functionId, HRESULT hrStatus) +{ + if (IsRejitEnabled(pProfilerInfo)) + { + pProfilerInfo->pProfInterface->ReJITError(moduleId, methodId, functionId, hrStatus); + } +} + inline void ProfControlBlock::ReJITError(ModuleID moduleId, mdMethodDef methodId, FunctionID functionId, HRESULT hrStatus) { LIMITED_METHOD_CONTRACT; DoOneProfilerIteration(&mainProfilerInfo, ProfilerCallbackType::Active, - [](ProfilerInfo *pProfilerInfo, ModuleID moduleId, mdMethodDef methodId, FunctionID functionId, HRESULT hrStatus) - { - if (IsRejitEnabled(pProfilerInfo)) - { - pProfilerInfo->pProfInterface->ReJITError(moduleId, methodId, functionId, hrStatus); - } - }, + &ReJITErrorHelper, moduleId, methodId, functionId, hrStatus); } @@ -602,6 +673,11 @@ inline BOOL IsProfilerTrackingModuleLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_MODULE_LOADS); } +inline HRESULT ModuleLoadStartedHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId) +{ + return profInterface->ModuleLoadStarted(moduleId); +} + inline void ProfControlBlock::ModuleLoadStarted(ModuleID moduleId) { LIMITED_METHOD_CONTRACT; @@ -609,11 +685,13 @@ inline void ProfControlBlock::ModuleLoadStarted(ModuleID moduleId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId) - { - return profInterface->ModuleLoadStarted(moduleId); - }, - moduleId); + &ModuleLoadStartedHelper, + moduleId); +} + +inline HRESULT ModuleLoadFinishedHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId, HRESULT hrStatus) +{ + return profInterface->ModuleLoadFinished(moduleId, hrStatus); } inline void ProfControlBlock::ModuleLoadFinished(ModuleID moduleId, HRESULT hrStatus) @@ -623,11 +701,13 @@ inline void ProfControlBlock::ModuleLoadFinished(ModuleID moduleId, HRESULT hrSt DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId, HRESULT hrStatus) - { - return profInterface->ModuleLoadFinished(moduleId, hrStatus); - }, - moduleId, hrStatus); + &ModuleLoadFinishedHelper, + moduleId, hrStatus); +} + +inline HRESULT ModuleUnloadStartedHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId) +{ + return profInterface->ModuleUnloadStarted(moduleId); } inline void ProfControlBlock::ModuleUnloadStarted(ModuleID moduleId) @@ -637,11 +717,13 @@ inline void ProfControlBlock::ModuleUnloadStarted(ModuleID moduleId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId) - { - return profInterface->ModuleUnloadStarted(moduleId); - }, - moduleId); + &ModuleUnloadStartedHelper, + moduleId); +} + +inline HRESULT ModuleUnloadFinishedHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId, HRESULT hrStatus) +{ + return profInterface->ModuleUnloadFinished(moduleId, hrStatus); } inline void ProfControlBlock::ModuleUnloadFinished(ModuleID moduleId, HRESULT hrStatus) @@ -651,11 +733,13 @@ inline void ProfControlBlock::ModuleUnloadFinished(ModuleID moduleId, HRESULT hr DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId, HRESULT hrStatus) - { - return profInterface->ModuleUnloadFinished(moduleId, hrStatus); - }, - moduleId, hrStatus); + &ModuleUnloadFinishedHelper, + moduleId, hrStatus); +} + +inline HRESULT ModuleAttachedToAssemblyHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId, AssemblyID AssemblyId) +{ + return profInterface->ModuleAttachedToAssembly(moduleId, AssemblyId); } inline void ProfControlBlock::ModuleAttachedToAssembly(ModuleID moduleId, AssemblyID AssemblyId) @@ -665,11 +749,8 @@ inline void ProfControlBlock::ModuleAttachedToAssembly(ModuleID moduleId, Assemb DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId, AssemblyID AssemblyId) - { - return profInterface->ModuleAttachedToAssembly(moduleId, AssemblyId); - }, - moduleId, AssemblyId); + &ModuleAttachedToAssemblyHelper, + moduleId, AssemblyId); } inline BOOL IsProfilerTrackingInMemorySymbolsUpdatesEnabled(ProfilerInfo *pProfilerInfo) @@ -685,6 +766,11 @@ inline BOOL IsProfilerTrackingInMemorySymbolsUpdatesEnabled(ProfilerInfo *pProfi return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED); } +inline HRESULT ModuleInMemorySymbolsUpdatedHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId) +{ + return profInterface->ModuleInMemorySymbolsUpdated(moduleId); +} + inline void ProfControlBlock::ModuleInMemorySymbolsUpdated(ModuleID moduleId) { LIMITED_METHOD_CONTRACT; @@ -692,11 +778,8 @@ inline void ProfControlBlock::ModuleInMemorySymbolsUpdated(ModuleID moduleId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingInMemorySymbolsUpdatesEnabled, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId) - { - return profInterface->ModuleInMemorySymbolsUpdated(moduleId); - }, - moduleId); + &ModuleInMemorySymbolsUpdatedHelper, + moduleId); } inline BOOL IsProfilerTrackingClasses(ProfilerInfo *pProfilerInfo) @@ -712,6 +795,11 @@ inline BOOL IsProfilerTrackingClasses(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CLASS_LOADS); } +inline HRESULT ClassLoadStartedHelper(void *additionalData, VolatilePtr profInterface, ClassID classId) +{ + return profInterface->ClassLoadStarted(classId); +} + inline void ProfControlBlock::ClassLoadStarted(ClassID classId) { LIMITED_METHOD_CONTRACT; @@ -719,11 +807,13 @@ inline void ProfControlBlock::ClassLoadStarted(ClassID classId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ClassID classId) - { - return profInterface->ClassLoadStarted(classId); - }, - classId); + &ClassLoadStartedHelper, + classId); +} + +inline HRESULT ClassLoadFinishedHelper(void *additionalData, VolatilePtr profInterface, ClassID classId, HRESULT hrStatus) +{ + return profInterface->ClassLoadFinished(classId, hrStatus); } inline void ProfControlBlock::ClassLoadFinished(ClassID classId, HRESULT hrStatus) @@ -733,11 +823,13 @@ inline void ProfControlBlock::ClassLoadFinished(ClassID classId, HRESULT hrStatu DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ClassID classId, HRESULT hrStatus) - { - return profInterface->ClassLoadFinished(classId, hrStatus); - }, - classId, hrStatus); + &ClassLoadFinishedHelper, + classId, hrStatus); +} + +inline HRESULT ClassUnloadStartedHelper(void *additionalData, VolatilePtr profInterface, ClassID classId) +{ + return profInterface->ClassUnloadStarted(classId); } inline void ProfControlBlock::ClassUnloadStarted(ClassID classId) @@ -747,11 +839,13 @@ inline void ProfControlBlock::ClassUnloadStarted(ClassID classId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ClassID classId) - { - return profInterface->ClassUnloadStarted(classId); - }, - classId); + &ClassUnloadStartedHelper, + classId); +} + +inline HRESULT ClassUnloadFinishedHelper(void *additionalData, VolatilePtr profInterface, ClassID classId, HRESULT hrStatus) +{ + return profInterface->ClassUnloadFinished(classId, hrStatus); } inline void ProfControlBlock::ClassUnloadFinished(ClassID classId, HRESULT hrStatus) @@ -761,11 +855,8 @@ inline void ProfControlBlock::ClassUnloadFinished(ClassID classId, HRESULT hrSta DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ClassID classId, HRESULT hrStatus) - { - return profInterface->ClassUnloadFinished(classId, hrStatus); - }, - classId, hrStatus); + &ClassUnloadFinishedHelper, + classId, hrStatus); } inline BOOL IsProfilerTrackingAppDomainLoads(ProfilerInfo *pProfilerInfo) @@ -781,6 +872,11 @@ inline BOOL IsProfilerTrackingAppDomainLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_APPDOMAIN_LOADS); } +inline HRESULT AppDomainCreationStartedHelper(void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId) +{ + return profInterface->AppDomainCreationStarted(appDomainId); +} + inline void ProfControlBlock::AppDomainCreationStarted(AppDomainID appDomainId) { LIMITED_METHOD_CONTRACT; @@ -788,11 +884,13 @@ inline void ProfControlBlock::AppDomainCreationStarted(AppDomainID appDomainId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId) - { - return profInterface->AppDomainCreationStarted(appDomainId); - }, - appDomainId); + &AppDomainCreationStartedHelper, + appDomainId); +} + +inline HRESULT AppDomainCreationFinishedHelper(void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId, HRESULT hrStatus) +{ + return profInterface->AppDomainCreationFinished(appDomainId, hrStatus); } inline void ProfControlBlock::AppDomainCreationFinished(AppDomainID appDomainId, HRESULT hrStatus) @@ -802,11 +900,13 @@ inline void ProfControlBlock::AppDomainCreationFinished(AppDomainID appDomainId, DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId, HRESULT hrStatus) - { - return profInterface->AppDomainCreationFinished(appDomainId, hrStatus); - }, - appDomainId, hrStatus); + &AppDomainCreationFinishedHelper, + appDomainId, hrStatus); +} + +inline HRESULT AppDomainShutdownStartedHelper(void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId) +{ + return profInterface->AppDomainShutdownStarted(appDomainId); } inline void ProfControlBlock::AppDomainShutdownStarted(AppDomainID appDomainId) @@ -816,11 +916,13 @@ inline void ProfControlBlock::AppDomainShutdownStarted(AppDomainID appDomainId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId) - { - return profInterface->AppDomainShutdownStarted(appDomainId); - }, - appDomainId); + &AppDomainShutdownStartedHelper, + appDomainId); +} + +inline HRESULT AppDomainShutdownFinishedHelper(void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId, HRESULT hrStatus) +{ + return profInterface->AppDomainShutdownFinished(appDomainId, hrStatus); } inline void ProfControlBlock::AppDomainShutdownFinished(AppDomainID appDomainId, HRESULT hrStatus) @@ -830,11 +932,8 @@ inline void ProfControlBlock::AppDomainShutdownFinished(AppDomainID appDomainId, DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId, HRESULT hrStatus) - { - return profInterface->AppDomainShutdownFinished(appDomainId, hrStatus); - }, - appDomainId, hrStatus); + &AppDomainShutdownFinishedHelper, + appDomainId, hrStatus); } inline BOOL IsProfilerTrackingAssemblyLoads(ProfilerInfo *pProfilerInfo) @@ -850,6 +949,11 @@ inline BOOL IsProfilerTrackingAssemblyLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_ASSEMBLY_LOADS); } +inline HRESULT AssemblyLoadStartedHelper(void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId) +{ + return profInterface->AssemblyLoadStarted(assemblyId); +} + inline void ProfControlBlock::AssemblyLoadStarted(AssemblyID assemblyId) { LIMITED_METHOD_CONTRACT; @@ -857,11 +961,13 @@ inline void ProfControlBlock::AssemblyLoadStarted(AssemblyID assemblyId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId) - { - return profInterface->AssemblyLoadStarted(assemblyId); - }, - assemblyId); + &AssemblyLoadStartedHelper, + assemblyId); +} + +inline HRESULT AssemblyLoadFinishedHelper(void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId, HRESULT hrStatus) +{ + return profInterface->AssemblyLoadFinished(assemblyId, hrStatus); } inline void ProfControlBlock::AssemblyLoadFinished(AssemblyID assemblyId, HRESULT hrStatus) @@ -871,11 +977,13 @@ inline void ProfControlBlock::AssemblyLoadFinished(AssemblyID assemblyId, HRESUL DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId, HRESULT hrStatus) - { - return profInterface->AssemblyLoadFinished(assemblyId, hrStatus); - }, - assemblyId, hrStatus); + &AssemblyLoadFinishedHelper, + assemblyId, hrStatus); +} + +inline HRESULT AssemblyUnloadStartedHelper(void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId) +{ + return profInterface->AssemblyUnloadStarted(assemblyId); } inline void ProfControlBlock::AssemblyUnloadStarted(AssemblyID assemblyId) @@ -885,11 +993,13 @@ inline void ProfControlBlock::AssemblyUnloadStarted(AssemblyID assemblyId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId) - { - return profInterface->AssemblyUnloadStarted(assemblyId); - }, - assemblyId); + &AssemblyUnloadStartedHelper, + assemblyId); +} + +inline HRESULT AssemblyUnloadFinishedHelper(void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId, HRESULT hrStatus) +{ + return profInterface->AssemblyUnloadFinished(assemblyId, hrStatus); } inline void ProfControlBlock::AssemblyUnloadFinished(AssemblyID assemblyId, HRESULT hrStatus) @@ -899,11 +1009,8 @@ inline void ProfControlBlock::AssemblyUnloadFinished(AssemblyID assemblyId, HRES DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId, HRESULT hrStatus) - { - return profInterface->AssemblyUnloadFinished(assemblyId, hrStatus); - }, - assemblyId, hrStatus); + &AssemblyUnloadFinishedHelper, + assemblyId, hrStatus); } inline BOOL IsProfilerTrackingTransitions(ProfilerInfo *pProfilerInfo) @@ -919,6 +1026,11 @@ inline BOOL IsProfilerTrackingTransitions(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CODE_TRANSITIONS); } +inline HRESULT UnmanagedToManagedTransitionHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) +{ + return profInterface->UnmanagedToManagedTransition(functionId, reason); +} + inline void ProfControlBlock::UnmanagedToManagedTransition(FunctionID functionId, COR_PRF_TRANSITION_REASON reason) { LIMITED_METHOD_CONTRACT; @@ -926,11 +1038,13 @@ inline void ProfControlBlock::UnmanagedToManagedTransition(FunctionID functionId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingTransitions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) - { - return profInterface->UnmanagedToManagedTransition(functionId, reason); - }, - functionId, reason); + &UnmanagedToManagedTransitionHelper, + functionId, reason); +} + +inline HRESULT ManagedToUnmanagedTransitionHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) +{ + return profInterface->ManagedToUnmanagedTransition(functionId, reason); } inline void ProfControlBlock::ManagedToUnmanagedTransition(FunctionID functionId, COR_PRF_TRANSITION_REASON reason) @@ -940,11 +1054,8 @@ inline void ProfControlBlock::ManagedToUnmanagedTransition(FunctionID functionId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingTransitions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) - { - return profInterface->ManagedToUnmanagedTransition(functionId, reason); - }, - functionId, reason); + &ManagedToUnmanagedTransitionHelper, + functionId, reason); } inline BOOL IsProfilerTrackingExceptions(ProfilerInfo *pProfilerInfo) @@ -960,6 +1071,11 @@ inline BOOL IsProfilerTrackingExceptions(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_EXCEPTIONS); } +inline HRESULT ExceptionThrownHelper(void *additionalData, VolatilePtr profInterface, ObjectID thrownObjectId) +{ + return profInterface->ExceptionThrown(thrownObjectId); +} + inline void ProfControlBlock::ExceptionThrown(ObjectID thrownObjectId) { LIMITED_METHOD_CONTRACT; @@ -967,11 +1083,13 @@ inline void ProfControlBlock::ExceptionThrown(ObjectID thrownObjectId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ObjectID thrownObjectId) - { - return profInterface->ExceptionThrown(thrownObjectId); - }, - thrownObjectId); + &ExceptionThrownHelper, + thrownObjectId); +} + +inline HRESULT ExceptionSearchFunctionEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId) +{ + return profInterface->ExceptionSearchFunctionEnter(functionId); } inline void ProfControlBlock::ExceptionSearchFunctionEnter(FunctionID functionId) @@ -981,11 +1099,13 @@ inline void ProfControlBlock::ExceptionSearchFunctionEnter(FunctionID functionId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId) - { - return profInterface->ExceptionSearchFunctionEnter(functionId); - }, - functionId); + &ExceptionSearchFunctionEnterHelper, + functionId); +} + +inline HRESULT ExceptionSearchFunctionLeaveHelper(void *additionalData, VolatilePtr profInterface) +{ + return profInterface->ExceptionSearchFunctionLeave(); } inline void ProfControlBlock::ExceptionSearchFunctionLeave() @@ -995,10 +1115,12 @@ inline void ProfControlBlock::ExceptionSearchFunctionLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->ExceptionSearchFunctionLeave(); - }); + &ExceptionSearchFunctionLeaveHelper); +} + +inline HRESULT ExceptionSearchFilterEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID funcId) +{ + return profInterface->ExceptionSearchFilterEnter(funcId); } inline void ProfControlBlock::ExceptionSearchFilterEnter(FunctionID funcId) @@ -1008,11 +1130,13 @@ inline void ProfControlBlock::ExceptionSearchFilterEnter(FunctionID funcId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID funcId) - { - return profInterface->ExceptionSearchFilterEnter(funcId); - }, - funcId); + &ExceptionSearchFilterEnterHelper, + funcId); +} + +inline HRESULT ExceptionSearchFilterLeaveHelper(void *additionalData, VolatilePtr profInterface) +{ + return profInterface->ExceptionSearchFilterLeave(); } inline void ProfControlBlock::ExceptionSearchFilterLeave() @@ -1022,10 +1146,12 @@ inline void ProfControlBlock::ExceptionSearchFilterLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->ExceptionSearchFilterLeave(); - }); + &ExceptionSearchFilterLeaveHelper); +} + +inline HRESULT ExceptionSearchCatcherFoundHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId) +{ + return profInterface->ExceptionSearchCatcherFound(functionId); } inline void ProfControlBlock::ExceptionSearchCatcherFound(FunctionID functionId) @@ -1035,11 +1161,13 @@ inline void ProfControlBlock::ExceptionSearchCatcherFound(FunctionID functionId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId) - { - return profInterface->ExceptionSearchCatcherFound(functionId); - }, - functionId); + &ExceptionSearchCatcherFoundHelper, + functionId); +} + +inline HRESULT ExceptionOSHandlerEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID funcId) +{ + return profInterface->ExceptionOSHandlerEnter(funcId); } inline void ProfControlBlock::ExceptionOSHandlerEnter(FunctionID funcId) @@ -1049,11 +1177,13 @@ inline void ProfControlBlock::ExceptionOSHandlerEnter(FunctionID funcId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID funcId) - { - return profInterface->ExceptionOSHandlerEnter(funcId); - }, - funcId); + &ExceptionOSHandlerEnterHelper, + funcId); +} + +inline HRESULT ExceptionOSHandlerLeaveHelper(void *additionalData, VolatilePtr profInterface, FunctionID funcId) +{ + return profInterface->ExceptionOSHandlerLeave(funcId); } inline void ProfControlBlock::ExceptionOSHandlerLeave(FunctionID funcId) @@ -1063,11 +1193,13 @@ inline void ProfControlBlock::ExceptionOSHandlerLeave(FunctionID funcId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID funcId) - { - return profInterface->ExceptionOSHandlerLeave(funcId); - }, - funcId); + &ExceptionOSHandlerLeaveHelper, + funcId); +} + +inline HRESULT ExceptionUnwindFunctionEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId) +{ + return profInterface->ExceptionUnwindFunctionEnter(functionId); } inline void ProfControlBlock::ExceptionUnwindFunctionEnter(FunctionID functionId) @@ -1077,11 +1209,13 @@ inline void ProfControlBlock::ExceptionUnwindFunctionEnter(FunctionID functionId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId) - { - return profInterface->ExceptionUnwindFunctionEnter(functionId); - }, - functionId); + &ExceptionUnwindFunctionEnterHelper, + functionId); +} + +inline HRESULT ExceptionUnwindFunctionLeaveHelper(void *additionalData, VolatilePtr profInterface) +{ + return profInterface->ExceptionUnwindFunctionLeave(); } inline void ProfControlBlock::ExceptionUnwindFunctionLeave() @@ -1091,10 +1225,12 @@ inline void ProfControlBlock::ExceptionUnwindFunctionLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->ExceptionUnwindFunctionLeave(); - }); + &ExceptionUnwindFunctionLeaveHelper); +} + +inline HRESULT ExceptionUnwindFinallyEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId) +{ + return profInterface->ExceptionUnwindFinallyEnter(functionId); } inline void ProfControlBlock::ExceptionUnwindFinallyEnter(FunctionID functionId) @@ -1104,11 +1240,13 @@ inline void ProfControlBlock::ExceptionUnwindFinallyEnter(FunctionID functionId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId) - { - return profInterface->ExceptionUnwindFinallyEnter(functionId); - }, - functionId); + &ExceptionUnwindFinallyEnterHelper, + functionId); +} + +inline HRESULT ExceptionUnwindFinallyLeaveHelper(void *additionalData, VolatilePtr profInterface) +{ + return profInterface->ExceptionUnwindFinallyLeave(); } inline void ProfControlBlock::ExceptionUnwindFinallyLeave() @@ -1118,10 +1256,12 @@ inline void ProfControlBlock::ExceptionUnwindFinallyLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->ExceptionUnwindFinallyLeave(); - }); + &ExceptionUnwindFinallyLeaveHelper); +} + +inline HRESULT ExceptionCatcherEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, ObjectID objectId) +{ + return profInterface->ExceptionCatcherEnter(functionId, objectId); } inline void ProfControlBlock::ExceptionCatcherEnter(FunctionID functionId, ObjectID objectId) @@ -1131,11 +1271,13 @@ inline void ProfControlBlock::ExceptionCatcherEnter(FunctionID functionId, Objec DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, ObjectID objectId) - { - return profInterface->ExceptionCatcherEnter(functionId, objectId); - }, - functionId, objectId); + &ExceptionCatcherEnterHelper, + functionId, objectId); +} + +inline HRESULT ExceptionCatcherLeaveHelper(void *additionalData, VolatilePtr profInterface) +{ + return profInterface->ExceptionCatcherLeave(); } inline void ProfControlBlock::ExceptionCatcherLeave() @@ -1145,10 +1287,7 @@ inline void ProfControlBlock::ExceptionCatcherLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->ExceptionCatcherLeave(); - }); + &ExceptionCatcherLeaveHelper); } inline BOOL IsProfilerTrackingCCW(ProfilerInfo *pProfilerInfo) @@ -1164,6 +1303,11 @@ inline BOOL IsProfilerTrackingCCW(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CCW); } +inline HRESULT COMClassicVTableCreatedHelper(void *additionalData, VolatilePtr profInterface, ClassID wrappedClassId, REFGUID implementedIID, void *pVTable, ULONG cSlots) +{ + return profInterface->COMClassicVTableCreated(wrappedClassId, implementedIID, pVTable, cSlots); +} + inline void ProfControlBlock::COMClassicVTableCreated(ClassID wrappedClassId, REFGUID implementedIID, void *pVTable, ULONG cSlots) { LIMITED_METHOD_CONTRACT; @@ -1171,11 +1315,8 @@ inline void ProfControlBlock::COMClassicVTableCreated(ClassID wrappedClassId, RE DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingCCW, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ClassID wrappedClassId, REFGUID implementedIID, void *pVTable, ULONG cSlots) - { - return profInterface->COMClassicVTableCreated(wrappedClassId, implementedIID, pVTable, cSlots); - }, - wrappedClassId, implementedIID, pVTable, cSlots); + &COMClassicVTableCreatedHelper, + wrappedClassId, implementedIID, pVTable, cSlots); } inline BOOL IsProfilerTrackingSuspends(ProfilerInfo *pProfilerInfo) @@ -1191,6 +1332,11 @@ inline BOOL IsProfilerTrackingSuspends(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_SUSPENDS); } +inline HRESULT RuntimeSuspendStartedHelper(void *additionalData, VolatilePtr profInterface, COR_PRF_SUSPEND_REASON suspendReason) +{ + return profInterface->RuntimeSuspendStarted(suspendReason); +} + inline void ProfControlBlock::RuntimeSuspendStarted(COR_PRF_SUSPEND_REASON suspendReason) { LIMITED_METHOD_CONTRACT; @@ -1198,11 +1344,13 @@ inline void ProfControlBlock::RuntimeSuspendStarted(COR_PRF_SUSPEND_REASON suspe DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, COR_PRF_SUSPEND_REASON suspendReason) - { - return profInterface->RuntimeSuspendStarted(suspendReason); - }, - suspendReason); + &RuntimeSuspendStartedHelper, + suspendReason); +} + +inline HRESULT RuntimeSuspendFinishedHelper(void *additionalData, VolatilePtr profInterface) +{ + return profInterface->RuntimeSuspendFinished(); } inline void ProfControlBlock::RuntimeSuspendFinished() @@ -1212,10 +1360,12 @@ inline void ProfControlBlock::RuntimeSuspendFinished() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->RuntimeSuspendFinished(); - }); + &RuntimeSuspendFinishedHelper); +} + +inline HRESULT RuntimeSuspendAbortedHelper(void *additionalData, VolatilePtr profInterface) +{ + return profInterface->RuntimeSuspendAborted(); } inline void ProfControlBlock::RuntimeSuspendAborted() @@ -1225,10 +1375,12 @@ inline void ProfControlBlock::RuntimeSuspendAborted() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->RuntimeSuspendAborted(); - }); + &RuntimeSuspendAbortedHelper); +} + +inline HRESULT RuntimeResumeStartedHelper(void *additionalData, VolatilePtr profInterface) +{ + return profInterface->RuntimeResumeStarted(); } inline void ProfControlBlock::RuntimeResumeStarted() @@ -1238,10 +1390,12 @@ inline void ProfControlBlock::RuntimeResumeStarted() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->RuntimeResumeStarted(); - }); + &RuntimeResumeStartedHelper); +} + +inline HRESULT RuntimeResumeFinishedHelper(void *additionalData, VolatilePtr profInterface) +{ + return profInterface->RuntimeResumeFinished(); } inline void ProfControlBlock::RuntimeResumeFinished() @@ -1251,10 +1405,12 @@ inline void ProfControlBlock::RuntimeResumeFinished() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->RuntimeResumeFinished(); - }); + &RuntimeResumeFinishedHelper); +} + +inline HRESULT RuntimeThreadSuspendedHelper(void *additionalData, VolatilePtr profInterface, ThreadID suspendedThreadId) +{ + return profInterface->RuntimeThreadSuspended(suspendedThreadId); } inline void ProfControlBlock::RuntimeThreadSuspended(ThreadID suspendedThreadId) @@ -1264,11 +1420,13 @@ inline void ProfControlBlock::RuntimeThreadSuspended(ThreadID suspendedThreadId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID suspendedThreadId) - { - return profInterface->RuntimeThreadSuspended(suspendedThreadId); - }, - suspendedThreadId); + &RuntimeThreadSuspendedHelper, + suspendedThreadId); +} + +inline HRESULT RuntimeThreadResumedHelper(void *additionalData, VolatilePtr profInterface, ThreadID resumedThreadId) +{ + return profInterface->RuntimeThreadResumed(resumedThreadId); } inline void ProfControlBlock::RuntimeThreadResumed(ThreadID resumedThreadId) @@ -1278,11 +1436,8 @@ inline void ProfControlBlock::RuntimeThreadResumed(ThreadID resumedThreadId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID resumedThreadId) - { - return profInterface->RuntimeThreadResumed(resumedThreadId); - }, - resumedThreadId); + &RuntimeThreadResumedHelper, + resumedThreadId); } inline BOOL IsProfilerTrackingAllocations(ProfilerInfo *pProfilerInfo) @@ -1299,6 +1454,11 @@ inline BOOL IsProfilerTrackingAllocations(ProfilerInfo *pProfilerInfo) || pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED)); } +inline HRESULT ObjectAllocatedHelper(void *additionalData, VolatilePtr profInterface, ObjectID objectId, ClassID classId) +{ + return profInterface->ObjectAllocated(objectId, classId); +} + inline void ProfControlBlock::ObjectAllocated(ObjectID objectId, ClassID classId) { LIMITED_METHOD_CONTRACT; @@ -1306,11 +1466,8 @@ inline void ProfControlBlock::ObjectAllocated(ObjectID objectId, ClassID classId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAllocations, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ObjectID objectId, ClassID classId) - { - return profInterface->ObjectAllocated(objectId, classId); - }, - objectId, classId); + &ObjectAllocatedHelper, + objectId, classId); } @@ -1327,6 +1484,11 @@ inline BOOL IsProfilerTrackingGC(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_GC); } +inline HRESULT FinalizeableObjectQueuedHelper(void *additionalData, VolatilePtr profInterface, BOOL isCritical, ObjectID objectID) +{ + return profInterface->FinalizeableObjectQueued(isCritical, objectID); +} + inline void ProfControlBlock::FinalizeableObjectQueued(BOOL isCritical, ObjectID objectID) { LIMITED_METHOD_CONTRACT; @@ -1334,11 +1496,13 @@ inline void ProfControlBlock::FinalizeableObjectQueued(BOOL isCritical, ObjectID DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, BOOL isCritical, ObjectID objectID) - { - return profInterface->FinalizeableObjectQueued(isCritical, objectID); - }, - isCritical, objectID); + &FinalizeableObjectQueuedHelper, + isCritical, objectID); +} + +inline HRESULT MovedReferenceHelper(void *additionalData, VolatilePtr profInterface, BYTE *pbMemBlockStart, BYTE *pbMemBlockEnd, ptrdiff_t cbRelocDistance, void *pHeapId, BOOL fCompacting) +{ + return profInterface->MovedReference(pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); } inline void ProfControlBlock::MovedReference(BYTE *pbMemBlockStart, BYTE *pbMemBlockEnd, ptrdiff_t cbRelocDistance, void *pHeapId, BOOL fCompacting) @@ -1348,11 +1512,13 @@ inline void ProfControlBlock::MovedReference(BYTE *pbMemBlockStart, BYTE *pbMemB DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, BYTE *pbMemBlockStart, BYTE *pbMemBlockEnd, ptrdiff_t cbRelocDistance, void *pHeapId, BOOL fCompacting) - { - return profInterface->MovedReference(pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); - }, - pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); + &MovedReferenceHelper, + pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); +} + +inline HRESULT EndMovedReferencesHelper(void *additionalData, VolatilePtr profInterface, void *pHeapId) +{ + return profInterface->EndMovedReferences(pHeapId); } inline void ProfControlBlock::EndMovedReferences(void *pHeapId) @@ -1362,11 +1528,13 @@ inline void ProfControlBlock::EndMovedReferences(void *pHeapId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, void *pHeapId) - { - return profInterface->EndMovedReferences(pHeapId); - }, - pHeapId); + &EndMovedReferencesHelper, + pHeapId); +} + +inline HRESULT RootReference2Helper(void *additionalData, VolatilePtr profInterface, BYTE *objectId, EtwGCRootKind dwEtwRootKind, EtwGCRootFlags dwEtwRootFlags, void *rootID, void *pHeapId) +{ + return profInterface->RootReference2(objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); } inline void ProfControlBlock::RootReference2(BYTE *objectId, EtwGCRootKind dwEtwRootKind, EtwGCRootFlags dwEtwRootFlags, void *rootID, void *pHeapId) @@ -1376,11 +1544,13 @@ inline void ProfControlBlock::RootReference2(BYTE *objectId, EtwGCRootKind dwEtw DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, BYTE *objectId, EtwGCRootKind dwEtwRootKind, EtwGCRootFlags dwEtwRootFlags, void *rootID, void *pHeapId) - { - return profInterface->RootReference2(objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); - }, - objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); + &RootReference2Helper, + objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); +} + +inline HRESULT EndRootReferences2Helper(void *additionalData, VolatilePtr profInterface, void *pHeapId) +{ + return profInterface->EndRootReferences2(pHeapId); } inline void ProfControlBlock::EndRootReferences2(void *pHeapId) @@ -1390,11 +1560,18 @@ inline void ProfControlBlock::EndRootReferences2(void *pHeapId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, void *pHeapId) - { - return profInterface->EndRootReferences2(pHeapId); - }, - pHeapId); + &EndRootReferences2Helper, + pHeapId); +} + +inline HRESULT ConditionalWeakTableElementReferenceHelper(void *additionalData, VolatilePtr profInterface, BYTE *primaryObjectId, BYTE *secondaryObjectId, void *rootID, void *pHeapId) +{ + if (!profInterface->IsCallback5Supported()) + { + return S_OK; + } + + return profInterface->ConditionalWeakTableElementReference(primaryObjectId, secondaryObjectId, rootID, pHeapId); } inline void ProfControlBlock::ConditionalWeakTableElementReference(BYTE *primaryObjectId, BYTE *secondaryObjectId, void *rootID, void *pHeapId) @@ -1404,16 +1581,18 @@ inline void ProfControlBlock::ConditionalWeakTableElementReference(BYTE *primary DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, BYTE *primaryObjectId, BYTE *secondaryObjectId, void *rootID, void *pHeapId) - { - if (!profInterface->IsCallback5Supported()) - { - return S_OK; - } + &ConditionalWeakTableElementReferenceHelper, + primaryObjectId, secondaryObjectId, rootID, pHeapId); +} + +inline HRESULT EndConditionalWeakTableElementReferencesHelper(void *additionalData, VolatilePtr profInterface, void *pHeapId) +{ + if (!profInterface->IsCallback5Supported()) + { + return S_OK; + } - return profInterface->ConditionalWeakTableElementReference(primaryObjectId, secondaryObjectId, rootID, pHeapId); - }, - primaryObjectId, secondaryObjectId, rootID, pHeapId); + return profInterface->EndConditionalWeakTableElementReferences(pHeapId); } inline void ProfControlBlock::EndConditionalWeakTableElementReferences(void *pHeapId) @@ -1423,16 +1602,13 @@ inline void ProfControlBlock::EndConditionalWeakTableElementReferences(void *pHe DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, void *pHeapId) - { - if (!profInterface->IsCallback5Supported()) - { - return S_OK; - } + &EndConditionalWeakTableElementReferencesHelper, + pHeapId); +} - return profInterface->EndConditionalWeakTableElementReferences(pHeapId); - }, - pHeapId); +inline HRESULT AllocByClassHelper(void *additionalData, VolatilePtr profInterface, ObjectID objId, ClassID classId, void *pHeapId) +{ + return profInterface->AllocByClass(objId, classId, pHeapId); } inline void ProfControlBlock::AllocByClass(ObjectID objId, ClassID classId, void *pHeapId) @@ -1442,11 +1618,13 @@ inline void ProfControlBlock::AllocByClass(ObjectID objId, ClassID classId, void DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ObjectID objId, ClassID classId, void *pHeapId) - { - return profInterface->AllocByClass(objId, classId, pHeapId); - }, - objId, classId, pHeapId); + &AllocByClassHelper, + objId, classId, pHeapId); +} + +inline HRESULT EndAllocByClassHelper(void *additionalData, VolatilePtr profInterface, void *pHeapId) +{ + return profInterface->EndAllocByClass(pHeapId); } inline void ProfControlBlock::EndAllocByClass(void *pHeapId) @@ -1456,11 +1634,13 @@ inline void ProfControlBlock::EndAllocByClass(void *pHeapId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, void *pHeapId) - { - return profInterface->EndAllocByClass(pHeapId); - }, - pHeapId); + &EndAllocByClassHelper, + pHeapId); +} + +inline HRESULT ObjectReferenceHelper(void *additionalData, VolatilePtr profInterface, ObjectID objId, ClassID classId, ULONG cNumRefs, ObjectID *arrObjRef) +{ + return profInterface->ObjectReference(objId, classId, cNumRefs, arrObjRef); } inline HRESULT ProfControlBlock::ObjectReference(ObjectID objId, ClassID classId, ULONG cNumRefs, ObjectID *arrObjRef) @@ -1470,11 +1650,13 @@ inline HRESULT ProfControlBlock::ObjectReference(ObjectID objId, ClassID classId return DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ObjectID objId, ClassID classId, ULONG cNumRefs, ObjectID *arrObjRef) - { - return profInterface->ObjectReference(objId, classId, cNumRefs, arrObjRef); - }, - objId, classId, cNumRefs, arrObjRef); + &ObjectReferenceHelper, + objId, classId, cNumRefs, arrObjRef); +} + +inline HRESULT HandleCreatedHelper(void *additionalData, VolatilePtr profInterface, UINT_PTR handleId, ObjectID initialObjectId) +{ + return profInterface->HandleCreated(handleId, initialObjectId); } inline void ProfControlBlock::HandleCreated(UINT_PTR handleId, ObjectID initialObjectId) @@ -1484,11 +1666,13 @@ inline void ProfControlBlock::HandleCreated(UINT_PTR handleId, ObjectID initialO DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, UINT_PTR handleId, ObjectID initialObjectId) - { - return profInterface->HandleCreated(handleId, initialObjectId); - }, - handleId, initialObjectId); + &HandleCreatedHelper, + handleId, initialObjectId); +} + +inline HRESULT HandleDestroyedHelper(void *additionalData, VolatilePtr profInterface, UINT_PTR handleId) +{ + return profInterface->HandleDestroyed(handleId); } inline void ProfControlBlock::HandleDestroyed(UINT_PTR handleId) @@ -1498,11 +1682,8 @@ inline void ProfControlBlock::HandleDestroyed(UINT_PTR handleId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, UINT_PTR handleId) - { - return profInterface->HandleDestroyed(handleId); - }, - handleId); + &HandleDestroyedHelper, + handleId); } @@ -1542,6 +1723,11 @@ inline BOOL IsProfilerTrackingGCOrMovedObjects(ProfilerInfo *pProfilerInfo) return IsProfilerTrackingGC(pProfilerInfo) || IsProfilerTrackingMovedObjects(pProfilerInfo); } +inline HRESULT GarbageCollectionStartedHelper(void *additionalData, VolatilePtr profInterface, int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason) +{ + return profInterface->GarbageCollectionStarted(cGenerations, generationCollected, reason); +} + inline void ProfControlBlock::GarbageCollectionStarted(int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason) { LIMITED_METHOD_CONTRACT; @@ -1549,11 +1735,13 @@ inline void ProfControlBlock::GarbageCollectionStarted(int cGenerations, BOOL ge DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGCOrBasicGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason) - { - return profInterface->GarbageCollectionStarted(cGenerations, generationCollected, reason); - }, - cGenerations, generationCollected, reason); + &GarbageCollectionStartedHelper, + cGenerations, generationCollected, reason); +} + +inline HRESULT GarbageCollectionFinishedHelper(void *additionalData, VolatilePtr profInterface) +{ + return profInterface->GarbageCollectionFinished(); } inline void ProfControlBlock::GarbageCollectionFinished() @@ -1563,10 +1751,7 @@ inline void ProfControlBlock::GarbageCollectionFinished() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGCOrBasicGC, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->GarbageCollectionFinished(); - }); + &GarbageCollectionFinishedHelper); } @@ -1583,6 +1768,33 @@ inline BOOL IsProfilerMonitoringEventPipe(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_EVENT_PIPE); } +inline HRESULT EventPipeEventDeliveredHelper(void *additionalData, VolatilePtr profInterface, + EventPipeProvider *provider, + DWORD eventId, + DWORD eventVersion, + ULONG cbMetadataBlob, + LPCBYTE metadataBlob, + ULONG cbEventData, + LPCBYTE eventData, + LPCGUID pActivityId, + LPCGUID pRelatedActivityId, + Thread *pEventThread, + ULONG numStackFrames, + UINT_PTR stackFrames[]) +{ + return profInterface->EventPipeEventDelivered(provider, + eventId, + eventVersion, + cbMetadataBlob, + metadataBlob, + cbEventData, + eventData, + pActivityId, + pRelatedActivityId, + pEventThread, + numStackFrames, + stackFrames); +} inline void ProfControlBlock::EventPipeEventDelivered(EventPipeProvider *provider, DWORD eventId, @@ -1602,32 +1814,7 @@ inline void ProfControlBlock::EventPipeEventDelivered(EventPipeProvider *provide DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerMonitoringEventPipe, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, EventPipeProvider *provider, - DWORD eventId, - DWORD eventVersion, - ULONG cbMetadataBlob, - LPCBYTE metadataBlob, - ULONG cbEventData, - LPCBYTE eventData, - LPCGUID pActivityId, - LPCGUID pRelatedActivityId, - Thread *pEventThread, - ULONG numStackFrames, - UINT_PTR stackFrames[]) - { - return profInterface->EventPipeEventDelivered(provider, - eventId, - eventVersion, - cbMetadataBlob, - metadataBlob, - cbEventData, - eventData, - pActivityId, - pRelatedActivityId, - pEventThread, - numStackFrames, - stackFrames); - }, + &EventPipeEventDeliveredHelper, provider, eventId, eventVersion, @@ -1642,6 +1829,11 @@ inline void ProfControlBlock::EventPipeEventDelivered(EventPipeProvider *provide stackFrames); } +inline HRESULT EventPipeProviderCreatedHelper(void *additionalData, VolatilePtr profInterface, EventPipeProvider *provider) +{ + return profInterface->EventPipeProviderCreated(provider); +} + inline void ProfControlBlock::EventPipeProviderCreated(EventPipeProvider *provider) { LIMITED_METHOD_CONTRACT; @@ -1649,11 +1841,8 @@ inline void ProfControlBlock::EventPipeProviderCreated(EventPipeProvider *provid DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerMonitoringEventPipe, (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, EventPipeProvider *provider) - { - return profInterface->EventPipeProviderCreated(provider); - }, - provider); + &EventPipeProviderCreatedHelper, + provider); } //--------------------------------------------------------------------------------------- diff --git a/src/coreclr/vm/eetoprofinterfaceimpl.h b/src/coreclr/vm/eetoprofinterfaceimpl.h index 4ec468a4150c7d..5453723fb8e022 100644 --- a/src/coreclr/vm/eetoprofinterfaceimpl.h +++ b/src/coreclr/vm/eetoprofinterfaceimpl.h @@ -476,6 +476,10 @@ class EEToProfInterfaceImpl HRESULT LoadAsNotficationOnly(BOOL *pbNotificationOnly); + ProfToEEInterfaceImpl *GetProfToEE() + { + return m_pProfToEE; + } private: // From c46a4df1ad64f7df2da462ac5f3a99d6a1f64916 Mon Sep 17 00:00:00 2001 From: David Mason Date: Wed, 6 Oct 2021 00:28:51 -0700 Subject: [PATCH 3/7] Fix jit inlining, fix R2R too --- src/coreclr/inc/profilepriv.inl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/coreclr/inc/profilepriv.inl b/src/coreclr/inc/profilepriv.inl index f7da3ee8b05662..bbf94e910fdd3e 100644 --- a/src/coreclr/inc/profilepriv.inl +++ b/src/coreclr/inc/profilepriv.inl @@ -527,7 +527,7 @@ inline BOOL IsProfilerTrackingCacheSearches(ProfilerInfo *pProfilerInfo) inline HRESULT JITCachedFunctionSearchStartedHelper(BOOL *pAllTrue, VolatilePtr profInterface, FunctionID functionId, BOOL *pbUseCachedFunction) { HRESULT hr = profInterface->JITCachedFunctionSearchStarted(functionId, pbUseCachedFunction); - *pAllTrue &= *pbUseCachedFunction; + *pAllTrue = *pAllTrue && *pbUseCachedFunction; return hr; } @@ -535,6 +535,7 @@ inline void ProfControlBlock::JITCachedFunctionSearchStarted(FunctionID function { LIMITED_METHOD_CONTRACT; + *pbUseCachedFunction = TRUE; BOOL allTrue = TRUE; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingCacheSearches, @@ -565,7 +566,7 @@ inline void ProfControlBlock::JITCachedFunctionSearchFinished(FunctionID functio inline HRESULT JITInliningHelper(BOOL *pAllTrue, VolatilePtr profInterface, FunctionID callerId, FunctionID calleeId, BOOL *pfShouldInline) { HRESULT hr = profInterface->JITInlining(callerId, calleeId, pfShouldInline); - *pAllTrue &= *pfShouldInline; + *pAllTrue = *pAllTrue && *pfShouldInline; return hr; } @@ -573,6 +574,7 @@ inline HRESULT ProfControlBlock::JITInlining(FunctionID callerId, FunctionID cal { LIMITED_METHOD_CONTRACT; + *pfShouldInline = TRUE; BOOL allTrue = TRUE; HRESULT hr = DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, From e8e39fd2947f20bec1e26a6893cdd13961e4d64a Mon Sep 17 00:00:00 2001 From: David Mason Date: Wed, 6 Oct 2021 02:55:33 -0700 Subject: [PATCH 4/7] Remove VolatilePtr<> from helpers --- src/coreclr/inc/profilepriv.inl | 174 +++++++++++++++----------------- 1 file changed, 80 insertions(+), 94 deletions(-) diff --git a/src/coreclr/inc/profilepriv.inl b/src/coreclr/inc/profilepriv.inl index bbf94e910fdd3e..8007c451f98fd2 100644 --- a/src/coreclr/inc/profilepriv.inl +++ b/src/coreclr/inc/profilepriv.inl @@ -88,7 +88,7 @@ inline void ProfilerInfo::Init() inUse = FALSE; } -inline HRESULT AnyProfilerPassesConditionHelper(BOOL *pAnyPassed, VolatilePtr profInterface) +inline HRESULT AnyProfilerPassesConditionHelper(BOOL *pAnyPassed, EEToProfInterfaceImpl *profInterface) { *pAnyPassed = TRUE; return S_OK; @@ -223,33 +223,19 @@ inline void ProfControlBlock::UpdateGlobalEventMask() { while (true) { - DWORD originalEventMask = globalEventMask.m_eventMask; - DWORD qwEventMask = 0; + UINT64 originalEventMask = globalEventMask.m_eventMask; + UINT64 qwEventMask = 0; IterateProfilers(ProfilerCallbackType::ActiveOrInitializing, - &UpdateGlobalEventMaskHelper, + [](ProfilerInfo *pProfilerInfo, UINT64 *pEventMask) + { + *pEventMask |= pProfilerInfo->eventMask.m_eventMask; + }, &qwEventMask); // We are relying on the memory barrier introduced by InterlockedCompareExchange64 to observer any // change to the global event mask. - if ((UINT64)InterlockedCompareExchange((DWORD *)&(globalEventMask.m_eventMask), qwEventMask, originalEventMask) == originalEventMask) - { - break; - } - } - - while (true) - { - DWORD originalEventMaskHigh = globalEventMask.m_eventMaskHigh; - DWORD qwEventMaskHigh = 0; - - IterateProfilers(ProfilerCallbackType::ActiveOrInitializing, - &UpdateGlobalEventMaskHighHelper, - &qwEventMaskHigh); - - // We are relying on the memory barrier introduced by InterlockedCompareExchange64 to observer any - // change to the global event mask. - if ((UINT64)InterlockedCompareExchange((DWORD *)&(globalEventMask.m_eventMaskHigh), qwEventMaskHigh, originalEventMaskHigh) == originalEventMaskHigh) + if ((UINT64)InterlockedCompareExchange64((LONG64 *)&(globalEventMask.m_eventMask), (LONG64)qwEventMask, (LONG64)originalEventMask) == originalEventMask) { break; } @@ -326,7 +312,7 @@ inline BOOL IsProfilerTrackingThreads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_THREADS); } -inline HRESULT ThreadCreatedHelper(void *additionalData, VolatilePtr profInterface, ThreadID threadID) +inline HRESULT ThreadCreatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID threadID) { return profInterface->ThreadCreated(threadID); } @@ -342,7 +328,7 @@ inline void ProfControlBlock::ThreadCreated(ThreadID threadID) threadID); } -inline HRESULT ThreadDestroyedHelper(void *additionalData, VolatilePtr profInterface, ThreadID threadID) +inline HRESULT ThreadDestroyedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID threadID) { return profInterface->ThreadDestroyed(threadID); } @@ -358,7 +344,7 @@ inline void ProfControlBlock::ThreadDestroyed(ThreadID threadID) threadID); } -inline HRESULT ThreadAssignedToOSThreadHelper(void *additionalData, VolatilePtr profInterface, ThreadID managedThreadId, DWORD osThreadId) +inline HRESULT ThreadAssignedToOSThreadHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID managedThreadId, DWORD osThreadId) { return profInterface->ThreadAssignedToOSThread(managedThreadId, osThreadId); } @@ -374,7 +360,7 @@ inline void ProfControlBlock::ThreadAssignedToOSThread(ThreadID managedThreadId, managedThreadId, osThreadId); } -inline HRESULT ThreadNameChangedHelper(void *additionalData, VolatilePtr profInterface, ThreadID managedThreadId, ULONG cchName, WCHAR name[]) +inline HRESULT ThreadNameChangedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID managedThreadId, ULONG cchName, WCHAR name[]) { return profInterface->ThreadNameChanged(managedThreadId, cchName, name); } @@ -390,7 +376,7 @@ inline void ProfControlBlock::ThreadNameChanged(ThreadID managedThreadId, ULONG managedThreadId, cchName, name); } -inline HRESULT ShutdownHelper(void *additionalData, VolatilePtr profInterface) +inline HRESULT ShutdownHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) { return profInterface->Shutdown(); } @@ -418,7 +404,7 @@ inline BOOL IsProfilerTrackingJITInfo(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_JIT_COMPILATION); } -inline HRESULT JITCompilationFinishedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) +inline HRESULT JITCompilationFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) { return profInterface->JITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); } @@ -434,7 +420,7 @@ inline void ProfControlBlock::JITCompilationFinished(FunctionID functionId, HRES functionId, hrStatus, fIsSafeToBlock); } -inline HRESULT JITCompilationStartedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, BOOL fIsSafeToBlock) +inline HRESULT JITCompilationStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, BOOL fIsSafeToBlock) { return profInterface->JITCompilationStarted(functionId, fIsSafeToBlock); } @@ -450,7 +436,7 @@ inline void ProfControlBlock::JITCompilationStarted(FunctionID functionId, BOOL functionId, fIsSafeToBlock); } -inline HRESULT DynamicMethodJITCompilationStartedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, BOOL fIsSafeToBlock, LPCBYTE pILHeader, ULONG cbILHeader) +inline HRESULT DynamicMethodJITCompilationStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, BOOL fIsSafeToBlock, LPCBYTE pILHeader, ULONG cbILHeader) { return profInterface->DynamicMethodJITCompilationStarted(functionId, fIsSafeToBlock, pILHeader, cbILHeader); } @@ -466,7 +452,7 @@ inline void ProfControlBlock::DynamicMethodJITCompilationStarted(FunctionID func functionId, fIsSafeToBlock, pILHeader, cbILHeader); } -inline HRESULT DynamicMethodJITCompilationFinishedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) +inline HRESULT DynamicMethodJITCompilationFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) { return profInterface->DynamicMethodJITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); } @@ -495,7 +481,7 @@ inline BOOL IsProfilerMonitoringDynamicFunctionUnloads(ProfilerInfo *pProfilerIn return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_DYNAMIC_FUNCTION_UNLOADS); } -inline HRESULT DynamicMethodUnloadedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId) +inline HRESULT DynamicMethodUnloadedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId) { return profInterface->DynamicMethodUnloaded(functionId); } @@ -524,7 +510,7 @@ inline BOOL IsProfilerTrackingCacheSearches(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CACHE_SEARCHES); } -inline HRESULT JITCachedFunctionSearchStartedHelper(BOOL *pAllTrue, VolatilePtr profInterface, FunctionID functionId, BOOL *pbUseCachedFunction) +inline HRESULT JITCachedFunctionSearchStartedHelper(BOOL *pAllTrue, EEToProfInterfaceImpl *profInterface, FunctionID functionId, BOOL *pbUseCachedFunction) { HRESULT hr = profInterface->JITCachedFunctionSearchStarted(functionId, pbUseCachedFunction); *pAllTrue = *pAllTrue && *pbUseCachedFunction; @@ -547,7 +533,7 @@ inline void ProfControlBlock::JITCachedFunctionSearchStarted(FunctionID function *pbUseCachedFunction = allTrue; } -inline HRESULT JITCachedFunctionSearchFinishedHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_JIT_CACHE result) +inline HRESULT JITCachedFunctionSearchFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_JIT_CACHE result) { return profInterface->JITCachedFunctionSearchFinished(functionId, result); } @@ -563,7 +549,7 @@ inline void ProfControlBlock::JITCachedFunctionSearchFinished(FunctionID functio functionId, result); } -inline HRESULT JITInliningHelper(BOOL *pAllTrue, VolatilePtr profInterface, FunctionID callerId, FunctionID calleeId, BOOL *pfShouldInline) +inline HRESULT JITInliningHelper(BOOL *pAllTrue, EEToProfInterfaceImpl *profInterface, FunctionID callerId, FunctionID calleeId, BOOL *pfShouldInline) { HRESULT hr = profInterface->JITInlining(callerId, calleeId, pfShouldInline); *pAllTrue = *pAllTrue && *pfShouldInline; @@ -675,7 +661,7 @@ inline BOOL IsProfilerTrackingModuleLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_MODULE_LOADS); } -inline HRESULT ModuleLoadStartedHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId) +inline HRESULT ModuleLoadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId) { return profInterface->ModuleLoadStarted(moduleId); } @@ -691,7 +677,7 @@ inline void ProfControlBlock::ModuleLoadStarted(ModuleID moduleId) moduleId); } -inline HRESULT ModuleLoadFinishedHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId, HRESULT hrStatus) +inline HRESULT ModuleLoadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId, HRESULT hrStatus) { return profInterface->ModuleLoadFinished(moduleId, hrStatus); } @@ -707,7 +693,7 @@ inline void ProfControlBlock::ModuleLoadFinished(ModuleID moduleId, HRESULT hrSt moduleId, hrStatus); } -inline HRESULT ModuleUnloadStartedHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId) +inline HRESULT ModuleUnloadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId) { return profInterface->ModuleUnloadStarted(moduleId); } @@ -723,7 +709,7 @@ inline void ProfControlBlock::ModuleUnloadStarted(ModuleID moduleId) moduleId); } -inline HRESULT ModuleUnloadFinishedHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId, HRESULT hrStatus) +inline HRESULT ModuleUnloadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId, HRESULT hrStatus) { return profInterface->ModuleUnloadFinished(moduleId, hrStatus); } @@ -739,7 +725,7 @@ inline void ProfControlBlock::ModuleUnloadFinished(ModuleID moduleId, HRESULT hr moduleId, hrStatus); } -inline HRESULT ModuleAttachedToAssemblyHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId, AssemblyID AssemblyId) +inline HRESULT ModuleAttachedToAssemblyHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId, AssemblyID AssemblyId) { return profInterface->ModuleAttachedToAssembly(moduleId, AssemblyId); } @@ -768,7 +754,7 @@ inline BOOL IsProfilerTrackingInMemorySymbolsUpdatesEnabled(ProfilerInfo *pProfi return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED); } -inline HRESULT ModuleInMemorySymbolsUpdatedHelper(void *additionalData, VolatilePtr profInterface, ModuleID moduleId) +inline HRESULT ModuleInMemorySymbolsUpdatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId) { return profInterface->ModuleInMemorySymbolsUpdated(moduleId); } @@ -797,7 +783,7 @@ inline BOOL IsProfilerTrackingClasses(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CLASS_LOADS); } -inline HRESULT ClassLoadStartedHelper(void *additionalData, VolatilePtr profInterface, ClassID classId) +inline HRESULT ClassLoadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ClassID classId) { return profInterface->ClassLoadStarted(classId); } @@ -813,7 +799,7 @@ inline void ProfControlBlock::ClassLoadStarted(ClassID classId) classId); } -inline HRESULT ClassLoadFinishedHelper(void *additionalData, VolatilePtr profInterface, ClassID classId, HRESULT hrStatus) +inline HRESULT ClassLoadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ClassID classId, HRESULT hrStatus) { return profInterface->ClassLoadFinished(classId, hrStatus); } @@ -829,7 +815,7 @@ inline void ProfControlBlock::ClassLoadFinished(ClassID classId, HRESULT hrStatu classId, hrStatus); } -inline HRESULT ClassUnloadStartedHelper(void *additionalData, VolatilePtr profInterface, ClassID classId) +inline HRESULT ClassUnloadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ClassID classId) { return profInterface->ClassUnloadStarted(classId); } @@ -845,7 +831,7 @@ inline void ProfControlBlock::ClassUnloadStarted(ClassID classId) classId); } -inline HRESULT ClassUnloadFinishedHelper(void *additionalData, VolatilePtr profInterface, ClassID classId, HRESULT hrStatus) +inline HRESULT ClassUnloadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ClassID classId, HRESULT hrStatus) { return profInterface->ClassUnloadFinished(classId, hrStatus); } @@ -874,7 +860,7 @@ inline BOOL IsProfilerTrackingAppDomainLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_APPDOMAIN_LOADS); } -inline HRESULT AppDomainCreationStartedHelper(void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId) +inline HRESULT AppDomainCreationStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId) { return profInterface->AppDomainCreationStarted(appDomainId); } @@ -890,7 +876,7 @@ inline void ProfControlBlock::AppDomainCreationStarted(AppDomainID appDomainId) appDomainId); } -inline HRESULT AppDomainCreationFinishedHelper(void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId, HRESULT hrStatus) +inline HRESULT AppDomainCreationFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId, HRESULT hrStatus) { return profInterface->AppDomainCreationFinished(appDomainId, hrStatus); } @@ -906,7 +892,7 @@ inline void ProfControlBlock::AppDomainCreationFinished(AppDomainID appDomainId, appDomainId, hrStatus); } -inline HRESULT AppDomainShutdownStartedHelper(void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId) +inline HRESULT AppDomainShutdownStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId) { return profInterface->AppDomainShutdownStarted(appDomainId); } @@ -922,7 +908,7 @@ inline void ProfControlBlock::AppDomainShutdownStarted(AppDomainID appDomainId) appDomainId); } -inline HRESULT AppDomainShutdownFinishedHelper(void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId, HRESULT hrStatus) +inline HRESULT AppDomainShutdownFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId, HRESULT hrStatus) { return profInterface->AppDomainShutdownFinished(appDomainId, hrStatus); } @@ -951,7 +937,7 @@ inline BOOL IsProfilerTrackingAssemblyLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_ASSEMBLY_LOADS); } -inline HRESULT AssemblyLoadStartedHelper(void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId) +inline HRESULT AssemblyLoadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId) { return profInterface->AssemblyLoadStarted(assemblyId); } @@ -967,7 +953,7 @@ inline void ProfControlBlock::AssemblyLoadStarted(AssemblyID assemblyId) assemblyId); } -inline HRESULT AssemblyLoadFinishedHelper(void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId, HRESULT hrStatus) +inline HRESULT AssemblyLoadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId, HRESULT hrStatus) { return profInterface->AssemblyLoadFinished(assemblyId, hrStatus); } @@ -983,7 +969,7 @@ inline void ProfControlBlock::AssemblyLoadFinished(AssemblyID assemblyId, HRESUL assemblyId, hrStatus); } -inline HRESULT AssemblyUnloadStartedHelper(void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId) +inline HRESULT AssemblyUnloadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId) { return profInterface->AssemblyUnloadStarted(assemblyId); } @@ -999,7 +985,7 @@ inline void ProfControlBlock::AssemblyUnloadStarted(AssemblyID assemblyId) assemblyId); } -inline HRESULT AssemblyUnloadFinishedHelper(void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId, HRESULT hrStatus) +inline HRESULT AssemblyUnloadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId, HRESULT hrStatus) { return profInterface->AssemblyUnloadFinished(assemblyId, hrStatus); } @@ -1028,7 +1014,7 @@ inline BOOL IsProfilerTrackingTransitions(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CODE_TRANSITIONS); } -inline HRESULT UnmanagedToManagedTransitionHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) +inline HRESULT UnmanagedToManagedTransitionHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) { return profInterface->UnmanagedToManagedTransition(functionId, reason); } @@ -1044,7 +1030,7 @@ inline void ProfControlBlock::UnmanagedToManagedTransition(FunctionID functionId functionId, reason); } -inline HRESULT ManagedToUnmanagedTransitionHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) +inline HRESULT ManagedToUnmanagedTransitionHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) { return profInterface->ManagedToUnmanagedTransition(functionId, reason); } @@ -1073,7 +1059,7 @@ inline BOOL IsProfilerTrackingExceptions(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_EXCEPTIONS); } -inline HRESULT ExceptionThrownHelper(void *additionalData, VolatilePtr profInterface, ObjectID thrownObjectId) +inline HRESULT ExceptionThrownHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ObjectID thrownObjectId) { return profInterface->ExceptionThrown(thrownObjectId); } @@ -1089,7 +1075,7 @@ inline void ProfControlBlock::ExceptionThrown(ObjectID thrownObjectId) thrownObjectId); } -inline HRESULT ExceptionSearchFunctionEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId) +inline HRESULT ExceptionSearchFunctionEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId) { return profInterface->ExceptionSearchFunctionEnter(functionId); } @@ -1105,7 +1091,7 @@ inline void ProfControlBlock::ExceptionSearchFunctionEnter(FunctionID functionId functionId); } -inline HRESULT ExceptionSearchFunctionLeaveHelper(void *additionalData, VolatilePtr profInterface) +inline HRESULT ExceptionSearchFunctionLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) { return profInterface->ExceptionSearchFunctionLeave(); } @@ -1120,7 +1106,7 @@ inline void ProfControlBlock::ExceptionSearchFunctionLeave() &ExceptionSearchFunctionLeaveHelper); } -inline HRESULT ExceptionSearchFilterEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID funcId) +inline HRESULT ExceptionSearchFilterEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID funcId) { return profInterface->ExceptionSearchFilterEnter(funcId); } @@ -1136,7 +1122,7 @@ inline void ProfControlBlock::ExceptionSearchFilterEnter(FunctionID funcId) funcId); } -inline HRESULT ExceptionSearchFilterLeaveHelper(void *additionalData, VolatilePtr profInterface) +inline HRESULT ExceptionSearchFilterLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) { return profInterface->ExceptionSearchFilterLeave(); } @@ -1151,7 +1137,7 @@ inline void ProfControlBlock::ExceptionSearchFilterLeave() &ExceptionSearchFilterLeaveHelper); } -inline HRESULT ExceptionSearchCatcherFoundHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId) +inline HRESULT ExceptionSearchCatcherFoundHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId) { return profInterface->ExceptionSearchCatcherFound(functionId); } @@ -1167,7 +1153,7 @@ inline void ProfControlBlock::ExceptionSearchCatcherFound(FunctionID functionId) functionId); } -inline HRESULT ExceptionOSHandlerEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID funcId) +inline HRESULT ExceptionOSHandlerEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID funcId) { return profInterface->ExceptionOSHandlerEnter(funcId); } @@ -1183,7 +1169,7 @@ inline void ProfControlBlock::ExceptionOSHandlerEnter(FunctionID funcId) funcId); } -inline HRESULT ExceptionOSHandlerLeaveHelper(void *additionalData, VolatilePtr profInterface, FunctionID funcId) +inline HRESULT ExceptionOSHandlerLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID funcId) { return profInterface->ExceptionOSHandlerLeave(funcId); } @@ -1199,7 +1185,7 @@ inline void ProfControlBlock::ExceptionOSHandlerLeave(FunctionID funcId) funcId); } -inline HRESULT ExceptionUnwindFunctionEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId) +inline HRESULT ExceptionUnwindFunctionEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId) { return profInterface->ExceptionUnwindFunctionEnter(functionId); } @@ -1215,7 +1201,7 @@ inline void ProfControlBlock::ExceptionUnwindFunctionEnter(FunctionID functionId functionId); } -inline HRESULT ExceptionUnwindFunctionLeaveHelper(void *additionalData, VolatilePtr profInterface) +inline HRESULT ExceptionUnwindFunctionLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) { return profInterface->ExceptionUnwindFunctionLeave(); } @@ -1230,7 +1216,7 @@ inline void ProfControlBlock::ExceptionUnwindFunctionLeave() &ExceptionUnwindFunctionLeaveHelper); } -inline HRESULT ExceptionUnwindFinallyEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId) +inline HRESULT ExceptionUnwindFinallyEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId) { return profInterface->ExceptionUnwindFinallyEnter(functionId); } @@ -1246,7 +1232,7 @@ inline void ProfControlBlock::ExceptionUnwindFinallyEnter(FunctionID functionId) functionId); } -inline HRESULT ExceptionUnwindFinallyLeaveHelper(void *additionalData, VolatilePtr profInterface) +inline HRESULT ExceptionUnwindFinallyLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) { return profInterface->ExceptionUnwindFinallyLeave(); } @@ -1261,7 +1247,7 @@ inline void ProfControlBlock::ExceptionUnwindFinallyLeave() &ExceptionUnwindFinallyLeaveHelper); } -inline HRESULT ExceptionCatcherEnterHelper(void *additionalData, VolatilePtr profInterface, FunctionID functionId, ObjectID objectId) +inline HRESULT ExceptionCatcherEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, ObjectID objectId) { return profInterface->ExceptionCatcherEnter(functionId, objectId); } @@ -1277,7 +1263,7 @@ inline void ProfControlBlock::ExceptionCatcherEnter(FunctionID functionId, Objec functionId, objectId); } -inline HRESULT ExceptionCatcherLeaveHelper(void *additionalData, VolatilePtr profInterface) +inline HRESULT ExceptionCatcherLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) { return profInterface->ExceptionCatcherLeave(); } @@ -1305,7 +1291,7 @@ inline BOOL IsProfilerTrackingCCW(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CCW); } -inline HRESULT COMClassicVTableCreatedHelper(void *additionalData, VolatilePtr profInterface, ClassID wrappedClassId, REFGUID implementedIID, void *pVTable, ULONG cSlots) +inline HRESULT COMClassicVTableCreatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ClassID wrappedClassId, REFGUID implementedIID, void *pVTable, ULONG cSlots) { return profInterface->COMClassicVTableCreated(wrappedClassId, implementedIID, pVTable, cSlots); } @@ -1334,7 +1320,7 @@ inline BOOL IsProfilerTrackingSuspends(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_SUSPENDS); } -inline HRESULT RuntimeSuspendStartedHelper(void *additionalData, VolatilePtr profInterface, COR_PRF_SUSPEND_REASON suspendReason) +inline HRESULT RuntimeSuspendStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, COR_PRF_SUSPEND_REASON suspendReason) { return profInterface->RuntimeSuspendStarted(suspendReason); } @@ -1350,7 +1336,7 @@ inline void ProfControlBlock::RuntimeSuspendStarted(COR_PRF_SUSPEND_REASON suspe suspendReason); } -inline HRESULT RuntimeSuspendFinishedHelper(void *additionalData, VolatilePtr profInterface) +inline HRESULT RuntimeSuspendFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) { return profInterface->RuntimeSuspendFinished(); } @@ -1365,7 +1351,7 @@ inline void ProfControlBlock::RuntimeSuspendFinished() &RuntimeSuspendFinishedHelper); } -inline HRESULT RuntimeSuspendAbortedHelper(void *additionalData, VolatilePtr profInterface) +inline HRESULT RuntimeSuspendAbortedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) { return profInterface->RuntimeSuspendAborted(); } @@ -1380,7 +1366,7 @@ inline void ProfControlBlock::RuntimeSuspendAborted() &RuntimeSuspendAbortedHelper); } -inline HRESULT RuntimeResumeStartedHelper(void *additionalData, VolatilePtr profInterface) +inline HRESULT RuntimeResumeStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) { return profInterface->RuntimeResumeStarted(); } @@ -1395,7 +1381,7 @@ inline void ProfControlBlock::RuntimeResumeStarted() &RuntimeResumeStartedHelper); } -inline HRESULT RuntimeResumeFinishedHelper(void *additionalData, VolatilePtr profInterface) +inline HRESULT RuntimeResumeFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) { return profInterface->RuntimeResumeFinished(); } @@ -1410,7 +1396,7 @@ inline void ProfControlBlock::RuntimeResumeFinished() &RuntimeResumeFinishedHelper); } -inline HRESULT RuntimeThreadSuspendedHelper(void *additionalData, VolatilePtr profInterface, ThreadID suspendedThreadId) +inline HRESULT RuntimeThreadSuspendedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID suspendedThreadId) { return profInterface->RuntimeThreadSuspended(suspendedThreadId); } @@ -1426,7 +1412,7 @@ inline void ProfControlBlock::RuntimeThreadSuspended(ThreadID suspendedThreadId) suspendedThreadId); } -inline HRESULT RuntimeThreadResumedHelper(void *additionalData, VolatilePtr profInterface, ThreadID resumedThreadId) +inline HRESULT RuntimeThreadResumedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID resumedThreadId) { return profInterface->RuntimeThreadResumed(resumedThreadId); } @@ -1456,7 +1442,7 @@ inline BOOL IsProfilerTrackingAllocations(ProfilerInfo *pProfilerInfo) || pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED)); } -inline HRESULT ObjectAllocatedHelper(void *additionalData, VolatilePtr profInterface, ObjectID objectId, ClassID classId) +inline HRESULT ObjectAllocatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ObjectID objectId, ClassID classId) { return profInterface->ObjectAllocated(objectId, classId); } @@ -1486,7 +1472,7 @@ inline BOOL IsProfilerTrackingGC(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_GC); } -inline HRESULT FinalizeableObjectQueuedHelper(void *additionalData, VolatilePtr profInterface, BOOL isCritical, ObjectID objectID) +inline HRESULT FinalizeableObjectQueuedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, BOOL isCritical, ObjectID objectID) { return profInterface->FinalizeableObjectQueued(isCritical, objectID); } @@ -1502,7 +1488,7 @@ inline void ProfControlBlock::FinalizeableObjectQueued(BOOL isCritical, ObjectID isCritical, objectID); } -inline HRESULT MovedReferenceHelper(void *additionalData, VolatilePtr profInterface, BYTE *pbMemBlockStart, BYTE *pbMemBlockEnd, ptrdiff_t cbRelocDistance, void *pHeapId, BOOL fCompacting) +inline HRESULT MovedReferenceHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, BYTE *pbMemBlockStart, BYTE *pbMemBlockEnd, ptrdiff_t cbRelocDistance, void *pHeapId, BOOL fCompacting) { return profInterface->MovedReference(pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); } @@ -1518,7 +1504,7 @@ inline void ProfControlBlock::MovedReference(BYTE *pbMemBlockStart, BYTE *pbMemB pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); } -inline HRESULT EndMovedReferencesHelper(void *additionalData, VolatilePtr profInterface, void *pHeapId) +inline HRESULT EndMovedReferencesHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, void *pHeapId) { return profInterface->EndMovedReferences(pHeapId); } @@ -1534,7 +1520,7 @@ inline void ProfControlBlock::EndMovedReferences(void *pHeapId) pHeapId); } -inline HRESULT RootReference2Helper(void *additionalData, VolatilePtr profInterface, BYTE *objectId, EtwGCRootKind dwEtwRootKind, EtwGCRootFlags dwEtwRootFlags, void *rootID, void *pHeapId) +inline HRESULT RootReference2Helper(void *additionalData, EEToProfInterfaceImpl *profInterface, BYTE *objectId, EtwGCRootKind dwEtwRootKind, EtwGCRootFlags dwEtwRootFlags, void *rootID, void *pHeapId) { return profInterface->RootReference2(objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); } @@ -1550,7 +1536,7 @@ inline void ProfControlBlock::RootReference2(BYTE *objectId, EtwGCRootKind dwEtw objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); } -inline HRESULT EndRootReferences2Helper(void *additionalData, VolatilePtr profInterface, void *pHeapId) +inline HRESULT EndRootReferences2Helper(void *additionalData, EEToProfInterfaceImpl *profInterface, void *pHeapId) { return profInterface->EndRootReferences2(pHeapId); } @@ -1566,7 +1552,7 @@ inline void ProfControlBlock::EndRootReferences2(void *pHeapId) pHeapId); } -inline HRESULT ConditionalWeakTableElementReferenceHelper(void *additionalData, VolatilePtr profInterface, BYTE *primaryObjectId, BYTE *secondaryObjectId, void *rootID, void *pHeapId) +inline HRESULT ConditionalWeakTableElementReferenceHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, BYTE *primaryObjectId, BYTE *secondaryObjectId, void *rootID, void *pHeapId) { if (!profInterface->IsCallback5Supported()) { @@ -1587,7 +1573,7 @@ inline void ProfControlBlock::ConditionalWeakTableElementReference(BYTE *primary primaryObjectId, secondaryObjectId, rootID, pHeapId); } -inline HRESULT EndConditionalWeakTableElementReferencesHelper(void *additionalData, VolatilePtr profInterface, void *pHeapId) +inline HRESULT EndConditionalWeakTableElementReferencesHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, void *pHeapId) { if (!profInterface->IsCallback5Supported()) { @@ -1608,7 +1594,7 @@ inline void ProfControlBlock::EndConditionalWeakTableElementReferences(void *pHe pHeapId); } -inline HRESULT AllocByClassHelper(void *additionalData, VolatilePtr profInterface, ObjectID objId, ClassID classId, void *pHeapId) +inline HRESULT AllocByClassHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ObjectID objId, ClassID classId, void *pHeapId) { return profInterface->AllocByClass(objId, classId, pHeapId); } @@ -1624,7 +1610,7 @@ inline void ProfControlBlock::AllocByClass(ObjectID objId, ClassID classId, void objId, classId, pHeapId); } -inline HRESULT EndAllocByClassHelper(void *additionalData, VolatilePtr profInterface, void *pHeapId) +inline HRESULT EndAllocByClassHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, void *pHeapId) { return profInterface->EndAllocByClass(pHeapId); } @@ -1640,7 +1626,7 @@ inline void ProfControlBlock::EndAllocByClass(void *pHeapId) pHeapId); } -inline HRESULT ObjectReferenceHelper(void *additionalData, VolatilePtr profInterface, ObjectID objId, ClassID classId, ULONG cNumRefs, ObjectID *arrObjRef) +inline HRESULT ObjectReferenceHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ObjectID objId, ClassID classId, ULONG cNumRefs, ObjectID *arrObjRef) { return profInterface->ObjectReference(objId, classId, cNumRefs, arrObjRef); } @@ -1656,7 +1642,7 @@ inline HRESULT ProfControlBlock::ObjectReference(ObjectID objId, ClassID classId objId, classId, cNumRefs, arrObjRef); } -inline HRESULT HandleCreatedHelper(void *additionalData, VolatilePtr profInterface, UINT_PTR handleId, ObjectID initialObjectId) +inline HRESULT HandleCreatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, UINT_PTR handleId, ObjectID initialObjectId) { return profInterface->HandleCreated(handleId, initialObjectId); } @@ -1672,7 +1658,7 @@ inline void ProfControlBlock::HandleCreated(UINT_PTR handleId, ObjectID initialO handleId, initialObjectId); } -inline HRESULT HandleDestroyedHelper(void *additionalData, VolatilePtr profInterface, UINT_PTR handleId) +inline HRESULT HandleDestroyedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, UINT_PTR handleId) { return profInterface->HandleDestroyed(handleId); } @@ -1725,7 +1711,7 @@ inline BOOL IsProfilerTrackingGCOrMovedObjects(ProfilerInfo *pProfilerInfo) return IsProfilerTrackingGC(pProfilerInfo) || IsProfilerTrackingMovedObjects(pProfilerInfo); } -inline HRESULT GarbageCollectionStartedHelper(void *additionalData, VolatilePtr profInterface, int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason) +inline HRESULT GarbageCollectionStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason) { return profInterface->GarbageCollectionStarted(cGenerations, generationCollected, reason); } @@ -1741,7 +1727,7 @@ inline void ProfControlBlock::GarbageCollectionStarted(int cGenerations, BOOL ge cGenerations, generationCollected, reason); } -inline HRESULT GarbageCollectionFinishedHelper(void *additionalData, VolatilePtr profInterface) +inline HRESULT GarbageCollectionFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) { return profInterface->GarbageCollectionFinished(); } @@ -1770,7 +1756,7 @@ inline BOOL IsProfilerMonitoringEventPipe(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_EVENT_PIPE); } -inline HRESULT EventPipeEventDeliveredHelper(void *additionalData, VolatilePtr profInterface, +inline HRESULT EventPipeEventDeliveredHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, EventPipeProvider *provider, DWORD eventId, DWORD eventVersion, @@ -1831,7 +1817,7 @@ inline void ProfControlBlock::EventPipeEventDelivered(EventPipeProvider *provide stackFrames); } -inline HRESULT EventPipeProviderCreatedHelper(void *additionalData, VolatilePtr profInterface, EventPipeProvider *provider) +inline HRESULT EventPipeProviderCreatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, EventPipeProvider *provider) { return profInterface->EventPipeProviderCreated(provider); } From cb927c3b27d99602171f2f18bcb63fb5ce1902c3 Mon Sep 17 00:00:00 2001 From: David Mason Date: Wed, 6 Oct 2021 03:20:57 -0700 Subject: [PATCH 5/7] Replace static contracts that I accidentally overwrote --- src/coreclr/inc/profilepriv.inl | 312 +++++--------------------------- 1 file changed, 42 insertions(+), 270 deletions(-) diff --git a/src/coreclr/inc/profilepriv.inl b/src/coreclr/inc/profilepriv.inl index 8007c451f98fd2..30889dbdf4ea42 100644 --- a/src/coreclr/inc/profilepriv.inl +++ b/src/coreclr/inc/profilepriv.inl @@ -1840,7 +1840,7 @@ inline void ProfControlBlock::EventPipeProviderCreated(EventPipeProvider *provid FORCEINLINE BOOL CORProfilerPresent() { - LIMITED_METHOD_DAC_CONTRACT; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->mainProfilerInfo.pProfInterface.Load() != NULL || (&g_profControlBlock)->notificationProfilerCount.Load() > 0; @@ -1848,7 +1848,7 @@ FORCEINLINE BOOL CORProfilerPresent() FORCEINLINE BOOL CORMainProfilerPresent() { - LIMITED_METHOD_DAC_CONTRACT; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->mainProfilerInfo.curProfStatus.Get() >= kProfStatusActive; } @@ -1858,13 +1858,7 @@ FORCEINLINE BOOL CORMainProfilerPresent() FORCEINLINE BOOL CORProfilerFunctionIDMapperEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (CORMainProfilerPresent() && ( @@ -1875,117 +1869,63 @@ FORCEINLINE BOOL CORProfilerFunctionIDMapperEnabled() FORCEINLINE BOOL CORProfilerTrackJITInfo() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_JIT_COMPILATION); } FORCEINLINE BOOL CORProfilerTrackCacheSearches() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CACHE_SEARCHES); } FORCEINLINE BOOL CORProfilerTrackModuleLoads() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_MODULE_LOADS); } FORCEINLINE BOOL CORProfilerTrackAssemblyLoads() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_ASSEMBLY_LOADS); } FORCEINLINE BOOL CORProfilerTrackAppDomainLoads() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_APPDOMAIN_LOADS); } FORCEINLINE BOOL CORProfilerTrackThreads() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_THREADS); } FORCEINLINE BOOL CORProfilerTrackClasses() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CLASS_LOADS); } FORCEINLINE BOOL CORProfilerTrackGC() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_GC); } FORCEINLINE BOOL CORProfilerTrackAllocationsEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return ( @@ -1998,91 +1938,49 @@ FORCEINLINE BOOL CORProfilerTrackAllocationsEnabled() FORCEINLINE BOOL CORProfilerTrackAllocations() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_OBJECT_ALLOCATED); } FORCEINLINE BOOL CORProfilerTrackLargeAllocations() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED); } FORCEINLINE BOOL CORProfilerTrackPinnedAllocations() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED); } FORCEINLINE BOOL CORProfilerEnableRejit() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_REJIT); } FORCEINLINE BOOL CORProfilerTrackExceptions() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_EXCEPTIONS); } FORCEINLINE BOOL CORProfilerTrackTransitions() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CODE_TRANSITIONS); } FORCEINLINE BOOL CORProfilerTrackEnterLeave() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; #ifdef PROF_TEST_ONLY_FORCE_ELT if ((&g_profControlBlock)->fTestOnlyForceEnterLeave) @@ -2094,39 +1992,21 @@ FORCEINLINE BOOL CORProfilerTrackEnterLeave() FORCEINLINE BOOL CORProfilerTrackCCW() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CCW); } FORCEINLINE BOOL CORProfilerTrackSuspends() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_SUSPENDS); } FORCEINLINE BOOL CORProfilerDisableInlining() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_INLINING); } @@ -2147,13 +2027,7 @@ FORCEINLINE BOOL CORProfilerDisableOptimizations() FORCEINLINE BOOL CORProfilerUseProfileImages() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; #ifdef PROF_TEST_ONLY_FORCE_ELT if ((&g_profControlBlock)->fTestOnlyForceEnterLeave) @@ -2165,14 +2039,14 @@ FORCEINLINE BOOL CORProfilerUseProfileImages() FORCEINLINE BOOL CORProfilerDisableAllNGenImages() { - LIMITED_METHOD_DAC_CONTRACT; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_ALL_NGEN_IMAGES); } FORCEINLINE BOOL CORProfilerTrackConditionalWeakTableElements() { - LIMITED_METHOD_DAC_CONTRACT; + STATIC_CONTRACT_LIMITED_METHOD; return CORProfilerTrackGC() && (&g_profControlBlock)->IsCallback5Supported(); } @@ -2187,182 +2061,98 @@ FORCEINLINE BOOL CORProfilerTrackConditionalWeakTableElements() FORCEINLINE BOOL CORProfilerELT3SlowPathEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO)); } FORCEINLINE BOOL CORProfilerELT3SlowPathEnterEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO)); } FORCEINLINE BOOL CORProfilerELT3SlowPathLeaveEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO)); } FORCEINLINE BOOL CORProfilerELT3SlowPathTailcallEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FRAME_INFO)); } FORCEINLINE BOOL CORProfilerELT2FastPathEnterEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO))); } FORCEINLINE BOOL CORProfilerELT2FastPathLeaveEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO))); } FORCEINLINE BOOL CORProfilerELT2FastPathTailcallEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FRAME_INFO))); } FORCEINLINE BOOL CORProfilerFunctionArgsEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FUNCTION_ARGS); } FORCEINLINE BOOL CORProfilerFunctionReturnValueEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FUNCTION_RETVAL); } FORCEINLINE BOOL CORProfilerFrameInfoEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FRAME_INFO); } FORCEINLINE BOOL CORProfilerStackSnapshotEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_STACK_SNAPSHOT); } FORCEINLINE BOOL CORProfilerInMemorySymbolsUpdatesEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED); } FORCEINLINE BOOL CORProfilerTrackDynamicFunctionUnloads() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_DYNAMIC_FUNCTION_UNLOADS); } FORCEINLINE BOOL CORProfilerDisableTieredCompilation() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_DISABLE_TIERED_COMPILATION); @@ -2370,39 +2160,21 @@ FORCEINLINE BOOL CORProfilerDisableTieredCompilation() FORCEINLINE BOOL CORProfilerTrackBasicGC() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_BASIC_GC); } FORCEINLINE BOOL CORProfilerTrackGCMovedObjects() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_GC_MOVED_OBJECTS); } FORCEINLINE BOOL CORProfilerTrackEventPipe() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_EVENT_PIPE); } From 126bd62da28927489cfd038ea1e6173962277284 Mon Sep 17 00:00:00 2001 From: David Mason Date: Wed, 6 Oct 2021 13:03:32 -0700 Subject: [PATCH 6/7] Get rid of additionalData argument --- src/coreclr/inc/profilepriv.h | 14 +- src/coreclr/inc/profilepriv.inl | 226 +++++++++++--------------------- 2 files changed, 84 insertions(+), 156 deletions(-) diff --git a/src/coreclr/inc/profilepriv.h b/src/coreclr/inc/profilepriv.h index e78ca30e362c2b..4bd3801644002b 100644 --- a/src/coreclr/inc/profilepriv.h +++ b/src/coreclr/inc/profilepriv.h @@ -275,12 +275,12 @@ class ProfControlBlock BOOL IsMainProfiler(ProfToEEInterfaceImpl *pProfToEE); ProfilerInfo *GetProfilerInfo(ProfToEEInterfaceImpl *pProfToEE); - template - static void DoProfilerCallbackHelper(ProfilerInfo *pProfilerInfo, ConditionFunc condition, Data *additionalData, CallbackFunc callback, HRESULT *pHR, Args... args) + template + static void DoProfilerCallbackHelper(ProfilerInfo *pProfilerInfo, ConditionFunc condition, CallbackFunc callback, HRESULT *pHR, Args... args) { if (condition(pProfilerInfo)) { - HRESULT innerHR = callback(additionalData, pProfilerInfo->pProfInterface, args...); + HRESULT innerHR = callback(pProfilerInfo->pProfInterface, args...); if (FAILED(innerHR)) { *pHR = innerHR; @@ -288,13 +288,13 @@ class ProfControlBlock } } - template - FORCEINLINE HRESULT DoProfilerCallback(ProfilerCallbackType callbackType, ConditionFunc condition, Data *additionalData, CallbackFunc callback, Args... args) + template + FORCEINLINE HRESULT DoProfilerCallback(ProfilerCallbackType callbackType, ConditionFunc condition, CallbackFunc callback, Args... args) { HRESULT hr = S_OK; IterateProfilers(callbackType, - &DoProfilerCallbackHelper, - condition, additionalData, callback, &hr, args...); + &DoProfilerCallbackHelper, + condition, callback, &hr, args...); return hr; } diff --git a/src/coreclr/inc/profilepriv.inl b/src/coreclr/inc/profilepriv.inl index 30889dbdf4ea42..9c17c9071ca97d 100644 --- a/src/coreclr/inc/profilepriv.inl +++ b/src/coreclr/inc/profilepriv.inl @@ -88,7 +88,7 @@ inline void ProfilerInfo::Init() inUse = FALSE; } -inline HRESULT AnyProfilerPassesConditionHelper(BOOL *pAnyPassed, EEToProfInterfaceImpl *profInterface) +inline HRESULT AnyProfilerPassesConditionHelper(EEToProfInterfaceImpl *profInterface, BOOL *pAnyPassed) { *pAnyPassed = TRUE; return S_OK; @@ -100,8 +100,8 @@ FORCEINLINE BOOL AnyProfilerPassesCondition(ConditionFunc condition) BOOL anyPassed = FALSE; (&g_profControlBlock)->DoProfilerCallback(ProfilerCallbackType::ActiveOrInitializing, condition, - &anyPassed, - &AnyProfilerPassesConditionHelper); + &AnyProfilerPassesConditionHelper, + &anyPassed); return anyPassed; } @@ -312,7 +312,7 @@ inline BOOL IsProfilerTrackingThreads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_THREADS); } -inline HRESULT ThreadCreatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID threadID) +inline HRESULT ThreadCreatedHelper(EEToProfInterfaceImpl *profInterface, ThreadID threadID) { return profInterface->ThreadCreated(threadID); } @@ -323,12 +323,11 @@ inline void ProfControlBlock::ThreadCreated(ThreadID threadID) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, - (void *)NULL, &ThreadCreatedHelper, threadID); } -inline HRESULT ThreadDestroyedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID threadID) +inline HRESULT ThreadDestroyedHelper(EEToProfInterfaceImpl *profInterface, ThreadID threadID) { return profInterface->ThreadDestroyed(threadID); } @@ -339,12 +338,11 @@ inline void ProfControlBlock::ThreadDestroyed(ThreadID threadID) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, - (void *)NULL, &ThreadDestroyedHelper, threadID); } -inline HRESULT ThreadAssignedToOSThreadHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID managedThreadId, DWORD osThreadId) +inline HRESULT ThreadAssignedToOSThreadHelper(EEToProfInterfaceImpl *profInterface, ThreadID managedThreadId, DWORD osThreadId) { return profInterface->ThreadAssignedToOSThread(managedThreadId, osThreadId); } @@ -355,12 +353,11 @@ inline void ProfControlBlock::ThreadAssignedToOSThread(ThreadID managedThreadId, DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, - (void *)NULL, &ThreadAssignedToOSThreadHelper, managedThreadId, osThreadId); } -inline HRESULT ThreadNameChangedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID managedThreadId, ULONG cchName, WCHAR name[]) +inline HRESULT ThreadNameChangedHelper(EEToProfInterfaceImpl *profInterface, ThreadID managedThreadId, ULONG cchName, WCHAR name[]) { return profInterface->ThreadNameChanged(managedThreadId, cchName, name); } @@ -371,12 +368,11 @@ inline void ProfControlBlock::ThreadNameChanged(ThreadID managedThreadId, ULONG DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, - (void *)NULL, &ThreadNameChangedHelper, managedThreadId, cchName, name); } -inline HRESULT ShutdownHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) +inline HRESULT ShutdownHelper(EEToProfInterfaceImpl *profInterface) { return profInterface->Shutdown(); } @@ -387,7 +383,6 @@ inline void ProfControlBlock::Shutdown() DoProfilerCallback(ProfilerCallbackType::Active, [](ProfilerInfo *pProfilerInfo) { return true; }, - (void *)NULL, &ShutdownHelper); } @@ -404,7 +399,7 @@ inline BOOL IsProfilerTrackingJITInfo(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_JIT_COMPILATION); } -inline HRESULT JITCompilationFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) +inline HRESULT JITCompilationFinishedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) { return profInterface->JITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); } @@ -415,12 +410,11 @@ inline void ProfControlBlock::JITCompilationFinished(FunctionID functionId, HRES DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, - (void *)NULL, &JITCompilationFinishedHelper, functionId, hrStatus, fIsSafeToBlock); } -inline HRESULT JITCompilationStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, BOOL fIsSafeToBlock) +inline HRESULT JITCompilationStartedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, BOOL fIsSafeToBlock) { return profInterface->JITCompilationStarted(functionId, fIsSafeToBlock); } @@ -431,12 +425,11 @@ inline void ProfControlBlock::JITCompilationStarted(FunctionID functionId, BOOL DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, - (void *)NULL, &JITCompilationStartedHelper, functionId, fIsSafeToBlock); } -inline HRESULT DynamicMethodJITCompilationStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, BOOL fIsSafeToBlock, LPCBYTE pILHeader, ULONG cbILHeader) +inline HRESULT DynamicMethodJITCompilationStartedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, BOOL fIsSafeToBlock, LPCBYTE pILHeader, ULONG cbILHeader) { return profInterface->DynamicMethodJITCompilationStarted(functionId, fIsSafeToBlock, pILHeader, cbILHeader); } @@ -447,12 +440,11 @@ inline void ProfControlBlock::DynamicMethodJITCompilationStarted(FunctionID func DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, - (void *)NULL, &DynamicMethodJITCompilationStartedHelper, functionId, fIsSafeToBlock, pILHeader, cbILHeader); } -inline HRESULT DynamicMethodJITCompilationFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) +inline HRESULT DynamicMethodJITCompilationFinishedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) { return profInterface->DynamicMethodJITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); } @@ -463,7 +455,6 @@ inline void ProfControlBlock::DynamicMethodJITCompilationFinished(FunctionID fun DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, - (void *)NULL, &DynamicMethodJITCompilationFinishedHelper, functionId, hrStatus, fIsSafeToBlock); } @@ -481,7 +472,7 @@ inline BOOL IsProfilerMonitoringDynamicFunctionUnloads(ProfilerInfo *pProfilerIn return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_DYNAMIC_FUNCTION_UNLOADS); } -inline HRESULT DynamicMethodUnloadedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId) +inline HRESULT DynamicMethodUnloadedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId) { return profInterface->DynamicMethodUnloaded(functionId); } @@ -492,7 +483,6 @@ inline void ProfControlBlock::DynamicMethodUnloaded(FunctionID functionId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerMonitoringDynamicFunctionUnloads, - (void *)NULL, &DynamicMethodUnloadedHelper, functionId); } @@ -510,7 +500,7 @@ inline BOOL IsProfilerTrackingCacheSearches(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CACHE_SEARCHES); } -inline HRESULT JITCachedFunctionSearchStartedHelper(BOOL *pAllTrue, EEToProfInterfaceImpl *profInterface, FunctionID functionId, BOOL *pbUseCachedFunction) +inline HRESULT JITCachedFunctionSearchStartedHelper(EEToProfInterfaceImpl *profInterface, BOOL *pAllTrue, FunctionID functionId, BOOL *pbUseCachedFunction) { HRESULT hr = profInterface->JITCachedFunctionSearchStarted(functionId, pbUseCachedFunction); *pAllTrue = *pAllTrue && *pbUseCachedFunction; @@ -525,15 +515,14 @@ inline void ProfControlBlock::JITCachedFunctionSearchStarted(FunctionID function BOOL allTrue = TRUE; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingCacheSearches, - &allTrue, &JITCachedFunctionSearchStartedHelper, - functionId, pbUseCachedFunction); + &allTrue, functionId, pbUseCachedFunction); // If any reject it, consider it rejected. *pbUseCachedFunction = allTrue; } -inline HRESULT JITCachedFunctionSearchFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_JIT_CACHE result) +inline HRESULT JITCachedFunctionSearchFinishedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_JIT_CACHE result) { return profInterface->JITCachedFunctionSearchFinished(functionId, result); } @@ -544,12 +533,11 @@ inline void ProfControlBlock::JITCachedFunctionSearchFinished(FunctionID functio DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingCacheSearches, - (void *)NULL, &JITCachedFunctionSearchFinishedHelper, functionId, result); } -inline HRESULT JITInliningHelper(BOOL *pAllTrue, EEToProfInterfaceImpl *profInterface, FunctionID callerId, FunctionID calleeId, BOOL *pfShouldInline) +inline HRESULT JITInliningHelper(EEToProfInterfaceImpl *profInterface, BOOL *pAllTrue, FunctionID callerId, FunctionID calleeId, BOOL *pfShouldInline) { HRESULT hr = profInterface->JITInlining(callerId, calleeId, pfShouldInline); *pAllTrue = *pAllTrue && *pfShouldInline; @@ -564,9 +552,8 @@ inline HRESULT ProfControlBlock::JITInlining(FunctionID callerId, FunctionID cal BOOL allTrue = TRUE; HRESULT hr = DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, - &allTrue, &JITInliningHelper, - callerId, calleeId, pfShouldInline); + &allTrue, callerId, calleeId, pfShouldInline); // If any reject it, consider it rejected. *pfShouldInline = allTrue; @@ -661,7 +648,7 @@ inline BOOL IsProfilerTrackingModuleLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_MODULE_LOADS); } -inline HRESULT ModuleLoadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId) +inline HRESULT ModuleLoadStartedHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId) { return profInterface->ModuleLoadStarted(moduleId); } @@ -672,12 +659,11 @@ inline void ProfControlBlock::ModuleLoadStarted(ModuleID moduleId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, - (void *)NULL, &ModuleLoadStartedHelper, moduleId); } -inline HRESULT ModuleLoadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId, HRESULT hrStatus) +inline HRESULT ModuleLoadFinishedHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId, HRESULT hrStatus) { return profInterface->ModuleLoadFinished(moduleId, hrStatus); } @@ -688,12 +674,11 @@ inline void ProfControlBlock::ModuleLoadFinished(ModuleID moduleId, HRESULT hrSt DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, - (void *)NULL, &ModuleLoadFinishedHelper, moduleId, hrStatus); } -inline HRESULT ModuleUnloadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId) +inline HRESULT ModuleUnloadStartedHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId) { return profInterface->ModuleUnloadStarted(moduleId); } @@ -704,12 +689,11 @@ inline void ProfControlBlock::ModuleUnloadStarted(ModuleID moduleId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, - (void *)NULL, &ModuleUnloadStartedHelper, moduleId); } -inline HRESULT ModuleUnloadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId, HRESULT hrStatus) +inline HRESULT ModuleUnloadFinishedHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId, HRESULT hrStatus) { return profInterface->ModuleUnloadFinished(moduleId, hrStatus); } @@ -720,12 +704,11 @@ inline void ProfControlBlock::ModuleUnloadFinished(ModuleID moduleId, HRESULT hr DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, - (void *)NULL, &ModuleUnloadFinishedHelper, moduleId, hrStatus); } -inline HRESULT ModuleAttachedToAssemblyHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId, AssemblyID AssemblyId) +inline HRESULT ModuleAttachedToAssemblyHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId, AssemblyID AssemblyId) { return profInterface->ModuleAttachedToAssembly(moduleId, AssemblyId); } @@ -736,7 +719,6 @@ inline void ProfControlBlock::ModuleAttachedToAssembly(ModuleID moduleId, Assemb DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, - (void *)NULL, &ModuleAttachedToAssemblyHelper, moduleId, AssemblyId); } @@ -754,7 +736,7 @@ inline BOOL IsProfilerTrackingInMemorySymbolsUpdatesEnabled(ProfilerInfo *pProfi return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED); } -inline HRESULT ModuleInMemorySymbolsUpdatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ModuleID moduleId) +inline HRESULT ModuleInMemorySymbolsUpdatedHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId) { return profInterface->ModuleInMemorySymbolsUpdated(moduleId); } @@ -765,7 +747,6 @@ inline void ProfControlBlock::ModuleInMemorySymbolsUpdated(ModuleID moduleId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingInMemorySymbolsUpdatesEnabled, - (void *)NULL, &ModuleInMemorySymbolsUpdatedHelper, moduleId); } @@ -783,7 +764,7 @@ inline BOOL IsProfilerTrackingClasses(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CLASS_LOADS); } -inline HRESULT ClassLoadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ClassID classId) +inline HRESULT ClassLoadStartedHelper(EEToProfInterfaceImpl *profInterface, ClassID classId) { return profInterface->ClassLoadStarted(classId); } @@ -794,12 +775,11 @@ inline void ProfControlBlock::ClassLoadStarted(ClassID classId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, - (void *)NULL, &ClassLoadStartedHelper, classId); } -inline HRESULT ClassLoadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ClassID classId, HRESULT hrStatus) +inline HRESULT ClassLoadFinishedHelper(EEToProfInterfaceImpl *profInterface, ClassID classId, HRESULT hrStatus) { return profInterface->ClassLoadFinished(classId, hrStatus); } @@ -810,12 +790,11 @@ inline void ProfControlBlock::ClassLoadFinished(ClassID classId, HRESULT hrStatu DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, - (void *)NULL, &ClassLoadFinishedHelper, classId, hrStatus); } -inline HRESULT ClassUnloadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ClassID classId) +inline HRESULT ClassUnloadStartedHelper(EEToProfInterfaceImpl *profInterface, ClassID classId) { return profInterface->ClassUnloadStarted(classId); } @@ -826,12 +805,11 @@ inline void ProfControlBlock::ClassUnloadStarted(ClassID classId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, - (void *)NULL, &ClassUnloadStartedHelper, classId); } -inline HRESULT ClassUnloadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ClassID classId, HRESULT hrStatus) +inline HRESULT ClassUnloadFinishedHelper(EEToProfInterfaceImpl *profInterface, ClassID classId, HRESULT hrStatus) { return profInterface->ClassUnloadFinished(classId, hrStatus); } @@ -842,7 +820,6 @@ inline void ProfControlBlock::ClassUnloadFinished(ClassID classId, HRESULT hrSta DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, - (void *)NULL, &ClassUnloadFinishedHelper, classId, hrStatus); } @@ -860,7 +837,7 @@ inline BOOL IsProfilerTrackingAppDomainLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_APPDOMAIN_LOADS); } -inline HRESULT AppDomainCreationStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId) +inline HRESULT AppDomainCreationStartedHelper(EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId) { return profInterface->AppDomainCreationStarted(appDomainId); } @@ -871,12 +848,11 @@ inline void ProfControlBlock::AppDomainCreationStarted(AppDomainID appDomainId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, - (void *)NULL, &AppDomainCreationStartedHelper, appDomainId); } -inline HRESULT AppDomainCreationFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId, HRESULT hrStatus) +inline HRESULT AppDomainCreationFinishedHelper(EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId, HRESULT hrStatus) { return profInterface->AppDomainCreationFinished(appDomainId, hrStatus); } @@ -887,12 +863,11 @@ inline void ProfControlBlock::AppDomainCreationFinished(AppDomainID appDomainId, DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, - (void *)NULL, &AppDomainCreationFinishedHelper, appDomainId, hrStatus); } -inline HRESULT AppDomainShutdownStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId) +inline HRESULT AppDomainShutdownStartedHelper(EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId) { return profInterface->AppDomainShutdownStarted(appDomainId); } @@ -903,12 +878,11 @@ inline void ProfControlBlock::AppDomainShutdownStarted(AppDomainID appDomainId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, - (void *)NULL, &AppDomainShutdownStartedHelper, appDomainId); } -inline HRESULT AppDomainShutdownFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId, HRESULT hrStatus) +inline HRESULT AppDomainShutdownFinishedHelper(EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId, HRESULT hrStatus) { return profInterface->AppDomainShutdownFinished(appDomainId, hrStatus); } @@ -919,7 +893,6 @@ inline void ProfControlBlock::AppDomainShutdownFinished(AppDomainID appDomainId, DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, - (void *)NULL, &AppDomainShutdownFinishedHelper, appDomainId, hrStatus); } @@ -937,7 +910,7 @@ inline BOOL IsProfilerTrackingAssemblyLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_ASSEMBLY_LOADS); } -inline HRESULT AssemblyLoadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId) +inline HRESULT AssemblyLoadStartedHelper(EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId) { return profInterface->AssemblyLoadStarted(assemblyId); } @@ -948,12 +921,11 @@ inline void ProfControlBlock::AssemblyLoadStarted(AssemblyID assemblyId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, - (void *)NULL, &AssemblyLoadStartedHelper, assemblyId); } -inline HRESULT AssemblyLoadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId, HRESULT hrStatus) +inline HRESULT AssemblyLoadFinishedHelper(EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId, HRESULT hrStatus) { return profInterface->AssemblyLoadFinished(assemblyId, hrStatus); } @@ -964,12 +936,11 @@ inline void ProfControlBlock::AssemblyLoadFinished(AssemblyID assemblyId, HRESUL DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, - (void *)NULL, &AssemblyLoadFinishedHelper, assemblyId, hrStatus); } -inline HRESULT AssemblyUnloadStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId) +inline HRESULT AssemblyUnloadStartedHelper(EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId) { return profInterface->AssemblyUnloadStarted(assemblyId); } @@ -980,12 +951,11 @@ inline void ProfControlBlock::AssemblyUnloadStarted(AssemblyID assemblyId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, - (void *)NULL, &AssemblyUnloadStartedHelper, assemblyId); } -inline HRESULT AssemblyUnloadFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId, HRESULT hrStatus) +inline HRESULT AssemblyUnloadFinishedHelper(EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId, HRESULT hrStatus) { return profInterface->AssemblyUnloadFinished(assemblyId, hrStatus); } @@ -996,7 +966,6 @@ inline void ProfControlBlock::AssemblyUnloadFinished(AssemblyID assemblyId, HRES DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, - (void *)NULL, &AssemblyUnloadFinishedHelper, assemblyId, hrStatus); } @@ -1014,7 +983,7 @@ inline BOOL IsProfilerTrackingTransitions(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CODE_TRANSITIONS); } -inline HRESULT UnmanagedToManagedTransitionHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) +inline HRESULT UnmanagedToManagedTransitionHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) { return profInterface->UnmanagedToManagedTransition(functionId, reason); } @@ -1025,12 +994,11 @@ inline void ProfControlBlock::UnmanagedToManagedTransition(FunctionID functionId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingTransitions, - (void *)NULL, &UnmanagedToManagedTransitionHelper, functionId, reason); } -inline HRESULT ManagedToUnmanagedTransitionHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) +inline HRESULT ManagedToUnmanagedTransitionHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) { return profInterface->ManagedToUnmanagedTransition(functionId, reason); } @@ -1041,7 +1009,6 @@ inline void ProfControlBlock::ManagedToUnmanagedTransition(FunctionID functionId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingTransitions, - (void *)NULL, &ManagedToUnmanagedTransitionHelper, functionId, reason); } @@ -1059,7 +1026,7 @@ inline BOOL IsProfilerTrackingExceptions(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_EXCEPTIONS); } -inline HRESULT ExceptionThrownHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ObjectID thrownObjectId) +inline HRESULT ExceptionThrownHelper(EEToProfInterfaceImpl *profInterface, ObjectID thrownObjectId) { return profInterface->ExceptionThrown(thrownObjectId); } @@ -1070,12 +1037,11 @@ inline void ProfControlBlock::ExceptionThrown(ObjectID thrownObjectId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionThrownHelper, thrownObjectId); } -inline HRESULT ExceptionSearchFunctionEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId) +inline HRESULT ExceptionSearchFunctionEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId) { return profInterface->ExceptionSearchFunctionEnter(functionId); } @@ -1086,12 +1052,11 @@ inline void ProfControlBlock::ExceptionSearchFunctionEnter(FunctionID functionId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionSearchFunctionEnterHelper, functionId); } -inline HRESULT ExceptionSearchFunctionLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) +inline HRESULT ExceptionSearchFunctionLeaveHelper(EEToProfInterfaceImpl *profInterface) { return profInterface->ExceptionSearchFunctionLeave(); } @@ -1102,11 +1067,10 @@ inline void ProfControlBlock::ExceptionSearchFunctionLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionSearchFunctionLeaveHelper); } -inline HRESULT ExceptionSearchFilterEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID funcId) +inline HRESULT ExceptionSearchFilterEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID funcId) { return profInterface->ExceptionSearchFilterEnter(funcId); } @@ -1117,12 +1081,11 @@ inline void ProfControlBlock::ExceptionSearchFilterEnter(FunctionID funcId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionSearchFilterEnterHelper, funcId); } -inline HRESULT ExceptionSearchFilterLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) +inline HRESULT ExceptionSearchFilterLeaveHelper(EEToProfInterfaceImpl *profInterface) { return profInterface->ExceptionSearchFilterLeave(); } @@ -1133,11 +1096,10 @@ inline void ProfControlBlock::ExceptionSearchFilterLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionSearchFilterLeaveHelper); } -inline HRESULT ExceptionSearchCatcherFoundHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId) +inline HRESULT ExceptionSearchCatcherFoundHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId) { return profInterface->ExceptionSearchCatcherFound(functionId); } @@ -1148,12 +1110,11 @@ inline void ProfControlBlock::ExceptionSearchCatcherFound(FunctionID functionId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionSearchCatcherFoundHelper, functionId); } -inline HRESULT ExceptionOSHandlerEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID funcId) +inline HRESULT ExceptionOSHandlerEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID funcId) { return profInterface->ExceptionOSHandlerEnter(funcId); } @@ -1164,12 +1125,11 @@ inline void ProfControlBlock::ExceptionOSHandlerEnter(FunctionID funcId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionOSHandlerEnterHelper, funcId); } -inline HRESULT ExceptionOSHandlerLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID funcId) +inline HRESULT ExceptionOSHandlerLeaveHelper(EEToProfInterfaceImpl *profInterface, FunctionID funcId) { return profInterface->ExceptionOSHandlerLeave(funcId); } @@ -1180,12 +1140,11 @@ inline void ProfControlBlock::ExceptionOSHandlerLeave(FunctionID funcId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionOSHandlerLeaveHelper, funcId); } -inline HRESULT ExceptionUnwindFunctionEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId) +inline HRESULT ExceptionUnwindFunctionEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId) { return profInterface->ExceptionUnwindFunctionEnter(functionId); } @@ -1196,12 +1155,11 @@ inline void ProfControlBlock::ExceptionUnwindFunctionEnter(FunctionID functionId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionUnwindFunctionEnterHelper, functionId); } -inline HRESULT ExceptionUnwindFunctionLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) +inline HRESULT ExceptionUnwindFunctionLeaveHelper(EEToProfInterfaceImpl *profInterface) { return profInterface->ExceptionUnwindFunctionLeave(); } @@ -1212,11 +1170,10 @@ inline void ProfControlBlock::ExceptionUnwindFunctionLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionUnwindFunctionLeaveHelper); } -inline HRESULT ExceptionUnwindFinallyEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId) +inline HRESULT ExceptionUnwindFinallyEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId) { return profInterface->ExceptionUnwindFinallyEnter(functionId); } @@ -1227,12 +1184,11 @@ inline void ProfControlBlock::ExceptionUnwindFinallyEnter(FunctionID functionId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionUnwindFinallyEnterHelper, functionId); } -inline HRESULT ExceptionUnwindFinallyLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) +inline HRESULT ExceptionUnwindFinallyLeaveHelper(EEToProfInterfaceImpl *profInterface) { return profInterface->ExceptionUnwindFinallyLeave(); } @@ -1243,11 +1199,10 @@ inline void ProfControlBlock::ExceptionUnwindFinallyLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionUnwindFinallyLeaveHelper); } -inline HRESULT ExceptionCatcherEnterHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, FunctionID functionId, ObjectID objectId) +inline HRESULT ExceptionCatcherEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, ObjectID objectId) { return profInterface->ExceptionCatcherEnter(functionId, objectId); } @@ -1258,12 +1213,11 @@ inline void ProfControlBlock::ExceptionCatcherEnter(FunctionID functionId, Objec DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionCatcherEnterHelper, functionId, objectId); } -inline HRESULT ExceptionCatcherLeaveHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) +inline HRESULT ExceptionCatcherLeaveHelper(EEToProfInterfaceImpl *profInterface) { return profInterface->ExceptionCatcherLeave(); } @@ -1274,7 +1228,6 @@ inline void ProfControlBlock::ExceptionCatcherLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, &ExceptionCatcherLeaveHelper); } @@ -1291,7 +1244,7 @@ inline BOOL IsProfilerTrackingCCW(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CCW); } -inline HRESULT COMClassicVTableCreatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ClassID wrappedClassId, REFGUID implementedIID, void *pVTable, ULONG cSlots) +inline HRESULT COMClassicVTableCreatedHelper(EEToProfInterfaceImpl *profInterface, ClassID wrappedClassId, REFGUID implementedIID, void *pVTable, ULONG cSlots) { return profInterface->COMClassicVTableCreated(wrappedClassId, implementedIID, pVTable, cSlots); } @@ -1302,7 +1255,6 @@ inline void ProfControlBlock::COMClassicVTableCreated(ClassID wrappedClassId, RE DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingCCW, - (void *)NULL, &COMClassicVTableCreatedHelper, wrappedClassId, implementedIID, pVTable, cSlots); } @@ -1320,7 +1272,7 @@ inline BOOL IsProfilerTrackingSuspends(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_SUSPENDS); } -inline HRESULT RuntimeSuspendStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, COR_PRF_SUSPEND_REASON suspendReason) +inline HRESULT RuntimeSuspendStartedHelper(EEToProfInterfaceImpl *profInterface, COR_PRF_SUSPEND_REASON suspendReason) { return profInterface->RuntimeSuspendStarted(suspendReason); } @@ -1331,12 +1283,11 @@ inline void ProfControlBlock::RuntimeSuspendStarted(COR_PRF_SUSPEND_REASON suspe DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, &RuntimeSuspendStartedHelper, suspendReason); } -inline HRESULT RuntimeSuspendFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) +inline HRESULT RuntimeSuspendFinishedHelper(EEToProfInterfaceImpl *profInterface) { return profInterface->RuntimeSuspendFinished(); } @@ -1347,11 +1298,10 @@ inline void ProfControlBlock::RuntimeSuspendFinished() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, &RuntimeSuspendFinishedHelper); } -inline HRESULT RuntimeSuspendAbortedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) +inline HRESULT RuntimeSuspendAbortedHelper(EEToProfInterfaceImpl *profInterface) { return profInterface->RuntimeSuspendAborted(); } @@ -1362,11 +1312,10 @@ inline void ProfControlBlock::RuntimeSuspendAborted() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, &RuntimeSuspendAbortedHelper); } -inline HRESULT RuntimeResumeStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) +inline HRESULT RuntimeResumeStartedHelper(EEToProfInterfaceImpl *profInterface) { return profInterface->RuntimeResumeStarted(); } @@ -1377,11 +1326,10 @@ inline void ProfControlBlock::RuntimeResumeStarted() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, &RuntimeResumeStartedHelper); } -inline HRESULT RuntimeResumeFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) +inline HRESULT RuntimeResumeFinishedHelper(EEToProfInterfaceImpl *profInterface) { return profInterface->RuntimeResumeFinished(); } @@ -1392,11 +1340,10 @@ inline void ProfControlBlock::RuntimeResumeFinished() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, &RuntimeResumeFinishedHelper); } -inline HRESULT RuntimeThreadSuspendedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID suspendedThreadId) +inline HRESULT RuntimeThreadSuspendedHelper(EEToProfInterfaceImpl *profInterface, ThreadID suspendedThreadId) { return profInterface->RuntimeThreadSuspended(suspendedThreadId); } @@ -1407,12 +1354,11 @@ inline void ProfControlBlock::RuntimeThreadSuspended(ThreadID suspendedThreadId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, &RuntimeThreadSuspendedHelper, suspendedThreadId); } -inline HRESULT RuntimeThreadResumedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ThreadID resumedThreadId) +inline HRESULT RuntimeThreadResumedHelper(EEToProfInterfaceImpl *profInterface, ThreadID resumedThreadId) { return profInterface->RuntimeThreadResumed(resumedThreadId); } @@ -1423,7 +1369,6 @@ inline void ProfControlBlock::RuntimeThreadResumed(ThreadID resumedThreadId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, &RuntimeThreadResumedHelper, resumedThreadId); } @@ -1442,7 +1387,7 @@ inline BOOL IsProfilerTrackingAllocations(ProfilerInfo *pProfilerInfo) || pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED)); } -inline HRESULT ObjectAllocatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ObjectID objectId, ClassID classId) +inline HRESULT ObjectAllocatedHelper(EEToProfInterfaceImpl *profInterface, ObjectID objectId, ClassID classId) { return profInterface->ObjectAllocated(objectId, classId); } @@ -1453,7 +1398,6 @@ inline void ProfControlBlock::ObjectAllocated(ObjectID objectId, ClassID classId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAllocations, - (void *)NULL, &ObjectAllocatedHelper, objectId, classId); } @@ -1472,7 +1416,7 @@ inline BOOL IsProfilerTrackingGC(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_GC); } -inline HRESULT FinalizeableObjectQueuedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, BOOL isCritical, ObjectID objectID) +inline HRESULT FinalizeableObjectQueuedHelper(EEToProfInterfaceImpl *profInterface, BOOL isCritical, ObjectID objectID) { return profInterface->FinalizeableObjectQueued(isCritical, objectID); } @@ -1483,12 +1427,11 @@ inline void ProfControlBlock::FinalizeableObjectQueued(BOOL isCritical, ObjectID DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &FinalizeableObjectQueuedHelper, isCritical, objectID); } -inline HRESULT MovedReferenceHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, BYTE *pbMemBlockStart, BYTE *pbMemBlockEnd, ptrdiff_t cbRelocDistance, void *pHeapId, BOOL fCompacting) +inline HRESULT MovedReferenceHelper(EEToProfInterfaceImpl *profInterface, BYTE *pbMemBlockStart, BYTE *pbMemBlockEnd, ptrdiff_t cbRelocDistance, void *pHeapId, BOOL fCompacting) { return profInterface->MovedReference(pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); } @@ -1499,12 +1442,11 @@ inline void ProfControlBlock::MovedReference(BYTE *pbMemBlockStart, BYTE *pbMemB DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &MovedReferenceHelper, pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); } -inline HRESULT EndMovedReferencesHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, void *pHeapId) +inline HRESULT EndMovedReferencesHelper(EEToProfInterfaceImpl *profInterface, void *pHeapId) { return profInterface->EndMovedReferences(pHeapId); } @@ -1515,12 +1457,11 @@ inline void ProfControlBlock::EndMovedReferences(void *pHeapId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &EndMovedReferencesHelper, pHeapId); } -inline HRESULT RootReference2Helper(void *additionalData, EEToProfInterfaceImpl *profInterface, BYTE *objectId, EtwGCRootKind dwEtwRootKind, EtwGCRootFlags dwEtwRootFlags, void *rootID, void *pHeapId) +inline HRESULT RootReference2Helper(EEToProfInterfaceImpl *profInterface, BYTE *objectId, EtwGCRootKind dwEtwRootKind, EtwGCRootFlags dwEtwRootFlags, void *rootID, void *pHeapId) { return profInterface->RootReference2(objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); } @@ -1531,12 +1472,11 @@ inline void ProfControlBlock::RootReference2(BYTE *objectId, EtwGCRootKind dwEtw DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &RootReference2Helper, objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); } -inline HRESULT EndRootReferences2Helper(void *additionalData, EEToProfInterfaceImpl *profInterface, void *pHeapId) +inline HRESULT EndRootReferences2Helper(EEToProfInterfaceImpl *profInterface, void *pHeapId) { return profInterface->EndRootReferences2(pHeapId); } @@ -1547,12 +1487,11 @@ inline void ProfControlBlock::EndRootReferences2(void *pHeapId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &EndRootReferences2Helper, pHeapId); } -inline HRESULT ConditionalWeakTableElementReferenceHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, BYTE *primaryObjectId, BYTE *secondaryObjectId, void *rootID, void *pHeapId) +inline HRESULT ConditionalWeakTableElementReferenceHelper(EEToProfInterfaceImpl *profInterface, BYTE *primaryObjectId, BYTE *secondaryObjectId, void *rootID, void *pHeapId) { if (!profInterface->IsCallback5Supported()) { @@ -1568,12 +1507,11 @@ inline void ProfControlBlock::ConditionalWeakTableElementReference(BYTE *primary DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &ConditionalWeakTableElementReferenceHelper, primaryObjectId, secondaryObjectId, rootID, pHeapId); } -inline HRESULT EndConditionalWeakTableElementReferencesHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, void *pHeapId) +inline HRESULT EndConditionalWeakTableElementReferencesHelper(EEToProfInterfaceImpl *profInterface, void *pHeapId) { if (!profInterface->IsCallback5Supported()) { @@ -1589,12 +1527,11 @@ inline void ProfControlBlock::EndConditionalWeakTableElementReferences(void *pHe DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &EndConditionalWeakTableElementReferencesHelper, pHeapId); } -inline HRESULT AllocByClassHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ObjectID objId, ClassID classId, void *pHeapId) +inline HRESULT AllocByClassHelper(EEToProfInterfaceImpl *profInterface, ObjectID objId, ClassID classId, void *pHeapId) { return profInterface->AllocByClass(objId, classId, pHeapId); } @@ -1605,12 +1542,11 @@ inline void ProfControlBlock::AllocByClass(ObjectID objId, ClassID classId, void DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &AllocByClassHelper, objId, classId, pHeapId); } -inline HRESULT EndAllocByClassHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, void *pHeapId) +inline HRESULT EndAllocByClassHelper(EEToProfInterfaceImpl *profInterface, void *pHeapId) { return profInterface->EndAllocByClass(pHeapId); } @@ -1621,12 +1557,11 @@ inline void ProfControlBlock::EndAllocByClass(void *pHeapId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &EndAllocByClassHelper, pHeapId); } -inline HRESULT ObjectReferenceHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, ObjectID objId, ClassID classId, ULONG cNumRefs, ObjectID *arrObjRef) +inline HRESULT ObjectReferenceHelper(EEToProfInterfaceImpl *profInterface, ObjectID objId, ClassID classId, ULONG cNumRefs, ObjectID *arrObjRef) { return profInterface->ObjectReference(objId, classId, cNumRefs, arrObjRef); } @@ -1637,12 +1572,11 @@ inline HRESULT ProfControlBlock::ObjectReference(ObjectID objId, ClassID classId return DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &ObjectReferenceHelper, objId, classId, cNumRefs, arrObjRef); } -inline HRESULT HandleCreatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, UINT_PTR handleId, ObjectID initialObjectId) +inline HRESULT HandleCreatedHelper(EEToProfInterfaceImpl *profInterface, UINT_PTR handleId, ObjectID initialObjectId) { return profInterface->HandleCreated(handleId, initialObjectId); } @@ -1653,12 +1587,11 @@ inline void ProfControlBlock::HandleCreated(UINT_PTR handleId, ObjectID initialO DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &HandleCreatedHelper, handleId, initialObjectId); } -inline HRESULT HandleDestroyedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, UINT_PTR handleId) +inline HRESULT HandleDestroyedHelper(EEToProfInterfaceImpl *profInterface, UINT_PTR handleId) { return profInterface->HandleDestroyed(handleId); } @@ -1669,7 +1602,6 @@ inline void ProfControlBlock::HandleDestroyed(UINT_PTR handleId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, &HandleDestroyedHelper, handleId); } @@ -1711,7 +1643,7 @@ inline BOOL IsProfilerTrackingGCOrMovedObjects(ProfilerInfo *pProfilerInfo) return IsProfilerTrackingGC(pProfilerInfo) || IsProfilerTrackingMovedObjects(pProfilerInfo); } -inline HRESULT GarbageCollectionStartedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason) +inline HRESULT GarbageCollectionStartedHelper(EEToProfInterfaceImpl *profInterface, int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason) { return profInterface->GarbageCollectionStarted(cGenerations, generationCollected, reason); } @@ -1722,12 +1654,11 @@ inline void ProfControlBlock::GarbageCollectionStarted(int cGenerations, BOOL ge DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGCOrBasicGC, - (void *)NULL, &GarbageCollectionStartedHelper, cGenerations, generationCollected, reason); } -inline HRESULT GarbageCollectionFinishedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface) +inline HRESULT GarbageCollectionFinishedHelper(EEToProfInterfaceImpl *profInterface) { return profInterface->GarbageCollectionFinished(); } @@ -1738,7 +1669,6 @@ inline void ProfControlBlock::GarbageCollectionFinished() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGCOrBasicGC, - (void *)NULL, &GarbageCollectionFinishedHelper); } @@ -1756,7 +1686,7 @@ inline BOOL IsProfilerMonitoringEventPipe(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_EVENT_PIPE); } -inline HRESULT EventPipeEventDeliveredHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, +inline HRESULT EventPipeEventDeliveredHelper(EEToProfInterfaceImpl *profInterface, EventPipeProvider *provider, DWORD eventId, DWORD eventVersion, @@ -1801,7 +1731,6 @@ inline void ProfControlBlock::EventPipeEventDelivered(EventPipeProvider *provide DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerMonitoringEventPipe, - (void *)NULL, &EventPipeEventDeliveredHelper, provider, eventId, @@ -1817,7 +1746,7 @@ inline void ProfControlBlock::EventPipeEventDelivered(EventPipeProvider *provide stackFrames); } -inline HRESULT EventPipeProviderCreatedHelper(void *additionalData, EEToProfInterfaceImpl *profInterface, EventPipeProvider *provider) +inline HRESULT EventPipeProviderCreatedHelper(EEToProfInterfaceImpl *profInterface, EventPipeProvider *provider) { return profInterface->EventPipeProviderCreated(provider); } @@ -1828,7 +1757,6 @@ inline void ProfControlBlock::EventPipeProviderCreated(EventPipeProvider *provid DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerMonitoringEventPipe, - (void *)NULL, &EventPipeProviderCreatedHelper, provider); } From e9b9cc21551abcc28ec975544d291270b05e2e22 Mon Sep 17 00:00:00 2001 From: David Mason Date: Wed, 6 Oct 2021 14:12:05 -0700 Subject: [PATCH 7/7] Initialize params for every call --- src/coreclr/inc/profilepriv.inl | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/coreclr/inc/profilepriv.inl b/src/coreclr/inc/profilepriv.inl index 9c17c9071ca97d..df5d91a20a8a74 100644 --- a/src/coreclr/inc/profilepriv.inl +++ b/src/coreclr/inc/profilepriv.inl @@ -500,10 +500,11 @@ inline BOOL IsProfilerTrackingCacheSearches(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CACHE_SEARCHES); } -inline HRESULT JITCachedFunctionSearchStartedHelper(EEToProfInterfaceImpl *profInterface, BOOL *pAllTrue, FunctionID functionId, BOOL *pbUseCachedFunction) +inline HRESULT JITCachedFunctionSearchStartedHelper(EEToProfInterfaceImpl *profInterface, BOOL *pAllTrue, FunctionID functionId) { - HRESULT hr = profInterface->JITCachedFunctionSearchStarted(functionId, pbUseCachedFunction); - *pAllTrue = *pAllTrue && *pbUseCachedFunction; + BOOL fUseCachedFunction = TRUE; + HRESULT hr = profInterface->JITCachedFunctionSearchStarted(functionId, &fUseCachedFunction); + *pAllTrue = *pAllTrue && fUseCachedFunction; return hr; } @@ -511,12 +512,11 @@ inline void ProfControlBlock::JITCachedFunctionSearchStarted(FunctionID function { LIMITED_METHOD_CONTRACT; - *pbUseCachedFunction = TRUE; BOOL allTrue = TRUE; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingCacheSearches, &JITCachedFunctionSearchStartedHelper, - &allTrue, functionId, pbUseCachedFunction); + &allTrue, functionId); // If any reject it, consider it rejected. *pbUseCachedFunction = allTrue; @@ -537,10 +537,11 @@ inline void ProfControlBlock::JITCachedFunctionSearchFinished(FunctionID functio functionId, result); } -inline HRESULT JITInliningHelper(EEToProfInterfaceImpl *profInterface, BOOL *pAllTrue, FunctionID callerId, FunctionID calleeId, BOOL *pfShouldInline) +inline HRESULT JITInliningHelper(EEToProfInterfaceImpl *profInterface, BOOL *pAllTrue, FunctionID callerId, FunctionID calleeId) { - HRESULT hr = profInterface->JITInlining(callerId, calleeId, pfShouldInline); - *pAllTrue = *pAllTrue && *pfShouldInline; + BOOL fShouldInline = TRUE; + HRESULT hr = profInterface->JITInlining(callerId, calleeId, &fShouldInline); + *pAllTrue = *pAllTrue && fShouldInline; return hr; } @@ -553,7 +554,7 @@ inline HRESULT ProfControlBlock::JITInlining(FunctionID callerId, FunctionID cal HRESULT hr = DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, &JITInliningHelper, - &allTrue, callerId, calleeId, pfShouldInline); + &allTrue, callerId, calleeId); // If any reject it, consider it rejected. *pfShouldInline = allTrue;