Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ LWM(GetArgNext, DWORDLONG, DWORDLONG)
LWM(GetArgType, Agnostic_GetArgType_Key, Agnostic_GetArgType_Value)
LWM(GetArrayInitializationData, DLD, DWORDLONG)
LWM(GetArrayRank, DWORDLONG, DWORD)
LWM(GetArrayIntrinsicID, DWORDLONG, DWORD)
LWM(GetBoundaries, DWORDLONG, Agnostic_GetBoundaries)
LWM(GetBoxHelper, DWORDLONG, DWORD)
LWM(GetBuiltinClass, DWORD, DWORDLONG)
Expand Down Expand Up @@ -94,13 +95,12 @@ LWM(GetHelperName, DWORD, DWORD)
LWM(GetHFAType, DWORDLONG, DWORD)
LWM(GetInlinedCallFrameVptr, DWORD, DLDL)
LWM(GetIntConfigValue, Agnostic_ConfigIntInfo, DWORD)
LWM(GetIntrinsicID, DWORDLONG, DD)
LWM(GetJitFlags, DWORD, DD)
LWM(GetJitTimeLogFilename, DWORD, DWORD)
LWM(GetJustMyCodeHandle, DWORDLONG, DLDL)
LWM(GetLazyStringLiteralHelper, DWORDLONG, DWORD)
LWM(GetLocationOfThisType, DWORDLONG, Agnostic_CORINFO_LOOKUP_KIND)
LWM(IsJitIntrinsic, DWORDLONG, DWORD)
LWM(IsIntrinsic, DWORDLONG, DWORD)
LWM(GetMethodAttribs, DWORDLONG, DWORD)
LWM(GetClassModule, DWORDLONG, DWORDLONG)
LWM(GetModuleAssembly, DWORDLONG, DWORDLONG)
Expand Down
79 changes: 35 additions & 44 deletions src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,26 +778,26 @@ DWORD MethodContext::repGetClassAttribs(CORINFO_CLASS_HANDLE classHandle)
return value;
}

void MethodContext::recIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn, bool result)
void MethodContext::recIsIntrinsic(CORINFO_METHOD_HANDLE ftn, bool result)
{
if (IsJitIntrinsic == nullptr)
IsJitIntrinsic = new LightWeightMap<DWORDLONG, DWORD>();
if (IsIntrinsic == nullptr)
IsIntrinsic = new LightWeightMap<DWORDLONG, DWORD>();

DWORDLONG key = CastHandle(ftn);
DWORD value = result ? 1 : 0;
IsJitIntrinsic->Add(key, value);
DEBUG_REC(dmpIsJitIntrinsic(key, value));
IsIntrinsic->Add(key, value);
DEBUG_REC(dmpIsIntrinsic(key, value));
}
void MethodContext::dmpIsJitIntrinsic(DWORDLONG key, DWORD value)
void MethodContext::dmpIsIntrinsic(DWORDLONG key, DWORD value)
{
printf("IsJitIntrinsic key ftn-%016llX, value res-%u", key, value);
printf("IsIntrinsic key ftn-%016llX, value res-%u", key, value);
}
bool MethodContext::repIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn)
bool MethodContext::repIsIntrinsic(CORINFO_METHOD_HANDLE ftn)
{
DWORDLONG key = CastHandle(ftn);
AssertMapAndKeyExist(IsJitIntrinsic, key, ": key %016llX", key);
DWORD value = IsJitIntrinsic->Get(key);
DEBUG_REP(dmpIsJitIntrinsic(key, value));
AssertMapAndKeyExist(IsIntrinsic, key, ": key %016llX", key);
DWORD value = IsIntrinsic->Get(key);
DEBUG_REP(dmpIsIntrinsic(key, value));
return value != 0;
}

Expand Down Expand Up @@ -1710,39 +1710,6 @@ void MethodContext::repGetCallInfoFromMethodHandle(CORINFO_METHOD_HANDLE methodH
LogException(EXCEPTIONCODE_MC, "Didn't find key %016llX.", methodHandle);
}

