From 0c428892ab569d17a8a2366d06e9900842d857cb Mon Sep 17 00:00:00 2001 From: Andon Andonov Date: Thu, 8 Mar 2018 21:47:19 +0100 Subject: Pass generic context argument for shared instance methods on generic interfaces (#16690) * Add checks and regression test * Uncomment InvokeConsumer tests * Revert JIT Interface Check --- src/vm/method.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/vm/method.cpp') diff --git a/src/vm/method.cpp b/src/vm/method.cpp index 8778744537..9b3080ec6c 100644 --- a/src/vm/method.cpp +++ b/src/vm/method.cpp @@ -1639,7 +1639,7 @@ BOOL MethodDesc::IsSharedByGenericMethodInstantiations() // - there is no this pointer providing generic dictionary info // * shared-code instance methods in instantiated generic structs (e.g. void MyValueType::m()) // - unboxed 'this' pointer in value-type instance methods don't have MethodTable pointer by definition -// * default interface method called via interface dispatch (e. g. IFoo.Foo calling into IFoo::Foo()) +// * shared instance and default interface methods called via interface dispatch (e. g. IFoo.Foo calling into IFoo::Foo()) // - this pointer is ambiguous as it can implement more than one IFoo BOOL MethodDesc::RequiresInstMethodTableArg() { @@ -1648,7 +1648,8 @@ BOOL MethodDesc::RequiresInstMethodTableArg() return IsSharedByGenericInstantiations() && !HasMethodInstantiation() && - (IsStatic() || GetMethodTable()->IsValueType() || IsDefaultInterfaceMethod()); + (IsStatic() || GetMethodTable()->IsValueType() || (GetMethodTable()->IsInterface() && !IsAbstract())); + } //******************************************************************************* @@ -1670,7 +1671,7 @@ BOOL MethodDesc::RequiresInstArg() LIMITED_METHOD_DAC_CONTRACT; BOOL fRet = IsSharedByGenericInstantiations() && - (HasMethodInstantiation() || IsStatic() || GetMethodTable()->IsValueType() || IsDefaultInterfaceMethod()); + (HasMethodInstantiation() || IsStatic() || GetMethodTable()->IsValueType() || (GetMethodTable()->IsInterface() && !IsAbstract())); _ASSERT(fRet == (RequiresInstMethodTableArg() || RequiresInstMethodDescArg())); return fRet; @@ -1747,7 +1748,7 @@ BOOL MethodDesc::AcquiresInstMethodTableFromThis() { !HasMethodInstantiation() && !IsStatic() && !GetMethodTable()->IsValueType() && - !IsDefaultInterfaceMethod(); + !(GetMethodTable()->IsInterface() && !IsAbstract()); } //******************************************************************************* -- cgit v1.2.3