Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix code review nits
  • Loading branch information
davidwrighton committed Dec 19, 2023
commit 67af66d7dbeac3bd0aaf86662cb417fcdad454b3
8 changes: 4 additions & 4 deletions src/coreclr/vm/classhash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ VOID EEClassHashTable::ConstructKeyFromData(PTR_EEClassHashEntry pEntry, // IN
_ASSERTE(!(IsCaseInsensitiveTable() && FORBIDGC_LOADER_USE_ENABLED()));
#endif

// cqb - If IsCaseInsensitiveTable() is true for the hash table, the bytes in Key will be allocated
// from cqb. This is to prevent wasting bytes in the Loader Heap. Thusly, it is important to note that
// in this case, the lifetime of Key is bounded by the lifetime of cqb, which will free the memory
// it allocated on destruction.
// If IsCaseInsensitiveTable() is true for the hash table, strings passed to the ConstructKeyCallback instance
// will be dynamically allocated. This is to prevent wasting bytes in the Loader Heap. Thusly, it is important
// to note that in this case, the lifetime of Key is bounded by the lifetime of the single call to UseKeys, and
// will be freed when that function returns.

_ASSERTE(m_pModule != NULL);
LPSTR pszName = NULL;
Expand Down
11 changes: 6 additions & 5 deletions src/coreclr/vm/clsload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3583,11 +3583,12 @@ VOID ClassLoader::AddExportedTypeDontHaveLock(Module *pManifestModule,
CONTRACTL_END

CrstHolder ch(&m_AvailableClassLock);
SArray<EEClassHashEntry_t *> exportedEntries;

AddExportedTypeHaveLock(
pManifestModule,
cl,
NULL,
&exportedEntries,
pamTracker);
}

Expand Down Expand Up @@ -3630,7 +3631,7 @@ VOID ClassLoader::AddExportedTypeHaveLock(Module *pManifestModule,
{
COUNT_T exportedEntryIndex = RidFromToken(mdImpl) - 1;
_ASSERTE(RidFromToken(mdImpl) < RidFromToken(cl));
if (exportedEntries != NULL && exportedEntries->GetCount() > exportedEntryIndex)
if (exportedEntries->GetCount() > exportedEntryIndex)
{
pEncloser = (*exportedEntries)[exportedEntryIndex];
}
Expand Down Expand Up @@ -3669,11 +3670,11 @@ VOID ClassLoader::AddExportedTypeHaveLock(Module *pManifestModule,
}

insertedEntry = InsertValue(pClassHash, pClassCaseInsHash, pszNameSpace, pszName, EEClassHashTable::CompressClassDef(cl), pEncloser, pamTracker);

_ASSERTE(insertedEntry != NULL);
if (exportedEntries != NULL)
COUNT_T exportedEntryIndex = RidFromToken(cl) - 1;
if (classEntryIndex < exportedEntries->GetCount())
{
COUNT_T exportedEntryIndex = RidFromToken(cl) - 1;
_ASSERTE(exportedEntryIndex < exportedEntries->GetCount());
(*exportedEntries)[exportedEntryIndex] = insertedEntry;
}
}
Expand Down