Skip to content

Commit

Permalink
Simplify CEEInfo::getTypeForPrimitiveValueClass (#71686)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotas authored Jul 6, 2022
1 parent ffcb014 commit 206dccb
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3956,26 +3956,11 @@ CorInfoType CEEInfo::getTypeForPrimitiveValueClass(
TypeHandle th(clsHnd);
_ASSERTE (!th.IsGenericVariable());

MethodTable *pMT = th.GetMethodTable();
PREFIX_ASSUME(pMT != NULL);

// Is it a non primitive struct such as
// RuntimeTypeHandle, RuntimeMethodHandle, RuntimeArgHandle?
if (pMT->IsValueType() &&
!pMT->IsTruePrimitive() &&
!pMT->IsEnum())
CorElementType elementType = th.GetVerifierCorElementType();
if (CorIsPrimitiveType(elementType))
{
// default value CORINFO_TYPE_UNDEF is what we want
result = asCorInfoType(elementType);
}
else
{
CorElementType elementType = th.GetInternalCorElementType();
if (CorIsPrimitiveType(elementType))
{
result = asCorInfoType(elementType);
}
}

EE_TO_JIT_TRANSITION();

return result;
Expand Down

0 comments on commit 206dccb

Please sign in to comment.