diff --git a/src/coreclr/jit/importercalls.cpp b/src/coreclr/jit/importercalls.cpp index bfd042fd102e8..839ffcfd7423f 100644 --- a/src/coreclr/jit/importercalls.cpp +++ b/src/coreclr/jit/importercalls.cpp @@ -265,11 +265,14 @@ var_types Compiler::impImportCall(OPCODE opcode, } #ifdef FEATURE_SIMD - call = impSIMDIntrinsic(opcode, newobjThis, clsHnd, methHnd, sig, mflags, pResolvedToken->token); - if (call != nullptr) + if (isIntrinsic) { - bIntrinsicImported = true; - goto DONE_CALL; + call = impSIMDIntrinsic(opcode, newobjThis, clsHnd, methHnd, sig, mflags, pResolvedToken->token); + if (call != nullptr) + { + bIntrinsicImported = true; + goto DONE_CALL; + } } #endif // FEATURE_SIMD diff --git a/src/coreclr/jit/simd.cpp b/src/coreclr/jit/simd.cpp index 5b6de344c8572..8ed34b43d739e 100644 --- a/src/coreclr/jit/simd.cpp +++ b/src/coreclr/jit/simd.cpp @@ -956,7 +956,8 @@ const SIMDIntrinsicInfo* Compiler::getSIMDIntrinsicInfo(CORINFO_CLASS_HANDLE* in if (sig->numArgs == 0) { const SIMDIntrinsicInfo* hwAccelIntrinsicInfo = &(simdIntrinsicInfoArray[SIMDIntrinsicHWAccel]); - if ((strcmp(eeGetMethodName(methodHnd, nullptr), hwAccelIntrinsicInfo->methodName) == 0) && + const char* methodName = info.compCompHnd->getMethodNameFromMetadata(methodHnd, nullptr, nullptr, nullptr); + if ((strcmp(methodName, hwAccelIntrinsicInfo->methodName) == 0) && JITtype2varType(sig->retType) == hwAccelIntrinsicInfo->retType) { // Sanity check @@ -993,7 +994,7 @@ const SIMDIntrinsicInfo* Compiler::getSIMDIntrinsicInfo(CORINFO_CLASS_HANDLE* in // TODO-Throughput: replace sequential search by binary search by arranging entries // sorted by method name. SIMDIntrinsicID intrinsicId = SIMDIntrinsicInvalid; - const char* methodName = eeGetMethodName(methodHnd, nullptr); + const char* methodName = info.compCompHnd->getMethodNameFromMetadata(methodHnd, nullptr, nullptr, nullptr); for (int i = SIMDIntrinsicNone + 1; i < SIMDIntrinsicInvalid; ++i) { if (strcmp(methodName, simdIntrinsicInfoArray[i].methodName) == 0) @@ -1855,18 +1856,14 @@ GenTree* Compiler::impSIMDIntrinsic(OPCODE opcode, unsigned methodFlags, int memberRef) { + assert((methodFlags & CORINFO_FLG_INTRINSIC) != 0); + // Exit early if we are not in one of the SIMD types. if (!isSIMDClass(clsHnd)) { return nullptr; } - // Exit early if the method is not a JIT Intrinsic (which requires the [Intrinsic] attribute). - if ((methodFlags & CORINFO_FLG_INTRINSIC) == 0) - { - return nullptr; - } - // Get base type and intrinsic Id CorInfoType simdBaseJitType = CORINFO_TYPE_UNDEF; unsigned size = 0; diff --git a/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp index 02d06fd4da772..28a97d47f032f 100644 --- a/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp @@ -1180,46 +1180,43 @@ const char* MethodContext::repGetMethodNameFromMetadata(CORINFO_METHOD_HANDLE ft const char** namespaceName, const char** enclosingClassName) { - const char* result = nullptr; - Agnostic_CORINFO_METHODNAME_TOKENout value; Agnostic_CORINFO_METHODNAME_TOKENin key; + key.ftn = CastHandle(ftn); key.className = (moduleName != nullptr); key.namespaceName = (namespaceName != nullptr); key.enclosingClassName = (enclosingClassName != nullptr); - int itemIndex = -1; - if (GetMethodNameFromMetadata != nullptr) - itemIndex = GetMethodNameFromMetadata->GetIndex(key); - if (itemIndex < 0) - { - if (moduleName != nullptr) - { - *moduleName = nullptr; - } - } - else - { - value = GetMethodNameFromMetadata->Get(key); - DEBUG_REP(dmpGetMethodNameFromMetadata(key, value)); + AssertMapAndKeyExist( + GetMethodNameFromMetadata, + key, + ": ftn-%016llX className-%u namespaceName-%u enclosingClassName-%u", + key.ftn, + key.className, + key.namespaceName, + key.enclosingClassName); - result = (const char*)GetMethodNameFromMetadata->GetBuffer(value.methodName); + Agnostic_CORINFO_METHODNAME_TOKENout value = GetMethodNameFromMetadata->Get(key); - if (moduleName != nullptr) - { - *moduleName = (const char*)GetMethodNameFromMetadata->GetBuffer(value.className); - } + DEBUG_REP(dmpGetMethodNameFromMetadata(key, value)); - if (namespaceName != nullptr) - { - *namespaceName = (const char*)GetMethodNameFromMetadata->GetBuffer(value.namespaceName); - } + const char* result = (const char*)GetMethodNameFromMetadata->GetBuffer(value.methodName); - if (enclosingClassName != nullptr) - { - *enclosingClassName = (const char*)GetMethodNameFromMetadata->GetBuffer(value.enclosingClassName); - } + if (moduleName != nullptr) + { + *moduleName = (const char*)GetMethodNameFromMetadata->GetBuffer(value.className); } + + if (namespaceName != nullptr) + { + *namespaceName = (const char*)GetMethodNameFromMetadata->GetBuffer(value.namespaceName); + } + + if (enclosingClassName != nullptr) + { + *enclosingClassName = (const char*)GetMethodNameFromMetadata->GetBuffer(value.enclosingClassName); + } + return result; } diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 7f9eb04892604..1ec3bfc16722f 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -6299,12 +6299,24 @@ const char* CEEInfo::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftnHnd, con } CONTRACTL_END; const char* result = NULL; - const char* classResult = NULL; - const char* namespaceResult = NULL; - const char* enclosingResult = NULL; JIT_TO_EE_TRANSITION(); + if (className != NULL) + { + *className = NULL; + } + + if (namespaceName != NULL) + { + *namespaceName = NULL; + } + + if (enclosingClassName != NULL) + { + *enclosingClassName = NULL; + } + MethodDesc *ftn = GetMethod(ftnHnd); mdMethodDef token = ftn->GetMemberDef(); @@ -6314,30 +6326,18 @@ const char* CEEInfo::getMethodNameFromMetadata(CORINFO_METHOD_HANDLE ftnHnd, con IMDInternalImport* pMDImport = pMT->GetMDImport(); IfFailThrow(pMDImport->GetNameOfMethodDef(token, &result)); - IfFailThrow(pMDImport->GetNameOfTypeDef(pMT->GetCl(), &classResult, &namespaceResult)); + if (className != NULL || namespaceName != NULL) + { + IfFailThrow(pMDImport->GetNameOfTypeDef(pMT->GetCl(), className, namespaceName)); + } // 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()) + if ((enclosingClassName != NULL || namespaceName != NULL) && pMT->GetClass()->IsNested()) { - IfFailThrow(pMDImport->GetNameOfTypeDef(pMT->GetEnclosingCl(), &enclosingResult, &namespaceResult)); + IfFailThrow(pMDImport->GetNameOfTypeDef(pMT->GetEnclosingCl(), enclosingClassName, namespaceName)); } } - if (className != NULL) - { - *className = classResult; - } - - if (namespaceName != NULL) - { - *namespaceName = namespaceResult; - } - - if (enclosingClassName != NULL) - { - *enclosingClassName = enclosingResult; - } - EE_TO_JIT_TRANSITION(); return result;