From 5df97c5d1552876196043229818e84b93d9982b6 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Thu, 16 Mar 2017 08:30:58 -0700 Subject: [PATCH] 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 --- src/coreclr/src/jit/importer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 -- 2.7.4