From 2867d5b5d7e10fe280c2dc8dd63e34f65162f297 Mon Sep 17 00:00:00 2001 From: Sergey Andreenko Date: Fri, 31 Mar 2017 18:36:06 -0700 Subject: [PATCH] delete GetMethod2 (dotnet/coreclr#10626) * delete GetMethod2 * delete unused code Commit migrated from https://github.com/dotnet/coreclr/commit/654c340d62a48c424d26d034a40bd360670320c0 --- src/coreclr/src/jit/_typeinfo.h | 7 ------- src/coreclr/src/jit/compiler.h | 4 ---- src/coreclr/src/jit/importer.cpp | 27 --------------------------- 3 files changed, 38 deletions(-) diff --git a/src/coreclr/src/jit/_typeinfo.h b/src/coreclr/src/jit/_typeinfo.h index 918e0a3..795691d 100755 --- a/src/coreclr/src/jit/_typeinfo.h +++ b/src/coreclr/src/jit/_typeinfo.h @@ -556,13 +556,6 @@ public: return m_method; } - // If FEATURE_CORECLR is enabled, GetMethod can be called - // before the pointer type is known to be a method pointer type. - CORINFO_METHOD_HANDLE GetMethod2() const - { - return m_method; - } - // Get this item's type // If primitive, returns the primitive type (TI_*) // If not primitive, returns: diff --git a/src/coreclr/src/jit/compiler.h b/src/coreclr/src/jit/compiler.h index 01e5735..5e876aa 100644 --- a/src/coreclr/src/jit/compiler.h +++ b/src/coreclr/src/jit/compiler.h @@ -2903,10 +2903,6 @@ protected: void impHandleAccessAllowed(CorInfoIsAccessAllowedResult result, CORINFO_HELPER_DESC* helperCall); void impHandleAccessAllowedInternal(CorInfoIsAccessAllowedResult result, CORINFO_HELPER_DESC* helperCall); - void impInsertCalloutForDelegate(CORINFO_METHOD_HANDLE callerMethodHnd, - CORINFO_METHOD_HANDLE calleeMethodHnd, - CORINFO_CLASS_HANDLE delegateTypeHnd); - var_types impImportCall(OPCODE opcode, CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken, // Is this a "constrained." call on a diff --git a/src/coreclr/src/jit/importer.cpp b/src/coreclr/src/jit/importer.cpp index eaf647a..969f2df 100644 --- a/src/coreclr/src/jit/importer.cpp +++ b/src/coreclr/src/jit/importer.cpp @@ -6126,25 +6126,6 @@ void Compiler::impInsertHelperCall(CORINFO_HELPER_DESC* helperInfo) impAppendTree(callout, (unsigned)CHECK_SPILL_NONE, impCurStmtOffs); } -void Compiler::impInsertCalloutForDelegate(CORINFO_METHOD_HANDLE callerMethodHnd, - CORINFO_METHOD_HANDLE calleeMethodHnd, - CORINFO_CLASS_HANDLE delegateTypeHnd) -{ -#ifdef FEATURE_CORECLR - if (!info.compCompHnd->isDelegateCreationAllowed(delegateTypeHnd, calleeMethodHnd)) - { - // Call the JIT_DelegateSecurityCheck helper before calling the actual function. - // This helper throws an exception if the CLR host disallows the call. - - GenTreePtr helper = gtNewHelperCallNode(CORINFO_HELP_DELEGATE_SECURITY_CHECK, TYP_VOID, GTF_EXCEPT, - gtNewArgList(gtNewIconEmbClsHndNode(delegateTypeHnd), - gtNewIconEmbMethHndNode(calleeMethodHnd))); - // Append the callout statement - impAppendTree(helper, (unsigned)CHECK_SPILL_NONE, impCurStmtOffs); - } -#endif // FEATURE_CORECLR -} - // Checks whether the return types of caller and callee are compatible // so that callee can be tail called. Note that here we don't check // compatibility in IL Verifier sense, but on the lines of return type @@ -12856,14 +12837,6 @@ void Compiler::impImportBlockCode(BasicBlock* block) assert(verCheckDelegateCreation(delegateCreateStart, codeAddr - 1, delegateMethodRef)); } #endif - -#ifdef FEATURE_CORECLR - // In coreclr the delegate transparency rule needs to be enforced even if verification is disabled - typeInfo tiActualFtn = impStackTop(0).seTypeInfo; - CORINFO_METHOD_HANDLE delegateMethodHandle = tiActualFtn.GetMethod2(); - - impInsertCalloutForDelegate(info.compMethodHnd, delegateMethodHandle, resolvedToken.hClass); -#endif // FEATURE_CORECLR } callTyp = impImportCall(opcode, &resolvedToken, constraintCall ? &constrainedResolvedToken : nullptr, -- 2.7.4