Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
add the same check to populate the class hash for non-exported types
Browse files Browse the repository at this point in the history
  • Loading branch information
davmason committed Feb 21, 2019
1 parent bd2217c commit 08ccf9a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/vm/clsload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4192,6 +4192,15 @@ VOID ClassLoader::AddAvailableClassDontHaveLock(Module *pModule,
#endif

CrstHolder ch(&m_AvailableClassLock);

// R2R pre-computes an export table and tries to avoid populating a class hash at runtime. However the profiler can
// still add new types on the fly by calling here. If that occurs we fallback to the slower path of creating the
// in memory hashtable as usual.
if (!pModule->IsResource() && pModule->GetAvailableClassHash() == NULL)
{
LazyPopulateCaseSensitiveHashTables();
}

AddAvailableClassHaveLock(
pModule,
classdef,
Expand Down Expand Up @@ -4386,7 +4395,9 @@ VOID ClassLoader::AddExportedTypeDontHaveLock(Module *pManifestModule,
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END


CrstHolder ch(&m_AvailableClassLock);

// R2R pre-computes an export table and tries to avoid populating a class hash at runtime. However the profiler can
// still add new types on the fly by calling here. If that occurs we fallback to the slower path of creating the
// in memory hashtable as usual.
Expand All @@ -4395,7 +4406,6 @@ VOID ClassLoader::AddExportedTypeDontHaveLock(Module *pManifestModule,
LazyPopulateCaseSensitiveHashTables();
}

CrstHolder ch(&m_AvailableClassLock);
AddExportedTypeHaveLock(
pManifestModule,
cl,
Expand Down

0 comments on commit 08ccf9a

Please sign in to comment.