Make sure we tell the same lie to the JIT for default interface methods
authorAndrew Au <andrewau@microsoft.com>
Wed, 11 Dec 2019 06:01:44 +0000 (22:01 -0800)
committerAndrew Au <andrewau@microsoft.com>
Wed, 11 Dec 2019 15:43:26 +0000 (07:43 -0800)
src/coreclr/src/jit/importer.cpp
src/coreclr/src/tools/Common/JitInterface/CorInfoTypes.cs
src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs

index c474744aec68e270097257d12ced2160dde1f9cf..0264c9dddce956cef7dd4ca22011d7e821de2a05 100644 (file)
@@ -20652,7 +20652,7 @@ void Compiler::addGuardedDevirtualizationCandidate(GenTreeCall*          call,
         return;
     }
 
-    // CT_INDRECT calls may use the cookie, bail if so...
+    // CT_INDIRECT calls may use the cookie, bail if so...
     //
     // If transforming these provides a benefit, we could save this off in the same way
     // we save the stub address below.
index 170a93b6a41005fffb8bb2b760bcf2ec52f482be..7f60db7ce6c0f747be83766c13a5a658ca1970e3 100644 (file)
@@ -984,7 +984,7 @@ namespace Internal.JitInterface
     // thisTransform and constraint calls
     // ----------------------------------
     //
-    // For evertyhing besides "constrained." calls "thisTransform" is set to
+    // For everything besides "constrained." calls "thisTransform" is set to
     // CORINFO_NO_THIS_TRANSFORM.
     //
     // For "constrained." calls the EE attempts to resolve the call at compile
index 1c64328f67054a06955b45d9ca987c5d326432a4..0caaa1b0126eadc8dfea3f2f67046b7a85d830e3 100644 (file)
@@ -1220,6 +1220,8 @@ namespace Internal.JitInterface
             }
             else
             {
+                // At this point, we knew it is a virtual call to targetMethod method, if it is a default interface method call, it should go through instantiating stub
+                useInstantiatingStub = useInstantiatingStub || (targetMethod.OwningType.IsInterface && !originalMethod.IsAbstract);
                 // Insert explicit null checks for cross-version bubble non-interface calls.
                 // It is required to handle null checks properly for non-virtual <-> virtual change between versions
                 pResult->nullInstanceCheck = callVirtCrossingVersionBubble && !targetMethod.OwningType.IsInterface;