void MethodContext::recGetIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand, CorInfoIntrinsics result)
{
if (GetIntrinsicID == nullptr)
GetIntrinsicID = new LightWeightMap<DWORDLONG, DD>();

DD value;
value.A = (pMustExpand != nullptr) ? (DWORD)(*pMustExpand ? 1 : 0) : (DWORD)0;
value.B = (DWORD)result;

DWORDLONG key = CastHandle(method);
GetIntrinsicID->Add(key, value);
DEBUG_REC(dmpGetIntrinsicID(key, value));
}
void MethodContext::dmpGetIntrinsicID(DWORDLONG key, DD value)
{
printf("GetIntrinsicID key mth-%016llX, mustExpand-%u, value intr-%u", key, value.A, value.B);
}
CorInfoIntrinsics MethodContext::repGetIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand)
{
DWORDLONG key = CastHandle(method);
AssertMapAndKeyExist(GetIntrinsicID, key, ": key %016llX", key);

DD value = GetIntrinsicID->Get(key);
DEBUG_REP(dmpGetIntrinsicID(key, value));

if (pMustExpand != nullptr)
{
*pMustExpand = (value.A == 0) ? false : true;
}
CorInfoIntrinsics result = (CorInfoIntrinsics)value.B;
return result;
}

void MethodContext::recIsIntrinsicType(CORINFO_CLASS_HANDLE cls, bool result)
{
if (IsIntrinsicType == nullptr)
Expand Down Expand Up @@ -6725,6 +6692,30 @@ unsigned MethodContext::repGetArrayRank(CORINFO_CLASS_HANDLE cls)
return result;
}

void MethodContext::recGetArrayIntrinsicID(CORINFO_METHOD_HANDLE hMethod, CorInfoArrayIntrinsic result)
{
if (GetArrayIntrinsicID == nullptr)
GetArrayIntrinsicID = new LightWeightMap<DWORDLONG, DWORD>();

DWORDLONG key = CastHandle(hMethod);
DWORD value = (DWORD)result;
GetArrayIntrinsicID->Add(key, value);
DEBUG_REC(dmpGetArrayIntrinsicID(key, value));
}
void MethodContext::dmpGetArrayIntrinsicID(DWORDLONG key, DWORD value)
{
printf("GetArrayIntrinsicID key %016llX, value %u", key, value);
}
CorInfoArrayIntrinsic MethodContext::repGetArrayIntrinsicID(CORINFO_METHOD_HANDLE hMethod)
{
DWORDLONG key = CastHandle(hMethod);
AssertMapAndKeyExist(GetArrayIntrinsicID, key, ": key %016llX", key);
DWORD value = GetArrayIntrinsicID->Get(key);
DEBUG_REP(dmpGetArrayIntrinsicID(key, value));
CorInfoArrayIntrinsic result = (CorInfoArrayIntrinsic)value;
return result;
}

void MethodContext::recIsFieldStatic(CORINFO_FIELD_HANDLE fhld, bool result)
{
if (IsFieldStatic == nullptr)
Expand Down
18 changes: 9 additions & 9 deletions src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ class MethodContext
void dmpGetClassAttribs(DWORDLONG key, DWORD value);
DWORD repGetClassAttribs(CORINFO_CLASS_HANDLE classHandle);

void recIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn, bool result);
void dmpIsJitIntrinsic(DWORDLONG key, DWORD value);
bool repIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn);
void recIsIntrinsic(CORINFO_METHOD_HANDLE ftn, bool result);
void dmpIsIntrinsic(DWORDLONG key, DWORD value);
bool repIsIntrinsic(CORINFO_METHOD_HANDLE ftn);

void recGetMethodAttribs(CORINFO_METHOD_HANDLE methodHandle, DWORD attribs);
void dmpGetMethodAttribs(DWORDLONG key, DWORD value);
Expand Down Expand Up @@ -225,10 +225,6 @@ class MethodContext
DWORD* exceptionCode);
void repGetCallInfoFromMethodHandle(CORINFO_METHOD_HANDLE methodHandle, CORINFO_CALL_INFO* pResult);

void recGetIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand, CorInfoIntrinsics result);
void dmpGetIntrinsicID(DWORDLONG key, DD value);
CorInfoIntrinsics repGetIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand);

void recAsCorInfoType(CORINFO_CLASS_HANDLE cls, CorInfoType result);
void dmpAsCorInfoType(DWORDLONG key, DWORD value);
CorInfoType repAsCorInfoType(CORINFO_CLASS_HANDLE cls);
Expand Down Expand Up @@ -818,6 +814,10 @@ class MethodContext
void dmpGetArrayRank(DWORDLONG key, DWORD value);
unsigned repGetArrayRank(CORINFO_CLASS_HANDLE cls);

void recGetArrayIntrinsicID(CORINFO_METHOD_HANDLE hMethod, CorInfoArrayIntrinsic result);
void dmpGetArrayIntrinsicID(DWORDLONG key, DWORD value);
CorInfoArrayIntrinsic repGetArrayIntrinsicID(CORINFO_METHOD_HANDLE hMethod);

