Skip to content

Commit

Permalink
Fix code review nits
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwrighton committed Dec 19, 2023
1 parent 551c8e9 commit 67af66d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
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

0 comments on commit 67af66d

Please sign in to comment.