// "System.Int32" ==> CORINFO_TYPE_INT..
CorInfoType getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls);
+// "System.Int32" ==> CORINFO_TYPE_INT..
+// "System.UInt32" ==> CORINFO_TYPE_UINT..
+CorInfoType getTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls);
+
// TRUE if child is a subtype of parent
// if parent is an interface, then does child implement / extend parent
BOOL canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent)
LWM(GetTokenTypeAsHandle, GetTokenTypeAsHandleValue, DWORDLONG)
LWM(GetTypeForBox, DWORDLONG, DWORDLONG)
LWM(GetTypeForPrimitiveValueClass, DWORDLONG, DWORD)
+LWM(GetTypeForPrimitiveNumericClass, DWORDLONG, DWORD)
LWM(GetUnboxedEntry, DWORDLONG, DLD);
LWM(GetUnBoxHelper, DWORDLONG, DWORD)
LWM(GetUnmanagedCallConv, DWORDLONG, DWORD)
return result;
}
+void MethodContext::recGetTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls, CorInfoType result)
+{
+ if (GetTypeForPrimitiveNumericClass == nullptr)
+ GetTypeForPrimitiveNumericClass = new LightWeightMap<DWORDLONG, DWORD>();
+
+ GetTypeForPrimitiveNumericClass->Add((DWORDLONG)cls, result);
+ DEBUG_REC(dmpGetTypeForPrimitiveNumericClass((DWORDLONG)cls, (DWORD)result));
+}
+void MethodContext::dmpGetTypeForPrimitiveNumericClass(DWORDLONG key, DWORD value)
+{
+ printf("GetTypeForPrimitiveNumericClass key cls-%016llX, value cit-%u(%s)", key, value, toString((CorInfoType)value));
+}
+CorInfoType MethodContext::repGetTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls)
+{
+ AssertCodeMsg(GetTypeForPrimitiveNumericClass != nullptr, EXCEPTIONCODE_MC,
+ "Encountered an empty LWM while looking for %016llX", (DWORDLONG)cls);
+ AssertCodeMsg(GetTypeForPrimitiveNumericClass->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC,
+ "Didn't find %016llX", (DWORDLONG)cls);
+ CorInfoType result = (CorInfoType)GetTypeForPrimitiveNumericClass->Get((DWORDLONG)cls);
+ DEBUG_REP(dmpGetTypeForPrimitiveNumericClass((DWORDLONG)cls, (DWORD)result));
+ return result;
+}
+
void MethodContext::recGetParentType(CORINFO_CLASS_HANDLE cls, CORINFO_CLASS_HANDLE result)
{
if (GetParentType == nullptr)
void dmpGetTypeForPrimitiveValueClass(DWORDLONG key, DWORD value);
CorInfoType repGetTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls);
+ void recGetTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls, CorInfoType result);
+ void dmpGetTypeForPrimitiveNumericClass(DWORDLONG key, DWORD value);
+ CorInfoType repGetTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls);
+
void recGetParentType(CORINFO_CLASS_HANDLE cls, CORINFO_CLASS_HANDLE result);
void dmpGetParentType(DWORDLONG key, DWORDLONG value);
CORINFO_CLASS_HANDLE repGetParentType(CORINFO_CLASS_HANDLE cls);
};
// ********************* Please keep this up-to-date to ease adding more ***************
-// Highest packet number: 167
+// Highest packet number: 168
// *************************************************************************************
enum mcPackets
{
Packet_GetTokenTypeAsHandle = 89,
Packet_GetTypeForBox = 90,
Packet_GetTypeForPrimitiveValueClass = 91,
+ Packet_GetTypeForPrimitiveNumericClass = 168, // Added 12/7/2017
Packet_GetUnboxedEntry = 165, // Added 10/26/17
Packet_GetUnBoxHelper = 92,
Packet_GetReadyToRunHelper = 150, // Added 10/10/2014
return temp;
}
+// "System.Int32" ==> CORINFO_TYPE_INT..
+// "System.UInt32" ==> CORINFO_TYPE_UINT..
+CorInfoType interceptor_ICJI::getTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls)
+{
+ mc->cr->AddCall("getTypeForPrimitiveNumericClass");
+ CorInfoType temp = original_ICorJitInfo->getTypeForPrimitiveNumericClass(cls);
+ mc->recGetTypeForPrimitiveNumericClass(cls, temp);
+ return temp;
+}
+
// TRUE if child is a subtype of parent
// if parent is an interface, then does child implement / extend parent
BOOL interceptor_ICJI::canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent)
return original_ICorJitInfo->getTypeForPrimitiveValueClass(cls);
}
+// "System.Int32" ==> CORINFO_TYPE_INT..
+// "System.UInt32" ==> CORINFO_TYPE_UINT..
+CorInfoType interceptor_ICJI::getTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls)
+{
+ mcs->AddCall("getTypeForPrimitiveNumericClass");
+ return original_ICorJitInfo->getTypeForPrimitiveNumericClass(cls);
+}
+
// TRUE if child is a subtype of parent
// if parent is an interface, then does child implement / extend parent
BOOL interceptor_ICJI::canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent)
return original_ICorJitInfo->getTypeForPrimitiveValueClass(cls);
}
+// "System.Int32" ==> CORINFO_TYPE_INT..
+// "System.UInt32" ==> CORINFO_TYPE_UINT..
+CorInfoType interceptor_ICJI::getTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls)
+{
+ return original_ICorJitInfo->getTypeForPrimitiveNumericClass(cls);
+}
+
// TRUE if child is a subtype of parent
// if parent is an interface, then does child implement / extend parent
BOOL interceptor_ICJI::canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent)
return jitInstance->mc->repGetTypeForPrimitiveValueClass(cls);
}
+// "System.Int32" ==> CORINFO_TYPE_INT..
+// "System.UInt32" ==> CORINFO_TYPE_UINT..
+CorInfoType MyICJI::getTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls)
+{
+ jitInstance->mc->cr->AddCall("getTypeForPrimitiveNumericClass");
+ return jitInstance->mc->repGetTypeForPrimitiveNumericClass(cls);
+}
+
// TRUE if child is a subtype of parent
// if parent is an interface, then does child implement / extend parent
BOOL MyICJI::canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent)
DEF_CLR_API(classMustBeLoadedBeforeCodeIsRun)
DEF_CLR_API(getBuiltinClass)
DEF_CLR_API(getTypeForPrimitiveValueClass)
+DEF_CLR_API(getTypeForPrimitiveNumericClass)
DEF_CLR_API(canCast)
DEF_CLR_API(areTypesEquivalent)
DEF_CLR_API(mergeClasses)
return temp;
}
+CorInfoType WrapICorJitInfo::getTypeForPrimitiveNumericClass(
+ CORINFO_CLASS_HANDLE cls)
+{
+ API_ENTER(getTypeForPrimitiveNumericClass);
+ CorInfoType temp = wrapHnd->getTypeForPrimitiveNumericClass(cls);
+ API_LEAVE(getTypeForPrimitiveNumericClass);
+ return temp;
+}
+
BOOL WrapICorJitInfo::canCast(
CORINFO_CLASS_HANDLE child,
CORINFO_CLASS_HANDLE parent )
return m_pEEJitInfo->getTypeForPrimitiveValueClass(cls);
}
+CorInfoType ZapInfo::getTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls)
+{
+ return m_pEEJitInfo->getTypeForPrimitiveNumericClass(cls);
+}
+
BOOL ZapInfo::canCast(CORINFO_CLASS_HANDLE child,
CORINFO_CLASS_HANDLE parent)
{
CORINFO_METHOD_HANDLE mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE methHnd);
CORINFO_CLASS_HANDLE getBuiltinClass(CorInfoClassId classId);
CorInfoType getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls);
+ CorInfoType getTypeForPrimitiveNumericClass(CORINFO_CLASS_HANDLE cls);
BOOL canCast(CORINFO_CLASS_HANDLE child, CORINFO_CLASS_HANDLE parent);
BOOL areTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2);
TypeCompareState compareTypesForCast(CORINFO_CLASS_HANDLE fromClass, CORINFO_CLASS_HANDLE toClass);