Skip to content

Commit 7584128

Browse files
committed
Implement missing superPMI methods
1 parent 14b7e27 commit 7584128

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

src/coreclr/tools/superpmi/superpmi-shared/lwmlist.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ LWM(GetMethodDefFromMethod, DWORDLONG, DWORD)
109109
LWM(GetMethodHash, DWORDLONG, DWORD)
110110
LWM(GetMethodInfo, DLDL, Agnostic_GetMethodInfo)
111111
LWM(HaveSameMethodDefinition, DLDL, DWORD)
112+
LWM(GetTypeDefinition, DWORDLONG, DWORDLONG)
112113
LWM(GetMethodNameFromMetadata, Agnostic_CORINFO_METHODNAME_TOKENin, Agnostic_CORINFO_METHODNAME_TOKENout)
113114
LWM(GetMethodSig, DLDL, Agnostic_CORINFO_SIG_INFO)
114115
LWM(GetMethodSync, DWORDLONG, DLDL)

src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3059,6 +3059,29 @@ bool MethodContext::repHaveSameMethodDefinition(CORINFO_METHOD_HANDLE methHnd1,
30593059
return value != 0;
30603060
}
30613061

3062+
void MethodContext::recGetTypeDefinition(CORINFO_CLASS_HANDLE cls, CORINFO_CLASS_HANDLE result)
3063+
{
3064+
if (GetTypeDefinition == nullptr)
3065+
GetTypeDefinition = new LightWeightMap<DWORDLONG, DWORDLONG>();
3066+
3067+
DWORDLONG key = CastHandle(cls);
3068+
DWORDLONG value = CastHandle(result);
3069+
GetTypeDefinition->Add(key, value);
3070+
DEBUG_REC(dmpGetTypeDefinition(key, value));
3071+
}
3072+
void MethodContext::dmpGetTypeDefinition(DWORDLONG key, DWORDLONG value)
3073+
{
3074+
printf("GetTypeDefinition key cls-%016" PRIX64 ", value cls-%016" PRIX64 "", key, value);
3075+
}
3076+
CORINFO_CLASS_HANDLE MethodContext::repGetTypeDefinition(CORINFO_CLASS_HANDLE cls)
3077+
{
3078+
DWORDLONG key = CastHandle(cls);
3079+
DWORDLONG value = LookupByKeyOrMiss(GetTypeDefinition, key, ": key %016" PRIX64 "", key);
3080+
DEBUG_REP(dmpGetTypeDefinition(key, value));
3081+
CORINFO_CLASS_HANDLE result = (CORINFO_CLASS_HANDLE)value;
3082+
return result;
3083+
}
3084+
30623085
void MethodContext::recGetNewHelper(CORINFO_CLASS_HANDLE classHandle,
30633086
bool hasSideEffects,
30643087
CorInfoHelpFunc result,

src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ class MethodContext
414414
void dmpHaveSameMethodDefinition(const DLDL& key, DWORD value);
415415
bool repHaveSameMethodDefinition(CORINFO_METHOD_HANDLE methHnd1, CORINFO_METHOD_HANDLE methHnd2);
416416

417+
void recGetTypeDefinition(CORINFO_CLASS_HANDLE type, CORINFO_CLASS_HANDLE result);
418+
void dmpGetTypeDefinition(DWORDLONG key, DWORDLONG value);
419+
CORINFO_CLASS_HANDLE repGetTypeDefinition(CORINFO_CLASS_HANDLE type);
420+
417421
void recGetNewHelper(CORINFO_CLASS_HANDLE classHandle,
418422
bool hasSideEffects,
419423
CorInfoHelpFunc result,
@@ -1154,6 +1158,7 @@ enum mcPackets
11541158
Packet_HaveSameMethodDefinition = 213,
11551159
Packet_NotifyMethodInfoUsage = 214,
11561160
Packet_IsExactType = 215,
1161+
Packet_GetTypeDefinition = 216,
11571162
};
11581163

11591164
void SetDebugDumpVariables();

src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@ bool interceptor_ICJI::haveSameMethodDefinition(
107107
return result;
108108
}
109109

110+
CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeDefinition(
111+
CORINFO_CLASS_HANDLE type)
112+
{
113+
CORINFO_CLASS_HANDLE result = original_ICorJitInfo->getTypeDefinition(type);
114+
mc->recGetTypeDefinition(type, result);
115+
116+
return result;
117+
}
118+
110119
// Decides if you have any limitations for inlining. If everything's OK, it will return
111120
// INLINE_PASS.
112121
//

src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ bool MyICJI::haveSameMethodDefinition(
9696
return value;
9797
}
9898

99+
CORINFO_CLASS_HANDLE MyICJI::getTypeDefinition(
100+
CORINFO_CLASS_HANDLE type)
101+
{
102+
jitInstance->mc->cr->AddCall("getTypeDefinition");
103+
CORINFO_CLASS_HANDLE value = jitInstance->mc->repGetTypeDefinition(type);
104+
return value;
105+
}
106+
99107
// Decides if you have any limitations for inlining. If everything's OK, it will return
100108
// INLINE_PASS.
101109
//

0 commit comments

Comments
 (0)