Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/coreclr/vm/virtualcallstub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ void VirtualCallStubManager::ResetCache()
// Go through each cache entry and if the cache element there is in
// the cache entry heap of the manager being deleted, then we just
// set the cache entry to empty.
#ifdef CHAIN_LOOKUP
// Serialize cache chain unlinking against concurrent insert/promote writers.
CrstHolder lh(g_resolveCache->GetWriteLock());
#endif
DispatchCache::Iterator it(g_resolveCache);
while (it.IsValid())
{
Expand Down Expand Up @@ -681,6 +685,10 @@ VirtualCallStubManager::~VirtualCallStubManager()
// Go through each cache entry and if the cache element there is in
// the cache entry heap of the manager being deleted, then we just
// set the cache entry to empty.
#ifdef CHAIN_LOOKUP
// Serialize cache chain unlinking against concurrent insert/promote writers.
CrstHolder lh(g_resolveCache->GetWriteLock());
#endif
DispatchCache::Iterator it(g_resolveCache);
while (it.IsValid())
{
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/vm/virtualcallstub.h
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,14 @@ class DispatchCache
cache[idx] = elem;
}

#ifdef CHAIN_LOOKUP
inline Crst *GetWriteLock()
{
LIMITED_METHOD_CONTRACT;
return &m_writeLock;
}
#endif

inline void ClearCacheEntry(size_t idx)
{
LIMITED_METHOD_CONTRACT;
Expand Down
Loading