summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFei Peng <fei.peng@intel.com>2018-11-20 17:05:25 -0800
committerFei Peng <fei.peng@intel.com>2018-11-29 13:25:17 -0800
commitbc62955491a970934e0b67d0d91c7f4148e40c89 (patch)
tree723fb98a748d0f6cd08277658cd3d3d82a95ccbe /src
parentb858fb810e76b5eaa5b5f7ccba3376463318550f (diff)
downloadcoreclr-bc62955491a970934e0b67d0d91c7f4148e40c89.tar.gz
coreclr-bc62955491a970934e0b67d0d91c7f4148e40c89.tar.bz2
coreclr-bc62955491a970934e0b67d0d91c7f4148e40c89.zip
Update JIT/EE getMethodNameFromMetadata to get enclosing class name
Diffstat (limited to 'src')
-rw-r--r--src/inc/corinfo.h20
-rw-r--r--src/jit/ICorJitInfo_API_wrapper.hpp9
-rw-r--r--src/vm/interpreter.cpp2
-rw-r--r--src/vm/jitinterface.cpp20
-rw-r--r--src/vm/jitinterface.h2
-rw-r--r--src/zap/zapinfo.cpp4
-rw-r--r--src/zap/zapinfo.h3
7 files changed, 38 insertions, 22 deletions
diff --git a/src/inc/corinfo.h b/src/inc/corinfo.h
index 68eec6b57e..9b7a2f971a 100644
--- a/src/inc/corinfo.h
+++ b/src/inc/corinfo.h
@@ -213,11 +213,11 @@ TODO: Talk about initializing strutures before use
#define SELECTANY extern __declspec(selectany)
#endif
-SELECTANY const GUID JITEEVersionIdentifier = { /* 09F7AAE2-07DF-4433-B8C5-BA864CCABDA3 */
- 0x9f7aae2,
- 0x7df,
- 0x4433,
- {0xb8, 0xc5, 0xba, 0x86, 0x4c, 0xca, 0xbd, 0xa3}
+SELECTANY const GUID JITEEVersionIdentifier = { /* FF09DB9F-26A8-4A0B-AF2C-78E32A516FE1 */
+ 0xff09db9f,
+ 0x26a8,
+ 0x4a0b,
+ {0xaf, 0x2c, 0x78, 0xe3, 0x2a, 0x51, 0x6f, 0xe1}
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -2894,12 +2894,14 @@ public:
) = 0;
// Return method name as in metadata, or nullptr if there is none,
- // and optionally return the class and namespace names as in metadata.
+ // and optionally return the class, enclosing class, and namespace names
+ // as in metadata.
// Suitable for non-debugging use.
virtual const char* getMethodNameFromMetadata(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- const char **className, /* OUT */
- const char **namespaceName /* OUT */
+ CORINFO_METHOD_HANDLE ftn, /* IN */
+ const char **className, /* OUT */
+ const char **namespaceName, /* OUT */
+ const char **enclosingClassName /* OUT */
) = 0;
// this function is for debugging only. It returns a value that
diff --git a/src/jit/ICorJitInfo_API_wrapper.hpp b/src/jit/ICorJitInfo_API_wrapper.hpp
index 6d93f5af30..8a9abb4437 100644
--- a/src/jit/ICorJitInfo_API_wrapper.hpp
+++ b/src/jit/ICorJitInfo_API_wrapper.hpp
@@ -1079,12 +1079,13 @@ const char* WrapICorJitInfo::getMethodName(
}
const char* WrapICorJitInfo::getMethodNameFromMetadata(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- const char **className, /* OUT */
- const char **namespaceName /* OUT */)
+ CORINFO_METHOD_HANDLE ftn, /* IN */
+ const char **className, /* OUT */
+ const char **namespaceName, /* OUT */
+ const char **enclosingClassName /* OUT */)
{
API_ENTER(getMethodNameFromMetadata);
- const char* temp = wrapHnd->getMethodNameFromMetaData(ftn, moduleName, namespaceName);
+ const char* temp = wrapHnd->getMethodNameFromMetaData(ftn, className, namespaceName, enclosingClassName);
API_LEAVE(getMethodNameFromMetadata);
return temp;
}
diff --git a/src/vm/interpreter.cpp b/src/vm/interpreter.cpp
index f435cdacb2..bdadc3245d 100644
--- a/src/vm/interpreter.cpp
+++ b/src/vm/interpreter.cpp
@@ -9131,7 +9131,7 @@ void Interpreter::DoCallWork(bool virtualCall, void* thisArg, CORINFO_RESOLVED_T
// SIMD intrinsics are recognized by name.
const char* namespaceName = NULL;
const char* className = NULL;
- const char* methodName = m_interpCeeInfo.getMethodNameFromMetadata((CORINFO_METHOD_HANDLE)methToCall, &className, &namespaceName);
+ const char* methodName = m_interpCeeInfo.getMethodNameFromMetadata((CORINFO_METHOD_HANDLE)methToCall, &className, &namespaceName, NULL);
if (strcmp(methodName, "get_IsHardwareAccelerated") == 0)
{
GCX_COOP();
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp
index 77054f9782..81f298031f 100644
--- a/src/vm/jitinterface.cpp
+++ b/src/vm/jitinterface.cpp
@@ -6607,7 +6607,7 @@ const char* CEEInfo::getMethodName (CORINFO_METHOD_HANDLE ftnHnd, const char** s
return result;
}
-const char* CEEInfo::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftnHnd, const char** className, const char** namespaceName)
+const char* CEEInfo::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftnHnd, const char** className, const char** namespaceName, const char **enclosingClassName)
{
CONTRACTL {
SO_TOLERANT;
@@ -6619,6 +6619,7 @@ const char* CEEInfo::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftnHnd, con
const char* result = NULL;
const char* classResult = NULL;
const char* namespaceResult = NULL;
+ const char* enclosingResult = NULL;
JIT_TO_EE_TRANSITION();
@@ -6627,10 +6628,16 @@ const char* CEEInfo::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftnHnd, con
if (!IsNilToken(token))
{
- if (!FAILED(ftn->GetMDImport()->GetNameOfMethodDef(token, &result)))
+ MethodTable* pMT = ftn->GetMethodTable();
+ IMDInternalImport* pMDImport = pMT->GetMDImport();
+
+ IfFailThrow(pMDImport->GetNameOfMethodDef(token, &result));
+ IfFailThrow(pMDImport->GetNameOfTypeDef(pMT->GetCl(), &classResult, &namespaceResult));
+ // Query enclosingClassName when the method is in a nested class
+ // and get the namespace of enclosing classes (nested class's namespace is empty)
+ if (pMT->GetClass()->IsNested())
{
- MethodTable* pMT = ftn->GetMethodTable();
- classResult = pMT->GetFullyQualifiedNameInfo(&namespaceResult);
+ IfFailThrow(pMDImport->GetNameOfTypeDef(pMT->GetEnclosingCl(), &enclosingResult, &namespaceResult));
}
}
@@ -6644,6 +6651,11 @@ const char* CEEInfo::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftnHnd, con
*namespaceName = namespaceResult;
}
+ if (enclosingClassName != NULL)
+ {
+ *enclosingClassName = enclosingResult;
+ }
+
EE_TO_JIT_TRANSITION();
return result;
diff --git a/src/vm/jitinterface.h b/src/vm/jitinterface.h
index dae6352000..4c23de9b51 100644
--- a/src/vm/jitinterface.h
+++ b/src/vm/jitinterface.h
@@ -689,7 +689,7 @@ public:
// ICorMethodInfo stuff
const char* getMethodName (CORINFO_METHOD_HANDLE ftnHnd, const char** scopeName);
- const char* getMethodNameFromMetadata (CORINFO_METHOD_HANDLE ftnHnd, const char** className, const char** namespaceName);
+ const char* getMethodNameFromMetadata (CORINFO_METHOD_HANDLE ftnHnd, const char** className, const char** namespaceName, const char **enclosingClassName);
unsigned getMethodHash (CORINFO_METHOD_HANDLE ftnHnd);
DWORD getMethodAttribs (CORINFO_METHOD_HANDLE ftnHnd);
diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp
index b94809f45e..7c0200b9c1 100644
--- a/src/zap/zapinfo.cpp
+++ b/src/zap/zapinfo.cpp
@@ -3605,9 +3605,9 @@ const char* ZapInfo::getMethodName(CORINFO_METHOD_HANDLE ftn, const char **modul
return m_pEEJitInfo->getMethodName(ftn, moduleName);
}
-const char* ZapInfo::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, const char **className, const char** namespaceName)
+const char* ZapInfo::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn, const char **className, const char** namespaceName, const char **enclosingClassName)
{
- return m_pEEJitInfo->getMethodNameFromMetadata(ftn, className, namespaceName);
+ return m_pEEJitInfo->getMethodNameFromMetadata(ftn, className, namespaceName, enclosingClassName);
}
unsigned ZapInfo::getMethodHash(CORINFO_METHOD_HANDLE ftn)
diff --git a/src/zap/zapinfo.h b/src/zap/zapinfo.h
index 0e4a84eb4c..a79319e7a2 100644
--- a/src/zap/zapinfo.h
+++ b/src/zap/zapinfo.h
@@ -634,7 +634,8 @@ public:
const char **moduleName);
const char* getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftn,
const char **className,
- const char **namespaceName);
+ const char **namespaceName,
+ const char **enclosingClassName);
unsigned getMethodHash(CORINFO_METHOD_HANDLE ftn);
DWORD getMethodAttribs(CORINFO_METHOD_HANDLE ftn);