Map method tables for collectible classes to null so profile entries won't
hold onto pointers that can become invalid.
Record the nulls in the profiles so that collectible classes still impact the
profile stats.
return;
}
- CORINFO_CLASS_HANDLE clsHnd = (CORINFO_CLASS_HANDLE)objRef->GetMethodTable();
+ MethodTable* pMT = objRef->GetMethodTable();
+
+ // If the object class is collectible, record NULL
+ // for the class handle.
+ //
+ if (pMT->GetLoaderAllocator()->IsCollectible())
+ {
+ pMT = NULL;
+ }
#ifdef _DEBUG
PgoManager::VerifyAddress(classProfile);
//
if (count < S)
{
- classProfile->ClassTable[count] = clsHnd;
+ classProfile->ClassTable[count] = (CORINFO_CLASS_HANDLE)pMT;
}
else
{
if ((x % N) < S)
{
unsigned i = x % S;
- classProfile->ClassTable[i] = clsHnd;
+ classProfile->ClassTable[i] = (CORINFO_CLASS_HANDLE)pMT;
}
}
}