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

Commit

Permalink
CR feedback from David
Browse files Browse the repository at this point in the history
  • Loading branch information
Fadi Hanna committed Aug 29, 2019
1 parent f18a56b commit 3a6c486
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/vm/genericdict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ BOOL DictionaryLayout::FindToken(MethodTable* pMT,

DWORD cbSig = -1;
pSig = pSigBuilder != NULL ? (BYTE*)pSigBuilder->GetSignature(&cbSig) : pSig;
if (FindTokenWorker(pAllocator, pMT->GetNumGenericArgs(), pMT->GetClass()->GetDictionaryLayout(), pSigBuilder, pSig, cbSig, nFirstOffset, signatureSource, pResult, pSlotOut))
if (FindTokenWorker(pAllocator, pMT->GetNumGenericArgs(), pMT->GetClass()->GetDictionaryLayout(), pSigBuilder, pSig, cbSig, nFirstOffset, signatureSource, pResult, pSlotOut, 0, FALSE))
return TRUE;

CrstHolder ch(&SystemDomain::SystemModule()->m_DictionaryCrst);
Expand All @@ -334,14 +334,14 @@ BOOL DictionaryLayout::FindToken(MethodTable* pMT,
// First, expand the PerInstInfo dictionaries on types that were using the dictionary layout that just got expanded, and expand their slots
pMT->GetModule()->ExpandTypeDictionaries_Locked(pMT, pOldLayout, pNewLayout);

// Ensure no other thread uses old dictionary pointers
FlushProcessWriteBuffers();

// Finally, update the dictionary layout pointer after all dictionaries of instantiated types have expanded, so that subsequent calls to
// DictionaryLayout::FindToken can use this. It is important to update the dictionary layout at the very last step, otherwise some other threads
// can start using newly added dictionary layout slots on types where the PerInstInfo hasn't expanded yet, and cause runtime failures.
pMT->GetClass()->SetDictionaryLayout(pNewLayout);

// Ensure no other thread uses old dictionary pointers
FlushProcessWriteBuffers();

return TRUE;
#else
pResult->signature = pSigBuilder == NULL ? pSig : CreateSignatureWithSlotData(pSigBuilder, pAllocator, 0);
Expand Down Expand Up @@ -372,7 +372,7 @@ BOOL DictionaryLayout::FindToken(MethodDesc* pMD,

DWORD cbSig = -1;
pSig = pSigBuilder != NULL ? (BYTE*)pSigBuilder->GetSignature(&cbSig) : pSig;
if (FindTokenWorker(pAllocator, pMD->GetNumGenericMethodArgs(), pMD->GetDictionaryLayout(), pSigBuilder, pSig, cbSig, nFirstOffset, signatureSource, pResult, pSlotOut))
if (FindTokenWorker(pAllocator, pMD->GetNumGenericMethodArgs(), pMD->GetDictionaryLayout(), pSigBuilder, pSig, cbSig, nFirstOffset, signatureSource, pResult, pSlotOut, 0, FALSE))
return TRUE;

CrstHolder ch(&SystemDomain::SystemModule()->m_DictionaryCrst);
Expand All @@ -393,14 +393,14 @@ BOOL DictionaryLayout::FindToken(MethodDesc* pMD,
// First, expand the PerInstInfo dictionaries on methods that were using the dictionary layout that just got expanded, and expand their slots
pMD->GetModule()->ExpandMethodDictionaries_Locked(pMD, pOldLayout, pNewLayout);

// Ensure no other thread uses old dictionary pointers
FlushProcessWriteBuffers();

// Finally, update the dictionary layout pointer after all dictionaries of instantiated methods have expanded, so that subsequent calls to
// DictionaryLayout::FindToken can use this. It is important to update the dictionary layout at the very last step, otherwise some other threads
// can start using newly added dictionary layout slots on methods where the PerInstInfo hasn't expanded yet, and cause runtime failures.
pMD->AsInstantiatedMethodDesc()->IMD_SetDictionaryLayout(pNewLayout);

// Ensure no other thread uses old dictionary pointers
FlushProcessWriteBuffers();

return TRUE;
#else
pResult->signature = pSigBuilder == NULL ? pSig : CreateSignatureWithSlotData(pSigBuilder, pAllocator, 0);
Expand Down
4 changes: 2 additions & 2 deletions src/vm/genericdict.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class DictionaryLayout
DictionaryEntrySignatureSource signatureSource,
CORINFO_RUNTIME_LOOKUP* pResult,
WORD* pSlotOut,
DWORD scanFromSlot = 0,
BOOL useEmptySlotIfFound = FALSE);
DWORD scanFromSlot,
BOOL useEmptySlotIfFound);


static DictionaryLayout* ExpandDictionaryLayout(LoaderAllocator* pAllocator,
Expand Down

0 comments on commit 3a6c486

Please sign in to comment.