From 2c8b3ae4c1786968f387af9c78a343e0a561869b Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Thu, 16 Mar 2017 08:30:58 -0700 Subject: 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. --- src/jit/importer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp index e285fed5ae..9d1daac04b 100644 --- a/src/jit/importer.cpp +++ b/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 -- cgit v1.2.3