Skip to content

Commit 169cea3

Browse files
Copilotjkotas
authored andcommitted
Remove nonExpansive parameter from Dictionary::PopulateEntry (#122758)
The `nonExpansive` parameter in `Dictionary::PopulateEntry` was always passed as `FALSE` from its only call site in `jithelpers.cpp`. This change removes the dead parameter and simplifies the implementation by eliminating unreachable code paths. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
1 parent 08553fc commit 169cea3

File tree

3 files changed

+7
-44
lines changed

3 files changed

+7
-44
lines changed

src/coreclr/vm/genericdict.cpp

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,6 @@ Dictionary::PopulateEntry(
669669
MethodDesc * pMD,
670670
MethodTable * pMT,
671671
LPVOID signature,
672-
BOOL nonExpansive,
673672
DictionaryEntry ** ppSlot,
674673
DWORD dictionaryIndexAndSlot, /* = -1 */
675674
Module * pModule /* = NULL */)
@@ -811,16 +810,11 @@ Dictionary::PopulateEntry(
811810
declaringType = ptr.GetTypeHandleThrowing(
812811
pLookupModule,
813812
&typeContext,
814-
(nonExpansive ? ClassLoader::DontLoadTypes : ClassLoader::LoadTypes),
813+
ClassLoader::LoadTypes,
815814
CLASS_LOADED,
816815
FALSE,
817816
NULL,
818817
pZapSigContext);
819-
if (declaringType.IsNull())
820-
{
821-
_ASSERTE(nonExpansive);
822-
return NULL;
823-
}
824818
IfFailThrow(ptr.SkipExactlyOne());
825819

826820
FALLTHROUGH;
@@ -831,16 +825,11 @@ Dictionary::PopulateEntry(
831825
TypeHandle th = ptr.GetTypeHandleThrowing(
832826
pLookupModule,
833827
&typeContext,
834-
(nonExpansive ? ClassLoader::DontLoadTypes : ClassLoader::LoadTypes),
828+
ClassLoader::LoadTypes,
835829
CLASS_LOADED,
836830
FALSE,
837831
NULL,
838832
pZapSigContext);
839-
if (th.IsNull())
840-
{
841-
_ASSERTE(nonExpansive);
842-
return NULL;
843-
}
844833
IfFailThrow(ptr.SkipExactlyOne());
845834

846835
if (!declaringType.IsNull())
@@ -864,16 +853,11 @@ Dictionary::PopulateEntry(
864853
constraintType = ptr.GetTypeHandleThrowing(
865854
pLookupModule,
866855
&typeContext,
867-
(nonExpansive ? ClassLoader::DontLoadTypes : ClassLoader::LoadTypes),
856+
ClassLoader::LoadTypes,
868857
CLASS_LOADED,
869858
FALSE,
870859
NULL,
871860
pZapSigContext);
872-
if (constraintType.IsNull())
873-
{
874-
_ASSERTE(nonExpansive);
875-
return NULL;
876-
}
877861
IfFailThrow(ptr.SkipExactlyOne());
878862

879863
FALLTHROUGH;
@@ -967,7 +951,6 @@ Dictionary::PopulateEntry(
967951
if (ownerType.IsNull())
968952
ownerType = pMethod->GetMethodTable();
969953

970-
_ASSERT(!ownerType.IsNull() && !nonExpansive);
971954
pOwnerMT = ownerType.GetMethodTable();
972955

973956
if (kind == DispatchStubAddrSlot && pMethod->IsVtableMethod())
@@ -981,22 +964,13 @@ Dictionary::PopulateEntry(
981964
ownerType = ptr.GetTypeHandleThrowing(
982965
pLookupModule,
983966
&typeContext,
984-
(nonExpansive ? ClassLoader::DontLoadTypes : ClassLoader::LoadTypes),
967+
ClassLoader::LoadTypes,
985968
CLASS_LOADED,
986969
FALSE,
987970
NULL,
988971
pZapSigContext);
989-
if (ownerType.IsNull())
990-
{
991-
_ASSERTE(nonExpansive);
992-
return NULL;
993-
}
994972
IfFailThrow(ptr.SkipExactlyOne());
995973

996-
// <NICE> wsperf: Create a path that doesn't load types or create new handles if nonExpansive is set </NICE>
997-
if (nonExpansive)
998-
return NULL;
999-
1000974
pOwnerMT = ownerType.GetMethodTable();
1001975
_ASSERTE(pOwnerMT != NULL);
1002976

@@ -1026,16 +1000,11 @@ Dictionary::PopulateEntry(
10261000
TypeHandle thMethodDefType = ptr.GetTypeHandleThrowing(
10271001
pLookupModule,
10281002
&typeContext,
1029-
(nonExpansive ? ClassLoader::DontLoadTypes : ClassLoader::LoadTypes),
1003+
ClassLoader::LoadTypes,
10301004
CLASS_LOADED,
10311005
FALSE,
10321006
NULL,
10331007
pZapSigContext);
1034-
if (thMethodDefType.IsNull())
1035-
{
1036-
_ASSERTE(nonExpansive);
1037-
return NULL;
1038-
}
10391008
IfFailThrow(ptr.SkipExactlyOne());
10401009
MethodTable * pMethodDefMT = thMethodDefType.GetMethodTable();
10411010
_ASSERTE(pMethodDefMT != NULL);
@@ -1257,16 +1226,11 @@ Dictionary::PopulateEntry(
12571226
ownerType = ptr.GetTypeHandleThrowing(
12581227
pLookupModule,
12591228
&typeContext,
1260-
(nonExpansive ? ClassLoader::DontLoadTypes : ClassLoader::LoadTypes),
1229+
ClassLoader::LoadTypes,
12611230
CLASS_LOADED,
12621231
FALSE,
12631232
NULL,
12641233
pZapSigContext);
1265-
if (ownerType.IsNull())
1266-
{
1267-
_ASSERTE(nonExpansive);
1268-
return NULL;
1269-
}
12701234
IfFailThrow(ptr.SkipExactlyOne());
12711235

12721236
// Computed by MethodTable::GetIndexForFieldDesc().

src/coreclr/vm/genericdict.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ class Dictionary
276276
static DictionaryEntry PopulateEntry(MethodDesc * pMD,
277277
MethodTable * pMT,
278278
LPVOID signature,
279-
BOOL nonExpansive,
280279
DictionaryEntry ** ppSlot,
281280
DWORD dictionaryIndexAndSlot = -1,
282281
Module * pModule = NULL);

src/coreclr/vm/jithelpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ DictionaryEntry GenericHandleWorkerCore(MethodDesc * pMD, MethodTable * pMT, LPV
557557
}
558558

559559
DictionaryEntry * pSlot;
560-
result = Dictionary::PopulateEntry(pMD, pDeclaringMT, signature, FALSE, &pSlot, dictionaryIndexAndSlot, pModule);
560+
result = Dictionary::PopulateEntry(pMD, pDeclaringMT, signature, &pSlot, dictionaryIndexAndSlot, pModule);
561561

562562
if (pMT != NULL && pDeclaringMT != pMT)
563563
{

0 commit comments

Comments
 (0)