void recIsFieldStatic(CORINFO_FIELD_HANDLE fhld, bool result);
void dmpIsFieldStatic(DWORDLONG key, DWORD value);
bool repIsFieldStatic(CORINFO_FIELD_HANDLE fhld);
Expand Down Expand Up @@ -970,7 +970,7 @@ enum mcPackets
Packet_GetHelperFtn = 63,
Packet_GetHelperName = 64,
Packet_GetInlinedCallFrameVptr = 65,
Packet_GetIntrinsicID = 66,
Packet_GetArrayIntrinsicID = 66,
Packet_GetJitTimeLogFilename = 67,
Packet_GetJustMyCodeHandle = 68,
Packet_GetLocationOfThisType = 69,
Expand Down Expand Up @@ -1095,7 +1095,7 @@ enum mcPackets
Packet_GetClassModule = 189,
Packet_GetModuleAssembly = 190,
Packet_GetAssemblyName = 191,
Packet_IsJitIntrinsic = 192,
Packet_IsIntrinsic = 192,
Packet_UpdateEntryPointForTailCall = 193,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ std::string SpmiDumpHelper::DumpCorInfoFlag(CorInfoFlag flags)
AddFlag(CORINFO_FLG_DISABLE_TIER0_FOR_LOOPS);
AddFlag(CORINFO_FLG_DONT_INLINE);
AddFlag(CORINFO_FLG_DONT_INLINE_CALLER);
AddFlag(CORINFO_FLG_JIT_INTRINSIC);
AddFlag(CORINFO_FLG_VALUECLASS);
AddFlag(CORINFO_FLG_VAROBJSIZE);
AddFlag(CORINFO_FLG_ARRAY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
/**********************************************************************************/

// Quick check whether the method is a jit intrinsic. Returns the same value as getMethodAttribs(ftn) &
// CORINFO_FLG_JIT_INTRINSIC, except faster.
bool interceptor_ICJI::isJitIntrinsic(CORINFO_METHOD_HANDLE ftn)
// CORINFO_FLG_INTRINSIC, except faster.
bool interceptor_ICJI::isIntrinsic(CORINFO_METHOD_HANDLE ftn)
{
mc->cr->AddCall("isJitIntrinsic");
bool temp = original_ICorJitInfo->isJitIntrinsic(ftn);
mc->recIsJitIntrinsic(ftn, temp);
mc->cr->AddCall("isIntrinsic");
bool temp = original_ICorJitInfo->isIntrinsic(ftn);
mc->recIsIntrinsic(ftn, temp);
return temp;
}

Expand Down Expand Up @@ -251,17 +251,6 @@ void interceptor_ICJI::expandRawHandleIntrinsic(CORINFO_RESOLVED_TOKEN* pR
original_ICorJitInfo->expandRawHandleIntrinsic(pResolvedToken, pResult);
}

// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
// getIntrinsicID() returns the intrinsic ID.
CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand /* OUT */
)
{
mc->cr->AddCall("getIntrinsicID");
CorInfoIntrinsics temp = original_ICorJitInfo->getIntrinsicID(method, pMustExpand);
mc->recGetIntrinsicID(method, pMustExpand, temp);
return temp;
}

// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute?
bool interceptor_ICJI::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
{
Expand Down Expand Up @@ -962,6 +951,15 @@ unsigned interceptor_ICJI::getArrayRank(CORINFO_CLASS_HANDLE cls)
return result;
}

// Get the index of runtime provided array method
CorInfoArrayIntrinsic interceptor_ICJI::getArrayIntrinsicID(CORINFO_METHOD_HANDLE ftn)
{
mc->cr->AddCall("getArrayIntrinsicID");
CorInfoArrayIntrinsic result = original_ICorJitInfo->getArrayIntrinsicID(ftn);
mc->recGetArrayIntrinsicID(ftn, result);
return result;
}

