diff options
author | Fei Peng <fei.peng@intel.com> | 2018-11-29 15:02:24 -0800 |
---|---|---|
committer | Fei Peng <fei.peng@intel.com> | 2018-11-29 15:02:56 -0800 |
commit | 1ebec7911d417205e6cfcae663e37fe843ce858b (patch) | |
tree | 2043f0653519f60de9bf09065a4202fd7cd3c699 /src/ToolBox | |
parent | bc62955491a970934e0b67d0d91c7f4148e40c89 (diff) | |
download | coreclr-1ebec7911d417205e6cfcae663e37fe843ce858b.tar.gz coreclr-1ebec7911d417205e6cfcae663e37fe843ce858b.tar.bz2 coreclr-1ebec7911d417205e6cfcae663e37fe843ce858b.zip |
Add SuperPMI code for the new getMethodNameFromMetadata
Diffstat (limited to 'src/ToolBox')
8 files changed, 88 insertions, 51 deletions
diff --git a/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h b/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h index 73a8d28fc9..b6a66a3e06 100644 --- a/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h +++ b/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h @@ -716,7 +716,8 @@ const char* getMethodName(CORINFO_METHOD_HANDLE ftn, /* IN */ // Suitable for non-debugging use. const char* getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ const char** className, /* OUT */ - const char** namespaceName /* OUT */ + const char** namespaceName, /* OUT */ + const char** enclosingClassName /* OUT */ ); // this function is for debugging only. It returns a value that diff --git a/src/ToolBox/superpmi/superpmi-shared/lwmlist.h b/src/ToolBox/superpmi/superpmi-shared/lwmlist.h index a50e9b6b34..137fbe111d 100644 --- a/src/ToolBox/superpmi/superpmi-shared/lwmlist.h +++ b/src/ToolBox/superpmi/superpmi-shared/lwmlist.h @@ -109,7 +109,7 @@ LWM(GetMethodDefFromMethod, DWORDLONG, DWORD) LWM(GetMethodHash, DWORDLONG, DWORD) LWM(GetMethodInfo, DWORDLONG, Agnostic_GetMethodInfo) LWM(GetMethodName, DLD, DD) -LWM(GetMethodNameFromMetadata, DLDD, DDD) +LWM(GetMethodNameFromMetadata, Agnostic_CORINFO_METHODNAME_TOKENin, Agnostic_CORINFO_METHODNAME_TOKENout) LWM(GetMethodSig, DLDL, Agnostic_CORINFO_SIG_INFO) LWM(GetMethodSync, DWORDLONG, DLDL) LWM(GetMethodVTableOffset, DWORDLONG, DDD) diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 11c73365a3..4883dd4f38 100644 --- a/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -1001,57 +1001,68 @@ const char* MethodContext::repGetMethodName(CORINFO_METHOD_HANDLE ftn, const cha void MethodContext::recGetMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, char* methodName, const char** className, - const char** namespaceName) + const char** namespaceName, + const char** enclosingClassName) { if (GetMethodNameFromMetadata == nullptr) - GetMethodNameFromMetadata = new LightWeightMap<DLDD, DDD>(); - DDD value; - DLDD key; - key.A = (DWORDLONG)ftn; - key.B = (className != nullptr); - key.C = (namespaceName != nullptr); + GetMethodNameFromMetadata = new LightWeightMap<Agnostic_CORINFO_METHODNAME_TOKENin, Agnostic_CORINFO_METHODNAME_TOKENout>(); + Agnostic_CORINFO_METHODNAME_TOKENout value; + Agnostic_CORINFO_METHODNAME_TOKENin key; + key.ftn = (DWORDLONG)ftn; + key.className = (className != nullptr); + key.namespaceName = (namespaceName != nullptr); + key.enclosingClassName = (enclosingClassName != nullptr); if (methodName != nullptr) - value.A = GetMethodNameFromMetadata->AddBuffer((unsigned char*)methodName, (DWORD)strlen(methodName) + 1); + value.methodName = GetMethodNameFromMetadata->AddBuffer((unsigned char*)methodName, (DWORD)strlen(methodName) + 1); else - value.A = (DWORD)-1; + value.methodName = (DWORD)-1; if ((className != nullptr) && (*className != nullptr)) - value.B = GetMethodNameFromMetadata->AddBuffer((unsigned char*)*className, (DWORD)strlen(*className) + 1); + value.className = GetMethodNameFromMetadata->AddBuffer((unsigned char*)*className, (DWORD)strlen(*className) + 1); else - value.B = (DWORD)-1; + value.className = (DWORD)-1; if ((namespaceName != nullptr) && (*namespaceName != nullptr)) - value.C = + value.namespaceName = GetMethodNameFromMetadata->AddBuffer((unsigned char*)*namespaceName, (DWORD)strlen(*namespaceName) + 1); else - value.C = (DWORD)-1; + value.namespaceName = (DWORD)-1; + + if ((enclosingClassName != nullptr) && (*enclosingClassName != nullptr)) + value.enclosingClassName = + GetMethodNameFromMetadata->AddBuffer((unsigned char*)*enclosingClassName, (DWORD)strlen(*enclosingClassName) + 1); + else + value.enclosingClassName = (DWORD)-1; GetMethodNameFromMetadata->Add(key, value); DEBUG_REC(dmpGetMethodNameFromMetadata(key, value)); } -void MethodContext::dmpGetMethodNameFromMetadata(DLDD key, DDD value) +void MethodContext::dmpGetMethodNameFromMetadata(Agnostic_CORINFO_METHODNAME_TOKENin key, Agnostic_CORINFO_METHODNAME_TOKENout value) { - unsigned char* methodName = (unsigned char*)GetMethodName->GetBuffer(value.A); - unsigned char* className = (unsigned char*)GetMethodName->GetBuffer(value.B); - unsigned char* namespaceName = (unsigned char*)GetMethodName->GetBuffer(value.C); - printf("GetMethodNameFromMetadata key - ftn-%016llX classNonNull-%u namespaceNonNull-%u, value meth-'%s', " - "class-'%s', namespace-'%s'", - key.A, key.B, key.C, methodName, className, namespaceName); + unsigned char* methodName = (unsigned char*)GetMethodName->GetBuffer(value.methodName); + unsigned char* className = (unsigned char*)GetMethodName->GetBuffer(value.className); + unsigned char* namespaceName = (unsigned char*)GetMethodName->GetBuffer(value.namespaceName); + unsigned char* enclosingClassName = (unsigned char*)GetMethodName->GetBuffer(value.enclosingClassName); + printf("GetMethodNameFromMetadata key - ftn-%016llX classNonNull-%u namespaceNonNull-%u nclosingClassNonNull-%u, value meth-'%s', " + "class-'%s', namespace-'%s' enclosingClass-'%s'", + key.ftn, key.className, key.namespaceName, key.enclosingClassName, methodName, className, namespaceName, enclosingClassName); GetMethodNameFromMetadata->Unlock(); } const char* MethodContext::repGetMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, const char** moduleName, - const char** namespaceName) + const char** namespaceName, + const char** enclosingClassName) { const char* result = nullptr; - DDD value; - DLDD key; - key.A = (DWORDLONG)ftn; - key.B = (moduleName != nullptr); - key.C = (namespaceName != nullptr); + Agnostic_CORINFO_METHODNAME_TOKENout value; + Agnostic_CORINFO_METHODNAME_TOKENin key; + key.ftn = (DWORDLONG)ftn; + key.className = (moduleName != nullptr); + key.namespaceName = (namespaceName != nullptr); + key.enclosingClassName = (enclosingClassName != nullptr); int itemIndex = -1; if (GetMethodNameFromMetadata != nullptr) @@ -1066,16 +1077,21 @@ const char* MethodContext::repGetMethodNameFromMetadata(CORINFO_METHOD_HANDLE ft else { value = GetMethodNameFromMetadata->Get(key); - result = (const char*)GetMethodNameFromMetadata->GetBuffer(value.A); + result = (const char*)GetMethodNameFromMetadata->GetBuffer(value.methodName); if (moduleName != nullptr) { - *moduleName = (const char*)GetMethodNameFromMetadata->GetBuffer(value.B); + *moduleName = (const char*)GetMethodNameFromMetadata->GetBuffer(value.className); } if (namespaceName != nullptr) { - *namespaceName = (const char*)GetMethodNameFromMetadata->GetBuffer(value.C); + *namespaceName = (const char*)GetMethodNameFromMetadata->GetBuffer(value.namespaceName); + } + + if (enclosingClassName != nullptr) + { + *enclosingClassName = (const char*)GetMethodNameFromMetadata->GetBuffer(value.enclosingClassName); } } DEBUG_REP(dmpGetMethodNameFromMetadata(key, value)); diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h index cde16adc12..115cd4182d 100644 --- a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -95,6 +95,20 @@ public: DWORD B; DWORD C; }; + struct Agnostic_CORINFO_METHODNAME_TOKENin + { + DWORDLONG ftn; + DWORD className; + DWORD namespaceName; + DWORD enclosingClassName; + }; + struct Agnostic_CORINFO_METHODNAME_TOKENout + { + DWORD methodName; + DWORD className; + DWORD namespaceName; + DWORD enclosingClassName; + }; struct Agnostic_CORINFO_RESOLVED_TOKENin { DWORDLONG tokenContext; @@ -625,11 +639,13 @@ public: void recGetMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, char* methodname, const char** moduleName, - const char** namespaceName); - void dmpGetMethodNameFromMetadata(DLDD key, DDD value); + const char** namespaceName, + const char** enclosingClassName); + void dmpGetMethodNameFromMetadata(Agnostic_CORINFO_METHODNAME_TOKENin key, Agnostic_CORINFO_METHODNAME_TOKENout value); const char* repGetMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, const char** className, - const char** namespaceName); + const char** namespaceName, + const char** enclosingClassName); void recGetJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes, DWORD result); void dmpGetJitFlags(DWORD key, DD value); diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp index 1b1ba5d565..898f8241cb 100644 --- a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -1481,14 +1481,15 @@ const char* interceptor_ICJI::getMethodName(CORINFO_METHOD_HANDLE ftn, /* return temp; } -const char* interceptor_ICJI::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ - const char** className, /* OUT */ - const char** namespaceName /* OUT */ +const char* interceptor_ICJI::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ + const char** className, /* OUT */ + const char** namespaceName, /* OUT */ + const char** enclosingClassName /* OUT */ ) { mc->cr->AddCall("getMethodNameFromMetadata"); - const char* temp = original_ICorJitInfo->getMethodNameFromMetadata(ftn, className, namespaceName); - mc->recGetMethodNameFromMetadata(ftn, (char*)temp, className, namespaceName); + const char* temp = original_ICorJitInfo->getMethodNameFromMetadata(ftn, className, namespaceName, enclosingClassName); + mc->recGetMethodNameFromMetadata(ftn, (char*)temp, className, namespaceName, enclosingClassName); return temp; } diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp index c8002f5cd7..3348479a85 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp @@ -1153,13 +1153,14 @@ const char* interceptor_ICJI::getMethodName(CORINFO_METHOD_HANDLE ftn, /* return original_ICorJitInfo->getMethodName(ftn, moduleName); } -const char* interceptor_ICJI::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ - const char** className, /* OUT */ - const char** namespaceName /* OUT */ +const char* interceptor_ICJI::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ + const char** className, /* OUT */ + const char** namespaceName, /* OUT */ + const char** enclosingClassName /* OUT */ ) { mcs->AddCall("getMethodNameFromMetadata"); - return original_ICorJitInfo->getMethodNameFromMetadata(ftn, className, namespaceName); + return original_ICorJitInfo->getMethodNameFromMetadata(ftn, className, namespaceName, enclosingClassName); } // this function is for debugging only. It returns a value that diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp index 1bdd3b75aa..b5a18f855c 100644 --- a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp @@ -1037,12 +1037,13 @@ const char* interceptor_ICJI::getMethodName(CORINFO_METHOD_HANDLE ftn, /* return original_ICorJitInfo->getMethodName(ftn, moduleName); } -const char* interceptor_ICJI::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ - const char** className, /* OUT */ - const char** namespaceName /* OUT */ +const char* interceptor_ICJI::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ + const char** className, /* OUT */ + const char** namespaceName, /* OUT */ + const char** enclosingClassName /* OUT */ ) { - return original_ICorJitInfo->getMethodNameFromMetadata(ftn, className, namespaceName); + return original_ICorJitInfo->getMethodNameFromMetadata(ftn, className, namespaceName, enclosingClassName); } // this function is for debugging only. It returns a value that diff --git a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp index d6d4d6e8ff..bf60a9a0bd 100644 --- a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp @@ -1259,13 +1259,14 @@ const char* MyICJI::getMethodName(CORINFO_METHOD_HANDLE ftn, /* IN */ return jitInstance->mc->repGetMethodName(ftn, moduleName); } -const char* MyICJI::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ - const char** className, /* OUT */ - const char** namespaceName /* OUT */ +const char* MyICJI::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, /* IN */ + const char** className, /* OUT */ + const char** namespaceName, /* OUT */ + const char** enclosingClassName /* OUT */ ) { jitInstance->mc->cr->AddCall("getMethodNameFromMetadata"); - return jitInstance->mc->repGetMethodNameFromMetadata(ftn, className, namespaceName); + return jitInstance->mc->repGetMethodNameFromMetadata(ftn, className, namespaceName, enclosingClassName); } // this function is for debugging only. It returns a value that |