diff options
author | Yi Zhang (CLR) <yizhang82@users.noreply.github.com> | 2017-05-22 17:52:59 -0700 |
---|---|---|
committer | Yi Zhang (CLR) <yzha@microsoft.com> | 2017-07-19 11:16:56 -0700 |
commit | a5f9bde9086a0a69ae290cf40bb89403d640e85f (patch) | |
tree | 09665551068c65b1dc2660322da8b7bef0ea923c /src/vm | |
parent | 9b8471b34c8fad1694ea0e9562e4699ac4eeda6e (diff) | |
download | coreclr-a5f9bde9086a0a69ae290cf40bb89403d640e85f.tar.gz coreclr-a5f9bde9086a0a69ae290cf40bb89403d640e85f.tar.bz2 coreclr-a5f9bde9086a0a69ae290cf40bb89403d640e85f.zip |
More update in /dev/defaultintf (#11693)
* Support non-virtual calls on interface private members correctly
* Support protected methods
* Properly handle precode
* Throw (tentative) exception when seeing conflict overrides and add a test case
(This updates CoreCLR dev/defaultintf the same with the build we are showing at //build)
Diffstat (limited to 'src/vm')
-rw-r--r-- | src/vm/i386/stublinkerx86.cpp | 2 | ||||
-rw-r--r-- | src/vm/jitinterface.cpp | 3 | ||||
-rw-r--r-- | src/vm/method.cpp | 12 | ||||
-rw-r--r-- | src/vm/methodtable.cpp | 7 | ||||
-rw-r--r-- | src/vm/methodtable.inl | 6 |
5 files changed, 15 insertions, 15 deletions
diff --git a/src/vm/i386/stublinkerx86.cpp b/src/vm/i386/stublinkerx86.cpp index c1b0b19f0c..1ad4636a8f 100644 --- a/src/vm/i386/stublinkerx86.cpp +++ b/src/vm/i386/stublinkerx86.cpp @@ -6698,7 +6698,7 @@ BOOL FixupPrecode::SetTargetInterlocked(TADDR target, TADDR expected) CONTRACTL { THROWS; // Creating a JumpStub could throw OutOfMemory - GC_TRIGGERS; + GC_NOTRIGGER; } CONTRACTL_END; diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index ea10ca788e..ecabc89ba7 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -5208,8 +5208,7 @@ void CEEInfo::getCallInfo( directCall = true; } else - // Force all interface calls to be interpreted as if they are virtual. - if (pTargetMD->GetMethodTable()->IsInterface()) + if (pTargetMD->GetMethodTable()->IsInterface() && pTargetMD->IsVirtual()) { directCall = false; } diff --git a/src/vm/method.cpp b/src/vm/method.cpp index 5ac5cafd01..845ce799a9 100644 --- a/src/vm/method.cpp +++ b/src/vm/method.cpp @@ -2587,10 +2587,7 @@ BOOL MethodDesc::RequiresStableEntryPoint(BOOL fEstimateForChunk /*=FALSE*/) return TRUE; // TODO: Can we avoid early allocation of precodes for interfaces and cominterop? - // Only abstract virtual interface method need precode - // @DIM_TODO - We need to decide what is the right approach for precode for default - // interface methods - if ((IsInterface() && IsAbstract() && IsVirtual() && !IsStatic()) || IsComPlusCall()) + if ((IsInterface() && !IsStatic() && IsVirtual()) || IsComPlusCall()) return TRUE; } @@ -2686,7 +2683,7 @@ BOOL MethodDesc::MayHaveNativeCode() _ASSERTE(IsIL()); - if (IsWrapperStub() || ContainsGenericVariables() || IsAbstract()) + if ((IsInterface() && !IsStatic() && IsVirtual() && IsAbstract()) || IsWrapperStub() || ContainsGenericVariables() || IsAbstract()) { return FALSE; } @@ -5024,6 +5021,11 @@ BOOL MethodDesc::SetNativeCodeInterlocked(PCODE addr, PCODE pExpected /*=NULL*/ (TADDR&)value, (TADDR&)expected) == (TADDR&)expected; #endif // FEATURE_INTERPRETER } + + if (IsDefaultInterfaceMethod() && HasPrecode()) + { + return GetPrecode()->SetTargetInterlocked(addr); + } #ifdef FEATURE_INTERPRETER PCODE pFound = FastInterlockCompareExchangePointer(GetAddrOfSlot(), addr, pExpected); diff --git a/src/vm/methodtable.cpp b/src/vm/methodtable.cpp index 7247dd06eb..42cb886b1c 100644 --- a/src/vm/methodtable.cpp +++ b/src/vm/methodtable.cpp @@ -7069,8 +7069,11 @@ BOOL MethodTable::FindDefaultMethod( } else { - // not good. we have a conflict - COMPlusThrow(kNotSupportedException); + if (!pBestCandidateMT->CanCastToInterface(pCurMT)) + { + // not good. we have a conflict + COMPlusThrow(kNotSupportedException); + } } } } diff --git a/src/vm/methodtable.inl b/src/vm/methodtable.inl index f8a073f5bb..a8a4d2301c 100644 --- a/src/vm/methodtable.inl +++ b/src/vm/methodtable.inl @@ -654,11 +654,7 @@ inline MethodDesc* MethodTable::GetMethodDescForSlot(DWORD slot) // for an interface virtual, since their slots usually point to stub. if (IsInterface() && slot < GetNumVirtuals()) { - // @DIM_TODO - This is not a reliable approach. Need to change MakeJitWorker to not stomp - // over slot and instead set the target of precode to the address. We may need the precode - // there anyway to handle other cases too (such as interop). - MethodDesc *pMD = MethodDesc::GetMethodDescFromStubAddr(pCode, /* fSpeculative = */ TRUE); - if (pMD != NULL) return pMD; + return MethodDesc::GetMethodDescFromStubAddr(pCode); } return MethodTable::GetMethodDescForSlotAddress(pCode); |