Skip to content

Commit

Permalink
Apply review suggestions for CEEInfo::getTypeDefinition
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Mar 12, 2024
1 parent 15b45d5 commit f0406b0
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7939,7 +7939,7 @@ bool CEEInfo::haveSameMethodDefinition(
CORINFO_CLASS_HANDLE CEEInfo::getTypeDefinition(CORINFO_CLASS_HANDLE type)
{
CONTRACTL {
NOTHROW;
THROWS;
GC_TRIGGERS;
MODE_PREEMPTIVE;
} CONTRACTL_END;
Expand All @@ -7949,20 +7949,19 @@ CORINFO_CLASS_HANDLE CEEInfo::getTypeDefinition(CORINFO_CLASS_HANDLE type)
JIT_TO_EE_TRANSITION();

TypeHandle constructedHandle(type);

_ASSERTE(constructedHandle.HasInstantiation());

TypeHandle definitionHandle = ClassLoader::LoadTypeDefThrowing(
constructedHandle.GetModule(),
constructedHandle.GetMethodTable()->GetCl(),
ClassLoader::ReturnNullIfNotFound,
ClassLoader::PermitUninstDefOrRef,
/* tokenNotToLoad */ tdAllTypes);
ClassLoader::ThrowIfNotFound,
ClassLoader::PermitUninstDefOrRef);

result = CORINFO_CLASS_HANDLE(definitionHandle.AsPtr());

JIT_TO_EE_TRANSITION();

// We forbid loading new types here, and we expect the resulting types to
// always be available. That is because if we are trying to get the type
// definition of some 'Foo<Bar>' type, then 'Foo<>' must also be loaded.
_ASSERTE(result != NULL);

return result;
Expand Down

0 comments on commit f0406b0

Please sign in to comment.