summaryrefslogtreecommitdiff
path: root/src/vm/assembly.cpp
diff options
context:
space:
mode:
authorSung Yoon Whang <suwhang@microsoft.com>2019-05-21 23:06:17 -0700
committerGitHub <noreply@github.com>2019-05-21 23:06:17 -0700
commitf33ffab85335b9ca6b0f669d59de599e981c295f (patch)
tree3ef8ec1c01937fc9d5263707cc6442145ac105cf /src/vm/assembly.cpp
parentbe5445e56ea2bdb6de907e3f892ca732fc802f0f (diff)
downloadcoreclr-f33ffab85335b9ca6b0f669d59de599e981c295f.tar.gz
coreclr-f33ffab85335b9ca6b0f669d59de599e981c295f.tar.bz2
coreclr-f33ffab85335b9ca6b0f669d59de599e981c295f.zip
Add runtime counter for current assemblies loaded (#24698)
* Consume # of assemblies loaded * Fix names * Fix build * Add ifdef in assemblynative.hpp * fix merge error * fix build break * Address PR feedback * Fix linux build * Remove ifdef
Diffstat (limited to 'src/vm/assembly.cpp')
-rw-r--r--src/vm/assembly.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp
index 4573f7cd42..e04310ee1f 100644
--- a/src/vm/assembly.cpp
+++ b/src/vm/assembly.cpp
@@ -80,6 +80,8 @@
// to help your debugging.
DWORD g_dwLoaderReasonForNotSharing = 0; // See code:DomainFile::m_dwReasonForRejectingNativeImage for a similar variable.
+volatile uint32_t g_cAssemblies = 0;
+
// These will sometimes result in a crash with error code 0x80131401 SECURITY_E_INCOMPATIBLE_SHARE
// "Loading this assembly would produce a different grant set from other instances."
enum ReasonForNotSharing
@@ -179,6 +181,8 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat
#endif
m_pManifest = Module::Create(this, mdFileNil, GetManifestFile(), pamTracker);
+ FastInterlockIncrement((LONG*)&g_cAssemblies);
+
PrepareModuleForAssembly(m_pManifest, pamTracker);
CacheManifestFiles();
@@ -326,6 +330,7 @@ void Assembly::StartUnload()
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_TRIGGERS;
STATIC_CONTRACT_FORBID_FAULT;
+
#ifdef PROFILING_SUPPORTED
if (CORProfilerTrackAssemblyLoads())
{
@@ -351,6 +356,8 @@ void Assembly::Terminate( BOOL signalProfiler )
m_pClassLoader = NULL;
}
+ FastInterlockDecrement((LONG*)&g_cAssemblies);
+
#ifdef PROFILING_SUPPORTED
if (CORProfilerTrackAssemblyLoads())
{