// Get static field data for an array
void* interceptor_ICJI::getArrayInitializationData(CORINFO_FIELD_HANDLE field, uint32_t size)
{
Expand Down
21 changes: 10 additions & 11 deletions src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#include "spmiutil.h"


bool interceptor_ICJI::isJitIntrinsic(
bool interceptor_ICJI::isIntrinsic(
CORINFO_METHOD_HANDLE ftn)
{
mcs->AddCall("isJitIntrinsic");
return original_ICorJitInfo->isJitIntrinsic(ftn);
mcs->AddCall("isIntrinsic");
return original_ICorJitInfo->isIntrinsic(ftn);
}

uint32_t interceptor_ICJI::getMethodAttribs(
Expand Down Expand Up @@ -161,14 +161,6 @@ void interceptor_ICJI::expandRawHandleIntrinsic(
original_ICorJitInfo->expandRawHandleIntrinsic(pResolvedToken, pResult);
}

CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(
CORINFO_METHOD_HANDLE method,
bool* pMustExpand)
{
mcs->AddCall("getIntrinsicID");
return original_ICorJitInfo->getIntrinsicID(method, pMustExpand);
}

bool interceptor_ICJI::isIntrinsicType(
CORINFO_CLASS_HANDLE classHnd)
{
Expand Down Expand Up @@ -682,6 +674,13 @@ unsigned interceptor_ICJI::getArrayRank(
return original_ICorJitInfo->getArrayRank(cls);
}

CorInfoArrayIntrinsic interceptor_ICJI::getArrayIntrinsicID(
CORINFO_METHOD_HANDLE ftn)
{
mcs->AddCall("getArrayIntrinsicID");
return original_ICorJitInfo->getArrayIntrinsicID(ftn);
}

void* interceptor_ICJI::getArrayInitializationData(
CORINFO_FIELD_HANDLE field,
uint32_t size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include "spmiutil.h"


bool interceptor_ICJI::isJitIntrinsic(
bool interceptor_ICJI::isIntrinsic(
CORINFO_METHOD_HANDLE ftn)
{
return original_ICorJitInfo->isJitIntrinsic(ftn);
return original_ICorJitInfo->isIntrinsic(ftn);
}

uint32_t interceptor_ICJI::getMethodAttribs(
Expand Down Expand Up @@ -143,13 +143,6 @@ void interceptor_ICJI::expandRawHandleIntrinsic(
original_ICorJitInfo->expandRawHandleIntrinsic(pResolvedToken, pResult);
}

CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(
CORINFO_METHOD_HANDLE method,
bool* pMustExpand)
{
return original_ICorJitInfo->getIntrinsicID(method, pMustExpand);
}

bool interceptor_ICJI::isIntrinsicType(
CORINFO_CLASS_HANDLE classHnd)
{
Expand Down Expand Up @@ -597,6 +590,12 @@ unsigned interceptor_ICJI::getArrayRank(
return original_ICorJitInfo->getArrayRank(cls);
}

CorInfoArrayIntrinsic interceptor_ICJI::getArrayIntrinsicID(
CORINFO_METHOD_HANDLE ftn)
{
return original_ICorJitInfo->getArrayIntrinsicID(ftn);
}

void* interceptor_ICJI::getArrayInitializationData(
CORINFO_FIELD_HANDLE field,
uint32_t size)
Expand Down
24 changes: 11 additions & 13 deletions src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ ICorJitInfo* InitICorJitInfo(JitInstance* jitInstance)
/**********************************************************************************/

// Quick check whether the method is a jit intrinsic. Returns the same value as getMethodAttribs(ftn) &
// CORINFO_FLG_JIT_INTRINSIC, except faster.
bool MyICJI::isJitIntrinsic(CORINFO_METHOD_HANDLE ftn)
// CORINFO_FLG_INTRINSIC, except faster.
bool MyICJI::isIntrinsic(CORINFO_METHOD_HANDLE ftn)
{
jitInstance->mc->cr->AddCall("isJitIntrinsic");
return jitInstance->mc->repIsJitIntrinsic(ftn);
jitInstance->mc->cr->AddCall("isIntrinsic");
return jitInstance->mc->repIsIntrinsic(ftn);
}

// return flags (defined above, CORINFO_FLG_PUBLIC ...)
Expand Down Expand Up @@ -217,15 +217,6 @@ void MyICJI::expandRawHandleIntrinsic(CORINFO_RESOLVED_TOKEN* pResolvedToken, CO
DebugBreakorAV(129);
}

// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
// getIntrinsicID() returns the intrinsic ID.
CorInfoIntrinsics MyICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand /* OUT */
)
{
jitInstance->mc->cr->AddCall("getIntrinsicID");
return jitInstance->mc->repGetIntrinsicID(method, pMustExpand);
}

// Is the given type in System.Private.Corelib and marked with IntrinsicAttribute?
bool MyICJI::isIntrinsicType(CORINFO_CLASS_HANDLE classHnd)
{
Expand Down Expand Up @@ -823,6 +814,13 @@ unsigned MyICJI::getArrayRank(CORINFO_CLASS_HANDLE cls)
return jitInstance->mc->repGetArrayRank(cls);
}

// Get the index of runtime provided array method
CorInfoArrayIntrinsic MyICJI::getArrayIntrinsicID(CORINFO_METHOD_HANDLE hMethod)
{
jitInstance->mc->cr->AddCall("getArrayIntrinsicID");
return jitInstance->mc->repGetArrayIntrinsicID(hMethod);
}

// Get static field data for an array
void* MyICJI::getArrayInitializationData(CORINFO_FIELD_HANDLE field, uint32_t size)
{
Expand Down
Loading