diff options
author | Fei Peng <fei.peng@intel.com> | 2017-12-07 14:08:55 -0800 |
---|---|---|
committer | Fei Peng <fei.peng@intel.com> | 2017-12-12 09:58:21 -0800 |
commit | 5ac4d2a87fb0333c519c626f512b8f5bd42b51a0 (patch) | |
tree | 8e92c848e51b797a6fecf70a1ce32c6fd0964758 /src | |
parent | 2e92b4a71071c1c99d1b39d8441c42d805d93310 (diff) | |
download | coreclr-5ac4d2a87fb0333c519c626f512b8f5bd42b51a0.tar.gz coreclr-5ac4d2a87fb0333c519c626f512b8f5bd42b51a0.tar.bz2 coreclr-5ac4d2a87fb0333c519c626f512b8f5bd42b51a0.zip |
Add SPMI for getTypeForPrimitiveNumericClass
Diffstat (limited to 'src')
-rw-r--r-- | src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h | 4 | ||||
-rw-r--r-- | src/ToolBox/superpmi/superpmi-shared/lwmlist.h | 1 | ||||
-rw-r--r-- | src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp | 23 | ||||
-rw-r--r-- | src/ToolBox/superpmi/superpmi-shared/methodcontext.h | 7 | ||||
-rw-r--r-- | src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp | 10 | ||||
-rw-r--r-- | src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp | 8 | ||||
-rw-r--r-- | src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp | 7 | ||||
-rw-r--r-- | src/ToolBox/superpmi/superpmi/icorjitinfo.cpp | 8 | ||||
-rw-r--r-- | src/jit/ICorJitInfo_API_names.h | 1 | ||||
-rw-r--r-- | src/jit/ICorJitInfo_API_wrapper.hpp | 9 | ||||
-rw-r--r-- | src/zap/zapinfo.cpp | 5 | ||||
-rw-r--r-- | src/zap/zapinfo.h | 1 |
12 files changed, 83 insertions, 1 deletions
diff --git a/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h b/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h index e0a5886e76..61d1785b51 100644 --- a/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h +++ b/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h @@ -430,6 +430,10 @@ CORINFO_CLASS_HANDLE getBuiltinClass(CorInfoClassId classId); // "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) diff --git a/src/ToolBox/superpmi/superpmi-shared/lwmlist.h b/src/ToolBox/superpmi/superpmi-shared/lwmlist.h index 467d28ac55..6a8b77e246 100644 --- a/src/ToolBox/superpmi/superpmi-shared/lwmlist.h +++ b/src/ToolBox/superpmi/superpmi-shared/lwmlist.h @@ -126,6 +126,7 @@ LWM(GetThreadTLSIndex, DWORD, DLD) 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) diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 601f73833e..4a16baf5b7 100644 --- a/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -1916,6 +1916,29 @@ CorInfoType MethodContext::repGetTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE 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) diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h index 1174f070c7..abcfd4926e 100644 --- a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -728,6 +728,10 @@ public: 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); @@ -1283,7 +1287,7 @@ private: }; // ********************* Please keep this up-to-date to ease adding more *************** -// Highest packet number: 167 +// Highest packet number: 168 // ************************************************************************************* enum mcPackets { @@ -1400,6 +1404,7 @@ 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 diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp index b6bc4fa8fb..d63a8acb90 100644 --- a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -906,6 +906,16 @@ CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE 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) diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp index 91d6b3388d..1b18072f41 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp @@ -704,6 +704,14 @@ CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE 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) diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp index d23f727fd9..ac7a6d9f30 100644 --- a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp @@ -629,6 +629,13 @@ CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE 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) diff --git a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp index 81ff74db71..852b1147e6 100644 --- a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp @@ -763,6 +763,14 @@ CorInfoType MyICJI::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls) 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) diff --git a/src/jit/ICorJitInfo_API_names.h b/src/jit/ICorJitInfo_API_names.h index 0a8117da59..c9edd544be 100644 --- a/src/jit/ICorJitInfo_API_names.h +++ b/src/jit/ICorJitInfo_API_names.h @@ -71,6 +71,7 @@ DEF_CLR_API(initClass) 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) diff --git a/src/jit/ICorJitInfo_API_wrapper.hpp b/src/jit/ICorJitInfo_API_wrapper.hpp index f298ea9173..9eaeb5d179 100644 --- a/src/jit/ICorJitInfo_API_wrapper.hpp +++ b/src/jit/ICorJitInfo_API_wrapper.hpp @@ -675,6 +675,15 @@ CorInfoType WrapICorJitInfo::getTypeForPrimitiveValueClass( 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 ) diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp index 215f4a7360..02edde0f17 100644 --- a/src/zap/zapinfo.cpp +++ b/src/zap/zapinfo.cpp @@ -3106,6 +3106,11 @@ CorInfoType ZapInfo::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls) 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) { diff --git a/src/zap/zapinfo.h b/src/zap/zapinfo.h index 621ffbdc30..0e2bf9dcaf 100644 --- a/src/zap/zapinfo.h +++ b/src/zap/zapinfo.h @@ -573,6 +573,7 @@ public: 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); |