diff options
-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); |