From fed24239df5e45f25d2ac90132ef040dc04e0f6c Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 5 Jul 2022 15:25:41 -0700 Subject: [PATCH 1/2] Simplify CEEInfo::getTypeForPrimitiveValueClass --- src/coreclr/vm/jitinterface.cpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 29ba345bada965..7e12df11fe87f1 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -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; From b7d2c22fb8e1983cc47925a690926b13538d8369 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 5 Jul 2022 15:53:58 -0700 Subject: [PATCH 2/2] Fix typo --- src/coreclr/vm/jitinterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 7e12df11fe87f1..e1864baa6bd784 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -3957,7 +3957,7 @@ CorInfoType CEEInfo::getTypeForPrimitiveValueClass( _ASSERTE (!th.IsGenericVariable()); CorElementType elementType = th.GetVerifierCorElementType(); - if (CorIsPrimitiveType(elementtype)) + if (CorIsPrimitiveType(elementType)) { result = asCorInfoType(elementType); }