From: Andy Ayers Date: Thu, 16 Mar 2017 15:30:58 +0000 (-0700) Subject: Interface call devirtualization: jit side of changes X-Git-Tag: submit/tizen/20210909.063632~11030^2~7683^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5df97c5d1552876196043229818e84b93d9982b6;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Interface call devirtualization: jit side of changes Unblock VM queries where the base class is an interface (queries where the implementing class is also an interface are still blocked as no resolution is possible). Pass along the context handle that the jit got from getCallInfo. Commit migrated from https://github.com/dotnet/coreclr/commit/2c8b3ae4c1786968f387af9c78a343e0a561869b --- diff --git a/src/coreclr/src/jit/importer.cpp b/src/coreclr/src/jit/importer.cpp index e285fed..9d1daac 100644 --- a/src/coreclr/src/jit/importer.cpp +++ b/src/coreclr/src/jit/importer.cpp @@ -18488,16 +18488,15 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call, return; } - // Bail (for now) if base class is an interface. if (isInterface) { assert(call->IsVirtualStub()); - JITDUMP("--- base class is interface, sorry\n"); - return; + JITDUMP("--- base class is interface\n"); } // Fetch the method that would be called based on the declared type of 'this' - CORINFO_METHOD_HANDLE derivedMethod = info.compCompHnd->resolveVirtualMethod(baseMethod, objClass); + CORINFO_CONTEXT_HANDLE ownerType = callInfo->contextHandle; + CORINFO_METHOD_HANDLE derivedMethod = info.compCompHnd->resolveVirtualMethod(baseMethod, objClass, ownerType); // If we failed to get a handle, we can't devirtualize. This can // happen when prejitting, if the devirtualization crosses