summaryrefslogtreecommitdiff
path: root/src/vm/jitinterface.cpp
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2018-10-05 12:51:06 +0200
committerGitHub <noreply@github.com>2018-10-05 12:51:06 +0200
commit27c848e37e9998142b60e776cf5b5d08a3543fe1 (patch)
tree0ed46884f7e98a2251e124b3ea3f9aada3b6f4b0 /src/vm/jitinterface.cpp
parentaf0c1f287d31ca3a641151df60baa7371635f508 (diff)
downloadcoreclr-27c848e37e9998142b60e776cf5b5d08a3543fe1.tar.gz
coreclr-27c848e37e9998142b60e776cf5b5d08a3543fe1.tar.bz2
coreclr-27c848e37e9998142b60e776cf5b5d08a3543fe1.zip
Report instantiation argument in non-virtual interface calls (#20257)
The existing code would incorrectly inhibit codegen from generating instantiation argument in non-virtual calls to default interface methods (i.e. those that can happen with the `base` syntax in C#). Fixes #16775.
Diffstat (limited to 'src/vm/jitinterface.cpp')
-rw-r--r--src/vm/jitinterface.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp
index 293bab97d9..5067a36077 100644
--- a/src/vm/jitinterface.cpp
+++ b/src/vm/jitinterface.cpp
@@ -5730,7 +5730,9 @@ void CEEInfo::getCallInfo(
pResult->classFlags = getClassAttribsInternal(pResolvedToken->hClass);
pResult->methodFlags = getMethodAttribsInternal(pResult->hMethod);
- getMethodSigInternal(pResult->hMethod, &pResult->sig, (pResult->hMethod == pResolvedToken->hMethod) ? pResolvedToken->hClass : NULL, /* isCallSite = */ TRUE);
+
+ SignatureKind signatureKind = flags & CORINFO_CALLINFO_CALLVIRT ? SK_VIRTUAL_CALLSITE : SK_CALLSITE;
+ getMethodSigInternal(pResult->hMethod, &pResult->sig, (pResult->hMethod == pResolvedToken->hMethod) ? pResolvedToken->hClass : NULL, signatureKind);
if (flags & CORINFO_CALLINFO_VERIFICATION)
{
@@ -8510,7 +8512,7 @@ CEEInfo::getMethodSigInternal(
CORINFO_METHOD_HANDLE ftnHnd,
CORINFO_SIG_INFO * sigRet,
CORINFO_CLASS_HANDLE owner,
- BOOL isCallSite)
+ SignatureKind signatureKind)
{
STANDARD_VM_CONTRACT;
@@ -8537,13 +8539,16 @@ CEEInfo::getMethodSigInternal(
if (ftn->RequiresInstArg())
{
//
- // If we are making an interface call that is a default interface method, we need to lie to the JIT.
+ // If we are making a virtual call to an instance method on an interface, we need to lie to the JIT.
// The reason being that we already made sure target is always directly callable (through instantiation stubs),
// JIT should not generate shared generics aware call code and insert the secret argument again at the callsite.
// Otherwise we would end up with two secret generic dictionary arguments (since the stub also provides one).
//
- BOOL isDefaultInterfaceMethodCallSite = isCallSite && ftn->IsDefaultInterfaceMethod();
- if (!isDefaultInterfaceMethodCallSite)
+ BOOL isCallSiteThatGoesThroughInstantiatingStub =
+ signatureKind == SK_VIRTUAL_CALLSITE &&
+ !ftn->IsStatic() &&
+ ftn->GetMethodTable()->IsInterface();
+ if (!isCallSiteThatGoesThroughInstantiatingStub)
sigRet->callConv = (CorInfoCallConv) (sigRet->callConv | CORINFO_CALLCONV_PARAMTYPE);
}