diff options
122 files changed, 12 insertions, 10649 deletions
diff --git a/clr.defines.targets b/clr.defines.targets index 9ed56035f7..49f159e7f8 100644 --- a/clr.defines.targets +++ b/clr.defines.targets @@ -58,7 +58,6 @@ <CDefines Condition="'$(FeaturePrejit)' == 'true'">$(CDefines);FEATURE_PREJIT</CDefines> <CDefines Condition="'$(FeatureRandomizedStringHashing)' == 'true'">$(CDefines);FEATURE_RANDOMIZED_STRING_HASHING</CDefines> <CDefines Condition="'$(FeatureReJIT)' == 'true'">$(CDefines);FEATURE_REJIT</CDefines> - <CDefines Condition="'$(FeatureRemoting)' == 'true'">$(CDefines);FEATURE_REMOTING</CDefines> <CDefines Condition="'$(FeatureSortTables)' == 'true'">$(CDefines);FEATURE_SORT_TABLES</CDefines> <CDefines Condition="'$(FeatureStackProbe)' == 'true'">$(CDefines);FEATURE_STACK_PROBE</CDefines> <CDefines Condition="'$(FeatureStandaloneSn)' == 'true'">$(CDefines);FEATURE_STANDALONE_SN</CDefines> @@ -115,7 +114,6 @@ <DefineConstants Condition="'$(FeatureXplatEventSource)' == 'true'">$(DefineConstants);FEATURE_EVENTSOURCE_XPLAT</DefineConstants> <DefineConstants Condition="'$(FeaturePerfmon)' == 'true'">$(DefineConstants);FEATURE_PERFMON</DefineConstants> <DefineConstants Condition="'$(FeatureRandomizedStringHashing)' == 'true'">$(DefineConstants);FEATURE_RANDOMIZED_STRING_HASHING</DefineConstants> - <DefineConstants Condition="'$(FeatureRemoting)' == 'true'">$(DefineConstants);FEATURE_REMOTING</DefineConstants> <DefineConstants Condition="'$(FeatureSortTables)' == 'true'">$(DefineConstants);FEATURE_SORT_TABLES</DefineConstants> <DefineConstants Condition="'$(FeatureTypeEquivalence)' == 'true'">$(DefineConstants);FEATURE_TYPEEQUIVALENCE</DefineConstants> <DefineConstants Condition="'$(FeatureUseLcid)' == 'true'">$(DefineConstants);FEATURE_USE_LCID</DefineConstants> @@ -240,7 +240,6 @@ <ResgenDefines Condition="'$(FeatureImpersonation)' == '1'">$(ResgenDefines) /define:FEATURE_IMPERSONATION</ResgenDefines> <ResgenDefines Condition="'$(FeatureIsostore)' == '1'">$(ResgenDefines) /define:FEATURE_ISOSTORE</ResgenDefines> <ResgenDefines Condition="'$(FeatureMacl)' == '1'">$(ResgenDefines) /define:FEATURE_MACL</ResgenDefines> - <ResgenDefines Condition="'$(FeatureRemoting)' == '1'">$(ResgenDefines) /define:FEATURE_REMOTING</ResgenDefines> <ResgenDefines Condition="'$(FeatureIdentityReference)' == '1'">$(ResgenDefines) /define:FEATURE_IDENTITY_REFERENCE</ResgenDefines> <ResgenDefines Condition="'$(FeatureDisplayCultureInfo)' == '1'">$(ResgenDefines) /define:FEATURE_DISPLAY_CULTURE_INFO</ResgenDefines> <ResgenDefines Condition="'$(FeatureDisplayRegionInfo)' == '1'">$(ResgenDefines) /define:FEATURE_DISPLAY_REGION_INFO</ResgenDefines> diff --git a/src/classlibnative/bcltype/objectnative.cpp b/src/classlibnative/bcltype/objectnative.cpp index bf65ad1ff5..82b189d5c8 100644 --- a/src/classlibnative/bcltype/objectnative.cpp +++ b/src/classlibnative/bcltype/objectnative.cpp @@ -18,13 +18,7 @@ #include "field.h" #include "object.h" #include "comsynchronizable.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "eeconfig.h" -#ifdef FEATURE_REMOTING -#include "objectclone.h" -#endif #include "mdaassistants.h" @@ -212,11 +206,6 @@ NOINLINE static Object* GetClassHelper(OBJECTREF objRef) HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_1(Frame::FRAME_ATTR_EXACT_DEPTH|Frame::FRAME_ATTR_CAPTURE_DEPTH_2, refType); -#ifdef FEATURE_REMOTING - if (objRef->IsTransparentProxy()) - refType = CRemotingServices::GetClass(objRef); - else -#endif refType = typeHandle.GetManagedClassObject(); HELPER_METHOD_FRAME_END(); diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp index 957ab68205..c6c71a28ff 100644 --- a/src/debug/daccess/dacdbiimpl.cpp +++ b/src/debug/daccess/dacdbiimpl.cpp @@ -3246,12 +3246,6 @@ CORDB_ADDRESS DacDbiInterfaceImpl::GetThreadOrContextStaticAddress(VMPTR_FieldDe { fieldAddress = pRuntimeThread->GetStaticFieldAddrNoCreate(pFieldDesc, NULL); } -#ifdef FEATURE_REMOTING - else if (pFieldDesc->IsContextStatic()) - { - fieldAddress = PTR_TO_TADDR(pRuntimeThread->GetContext()->GetStaticFieldAddrNoCreate(pFieldDesc)); - } -#endif else { // In case we have more special cases added later, this will allow us to notice the need to diff --git a/src/debug/daccess/dacfn.cpp b/src/debug/daccess/dacfn.cpp index 33dfa10b54..3d729ba371 100644 --- a/src/debug/daccess/dacfn.cpp +++ b/src/debug/daccess/dacfn.cpp @@ -16,10 +16,6 @@ #ifdef FEATURE_PREJIT #include "compile.h" #endif // FEATURE_PREJIT -#ifdef FEATURE_REMOTING -#include <remoting.h> -#include "objectclone.h" -#endif #include <virtualcallstub.h> #include "peimagelayout.inl" diff --git a/src/debug/daccess/inspect.cpp b/src/debug/daccess/inspect.cpp index 5276626dcb..a69cfa3835 100644 --- a/src/debug/daccess/inspect.cpp +++ b/src/debug/daccess/inspect.cpp @@ -166,9 +166,6 @@ GetTypeFieldValueFlags(TypeHandle typeHandle, otherFlags |= CLRDATA_VALUE_FROM_TASK_LOCAL; } else -#ifdef FEATURE_REMOTING - if (!fieldDesc->IsContextStatic()) -#endif { otherFlags |= CLRDATA_VALUE_FROM_INSTANCE; } @@ -1436,13 +1433,6 @@ ClrDataValue::NewFromFieldDesc(ClrDataAccess* dac, baseAddr = TO_CDADDR(tlsThread->GetStaticFieldAddrNoCreate(fieldDesc, NULL)); } -#ifdef FEATURE_REMOTING - else if (fieldDesc->IsContextStatic()) - { - // XXX Microsoft - Microsoft says Context is going away. - return E_NOTIMPL; - } -#endif else if (fieldDesc->IsStatic()) { baseAddr = TO_CDADDR diff --git a/src/debug/daccess/nidump.cpp b/src/debug/daccess/nidump.cpp index 3ba3d9778c..b2663fe367 100644 --- a/src/debug/daccess/nidump.cpp +++ b/src/debug/daccess/nidump.cpp @@ -24,9 +24,6 @@ #include <pedecoder.h> -#ifdef FEATURE_REMOTING -#include <crossdomaincalls.h> -#endif #include <mdfileformat.h> @@ -5545,9 +5542,6 @@ NativeImageDumper::EnumMnemonics s_MTFlagsLow[] = MTFLAG_ENTRY(GenericsMask_GenericInst), MTFLAG_ENTRY(GenericsMask_SharedInst), MTFLAG_ENTRY(GenericsMask_TypicalInst), -#if defined(FEATURE_REMOTING) - MTFLAG_ENTRY(ContextStatic), -#endif MTFLAG_ENTRY(HasRemotingVtsInfo), MTFLAG_ENTRY(HasVariance), MTFLAG_ENTRY(HasDefaultCtor), @@ -5788,9 +5782,6 @@ static NativeImageDumper::EnumMnemonics s_VMFlags[] = VMF_ENTRY(FIXED_ADDRESS_VT_STATICS), VMF_ENTRY(HASLAYOUT), VMF_ENTRY(ISNESTED), -#ifdef FEATURE_REMOTING - VMF_ENTRY(CANNOT_BE_BLITTED_BY_OBJECT_CLONER), -#endif VMF_ENTRY(IS_EQUIVALENT_TYPE), VMF_ENTRY(HASOVERLAYEDFIELDS), @@ -6897,12 +6888,6 @@ void NativeImageDumper::DumpFieldDesc( PTR_FieldDesc fd, const char * name ) offsetof(FieldDesc, m_dword1), fieldsize(FieldDesc, m_dword1), fd->m_isThreadLocal ); -#if defined(FEATURE_REMOTING) - m_display->WriteFieldFlag( "m_isContextLocal", - offsetof(FieldDesc, m_dword1), - fieldsize(FieldDesc, m_dword1), - fd->m_isContextLocal ); -#endif m_display->WriteFieldFlag( "m_isRVA", offsetof(FieldDesc, m_dword1), fieldsize(FieldDesc, m_dword1), fd->m_isRVA ); @@ -6934,30 +6919,6 @@ void NativeImageDumper::DumpFieldDesc( PTR_FieldDesc fd, const char * name ) #endif DisplayEndStructure( ALWAYS ); //name } -#if defined(FEATURE_REMOTING) -NativeImageDumper::EnumMnemonics s_XADOptFlags[] = -{ -#define XAD_ENTRY(x) NativeImageDumper::EnumMnemonics( RemotableMethodInfo:: x, W(#x) ) - XAD_ENTRY(XAD_FLAGS_INITIALIZED), - XAD_ENTRY(XAD_NOT_OPTIMIZABLE), - XAD_ENTRY(XAD_BLITTABLE_ARGS), - XAD_ENTRY(XAD_BLITTABLE_RET), - - //this is actually the OR of the three below this. It is a "flag" so - //it gets cleared out. - XAD_ENTRY(XAD_RET_GC_REF), - XAD_ENTRY(XAD_RET_FLOAT), - XAD_ENTRY(XAD_RET_DOUBLE), -#ifdef FEATURE_HFA - XAD_ENTRY(XAD_RET_HFA_TYPE), -#endif - - XAD_ENTRY(XAD_METHOD_IS_VIRTUAL), - XAD_ENTRY(XAD_ARGS_HAVE_A_FLOAT), - -#undef XAD_ENTRY -}; -#endif #ifdef _PREFAST_ #pragma warning(push) @@ -7440,133 +7401,6 @@ NativeImageDumper::DumpMethodTable( PTR_MethodTable mt, const char * name, } #endif // FEATURE_COMINTEROP -#if defined(FEATURE_REMOTING) - //RemotingVtsInfo comes after the generic dictionaries. So if I - //don't have extents, I can't print them. - if(haveCompleteExtents && - mt->HasRemotingVtsInfo() - && CHECK_OPT(METHODTABLES) - ) - { - _ASSERTE(clazz == GetClassFromMT(mt)); - /* REVISIT_TODO Tue 12/13/2005 - * Is this right? is m_wNumStaticFields actually the number of static - * fields? - */ - unsigned numFields = (unsigned)(CountFields(mt) - - clazz->GetNumStaticFields()); - PTR_RemotingVtsInfo vts = *mt->GetRemotingVtsInfoPtr(); - m_display->StartStructureWithOffset( "OptionalMember_RemotingVtsInfo", - mt->GetOffsetOfOptionalMember(MethodTable::OptionalMember_RemotingVtsInfo), - sizeof(void*), - DPtrToPreferredAddr(vts), - RemotingVtsInfo::GetSize(numFields) - ); - - DisplayStartArrayWithOffset( m_pCallbacks, W("%-30s: %s"), - RemotingVtsInfo, ALWAYS ); - for( int i = 0; i < _countof(vts->m_pCallbacks); ++i ) - { - PTR_MethodDesc md( vts->m_pCallbacks[i].GetValue() ); - DisplayStartElement( "Callback", ALWAYS ); - DisplayWriteElementString( "CallbackType", s_VTSCallbackNames[i], - ALWAYS ); - if (CORCOMPILE_IS_POINTER_TAGGED(PTR_TO_TADDR(md))) - { - DoWriteFieldMethodDesc( "MethodDesc", UINT_MAX, UINT_MAX, md ); - } - else - { - WriteElementMethodDesc( "MethodDesc", md ); - } - DisplayEndElement( ALWAYS ); //Callback - } - DisplayEndArray( NULL, ALWAYS ); //m_pCallbacks -#ifdef _DEBUG - DisplayWriteFieldInt( m_dwNumFields, vts->m_dwNumFields, - RemotingVtsInfo, ALWAYS ); -#endif - /* REVISIT_TODO Tue 12/13/2005 - * Is there any reason to dump this map? - */ - m_display->WriteFieldEmpty("m_rFieldTypes", - offsetof(RemotingVtsInfo, m_rFieldTypes), - RemotingVtsInfo::GetSize(numFields) - - offsetof(RemotingVtsInfo, m_rFieldTypes) ); - DisplayEndStructure( ALWAYS ); //OptionalMember_RemotingVtsInfo - } - - //RemotableMethodInfo comes after the generic dictionaries. So if I - //don't have extents, I can't print them. - if(haveCompleteExtents && - mt->HasRemotableMethodInfo() && - CHECK_OPT(METHODTABLES) - ) - { - PTR_CrossDomainOptimizationInfo cdOpt = *mt->GetRemotableMethodInfoPtr(); - if( cdOpt == NULL ) - { - _ASSERTE(mt->GetNumVtableSlots() == 0 ); - m_display->WriteElementPointer("OptionalMember_RemotableMethodInfo", - NULL); - } - else - { - _ASSERTE(mt->GetNumVtableSlots() > 0 ); - - unsigned size = sizeof(RemotableMethodInfo) * mt->GetNumVtableSlots(); - //one remotable method info for each method. - m_display->StartStructureWithOffset( "OptionalMember_RemotableMethodInfo", - mt->GetOffsetOfOptionalMember(MethodTable::OptionalMember_RemotableMethodInfo), - sizeof(void*), - DPtrToPreferredAddr(cdOpt), - size ); - m_display->StartArrayWithOffset( "m_rmi", - offsetof(CrossDomainOptimizationInfo, - m_rmi), - mt->GetNumVtableSlots() - * sizeof(RemotableMethodInfo), NULL ); - PTR_RemotableMethodInfo rmi( PTR_HOST_MEMBER_TADDR(CrossDomainOptimizationInfo, cdOpt, m_rmi) ); - for( unsigned i = 0; i < mt->GetNumVtableSlots(); ++i ) - { - PTR_RemotableMethodInfo current = rmi + i; - DisplayStartStructure( "RemotableMethodInfo", - DPtrToPreferredAddr(current), - sizeof(*current), ALWAYS ); - DisplayWriteFieldEnumerated( m_OptFlags, current->m_OptFlags, - RemotableMethodInfo, s_XADOptFlags, - W(", "), ALWAYS ); - DisplayEndStructure( ALWAYS ); //RemotableMethodInfo - } - DisplayEndArray( "Total RemotableMethodInfos", ALWAYS ); //m_rmi - DisplayEndStructure( ALWAYS ); // OptionalMember_RemotableMethodInfo - } - } - - //ContextStatics comes after the generic dictionaries. So if I - //don't have extents, I can't print them. - if(haveCompleteExtents && - mt->HasContextStatics() && - CHECK_OPT(METHODTABLES) - ) - { - PTR_ContextStaticsBucket statics = - *(mt->GetContextStaticsBucketPtr()); - m_display->StartStructureWithOffset( "OptionalMember_ContextStatics", - mt->GetOffsetOfOptionalMember(MethodTable::OptionalMember_ContextStatics), - sizeof(void*), - DPtrToPreferredAddr(statics), - sizeof(*statics) ); - -#define HANDLE_FIELD(field) \ - DisplayWriteFieldInt( field, statics->field, \ - ContextStaticsBucket, ALWAYS ) - HANDLE_FIELD(m_dwContextStaticsOffset); - HANDLE_FIELD(m_wContextStaticsSize); -#undef HANDLE_FIELD - DisplayEndStructure( ALWAYS ); //OptionalMember_ContextStatics - } -#endif DisplayEndStructure( METHODTABLES ); //MethodTable } // NativeImageDumper::DumpMethodTable #ifdef _PREFAST_ diff --git a/src/debug/daccess/request.cpp b/src/debug/daccess/request.cpp index 1f90c5e428..5c0f021f70 100644 --- a/src/debug/daccess/request.cpp +++ b/src/debug/daccess/request.cpp @@ -1801,11 +1801,7 @@ ClrDataAccess::GetFieldDescData(CLRDATA_ADDRESS addr, struct DacpFieldDescData * FieldDescData->MTOfEnclosingClass = HOST_CDADDR(pFieldDesc->GetApproxEnclosingMethodTable()); FieldDescData->dwOffset = pFieldDesc->GetOffset(); FieldDescData->bIsThreadLocal = pFieldDesc->IsThreadStatic(); -#ifdef FEATURE_REMOTING - FieldDescData->bIsContextLocal = pFieldDesc->IsContextStatic();; -#else FieldDescData->bIsContextLocal = FALSE; -#endif FieldDescData->bIsStatic = pFieldDesc->IsStatic(); FieldDescData->NextField = HOST_CDADDR(PTR_FieldDesc(PTR_HOST_TO_TADDR(pFieldDesc) + sizeof(FieldDesc))); @@ -1835,16 +1831,8 @@ ClrDataAccess::GetMethodTableFieldData(CLRDATA_ADDRESS mt, struct DacpMethodTabl data->FirstField = PTR_TO_TADDR(pMT->GetClass()->GetFieldDescList()); -#ifdef FEATURE_REMOTING - BOOL hasContextStatics = pMT->HasContextStatics(); - - data->wContextStaticsSize = (hasContextStatics) ? pMT->GetContextStaticsSize() : 0; - _ASSERTE(!hasContextStatics || FitsIn<WORD>(pMT->GetContextStaticsOffset())); - data->wContextStaticOffset = (hasContextStatics) ? static_cast<WORD>(pMT->GetContextStaticsOffset()) : 0; -#else data->wContextStaticsSize = 0; data->wContextStaticOffset = 0; -#endif } SOSDacLeave(); diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp index df2e9a444e..b19ae9a6a6 100644 --- a/src/debug/ee/debugger.cpp +++ b/src/debug/ee/debugger.cpp @@ -18,9 +18,6 @@ #include "eeconfig.h" // This is here even for retail & free builds... #include "../../dlls/mscorrc/resource.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "context.h" #include "vars.hpp" diff --git a/src/debug/ee/frameinfo.cpp b/src/debug/ee/frameinfo.cpp index 35e5bb9a09..fb9ea886bf 100644 --- a/src/debug/ee/frameinfo.cpp +++ b/src/debug/ee/frameinfo.cpp @@ -1778,29 +1778,6 @@ StackWalkAction DebuggerWalkStackProc(CrawlFrame *pCF, void *data) } break; -#ifdef FEATURE_REMOTING - case Frame::TYPE_TP_METHOD_FRAME: - LOG((LF_CORDB, LL_INFO100000, "DWSP: Frame type is TYPE_TP_METHOD_FRAME.\n")); - if (d->ShouldIgnoreNonmethodFrames()) - { - // Transparant Proxies push a frame onto the stack that they - // use to figure out where they're really going; this frame - // doesn't actually contain any code, although it does have - // enough info into fooling our routines into thinking it does: - // Just ignore these. - LOG((LF_CORDB, LL_INFO100000, "DWSP: Skipping frame 0x%x b/c it's " - "a transparant proxy frame!\n", frame)); - use = false; - } - else - { - // Otherwise do the same thing as for internal frames - LOG((LF_CORDB, LL_INFO100000, "DWSP: NOT Skipping frame 0x%x even though it's " - "a transparant proxy frame!\n", frame)); - INTERNAL_FRAME_ACTION(d, use); - } - break; -#endif default: _ASSERTE(!"Invalid frame type!"); break; diff --git a/src/debug/ee/funceval.cpp b/src/debug/ee/funceval.cpp index eb8950deab..dcfe5a5dcf 100644 --- a/src/debug/ee/funceval.cpp +++ b/src/debug/ee/funceval.cpp @@ -21,9 +21,6 @@ #include "eeconfig.h" // This is here even for retail & free builds... #include "../../dlls/mscorrc/resource.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "context.h" #include "vars.hpp" diff --git a/src/inc/dacvars.h b/src/inc/dacvars.h index 478f90426f..12d875af8f 100644 --- a/src/inc/dacvars.h +++ b/src/inc/dacvars.h @@ -162,9 +162,6 @@ DEFINE_DACVAR(ULONG, BOOL, dac__g_fAppX, ::g_fAppX) DEFINE_DACVAR(ULONG, BOOL, SString__s_IsANSIMultibyte, SString::s_IsANSIMultibyte) -#ifdef FEATURE_REMOTING -DEFINE_DACVAR_NO_DUMP(ULONG, MethodTable, CTPMethodTable__s_pThunkTable, CTPMethodTable::s_pThunkTable) -#endif // FEATURE_REMOTING DEFINE_DACVAR(ULONG, INT32, ArrayBase__s_arrayBoundsZero, ArrayBase::s_arrayBoundsZero) diff --git a/src/inc/jithelpers.h b/src/inc/jithelpers.h index 854d2059f0..78b647687b 100644 --- a/src/inc/jithelpers.h +++ b/src/inc/jithelpers.h @@ -70,11 +70,7 @@ JITHELPER(CORINFO_HELP_DBLROUND, JIT_DoubleRound, CORINFO_HELP_SIG_16_STACK) // Allocating a new object -#ifdef FEATURE_REMOTING - JITHELPER(CORINFO_HELP_NEW_CROSSCONTEXT, JIT_NewCrossContext, CORINFO_HELP_SIG_REG_ONLY) -#else JITHELPER(CORINFO_HELP_NEW_CROSSCONTEXT, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) -#endif JITHELPER(CORINFO_HELP_NEWFAST, JIT_New, CORINFO_HELP_SIG_REG_ONLY) DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST, JIT_New, CORINFO_HELP_SIG_REG_ONLY) DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST_ALIGN8, JIT_New, CORINFO_HELP_SIG_REG_ONLY) @@ -209,11 +205,7 @@ JITHELPER(CORINFO_HELP_GETFIELDADDR, JIT_GetFieldAddr,CORINFO_HELP_SIG_REG_ONLY) -#ifdef FEATURE_REMOTING - JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, JIT_GetStaticFieldAddr_Context,CORINFO_HELP_SIG_REG_ONLY) -#else JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) -#endif #if COR_JIT_EE_VERSION > 460 JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) @@ -323,11 +315,7 @@ JITHELPER(CORINFO_HELP_EE_EXTERNAL_FIXUP, ExternalMethodFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB) JITHELPER(CORINFO_HELP_EE_VTABLE_FIXUP, VirtualMethodFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB) -#if (defined(_TARGET_X86_) || defined(_TARGET_ARM_)) && defined(FEATURE_REMOTING) - JITHELPER(CORINFO_HELP_EE_REMOTING_THUNK, PrecodeRemotingThunk, CORINFO_HELP_SIG_UNDEF) -#else JITHELPER(CORINFO_HELP_EE_REMOTING_THUNK, NULL, CORINFO_HELP_SIG_UNDEF) -#endif // We do not need this to be saved in ngen images on Mac64 since the exception dispatch // is not done via the OS and thus, there wont be any need to know this information diff --git a/src/inc/vptr_list.h b/src/inc/vptr_list.h index 4e50fe52a8..a0333c3239 100644 --- a/src/inc/vptr_list.h +++ b/src/inc/vptr_list.h @@ -31,12 +31,6 @@ VPTR_CLASS(SharedDomain) VPTR_CLASS(SystemDomain) VPTR_CLASS(DomainAssembly) -#ifdef FEATURE_REMOTING -#ifdef _TARGET_AMD64_ // HAS_REMOTING_PRECODE -VPTR_CLASS(CNonVirtualThunkMgr) -#endif -VPTR_CLASS(CVirtualThunkMgr) -#endif VPTR_CLASS(PrecodeStubManager) VPTR_CLASS(StubLinkStubManager) VPTR_CLASS(ThePreStubManager) @@ -65,11 +59,6 @@ VPTR_CLASS(ComPlusMethodFrame) VPTR_CLASS(ComPrestubMethodFrame) #endif // FEATURE_COMINTEROP VPTR_CLASS(ContextTransitionFrame) -#ifdef FEATURE_REMOTING -VPTR_CLASS(GCSafeCollectionFrame) -VPTR_CLASS(GCSafeObjectTable) -VPTR_CLASS(GCSafeObjectHashTable) -#endif #ifdef FEATURE_INTERPRETER VPTR_CLASS(InterpreterFrame) #endif // FEATURE_INTERPRETER @@ -107,9 +96,6 @@ VPTR_CLASS(DynamicHelperFrame) #if !defined(_TARGET_X86_) VPTR_CLASS(StubHelperFrame) #endif -#ifdef FEATURE_REMOTING -VPTR_CLASS(TPMethodFrame) -#endif #if defined(_TARGET_X86_) VPTR_CLASS(UMThkCallFrame) #endif diff --git a/src/vm/amd64/GenericComPlusCallStubs.asm b/src/vm/amd64/GenericComPlusCallStubs.asm index 9240ad5fa7..f7d670e6ea 100644 --- a/src/vm/amd64/GenericComPlusCallStubs.asm +++ b/src/vm/amd64/GenericComPlusCallStubs.asm @@ -16,101 +16,12 @@ include asmconstants.inc CTPMethodTable__s_pThunkTable equ ?s_pThunkTable@CTPMethodTable@@0PEAVMethodTable@@EA InstantiatedMethodDesc__IMD_GetComPlusCallInfo equ ?IMD_GetComPlusCallInfo@InstantiatedMethodDesc@@QEAAPEAUComPlusCallInfo@@XZ -ifdef FEATURE_REMOTING -extern CRemotingServices__DispatchInterfaceCall:proc -extern CTPMethodTable__s_pThunkTable:qword -extern InstantiatedMethodDesc__IMD_GetComPlusCallInfo:proc -endif extern CLRToCOMWorker:proc extern ProcessCLRException:proc -ifdef FEATURE_REMOTING -; -; in: -; r10: MethodDesc* -; rcx: 'this' object -; -; out: -; METHODDESC_REGISTER (r10) = MethodDesc* (for IL stubs) -; -LEAF_ENTRY GenericComPlusCallStub, _TEXT - - ; - ; check for a null 'this' pointer and - ; then see if this is a TransparentProxy - ; - - test rcx, rcx - jz do_com_call - - mov rax, [CTPMethodTable__s_pThunkTable] - cmp [rcx], rax - jne do_com_call - - ; - ; 'this' is a TransparentProxy - ; - jmp CRemotingServices__DispatchInterfaceCall - -do_com_call: - - ; - ; Check if the call is being made on an InstantiatedMethodDesc. - ; - - mov ax, [r10 + OFFSETOF__MethodDesc__m_wFlags] - and ax, MethodDescClassification__mdcClassification - cmp ax, MethodDescClassification__mcInstantiated - je GenericComPlusCallWorkerInstantiated - - ; - ; Check if there is an IL stub. - ; - - mov rax, [r10 + OFFSETOF__ComPlusCallMethodDesc__m_pComPlusCallInfo] - mov rax, [rax + OFFSETOF__ComPlusCallInfo__m_pILStub] - test rax, rax - jz GenericComPlusCallStubSlow - - TAILJMP_RAX - -LEAF_END GenericComPlusCallStub, _TEXT - -; We could inline IMD_GetComPlusCallInfo here but it would be ugly. -NESTED_ENTRY GenericComPlusCallWorkerInstantiated, _TEXT, ProcessCLRException - alloc_stack 68h - - save_reg_postrsp r10, 60h - - SAVE_ARGUMENT_REGISTERS 70h - - SAVE_FLOAT_ARGUMENT_REGISTERS 20h - - END_PROLOGUE - - mov rcx, r10 - call InstantiatedMethodDesc__IMD_GetComPlusCallInfo - - RESTORE_FLOAT_ARGUMENT_REGISTERS 20h - - RESTORE_ARGUMENT_REGISTERS 70h - - mov r10, [rsp + 60h] - - mov rax, [rax + OFFSETOF__ComPlusCallInfo__m_pILStub] - - add rsp, 68h - TAILJMP_RAX -NESTED_END GenericComPlusCallWorkerInstantiated, _TEXT -endif - -ifdef FEATURE_REMOTING -NESTED_ENTRY GenericComPlusCallStubSlow, _TEXT, ProcessCLRException -else NESTED_ENTRY GenericComPlusCallStub, _TEXT, ProcessCLRException -endif PROLOG_WITH_TRANSITION_BLOCK 8 @@ -137,11 +48,7 @@ endif EPILOG_WITH_TRANSITION_BLOCK_RETURN -ifdef FEATURE_REMOTING -NESTED_END GenericComPlusCallStubSlow, _TEXT -else NESTED_END GenericComPlusCallStub, _TEXT -endif endif ; FEATURE_COMINTEROP diff --git a/src/vm/amd64/RemotingThunksAMD64.asm b/src/vm/amd64/RemotingThunksAMD64.asm deleted file mode 100644 index 6d555e8beb..0000000000 --- a/src/vm/amd64/RemotingThunksAMD64.asm +++ /dev/null @@ -1,303 +0,0 @@ -; Licensed to the .NET Foundation under one or more agreements. -; The .NET Foundation licenses this file to you under the MIT license. -; See the LICENSE file in the project root for more information. - -include AsmMacros.inc -include AsmConstants.inc -ifdef FEATURE_REMOTING - -extern CallDescrWorkerUnwindFrameChainHandler:proc - -extern TransparentProxyStubWorker:proc - -; Stack frame layout: -; -; (stack parameters) -; ... -; r9 -; r8 -; rdx -; rcx <- TPSCC_PARAMS_OFFSET -; return address <- TPSCC_STACK_FRAME_SIZE -; r10 <- TPSCC_R10_OFFSET -; xmm3 -; xmm2 -; xmm1 -; xmm0 <- TPSCC_XMM_SAVE_OFFSET -; callee's r9 -; callee's r8 -; callee's rdx -; callee's rcx - -TPSCC_XMM_SAVE_OFFSET = 20h -TPSCC_R10_OFFSET = 60h -TPSCC_STACK_FRAME_SIZE = 68h -TPSCC_PARAMS_OFFSET = 70h - -TRANSPARENT_PROXY_STUB_PROLOGUE macro - alloc_stack TPSCC_STACK_FRAME_SIZE - - save_reg_postrsp r10, TPSCC_R10_OFFSET - - SAVE_ARGUMENT_REGISTERS TPSCC_PARAMS_OFFSET - SAVE_FLOAT_ARGUMENT_REGISTERS TPSCC_XMM_SAVE_OFFSET - - END_PROLOGUE - - endm - -NESTED_ENTRY TransparentProxyStub, _TEXT, CallDescrWorkerUnwindFrameChainHandler - - TRANSPARENT_PROXY_STUB_PROLOGUE - - ;; rcx: this - ;; [rsp]: slot number - - mov rax, [rcx + TransparentProxyObject___stub] - mov rcx, [rcx + TransparentProxyObject___stubData] - call rax - - RESTORE_ARGUMENT_REGISTERS TPSCC_PARAMS_OFFSET - RESTORE_FLOAT_ARGUMENT_REGISTERS TPSCC_XMM_SAVE_OFFSET - - mov r10, [rsp + TPSCC_R10_OFFSET] - - test rax, rax - jnz CrossContext - - mov r11, [rcx + TransparentProxyObject___pMT] - - ; Convert the slot number (r10) into the code address (in rax) - ; See MethodTable.h for details on vtable layout - shr r10, MethodTable_VtableSlotsPerChunkLog2 - mov rax, [r11 + r10*8 + METHODTABLE_OFFSET_VTABLE] - - mov r10, [rsp + TPSCC_R10_OFFSET] ; Reload the slot - and r10, MethodTable_VtableSlotsPerChunk-1 - mov rax, [rax + r10*8] - - add rsp, TPSCC_STACK_FRAME_SIZE - TAILJMP_RAX - -CrossContext: - add rsp, TPSCC_STACK_FRAME_SIZE - jmp TransparentProxyStub_CrossContext - -NESTED_END TransparentProxyStub, _TEXT - - -NESTED_ENTRY TransparentProxyStub_CrossContext, _TEXT - - PROLOG_WITH_TRANSITION_BLOCK 8 - - ; - ; Call TransparentProxyStubWorker. - ; - lea rcx, [rsp + __PWTB_TransitionBlock] ; pTransitionBlock - mov rdx, r10 ; MethodDesc * - call TransparentProxyStubWorker - - ; handle FP return values - - lea rcx, [rsp + __PWTB_FloatArgumentRegisters - 8] - cmp rax, 4 - jne @F - movss xmm0, real4 ptr [rcx] -@@: - cmp rax, 8 - jne @F - movsd xmm0, real8 ptr [rcx] -@@: - ; load return value - mov rax, [rcx] - - EPILOG_WITH_TRANSITION_BLOCK_RETURN - -NESTED_END TransparentProxyStub_CrossContext, _TEXT - -LEAF_ENTRY TransparentProxyStubPatch, _TEXT - ; make sure that the basic block is unique - test eax,12 -PATCH_LABEL TransparentProxyStubPatchLabel - ret -LEAF_END TransparentProxyStubPatch, _TEXT - -;+---------------------------------------------------------------------------- -; -; Method: CRemotingServices::CallFieldGetter private -; -; Synopsis: Calls the field getter function (Object::__FieldGetter) in -; managed code by setting up the stack and calling the target -; -;+---------------------------------------------------------------------------- -; extern "C" -;void __stdcall CRemotingServices__CallFieldGetter( MethodDesc *pMD, -; LPVOID pThis, -; LPVOID pFirst, -; LPVOID pSecond, -; LPVOID pThird -; ) -LEAF_ENTRY CRemotingServices__CallFieldGetter, _TEXT - -; +28 pThird -; +20 scratch area -; +18 scratch area -; +10 scratch area -; + 8 scratch area -; rsp return address - - mov METHODDESC_REGISTER, rcx - mov rcx, rdx - mov rdx, r8 - mov r8, r9 - mov r9, [rsp + 28h] - jmp TransparentProxyStub - -LEAF_END CRemotingServices__CallFieldGetter, _TEXT - - -;+---------------------------------------------------------------------------- -; -; Method: CRemotingServices::CallFieldSetter private -; -; Synopsis: Calls the field setter function (Object::__FieldSetter) in -; managed code by setting up the stack and calling the target -; -;+---------------------------------------------------------------------------- -; extern "C" -;void __stdcall CRemotingServices__CallFieldSetter( MethodDesc *pMD, -; LPVOID pThis, -; LPVOID pFirst, -; LPVOID pSecond, -; LPVOID pThird -; ) -LEAF_ENTRY CRemotingServices__CallFieldSetter, _TEXT - -; +28 pThird -; +20 scratch area -; +18 scratch area -; +10 scratch area -; + 8 scratch area -; rsp return address - - mov METHODDESC_REGISTER, rcx - mov rcx, rdx - mov rdx, r8 - mov r8, r9 - mov r9, [rsp + 28h] - jmp TransparentProxyStub - -LEAF_END CRemotingServices__CallFieldSetter, _TEXT - - -;; extern "C" ARG_SLOT __stdcall CTPMethodTable__CallTargetHelper2(const void *pTarget, -;; LPVOID pvFirst, -;; LPVOID pvSecond); -NESTED_ENTRY CTPMethodTable__CallTargetHelper2, _TEXT, CallDescrWorkerUnwindFrameChainHandler - alloc_stack 28h ;; alloc callee scratch and align the stack - END_PROLOGUE - - mov rax, rcx ; rax <- call target - mov rcx, rdx ; rcx <- first arg - mov rdx, r8 ; rdx <- second arg - - call rax - ;; It is important to have an instruction between the previous call and the epilog. - ;; If the return address is in epilog, OS won't call personality routine because - ;; it thinks personality routine does not help in this case. - nop - - ; epilog - add rsp, 28h - ret -NESTED_END CTPMethodTable__CallTargetHelper2, _TEXT - -;; extern "C" ARG_SLOT __stdcall CTPMethodTable__CallTargetHelper2(const void *pTarget, -;; LPVOID pvFirst, -;; LPVOID pvSecond, -;; LPVOID pvThird); -NESTED_ENTRY CTPMethodTable__CallTargetHelper3, _TEXT, CallDescrWorkerUnwindFrameChainHandler - alloc_stack 28h ;; alloc callee scratch and align the stack - END_PROLOGUE - - mov rax, rcx ; rax <- call target - mov rcx, rdx ; rcx <- first arg - mov rdx, r8 ; rdx <- second arg - mov r8, r9 ; r8 <- third arg - - call rax - - ;; It is important to have an instruction between the previous call and the epilog. - ;; If the return address is in epilog, OS won't call personality routine because - ;; it thinks personality routine does not help in this case. - nop - - ; epilog - add rsp, 28h - ret -NESTED_END CTPMethodTable__CallTargetHelper3, _TEXT - -NESTED_ENTRY CRemotingServices__DispatchInterfaceCall, _TEXT, CallDescrWorkerUnwindFrameChainHandler - - TRANSPARENT_PROXY_STUB_PROLOGUE - - ; - ; 'this' is a TransparentProxy. Call to stub to see if need to cross contexts. - ; - - mov rax, [rcx + TransparentProxyObject___stub] - mov rcx, [rcx + TransparentProxyObject___stubData] - call rax - - test rax, rax - jnz CrossContext - -extern VSD_GetTargetForTPWorkerQuick:proc - mov rcx, [rsp + TPSCC_PARAMS_OFFSET] ; rcx <- this - mov rdx, [rsp + TPSCC_R10_OFFSET] ; rdx <- Get the MethodDesc* or slot number - call VSD_GetTargetForTPWorkerQuick - - RESTORE_ARGUMENT_REGISTERS TPSCC_PARAMS_OFFSET - RESTORE_FLOAT_ARGUMENT_REGISTERS TPSCC_XMM_SAVE_OFFSET - - mov r10, [rsp + TPSCC_R10_OFFSET] - - test rax, rax ; Did we find a target? - jz SlowDispatch - - add rsp, TPSCC_STACK_FRAME_SIZE - TAILJMP_RAX - -SlowDispatch: - add rsp, TPSCC_STACK_FRAME_SIZE - jmp InContextTPDispatchAsmStub - -CrossContext: - RESTORE_ARGUMENT_REGISTERS TPSCC_PARAMS_OFFSET - RESTORE_FLOAT_ARGUMENT_REGISTERS TPSCC_XMM_SAVE_OFFSET - - mov r10, [rsp + TPSCC_R10_OFFSET] - - add rsp, TPSCC_STACK_FRAME_SIZE - jmp TransparentProxyStub_CrossContext - -NESTED_END CRemotingServices__DispatchInterfaceCall, _TEXT - -NESTED_ENTRY InContextTPDispatchAsmStub, _TEXT - - PROLOG_WITH_TRANSITION_BLOCK - -extern VSD_GetTargetForTPWorker:proc - lea rcx, [rsp + __PWTB_TransitionBlock] ; pTransitionBlock - mov rdx, r10 ; token - call VSD_GetTargetForTPWorker - - EPILOG_WITH_TRANSITION_BLOCK_TAILCALL - TAILJMP_RAX - -NESTED_END InContextTPDispatchAsmStub, _TEXT - -endif ; FEATURE_REMOTING - - end - diff --git a/src/vm/amd64/asmconstants.h b/src/vm/amd64/asmconstants.h index c78d5b51e4..9c3b22d8cc 100644 --- a/src/vm/amd64/asmconstants.h +++ b/src/vm/amd64/asmconstants.h @@ -174,16 +174,6 @@ ASMCONSTANTS_C_ASSERT(THREAD_CATCHATSAFEPOINT_BITS == Thread::TS_CatchAtSafePoin #endif // CROSSGEN_COMPILE -#ifdef FEATURE_REMOTING -#define TransparentProxyObject___stubData 0x10 -ASMCONSTANTS_C_ASSERT(TransparentProxyObject___stubData == offsetof(TransparentProxyObject, _stubData)) - -#define TransparentProxyObject___stub 0x28 -ASMCONSTANTS_C_ASSERT(TransparentProxyObject___stub == offsetof(TransparentProxyObject, _stub)) - -#define TransparentProxyObject___pMT 0x18 -ASMCONSTANTS_C_ASSERT(TransparentProxyObject___pMT == offsetof(TransparentProxyObject, _pMT)) -#endif // FEATURE_REMOTING #define OFFSETOF__NDirectMethodDesc__m_pWriteableData DBG_FRE(0x48, 0x20) ASMCONSTANTS_C_ASSERT(OFFSETOF__NDirectMethodDesc__m_pWriteableData == offsetof(NDirectMethodDesc, ndirect.m_pWriteableData)); @@ -277,7 +267,7 @@ ASMCONSTANTS_C_ASSERT(MethodTable_VtableSlotsPerChunk == VTABLE_SLOTS_PER_CHUNK) #define MethodTable_VtableSlotsPerChunkLog2 3 ASMCONSTANTS_C_ASSERT(MethodTable_VtableSlotsPerChunkLog2 == VTABLE_SLOTS_PER_CHUNK_LOG2) -#if defined(FEATURE_TYPEEQUIVALENCE) || defined(FEATURE_REMOTING) +#if defined(FEATURE_TYPEEQUIVALENCE) #define METHODTABLE_EQUIVALENCE_FLAGS 0x02000000 ASMCONSTANTS_C_ASSERT(METHODTABLE_EQUIVALENCE_FLAGS == MethodTable::enum_flag_HasTypeEquivalence); diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index a02e9ed727..e63890f830 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -23,9 +23,6 @@ #endif #include "comdynamic.h" #include "mlinfo.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "posterror.h" #include "assemblynative.hpp" #include "shimload.h" @@ -36,9 +33,6 @@ #include "eventtrace.h" #include "comdelegate.h" #include "siginfo.hpp" -#ifdef FEATURE_REMOTING -#include "objectclone.h" -#endif #include "typekey.h" #include "caparser.h" @@ -68,11 +62,6 @@ #include "appdomain.inl" #include "typeparse.h" #include "mdaassistants.h" -#ifdef FEATURE_REMOTING -#include "mscorcfg.h" -#include "appdomainconfigfactory.hpp" -#include "crossdomaincalls.h" -#endif #include "threadpoolrequest.h" #include "nativeoverlapped.h" @@ -2102,57 +2091,7 @@ COMorRemotingFlag AppDomain::GetPreferComInsteadOfManagedRemotingFromConfigFile( } CONTRACTL_END; -#ifdef FEATURE_REMOTING - COMorRemotingFlag res = COMorRemoting_NotInitialized; - NonVMComHolder<IXMLParser> pIXMLParser(NULL); - NonVMComHolder<IStream> pFile(NULL); - NonVMComHolder<AppDomainConfigFactory> factory(NULL); - - EX_TRY - { - HRESULT hr; - CQuickBytes qb; - - // get config file URL which is a combination of app base and config file name - IfFailGo(m_pFusionContext->PrefetchAppConfigFile()); - - LPWSTR wzConfigFileUrl = (LPWSTR)qb.AllocThrows(MAX_URL_LENGTH * sizeof(WCHAR)); - DWORD dwSize = static_cast<DWORD>(qb.Size()); - - IfFailGo(m_pFusionContext->Get(ACTAG_APP_CFG_LOCAL_FILEPATH, wzConfigFileUrl, &dwSize, 0)); - - IfFailGo(CreateConfigStream(wzConfigFileUrl, &pFile)); - - IfFailGo(GetXMLObjectEx(&pIXMLParser)); - - factory = new (nothrow) AppDomainConfigFactory(); - - if (!factory) { - goto ErrExit; - } - factory->AddRef(); // RefCount = 1 - - - IfFailGo(pIXMLParser->SetInput(pFile)); // filestream's RefCount=2 - - IfFailGo(pIXMLParser->SetFactory(factory)); // factory's RefCount=2 - - IfFailGo(pIXMLParser->Run(-1)); - - res = factory->GetCOMorRemotingFlag(); -ErrExit: ; - - } - EX_CATCH - { - ; - } - EX_END_CATCH(SwallowAllExceptions); - - return res; -#else // FEATURE_REMOTING return COMorRemoting_COM; -#endif // FEATURE_REMOTING } #endif // FEATURE_COMINTEROP @@ -3564,9 +3503,6 @@ struct CallersDataWithStackMark { StackCrawlMark* stackMark; BOOL foundMe; -#ifdef FEATURE_REMOTING - BOOL skippingRemoting; -#endif MethodDesc* pFoundMethod; MethodDesc* pPrevMethod; AppDomain* pAppDomain; @@ -3761,25 +3697,6 @@ StackWalkAction SystemDomain::CallersMethodCallbackWithStackMark(CrawlFrame* pCf Frame* frame = pCf->GetFrame(); _ASSERTE(pCf->IsFrameless() || frame); -#ifdef FEATURE_REMOTING - if (pFunc == MscorlibBinder::GetMethod(METHOD__STACK_BUILDER_SINK__PRIVATE_PROCESS_MESSAGE)) - { - _ASSERTE(!pCaller->skippingRemoting); - pCaller->skippingRemoting = true; - return SWA_CONTINUE; - } - // And we spot the client end because there's a transparent proxy transition - // frame pushed. - if (frame && frame->GetFrameType() == Frame::TYPE_TP_METHOD_FRAME) - { - pCaller->skippingRemoting = false; - return SWA_CONTINUE; - } - - // Skip any frames into between the server and client remoting endpoints. - if (pCaller->skippingRemoting) - return SWA_CONTINUE; -#endif // Skipping reflection frames. We don't need to be quite as exhaustive here @@ -3847,7 +3764,6 @@ StackWalkAction SystemDomain::CallersMethodCallbackWithStackMark(CrawlFrame* pCf return SWA_CONTINUE; } -#ifndef FEATURE_REMOTING // If remoting is not available, we only set the caller if the crawlframe is from the same domain. // Why? Because if the callerdomain is different from current domain, // there have to be interop/native frames in between. @@ -3857,7 +3773,6 @@ StackWalkAction SystemDomain::CallersMethodCallbackWithStackMark(CrawlFrame* pCf // In general, if the caller is INTEROP, we set the caller/callerdomain to be NULL // (To be precise: they are already NULL and we don't change them). if (pCf->GetAppDomain() == GetAppDomain()) -#endif // FEATURE_REMOTING // We must either be looking for the caller, or the caller's caller when // we've already found the caller (we used a non-null value in pFoundMethod // simply as a flag, the correct method to return in both case is the @@ -4264,14 +4179,6 @@ AppDomain::~AppDomain() -#ifdef FEATURE_REMOTING - if (!g_fEEInit) - { - GCX_COOP(); // See SystemDomain::EnumAllStaticGCRefs if you are removing this - CrossDomainTypeMap::FlushStaleEntries(); - CrossDomainFieldMap::FlushStaleEntries(); - } -#endif // FEATURE_REMOTING #ifdef FEATURE_COMINTEROP if (m_pNameToTypeMap != nullptr) @@ -4858,16 +4765,7 @@ OBJECTREF AppDomain::DoSetup(OBJECTREF* setupInfo) OBJECTREF activator; activator=setup.Call_RetOBJECTREF(args); -#ifdef FEATURE_REMOTING - if (activator != NULL) - { - GCPROTECT_BEGIN(activator); - retval=AppDomainHelper::CrossContextCopyTo(adid,&activator); - GCPROTECT_END(); - } -#else _ASSERTE(activator==NULL); -#endif #if defined(FEATURE_MULTICOREJIT) // Disable AutoStartProfile in default domain from this code path. @@ -8512,22 +8410,6 @@ void AppDomain::Exit(BOOL fRunFinalizers, BOOL fAsyncExit) // if (!NingenEnabled()) { -#ifdef FEATURE_REMOTING - EX_TRY - { - ADID domainId = GetId(); - MethodDescCallSite domainUnloaded(METHOD__REMOTING_SERVICES__DOMAIN_UNLOADED); - - ARG_SLOT args[1]; - args[0] = domainId.m_dwId; - domainUnloaded.Call(args); - } - EX_CATCH - { - //we don't care if it fails - } - EX_END_CATCH(SwallowAllExceptions); -#endif // FEATURE_REMOTING } ClearGCRoots(); @@ -9595,25 +9477,6 @@ end: } #endif // _DEBUG -#ifdef FEATURE_REMOTING -OBJECTREF AppDomain::GetAppDomainProxy() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - OBJECTREF orProxy = CRemotingServices::CreateProxyForDomain(this); - - _ASSERTE(orProxy->IsTransparentProxy()); - - return orProxy; -} -#endif #endif // CROSSGEN_COMPILE diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp index 525d93493c..d6023dd3b2 100644 --- a/src/vm/appdomain.hpp +++ b/src/vm/appdomain.hpp @@ -2692,9 +2692,6 @@ public: //**************************************************************************************** // Get the proxy for this app domain -#ifdef FEATURE_REMOTING - OBJECTREF GetAppDomainProxy(); -#endif ADIndex GetIndex() { diff --git a/src/vm/appdomainnative.cpp b/src/vm/appdomainnative.cpp index dd46add6ee..7ac3b186d9 100644 --- a/src/vm/appdomainnative.cpp +++ b/src/vm/appdomainnative.cpp @@ -7,9 +7,6 @@ #include "common.h" #include "appdomain.hpp" #include "appdomainnative.hpp" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "security.h" #include "vars.hpp" #include "eeconfig.h" @@ -41,9 +38,6 @@ inline AppDomain *AppDomainNative::ValidateArg(APPDOMAINREF pThis) // Should not get here with a Transparent proxy for the this pointer - // should have always called through onto the real object -#ifdef FEATURE_REMOTING - _ASSERTE(! CRemotingServices::IsTransparentProxy(OBJECTREFToObject(pThis))); -#endif AppDomain* pDomain = (AppDomain*)pThis->GetDomain(); @@ -62,156 +56,6 @@ inline AppDomain *AppDomainNative::ValidateArg(APPDOMAINREF pThis) } -#ifdef FEATURE_REMOTING -//************************************************************************ -FCIMPL5(Object*, AppDomainNative::CreateDomain, StringObject* strFriendlyNameUNSAFE, Object* appdomainSetupUNSAFE, Object* providedEvidenceUNSAFE, Object* creatorsEvidenceUNSAFE, void* parentSecurityDescriptor) -{ - FCALL_CONTRACT; - - struct _gc - { - OBJECTREF retVal; - STRINGREF strFriendlyName; - OBJECTREF appdomainSetup; - OBJECTREF providedEvidence; - OBJECTREF creatorsEvidence; - OBJECTREF entryPointProxy; - } gc; - - ZeroMemory(&gc, sizeof(gc)); - gc.strFriendlyName=(STRINGREF)strFriendlyNameUNSAFE; - gc.appdomainSetup=(OBJECTREF)appdomainSetupUNSAFE; - gc.providedEvidence=(OBJECTREF)providedEvidenceUNSAFE; - gc.creatorsEvidence=(OBJECTREF)creatorsEvidenceUNSAFE; - - HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); - - CreateDomainHelper(&gc.strFriendlyName, &gc.appdomainSetup, &gc.providedEvidence, &gc.creatorsEvidence, parentSecurityDescriptor, &gc.entryPointProxy, &gc.retVal); - - HELPER_METHOD_FRAME_END(); - return OBJECTREFToObject(gc.retVal); -} -FCIMPLEND - -FCIMPL5(Object*, AppDomainNative::CreateInstance, StringObject* strFriendlyNameUNSAFE, Object* appdomainSetupUNSAFE, Object* providedEvidenceUNSAFE, Object* creatorsEvidenceUNSAFE, void* parentSecurityDescriptor) -{ - FCALL_CONTRACT; - - struct _gc - { - OBJECTREF retVal; - STRINGREF strFriendlyName; - OBJECTREF appdomainSetup; - OBJECTREF providedEvidence; - OBJECTREF creatorsEvidence; - OBJECTREF entryPointProxy; - } gc; - - ZeroMemory(&gc, sizeof(gc)); - gc.strFriendlyName=(STRINGREF)strFriendlyNameUNSAFE; - gc.appdomainSetup=(OBJECTREF)appdomainSetupUNSAFE; - gc.providedEvidence=(OBJECTREF)providedEvidenceUNSAFE; - gc.creatorsEvidence=(OBJECTREF)creatorsEvidenceUNSAFE; - - HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); - - CreateDomainHelper(&gc.strFriendlyName, &gc.appdomainSetup, &gc.providedEvidence, &gc.creatorsEvidence, parentSecurityDescriptor, &gc.entryPointProxy, &gc.retVal); - - HELPER_METHOD_FRAME_END(); - return OBJECTREFToObject(gc.entryPointProxy); -} -FCIMPLEND - -void AppDomainNative::CreateDomainHelper (STRINGREF* ppFriendlyName, OBJECTREF* ppAppdomainSetup, OBJECTREF* ppProvidedEvidence, OBJECTREF* ppCreatorsEvidence, void* parentSecurityDescriptor, OBJECTREF* pEntryPointProxy, OBJECTREF* pRetVal) -{ - CONTRACTL - { - MODE_COOPERATIVE; - GC_TRIGGERS; - THROWS; - PRECONDITION(IsProtectedByGCFrame(ppFriendlyName)); - PRECONDITION(IsProtectedByGCFrame(ppAppdomainSetup)); - PRECONDITION(IsProtectedByGCFrame(ppProvidedEvidence)); - PRECONDITION(IsProtectedByGCFrame(ppCreatorsEvidence)); - PRECONDITION(IsProtectedByGCFrame(pEntryPointProxy)); - PRECONDITION(IsProtectedByGCFrame(pRetVal)); - } - CONTRACTL_END; - - - AppDomainCreationHolder<AppDomain> pDomain; - - // This helper will send the AppDomain creation notifications for profiler / debugger. - // If it throws, its backout code will also send a notification. - // If it succeeds, then we still need to send a AppDomainCreateFinished notification. - AppDomain::CreateUnmanagedObject(pDomain); - -#ifdef PROFILING_SUPPORTED - EX_TRY -#endif - { - OBJECTREF setupInfo=NULL; - GCPROTECT_BEGIN(setupInfo); - - MethodDescCallSite prepareDataForSetup(METHOD__APP_DOMAIN__PREPARE_DATA_FOR_SETUP); - - ARG_SLOT args[8]; - args[0]=ObjToArgSlot(*ppFriendlyName); - args[1]=ObjToArgSlot(*ppAppdomainSetup); - args[2]=ObjToArgSlot(*ppProvidedEvidence); - args[3]=ObjToArgSlot(*ppCreatorsEvidence); - args[4]=PtrToArgSlot(parentSecurityDescriptor); - args[5]=PtrToArgSlot(NULL); - args[6]=PtrToArgSlot(NULL); - args[7]=PtrToArgSlot(NULL); - - setupInfo = prepareDataForSetup.Call_RetOBJECTREF(args); - - - // We need to ensure that the AppDomainProxy is generated before we call into DoSetup, since - // GetAppDomainProxy will ensure that remoting is correctly configured in the domain. DoSetup can - // end up loading user assemblies into the domain, and those assemblies may require that remoting be - // setup already. For instance, C++/CLI applications may trigger the CRT to try to marshal a - // reference to the default domain into the current domain, which won't work correctly without this - // setup being done. - *pRetVal = pDomain->GetAppDomainProxy(); - - *pEntryPointProxy=pDomain->DoSetup(&setupInfo); - - - GCPROTECT_END(); - - pDomain->CacheStringsForDAC(); - } - -#ifdef PROFILING_SUPPORTED - EX_HOOK - { - // Need the first assembly loaded in to get any data on an app domain. - { - BEGIN_PIN_PROFILER(CORProfilerTrackAppDomainLoads()); - GCX_PREEMP(); - g_profControlBlock.pProfInterface->AppDomainCreationFinished((AppDomainID)(AppDomain *) pDomain, GET_EXCEPTION()->GetHR()); - END_PIN_PROFILER(); - } - } - EX_END_HOOK; - - // Need the first assembly loaded in to get any data on an app domain. - { - BEGIN_PIN_PROFILER(CORProfilerTrackAppDomainLoads()); - GCX_PREEMP(); - g_profControlBlock.pProfInterface->AppDomainCreationFinished((AppDomainID)(AppDomain*) pDomain, S_OK); - END_PIN_PROFILER(); - } -#endif // PROFILING_SUPPORTED - - ETW::LoaderLog::DomainLoad(pDomain, (LPWSTR)(*ppFriendlyName)->GetBuffer()); - - // DoneCreating releases ownership of AppDomain. After this call, there should be no access to pDomain. - pDomain.DoneCreating(); -} -#endif // FEATURE_REMOTING void QCALLTYPE AppDomainNative::SetupDomainSecurity(QCall::AppDomainHandle pDomain, QCall::ObjectHandleOnStack ohEvidence, @@ -856,25 +700,6 @@ FCIMPL1(FC_BOOL_RET, AppDomainNative::IsDomainIdValid, INT32 dwId) } FCIMPLEND -#ifdef FEATURE_REMOTING -FCIMPL0(Object*, AppDomainNative::GetDefaultDomain) -{ - FCALL_CONTRACT; - - APPDOMAINREF rv = NULL; - - HELPER_METHOD_FRAME_BEGIN_RET_1(rv); - - if (GetThread()->GetDomain()->IsDefaultDomain()) - rv = (APPDOMAINREF) SystemDomain::System()->DefaultDomain()->GetExposedObject(); - else - rv = (APPDOMAINREF) SystemDomain::System()->DefaultDomain()->GetAppDomainProxy(); - - HELPER_METHOD_FRAME_END(); - return OBJECTREFToObject(rv); -} -FCIMPLEND -#endif FCIMPL1(INT32, AppDomainNative::GetId, AppDomainBaseObject* refThisUNSAFE) { diff --git a/src/vm/appdomainnative.hpp b/src/vm/appdomainnative.hpp index 6f6c564869..7693e6019a 100644 --- a/src/vm/appdomainnative.hpp +++ b/src/vm/appdomainnative.hpp @@ -21,10 +21,6 @@ class AppDomainNative { public: static AppDomain *ValidateArg(APPDOMAINREF pThis); -#ifdef FEATURE_REMOTING - static FCDECL5(Object*, CreateDomain, StringObject* strFriendlyNameUNSAFE, Object* appdomainSetup, Object* providedEvidenceUNSAFE, Object* creatorsEvidenceUNSAFE, void* parentSecurityDescriptor); - static FCDECL5(Object*, CreateInstance, StringObject* strFriendlyNameUNSAFE, Object* appdomainSetup, Object* providedEvidenceUNSAFE, Object* creatorsEvidenceUNSAFE, void* parentSecurityDescriptor); -#endif static FCDECL2(void, SetupFriendlyName, AppDomainBaseObject* refThisUNSAFE, StringObject* strFriendlyNameUNSAFE); #if FEATURE_COMINTEROP static FCDECL1(void, SetDisableInterfaceCache, AppDomainBaseObject* refThisUNSAFE); @@ -50,9 +46,6 @@ public: static FCDECL1(FC_BOOL_RET, IsFinalizingForUnload, AppDomainBaseObject* refThisUNSAFE); static FCDECL1(void, ForceToSharedDomain, Object* pObjectUNSAFE); static FCDECL1(void, ChangeSecurityPolicy, AppDomainBaseObject* refThisUNSAFE); -#ifdef FEATURE_REMOTING - static FCDECL0(Object*, GetDefaultDomain); -#endif static FCDECL1(LPVOID, GetFusionContext, AppDomainBaseObject* refThis); static FCDECL2(Object*, IsStringInterned, AppDomainBaseObject* refThis, StringObject* pString); static FCDECL1(FC_BOOL_RET, IsUnloadingForcedFinalize, AppDomainBaseObject* refThis); @@ -76,9 +69,6 @@ private: static INT32 ExecuteAssemblyHelper(Assembly* pAssembly, BOOL bCreatedConsole, PTRARRAYREF *pStringArgs); -#ifdef FEATURE_REMOTING - static void CreateDomainHelper (STRINGREF* ppFriendlyName, OBJECTREF* ppAppdomainSetup, OBJECTREF* ppProvidedEvidence, OBJECTREF* ppCreatorsEvidence, void* parentSecurityDescriptor, OBJECTREF* pEntryPointProxy, OBJECTREF* pRetVal); -#endif public: static diff --git a/src/vm/appdomainstack.cpp b/src/vm/appdomainstack.cpp index 7e55a8d597..5561b7d22c 100644 --- a/src/vm/appdomainstack.cpp +++ b/src/vm/appdomainstack.cpp @@ -14,11 +14,7 @@ #include "security.h" #include "securitypolicy.h" #include "appdomain.inl" -#ifdef FEATURE_REMOTING -#include "crossdomaincalls.h" -#else #include "callhelpers.h" -#endif #ifdef _DEBUG void AppDomainStack::CheckOverridesAssertCounts() diff --git a/src/vm/arm/asmconstants.h b/src/vm/arm/asmconstants.h index 93af04734e..41597b2dbe 100644 --- a/src/vm/arm/asmconstants.h +++ b/src/vm/arm/asmconstants.h @@ -176,23 +176,6 @@ ASMCONSTANTS_C_ASSERT(UMThunkMarshInfo__m_pILStub == offsetof(UMThunkMarshInfo, #define UMThunkMarshInfo__m_cbActualArgSize 0x04 ASMCONSTANTS_C_ASSERT(UMThunkMarshInfo__m_cbActualArgSize == offsetof(UMThunkMarshInfo, m_cbActualArgSize)) -#ifdef FEATURE_REMOTING - -#define TransparentProxyObject___stubData 0x8 -ASMCONSTANTS_C_ASSERT(TransparentProxyObject___stubData == offsetof(TransparentProxyObject, _stubData)) - -#define TransparentProxyObject___stub 0x14 -ASMCONSTANTS_C_ASSERT(TransparentProxyObject___stub == offsetof(TransparentProxyObject, _stub)) - -#define TransparentProxyObject___pMT 0xc -ASMCONSTANTS_C_ASSERT(TransparentProxyObject___pMT == offsetof(TransparentProxyObject, _pMT)) - -#define RemotingPrecode__m_pMethodDesc 0x10 -ASMCONSTANTS_C_ASSERT(RemotingPrecode__m_pMethodDesc == offsetof(RemotingPrecode, m_pMethodDesc)) - -#define REMOTING_PRECODE_RET_OFFSET 0x06 - -#endif // FEATURE_REMOTING #define MethodDesc__m_wFlags DBG_FRE(0x1A, 0x06) ASMCONSTANTS_C_ASSERT(MethodDesc__m_wFlags == offsetof(MethodDesc, m_wFlags)) diff --git a/src/vm/arm/asmhelpers.asm b/src/vm/arm/asmhelpers.asm index 002477d1a4..542bdc65cc 100644 --- a/src/vm/arm/asmhelpers.asm +++ b/src/vm/arm/asmhelpers.asm @@ -40,12 +40,6 @@ #endif // WRITE_BARRIER_CHECK -#ifdef FEATURE_REMOTING - IMPORT $CTPMethodTable__s_pThunkTable - IMPORT VSD_GetTargetForTPWorker - IMPORT VSD_GetTargetForTPWorkerQuick - IMPORT TransparentProxyStubWorker -#endif #ifdef FEATURE_COMINTEROP IMPORT CLRToCOMWorker IMPORT ComPreStubWorker @@ -664,7 +658,7 @@ ThePreStubPatchLabel NESTED_END -#if defined(FEATURE_REMOTING) || defined(FEATURE_COMINTEROP) +#if defined(FEATURE_COMINTEROP) ; ------------------------------------------------------------------ ; setStubReturnValue @@ -713,372 +707,10 @@ NoFloatingPointRetVal LEAF_END -#endif // FEATURE_REMOTING || FEATURE_COMINTEROP - -#ifdef FEATURE_REMOTING - -; ------------------------------------------------------------------ -; Remoting stub used to dispatch a method invocation. This is the choke point for all remoting calls; all -; scenarios where we determine we're not a local or a COM call, regardless of whether the dispatch is -; interface, virtual or direct will wind up here sooner or later. -; -; On entry: -; r0 : transparent proxy -; r12 : target MethodDesc or slot number -; plus user arguments in registers and on the stack -; - NESTED_ENTRY TransparentProxyStub_CrossContext - - PROLOG_WITH_TRANSITION_BLOCK 0x20 - - add r0, sp, #__PWTB_TransitionBlock ; pTransitionBlock - mov r1, r12 ; pMethodDesc - - bl TransparentProxyStubWorker - - ; r0 = fpRetSize - - ; return value is stored before float argument registers - add r1, sp, #(__PWTB_FloatArgumentRegisters - 0x20) - bl setStubReturnValue - - EPILOG_WITH_TRANSITION_BLOCK_RETURN - - NESTED_END - -; ------------------------------------------------------------------ -; This method does nothing. It's just a fixed function for the debugger to put a breakpoint on. - LEAF_ENTRY TransparentProxyStubPatch - add r0, r1, r2 -TransparentProxyStubPatchLabel - EXPORT TransparentProxyStubPatchLabel - bx lr - LEAF_END - -; ------------------------------------------------------------------ -; VSD helper for performing an in-context interface dispatch on a TransparentProxy. This only happens for -; ContextBoundObjects that are invoked in the correct context, never for general remoting. -; -; On entry: -; r0 : transparent proxy -; r12 : interface MethodDesc -; plus user arguments in registers and on the stack -; -; On exit: -; Tail calls to actual target which returns as normal to the caller. -; - NESTED_ENTRY InContextTPQuickDispatchAsmStub - - ; Spill caller's volatile argument registers and some other state we wish to preserve. - PROLOG_PUSH {r0-r3,r12,lr} - PROLOG_VPUSH {d0-d7} - - CHECK_STACK_ALIGNMENT - - ; Set up arguments for VSD_GetTargetForTPWorkerQuick - ; mov r0, r0 ; this - mov r1, r12 ; Interface MethodDesc - - bl VSD_GetTargetForTPWorkerQuick - - ; If we didn't find a target head for the slow path. - cbz r0, CacheMiss - - ; Save target address since we're about to restore the value of r0. Can't place it directly into r12 - ; since that's about to be restored as well. Instead we overwrite the saved version of r12 on the - ; stack (we don't need it any more since the lookup succeeded). - str r0, [sp, #((16 * 4) + (4 * 4))] - - ; Restore caller's argument registers. - EPILOG_VPOP {d0-d7} - EPILOG_POP {r0-r3,r12,lr} - - ; Tail call to the real code using the previously computed target address. - EPILOG_BRANCH_REG r12 - -CacheMiss - ; Restore caller's argument registers. - EPILOG_VPOP {d0-d7} - EPILOG_POP {r0-r3,r12,lr} - - EPILOG_BRANCH InContextTPDispatchAsmStub - - NESTED_END - -; ------------------------------------------------------------------ - - NESTED_ENTRY InContextTPDispatchAsmStub - - PROLOG_WITH_TRANSITION_BLOCK - - add r0, sp, #__PWTB_TransitionBlock ; pTransitionBlock - mov r1, r12 ; pMethodDesc / token - - bl VSD_GetTargetForTPWorker - - mov r12, r0 - - EPILOG_WITH_TRANSITION_BLOCK_TAILCALL - EPILOG_BRANCH_REG r12 - - NESTED_END - -; ------------------------------------------------------------------ -; Macro used to compare a MethodTable with that of __TransparentProxy. Sets the Z condition flag to indicate -; the result (Z=1 for a match, Z=0 for a mismatch). -; - MACRO - TP_TYPE_CHECK $methodTableReg, $scratchReg - - ldr $scratchReg, =$CTPMethodTable__s_pThunkTable - ldr $scratchReg, [$scratchReg] - cmp $scratchReg, $methodTableReg - MEND - -; ------------------------------------------------------------------ -; Macro used to perform a context check. -; -; Calls a user customizable routine that determines whether the current execution context warrants a context -; transition for the call. Regular remoting (as opposed to context transitioning based on ContextBoundObjects) -; always returns a context-mismatch from this call. -; -; On entry: -; r0 : this (TranparentProxy object) -; -; On exit: -; r0 : check result (0 == contexts match, non-zero == contexts mismatch) -; r1-r3,r12,lr: trashed -; - MACRO - TP_CONTEXT_CHECK - - ldr r1, [r0, #TransparentProxyObject___stub] - ldr r0, [r0, #TransparentProxyObject___stubData] - blx r1 - MEND - -; ------------------------------------------------------------------ -; Used by the remoting precode for non-virtual dispatch to instance methods which might be remoted. Performs a -; context and transparent proxy check and if both of these are negative (or the call has been made on a null -; 'this') we simply return and the precode will dispatch the call locally as normal. Otherwise we redirect to -; the remoting system and never return. -; -; On entry: -; r0 : this (may or may not be a TransparentProxy) -; r1 : trashed -; lr : return address into RemotingPrecode (RemotingPrecode* + REMOTING_PRECODE_RET_OFFSET) -; [sp, #0] : caller's saved r1 -; [sp, #4] : caller's saved lr (i.e. return address into caller of RemotingPrecode) -; plus user arguments in registers and on the stack -; - LEAF_ENTRY PrecodeRemotingThunk - - ; Send null 'this' case to local dispatch case (else we'd need to handle an A/V from this stub). - cbz r0, LocalDispatch ; predicted not taken - - ; Load MethodTable* in r12. - ldr r12, [r0] - - ; Compare MethodTable in 'this' with that of __TransparentProxy; if they're not equal we dispatch - ; locally. - TP_TYPE_CHECK r12, r1 ; r1 is a scratch register - beq TransparentProxyDispatch ; predicted not taken - -LocalDispatch - ; Recover target MethodDesc pointer from the RemotingPrecode (we have the address of this + - ; REMOTING_PRECODE_RET_OFFSET in lr). Subtract extra 1 to account for the low-bit being set in LR to - ; indicate thumb mode. - ; We do this here because even the local case needs r12 initialized. - ldr r12, [lr, #(RemotingPrecode__m_pMethodDesc - REMOTING_PRECODE_RET_OFFSET - 1)] - - bx lr - - LEAF_END - -; ------------------------------------------------------------------ -; Handles the atypical path for the remoting precode above (typically the non-local dispatch cases). The -; regular entry point defined by NESTED_ENTRY below is never called directly; it serves only to generate -; prolog unwind data matching the pushes of the caller's r1 and lr done in the remoting precode so we can -; unwind out of this frame. The real entry point is TransparentProxyDispatch called directly from -; PrecodeRemotingThunk. -; - NESTED_ENTRY TransparentProxyDispatch_FakeProlog - - ; Match what the remoting precode has pushed. - PROLOG_PUSH {r1,lr} - - ; This is where execution really starts. -TransparentProxyDispatch - - ; We need some temporary registers and to preserve lr. - PROLOG_PUSH {r0,r2-r5,lr} - - CHECK_STACK_ALIGNMENT - - ; Recover target MethodDesc pointer from the RemotingPrecode (we have the address of this + - ; REMOTING_PRECODE_RET_OFFSET in lr). Subtract extra 1 to account for the low-bit being set in LR to - ; indicate thumb mode. Stash the result in a non-volatile register to preserve it over the call to - ; TP_CONTEXT_CHECK below. - ldr r4, [lr, #(RemotingPrecode__m_pMethodDesc - REMOTING_PRECODE_RET_OFFSET - 1)] - - ; Check whether the TP is already in the correct context. This can happen for ContextBoundObjects - ; only. The following macro will trash volatile registers and lr and return the result in r0 (0 == - ; context match, non-zero for everything else). All other registers are preserved. - TP_CONTEXT_CHECK - - ; Place MethodDesc* in r12 ready for wherever we dispatch to next. - mov r12, r4 - - ; Check the result of TP_CONTEXT_CHECK - cbnz r0, ContextMismatch1 - - ; At this point we know we're being called on a transparent proxy but the source and destination - ; contexts match. This only happens for a ContextBoundObject. For an non-interface dispatch we can - ; just return to the local dispatch case; the precode will eventually redirect to the jitted code - ; which knows how to handle a TP-wrapped ContextBoundObject. For interface calls we need to hand off - ; to VSD so it can resolve to the real target method. The quickest way to determine which of these - ; cases we need is to look at the classification of the method desc. All interface methods for which a - ; remoting precode is used are marked as mcComInterop, which though non-intuitive is generally OK - ; since only COM interop and remoting can dispatch directly on an interface method desc. (Generic - ; interface methods are not classified as mcComInterop but we use a different mechanism to intercept - ; those). - ldrh r0, [r4, #MethodDesc__m_wFlags] - and r0, #MethodDesc__mdcClassification - cmp r0, #MethodDesc__mcComInterop - bne LocalDispatch1 - - ; Local interface dispatch case. Restore argument registers saved here and in the RemotingPrecode, - ; discard return address into the RemotingPrecode (we're not going back there) and restore the real - ; caller's return address to LR before tail calling into the interface dispatch helper. - EPILOG_POP {r0,r2-r5,lr} ; Restore arg registers saved by this routine and RemotingPrecode lr - EPILOG_POP {r1,lr} ; Restore r1 saved by RemotingPrecode and real return address - EPILOG_BRANCH InContextTPQuickDispatchAsmStub - -LocalDispatch1 - - ; Local dispatch case. Restore argument registers saved here and return to the remoting precode. - EPILOG_POP {r0,r2-r5,pc} - -ContextMismatch1 - ; Context-mismatch (remoted) dispatch case. Restore argument registers saved here and in the - ; RemotingPrecode, discard return address into the RemotingPrecode (we're not going back there) and - ; restore the real caller's return address to LR before tail calling into the cross-context helper. - EPILOG_POP {r0,r2-r5,lr} ; Restore arg registers saved by this routine and RemotingPrecode lr - EPILOG_POP {r1,lr} ; Restore r1 saved by RemotingPrecode and real return address - EPILOG_BRANCH TransparentProxyStub_CrossContext - - NESTED_END - -; ------------------------------------------------------------------ -; Used to dispatch an interface call that is possibly be cross-context or remoted. Normally this is handled -; by the remoting precode stub above but there is an edge case for generic interface methods that falls -; through the cracks (it is not easy to cover since the precode stub makes use of it as a quick means -; to differentiate between interface and non-interface calls in the non-cross context case). -; -; On entry: -; r0 : this (TransparentProxy object) -; r12 : interface MethodDesc -; plus user arguments in registers and on the stack -; -; On exit: -; Tail calls to the VSD in-context TP dispatcher or remoting system as appropriate. -; - NESTED_ENTRY CRemotingServices__DispatchInterfaceCall - - PROLOG_PUSH {r0-r3,r12,lr} - - CHECK_STACK_ALIGNMENT - - ; Check whether the TP is already in the correct context. This can happen for ContextBoundObjects - ; only. The following macro will trash volatile registers and lr and return the result in r0 (0 == - ; context match, non-zero for everything else). All other registers are preserved. - TP_CONTEXT_CHECK - cbnz r0, ContextMismatch2 - - ; Local interface dispatch case. Tail call to VSD helper specifically for the in-context TP dispatch - ; scenario. Interface MethodDesc is restored to r12. - EPILOG_POP {r0-r3,r12,lr} - EPILOG_BRANCH InContextTPQuickDispatchAsmStub - -ContextMismatch2 - ; Context-mismatch (remoted) dispatch case. Tail call to the general remoting dispatch code. Interface - ; MethodDesc is restored to r12. - EPILOG_POP {r0-r3,r12,lr} - EPILOG_BRANCH TransparentProxyStub_CrossContext - - NESTED_END - -; ------------------------------------------------------------------ -; Common stub used for vtable dispatch of remoted methods. A small prestub will load the vtable slot index -; into r12 and then jump here. This stub determines whether we're already in the correct context (which can -; only happen for ContextBoundObjects). Depending on the answers we'll either dispatch the call locally or -; re-direct it to the remoting system (via TransparentProxyStub_CrossContext). -; -; On entry: -; r0 : this (TransparentProxy object) -; r12 : virtual method slot number -; plus user arguments in registers and on the stack -; -; On exit: -; Tail calls to the VSD in-context TP dispatcher or remoting system as appropriate. -; - NESTED_ENTRY TransparentProxyStub - - PROLOG_PUSH {r0-r3,r12,lr} - - CHECK_STACK_ALIGNMENT - - ; Check whether the TP is already in the correct context. This can happen for ContextBoundObjects - ; only. The following macro will trash volatile registers and lr and return the result in r0 (0 == - ; context match, non-zero for everything else). All other registers are preserved. - TP_CONTEXT_CHECK - cbnz r0, ContextMismatch3 - - ; We need to perform a local vtable dispatch on the ContextBoundObject. Obviously this needs to be on - ; the real type held in the proxy, not TransparentProxy's MethodTable or we'll just end up back here - ; recursively. - - ; Recover 'this' pointer and slot number. - ldr r0, [sp] - ldr r12, [sp, #0x10] - - ; Extract real type from the TP. - ldr r0, [r0, #TransparentProxyObject___pMT] - - ; Vtables are no longer a linear array. Instead they use a two-level indirection with the first level - ; consisting of fixed sized chunks of function pointer arrays. R12 has our slot number. - - ; Calculate first level chunk index. - lsr r1, r12, #ASM__VTABLE_SLOTS_PER_CHUNK_LOG2 - - ; Load the address of the chunk from the MethodTable (the chunk table immediately follows the - ; MethodTable structure). - add r0, #SIZEOF__MethodTable - ldr r2, [r0, r1, lsl #2] - - ; Calculate the slot index within the chunk. - and r0, r12, #(ASM__VTABLE_SLOTS_PER_CHUNK - 1) - - ; Load the target address into r12 (we no longer need the slot number and we're about to restore the - ; other registers). - ldr r12, [r2, r0, lsl #2] - - ; Restore the stack state and tail call to the local target. - EPILOG_POP {r0-r3} - EPILOG_STACK_FREE 4 ; Skip restore of r12 since we've overwritten it - EPILOG_POP {lr} - EPILOG_BRANCH_REG r12 - -ContextMismatch3 - ; Contexts don't match so we have to dispatch through remoting. Clean up the stack and tail call to - ; the helper. - EPILOG_POP {r0-r3,r12,lr} - EPILOG_BRANCH TransparentProxyStub_CrossContext +#endif // FEATURE_COMINTEROP - NESTED_END -#endif // FEATURE_REMOTING -#if defined(FEATURE_REMOTING) || defined(FEATURE_COMINTEROP) +#if defined(FEATURE_COMINTEROP) ; ------------------------------------------------------------------ ; Function used by remoting/COM interop to get floating point return value (since it's not in the same ; register(s) as non-floating point values). @@ -1128,116 +760,8 @@ LsetFP8 LEAF_END -#endif defined(FEATURE_REMOTING) || defined(FEATURE_COMINTEROP) -#ifdef FEATURE_REMOTING - -; ------------------------------------------------------------------ -; Tail call Object.FieldGetter remotely with the given arguments. -; -; On entry: -; r0 : pMD (MethodDesc * of the Object.FieldGetter method) -; r1 : pThis (the transparent proxy) -; r2 : pFirst -; r3 : pSecond -; [sp, #0] : pThird -; -; On exit: -; Tail calls to the managed method -; - LEAF_ENTRY CRemotingServices__CallFieldGetter - - mov r12, r0 - mov r0, r1 - mov r1, r2 - mov r2, r3 - ldr r3, [sp, #0] - - b TransparentProxyStub_CrossContext - - LEAF_END - -; ------------------------------------------------------------------ -; Tail call Object.FieldSetter remotely with the given arguments. -; -; On entry: -; r0 : pMD (MethodDesc * of the Object.FieldSetter method) -; r1 : pThis (the transparent proxy) -; r2 : pFirst -; r3 : pSecond -; [sp, #0] : pThird -; -; On exit: -; Tail calls to the managed method -; - LEAF_ENTRY CRemotingServices__CallFieldSetter - - mov r12, r0 - mov r0, r1 - mov r1, r2 - mov r2, r3 - ldr r3, [sp, #0] - - b TransparentProxyStub_CrossContext - - LEAF_END - -; ------------------------------------------------------------------ -; General purpose remoting helper used to call given target with two parameters. -; -; On entry: -; r0 : pTarget -; r1 : pFirst -; r2 : pSecond -; -; - NESTED_ENTRY CTPMethodTable__CallTargetHelper2,,CallDescrWorkerUnwindFrameChainHandler - - PROLOG_PUSH {r11, lr} - - mov r12, r0 - mov r0, r1 - mov r1, r2 - - blx r12 - - ; Adding a nop so that unwind does not result in the IP being in epilog. - ; This ensures that the OS unwinder looks up the personality routine for this method. - nop - - EPILOG_POP {r11, pc} - - NESTED_END - -; ------------------------------------------------------------------ -; General purpose remoting helper used to call given target with three parameters. -; -; On entry: -; r0 : pTarget -; r1 : pFirst -; r2 : pSecond -; r3 : pThird -; -; - NESTED_ENTRY CTPMethodTable__CallTargetHelper3,,CallDescrWorkerUnwindFrameChainHandler - - PROLOG_PUSH {r11, lr} - - mov r12, r0 - mov r0, r1 - mov r1, r2 - mov r2, r3 - - blx r12 - - ; Adding a nop so that unwind does not result in the IP being in epilog. - ; This ensures that the OS unwinder looks up the personality routine for this method. - nop - - EPILOG_POP {r11, pc} - - NESTED_END +#endif defined(FEATURE_COMINTEROP) -#endif // FEATURE_REMOTING #ifdef FEATURE_COMINTEROP ; ------------------------------------------------------------------ diff --git a/src/vm/arm/cgencpu.h b/src/vm/arm/cgencpu.h index 63c578bb88..34af8187b2 100644 --- a/src/vm/arm/cgencpu.h +++ b/src/vm/arm/cgencpu.h @@ -63,9 +63,6 @@ EXTERN_C void checkStack(void); #define USE_INDIRECT_CODEHEADER -#ifdef FEATURE_REMOTING -#define HAS_REMOTING_PRECODE 1 -#endif EXTERN_C void getFPReturn(int fpSize, INT64 *pRetVal); EXTERN_C void setFPReturn(int fpSize, INT64 retVal); diff --git a/src/vm/arm/stubs.cpp b/src/vm/arm/stubs.cpp index 5c9e31eab5..2051d130c0 100644 --- a/src/vm/arm/stubs.cpp +++ b/src/vm/arm/stubs.cpp @@ -16,9 +16,6 @@ #include "field.h" #include "dllimportcallback.h" #include "dllimport.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "eeconfig.h" #include "cgensys.h" #include "asmconstants.h" @@ -3512,177 +3509,6 @@ VOID ResetCurrentContext() } #endif // !DACCESS_COMPILE -#if defined(FEATURE_REMOTING) && !defined(CROSSGEN_COMPILE) - -#ifndef DACCESS_COMPILE -PCODE CTPMethodTable::CreateThunkForVirtualMethod(DWORD dwSlot, BYTE *startaddr) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(CheckPointer(startaddr)); - } - CONTRACTL_END; - - WORD *pCode = (WORD*)((ULONG_PTR)startaddr); - - // Slot literal is split into four pieces in the mov instruction: - // imm4:i:imm3:imm8 - _ASSERTE(FitsInU2(dwSlot)); - WORD imm4 = ((WORD)dwSlot & 0xf000) >> 12; - WORD i = ((WORD)dwSlot & 0x0800) >> 11; - WORD imm3 = ((WORD)dwSlot & 0x0700) >> 8; - WORD imm8 = (WORD)dwSlot & 0x00ff; - - // f240 0c00 mov r12, #dwSlot - // f8df f000 ldr pc, [pc, #0] - // ???? ???? dcd TransparentProxyStub - - *pCode++ = 0xf240 | (i << 10) | imm4; - *pCode++ = 0x0c00 | (imm3 << 12) | imm8; - *pCode++ = 0xf8df; - *pCode++ = 0xf000; - *((PCODE*)pCode) = GetTPStubEntryPoint(); - - _ASSERTE(CVirtualThunkMgr::IsThunkByASM((PCODE)startaddr)); - - return (PCODE)(startaddr + THUMB_CODE); -} -#endif // DACCESS_COMPILE - -BOOL CVirtualThunkMgr::IsThunkByASM(PCODE startaddr) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(startaddr != NULL); - } - CONTRACTL_END; - -#ifndef DACCESS_COMPILE - PTR_WORD pInstr = dac_cast<PTR_WORD>(PCODEToPINSTR(startaddr)); - - return (((pInstr[0] & 0xf240) == 0xf240) && - ((pInstr[1] & 0x0c00) == 0x0c00) && - (pInstr[2] == 0xf8df) && - (pInstr[3] == 0xf000) && - (*(PCODE*)&pInstr[4] == CTPMethodTable::GetTPStubEntryPoint())); -#else - DacNotImpl(); - return FALSE; -#endif -} - -MethodDesc *CVirtualThunkMgr::GetMethodDescByASM(PCODE startaddr, MethodTable *pMT) -{ - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(startaddr != NULL); - PRECONDITION(CheckPointer(pMT)); - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - _ASSERTE(IsThunkByASM(startaddr)); - - PTR_WORD pInstr = dac_cast<PTR_WORD>(PCODEToPINSTR(startaddr)); - - WORD i = (pInstr[0] & 0x0400) >> 10; - WORD imm4 = pInstr[0] & 0x000f; - WORD imm3 = (pInstr[1] & 0x7000) >> 12; - WORD imm8 = pInstr[1] & 0x00ff; - - WORD wSlot = (imm4 << 12) | (i << 11) | (imm3 << 8) | imm8; - - RETURN (pMT->GetMethodDescForSlot(wSlot)); -} - -#ifndef DACCESS_COMPILE - -BOOL CVirtualThunkMgr::DoTraceStub(PCODE stubStartAddress, TraceDestination *trace) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(stubStartAddress != NULL); - PRECONDITION(CheckPointer(trace)); - } - CONTRACTL_END; - - TADDR pInstr = PCODEToPINSTR(stubStartAddress); - - BOOL bIsStub = FALSE; - - // Find a thunk whose code address matching the starting address - LPBYTE pThunk = FindThunk((LPBYTE)pInstr); - if (pThunk) - { - LONG destAddress = 0; - - // The stub target address is stored as an absolute pointer 8 byte into the thunk. - destAddress = *(LONG*)(pThunk + 8); - - // We cannot tell where the stub will end up until OnCall is reached. - // So we tell the debugger to run till OnCall is reached and then - // come back and ask us again for the actual destination address of - // the call - - Stub *stub = Stub::RecoverStub((TADDR)destAddress); - - trace->InitForFramePush(stub->GetPatchAddress()); - bIsStub = TRUE; - } - - return bIsStub; -} - -extern "C" UINT_PTR __stdcall CRemotingServices__CheckForContextMatch(Object* pStubData) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_COOPERATIVE; // due to the Object parameter - SO_TOLERANT; - PRECONDITION(CheckPointer(pStubData)); - } - CONTRACTL_END; - - UINT_PTR contextID = *(UINT_PTR*)pStubData->UnBox(); - UINT_PTR contextCur = (UINT_PTR)GetThread()->m_Context; - return (contextCur != contextID); // chosen to match x86 convention -} - -// Return true if the current context matches that of the transparent proxy given. -BOOL CTPMethodTable__GenericCheckForContextMatch(Object* orTP) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_COOPERATIVE; // due to the Object parameter - SO_TOLERANT; - } - CONTRACTL_END; - - Object *StubData = OBJECTREFToObject(((TransparentProxyObject*)orTP)->GetStubData()); - CTPMethodTable::CheckContextCrossingProc *pfnCheckContextCrossing = - (CTPMethodTable::CheckContextCrossingProc*)(((TransparentProxyObject*)orTP)->GetStub()); - return pfnCheckContextCrossing(StubData) == 0; -} - -#endif // !DACCESS_COMPILE - -#endif // FEATURE_REMOTING && !CROSSGEN_COMPILE #ifdef FEATURE_COMINTEROP void emitCOMStubCall (ComCallMethodDesc *pCOMMethod, PCODE target) diff --git a/src/vm/arm/virtualcallstubcpu.hpp b/src/vm/arm/virtualcallstubcpu.hpp index b16983f10a..a1e15d3661 100644 --- a/src/vm/arm/virtualcallstubcpu.hpp +++ b/src/vm/arm/virtualcallstubcpu.hpp @@ -9,9 +9,6 @@ #ifdef DECLARE_DATA #include "asmconstants.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #ifdef FEATURE_PREJIT #include "compile.h" #endif diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp index 7801c9b9ed..b53acb564f 100644 --- a/src/vm/assembly.cpp +++ b/src/vm/assembly.cpp @@ -44,9 +44,6 @@ #endif #include "appdomainnative.hpp" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "customattribute.h" #include "winnls.h" diff --git a/src/vm/assemblynative.cpp b/src/vm/assemblynative.cpp index c9a15d3d7d..ed5cd7207a 100644 --- a/src/vm/assemblynative.cpp +++ b/src/vm/assemblynative.cpp @@ -28,8 +28,6 @@ #include "interoputil.h" #include "frames.h" #include "typeparse.h" -#ifdef FEATURE_REMOTING -#endif #include "stackprobe.h" #include "appdomainnative.hpp" @@ -274,18 +272,6 @@ Assembly* AssemblyNative::LoadFromBuffer(BOOL fForIntrospection, const BYTE* pAs dwSpecialFlags = pDomainSecDesc->GetSpecialFlags(); } -#ifdef FEATURE_REMOTING - // Caller may be in another appdomain context, in which case we'll need to marshal/unmarshal the grant - // and deny sets across. - if (pCallersDomain != GetAppDomain()) - { - gc.granted = AppDomainHelper::CrossContextCopyFrom(pCallersDomain->GetId(), &(gc.granted)); - if (gc.denied != NULL) - { - gc.denied = AppDomainHelper::CrossContextCopyFrom(pCallersDomain->GetId(), &(gc.denied)); - } - } -#endif // FEATURE_REMOTING // Instead of resolving policy, the loader should use an inherited grant set loadSecurity.m_pGrantSet = &gc.granted; diff --git a/src/vm/binder.cpp b/src/vm/binder.cpp index a4b7572a2a..3c95d76824 100644 --- a/src/vm/binder.cpp +++ b/src/vm/binder.cpp @@ -12,9 +12,6 @@ #include "field.h" #include "excep.h" -#ifdef FEATURE_REMOTING -#include "message.h" -#endif // FEATURE_REMOTING #include "eeconfig.h" #include "rwlock.h" #include "runtimehandles.h" diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index 7ff6c383a6..61d8ae207f 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -44,11 +44,6 @@ #include "metadataexports.h" #include "inlinetracking.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#include "crossdomaincalls.h" -#include "objectclone.h" -#endif #ifdef FEATURE_PREJIT #include "exceptionhandling.h" @@ -1311,24 +1306,6 @@ void Module::Destruct() FreeClassTables(); -#if defined(FEATURE_REMOTING) && !defined(HAS_REMOTING_PRECODE) - // Destroys thunks for all methods included in hash table. - if (m_pInstMethodHashTable != NULL) - { - InstMethodHashTable::Iterator it(m_pInstMethodHashTable); - InstMethodHashEntry *pEntry; - - while (m_pInstMethodHashTable->FindNext(&it, &pEntry)) - { - MethodDesc *pMD = pEntry->GetMethod(); - if (!pMD->IsRestored()) - continue; - - if(pMD->GetMethodTable()->IsMarshaledByRef()) - CRemotingServices::DestroyThunk(pMD); - } - } -#endif // FEATURE_REMOTING && !HAS_REMOTING_PRECODE #ifdef DEBUGGING_SUPPORTED if (g_pDebugInterface) @@ -8473,43 +8450,6 @@ void ModuleCtorInfo::Save(DataImage *image, CorProfileData *profileData) } } -#ifdef FEATURE_REMOTING -static void IsCrossAppDomainOptimizableWrapper(MethodDesc * pMD, - DWORD* pnumDwords) -{ - STANDARD_VM_CONTRACT; - - GCX_COOP(); - - EX_TRY - { - if (pMD->GetNumGenericMethodArgs() == 0 && !pMD->IsStatic()) - RemotableMethodInfo::IsCrossAppDomainOptimizable(pMD, pnumDwords); - } - EX_CATCH - { - // If there is an exception, it'll mean the info for this method will remain uninitialized. - // Just ignore the exception. At runtime, we'll try to initialize it - // An exception is possible during ngen if all dependencies are not available - } - EX_END_CATCH(SwallowAllExceptions) -} - -static void PrepareRemotableMethodInfo(MethodTable * pMT) -{ - STANDARD_VM_CONTRACT; - - if (!pMT->HasRemotableMethodInfo()) - return; - - MethodTable::MethodIterator it(pMT); - for (; it.IsValid(); it.Next()) - { - DWORD numDwords = 0; - IsCrossAppDomainOptimizableWrapper(it.GetMethodDesc(), &numDwords); - } -} -#endif // FEATURE_REMOTING bool Module::AreAllClassesFullyLoaded() { @@ -8562,9 +8502,6 @@ void Module::PrepareTypesForSave(DataImage *image) if (pMT == NULL || !pMT->IsFullyLoaded()) continue; -#ifdef FEATURE_REMOTING - PrepareRemotableMethodInfo(pMT); -#endif // FEATURE_REMOTING } } @@ -8594,16 +8531,6 @@ void Module::PrepareTypesForSave(DataImage *image) } } -#ifdef FEATURE_REMOTING - for(COUNT_T i = 0; i < pTypes.GetCount(); i ++) - { - MethodTable * pMT = pTypes[i].AsMethodTable(); - - PrepareRemotableMethodInfo(pMT); - - // @todo: prepare critical instantiated types? - } -#endif // FEATURE_REMOTING } image->GetPreloader()->TriageForZap(FALSE, FALSE); diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index cbe3659248..53d4ee1ca7 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -158,9 +158,6 @@ #include "eedbginterfaceimpl.h" #include "debugdebugger.h" #include "cordbpriv.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "comdelegate.h" #include "appdomain.hpp" #include "perfcounters.h" @@ -869,9 +866,6 @@ void EEStartupHelper(COINITIEE fFlags) #ifndef CROSSGEN_COMPILE // Initialize remoting -#ifdef FEATURE_REMOTING - CRemotingServices::Initialize(); -#endif // FEATURE_REMOTING // weak_short, weak_long, strong; no pin if (!Ref_Initialize()) diff --git a/src/vm/class.cpp b/src/vm/class.cpp index 785536a7a4..21720909cb 100644 --- a/src/vm/class.cpp +++ b/src/vm/class.cpp @@ -184,15 +184,6 @@ void EEClass::Destruct(MethodTable * pOwningMT) // default appdomain and mscorlib.dll module during shutdown _ASSERTE(!pOwningMT->IsTransparentProxy()); -#if defined(FEATURE_REMOTING) && !defined(HAS_REMOTING_PRECODE) - // Destruct the method descs by walking the chunks. - MethodTable::IntroducedMethodIterator it(pOwningMT); - for (; it.IsValid(); it.Next()) - { - MethodDesc * pMD = it.GetMethodDesc(); - pMD->Destruct(); - } -#endif #ifdef FEATURE_COMINTEROP if (GetSparseCOMInteropVTableMap() != NULL && !pOwningMT->IsZapped()) diff --git a/src/vm/class.h b/src/vm/class.h index 80be180a6e..756f6d5fc5 100644 --- a/src/vm/class.h +++ b/src/vm/class.h @@ -1039,21 +1039,6 @@ public: return m_pMethodTable; } #ifndef DACCESS_COMPILE -#ifdef FEATURE_REMOTING - inline void SetMethodTableForTransparentProxy(MethodTable* pMT) - { - LIMITED_METHOD_CONTRACT; - // Transparent proxy class' true method table - // is replaced by a global thunk table - - _ASSERTE(pMT->IsTransparentProxy() && - m_pMethodTable->IsTransparentProxy()); - - IBCLOG(LogEEClassCOWTableAccess(GetMethodTable())); - - m_pMethodTable = pMT; - } -#endif inline void SetMethodTable(MethodTable* pMT) { @@ -1634,23 +1619,10 @@ public: LIMITED_METHOD_CONTRACT; m_VMFlags |= (DWORD)VMFLAG_HAS_FIELDS_WHICH_MUST_BE_INITED; } -#ifdef FEATURE_REMOTING - DWORD CannotBeBlittedByObjectCloner() - { - LIMITED_METHOD_CONTRACT; - return (m_VMFlags & VMFLAG_CANNOT_BE_BLITTED_BY_OBJECT_CLONER); - } - void SetCannotBeBlittedByObjectCloner() - { - LIMITED_METHOD_CONTRACT; - m_VMFlags |= (DWORD)VMFLAG_CANNOT_BE_BLITTED_BY_OBJECT_CLONER; - } -#else void SetCannotBeBlittedByObjectCloner() { /* no op */ } -#endif DWORD HasNonPublicFields() { LIMITED_METHOD_CONTRACT; @@ -2112,9 +2084,6 @@ public: VMFLAG_FIXED_ADDRESS_VT_STATICS = 0x00000020, // Value type Statics in this class will be pinned VMFLAG_HASLAYOUT = 0x00000040, VMFLAG_ISNESTED = 0x00000080, -#ifdef FEATURE_REMOTING - VMFLAG_CANNOT_BE_BLITTED_BY_OBJECT_CLONER = 0x00000100, // This class has GC type fields, or implements ISerializable or has non-Serializable fields -#endif VMFLAG_IS_EQUIVALENT_TYPE = 0x00000200, diff --git a/src/vm/classcompat.cpp b/src/vm/classcompat.cpp index 50c56506a9..0bd1c2da06 100644 --- a/src/vm/classcompat.cpp +++ b/src/vm/classcompat.cpp @@ -36,9 +36,6 @@ #include "dbginterface.h" #include "comdelegate.h" #include "sigformat.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "eeprofinterfaces.h" #include "dllimportcallback.h" #include "listlock.h" diff --git a/src/vm/classfactory.cpp b/src/vm/classfactory.cpp index 9d60b5b086..3c5a97ae05 100644 --- a/src/vm/classfactory.cpp +++ b/src/vm/classfactory.cpp @@ -11,9 +11,6 @@ #include "frames.h" #include "excep.h" #include "registration.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "typeparse.h" #include "mdaassistants.h" diff --git a/src/vm/classnames.h b/src/vm/classnames.h index a2da111ed0..73d9853159 100644 --- a/src/vm/classnames.h +++ b/src/vm/classnames.h @@ -66,9 +66,6 @@ #define g_PropertyChangedEventHandler_WinRT_Name "System.Runtime.InteropServices.WindowsRuntime.PropertyChangedEventHandler_WinRT" #endif // FEATURE_COMINTEROP -#ifdef FEATURE_REMOTING -#define g_ContextBoundObjectClassName "System.ContextBoundObject" -#endif #define g_DateClassName "System.DateTime" #define g_DateTimeOffsetClassName "System.DateTimeOffset" diff --git a/src/vm/clrtocomcall.cpp b/src/vm/clrtocomcall.cpp index 60aae0036a..96d0722caf 100644 --- a/src/vm/clrtocomcall.cpp +++ b/src/vm/clrtocomcall.cpp @@ -21,9 +21,6 @@ #include "dllimport.h" #include "mlinfo.h" #include "eeconfig.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "corhost.h" #include "reflectioninvocation.h" #include "mdaassistants.h" @@ -460,15 +457,6 @@ PCODE ComPlusCall::GetStubForILStub(MethodDesc* pMD, MethodDesc** ppStubMD) if (*ppStubMD) { -#ifdef FEATURE_REMOTING -#ifndef HAS_REMOTING_PRECODE - if (!pMD->IsStatic()) - { - pStub = TheGenericComplusCallStub(); - } - else -#endif // !HAS_REMOTING_PRECODE -#endif { pStub = *pComInfo->GetAddrOfILStubField(); } @@ -481,13 +469,6 @@ PCODE ComPlusCall::GetStubForILStub(MethodDesc* pMD, MethodDesc** ppStubMD) return pStub; } -#ifdef FEATURE_REMOTING -extern -Signature InitMessageData(messageData *msgData, - FramedMethodFrame *pFrame, - Module **ppModule, - SigTypeContext *pTypeContext); -#endif // FEATURE_REMOTING I4ARRAYREF SetUpWrapperInfo(MethodDesc *pMD) { @@ -649,213 +630,6 @@ UINT32 CLRToCOMEventCallWorker(ComPlusMethodFrame* pFrame, ComPlusCallMethodDesc return 0; } -#ifdef FEATURE_REMOTING -UINT32 CLRToCOMLateBoundWorker(ComPlusMethodFrame* pFrame, ComPlusCallMethodDesc *pMD) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); - PRECONDITION(CheckPointer(pFrame)); - PRECONDITION(CheckPointer(pMD)); - } - CONTRACTL_END; - - HRESULT hr = S_OK; - DISPID DispId = DISPID_UNKNOWN; - const unsigned cbExtraSlots = 7; - DWORD BindingFlags = BINDER_AllLookup; - UINT32 fpRetSize; - mdProperty pd; - LPCUTF8 strMemberName; - mdToken tkMember; - ULONG uSemantic; - - LOG((LF_STUBS, LL_INFO1000, "Calling CLRToCOMLateBoundWorker %s::%s \n", pMD->m_pszDebugClassName, pMD->m_pszDebugMethodName)); - - // Retrieve the method table and the method desc of the call. - MethodTable *pItfMT = pMD->GetInterfaceMethodTable(); - ComPlusCallMethodDesc *pItfMD = pMD; - IMDInternalImport *pMDImport = pItfMT->GetMDImport(); - - // Make sure this is only called on dispath only interfaces. - _ASSERTE(pItfMT->GetComInterfaceType() == ifDispatch); - - // If this is a method impl MD then we need to retrieve the actual interface MD that - // this is a method impl for. - // REVISIT_TODO: Stop using ComSlot to convert method impls to interface MD - // _ASSERTE(pMD->m_pComPlusCallInfo->m_cachedComSlot == 7); - // GopalK - if (!pMD->GetMethodTable()->IsInterface()) { - pItfMD = (ComPlusCallMethodDesc*)pItfMT->GetMethodDescForSlot(pMD->m_pComPlusCallInfo->m_cachedComSlot - cbExtraSlots); - CONSISTENCY_CHECK(pMD->GetInterfaceMD() == pItfMD); - } - - // See if there is property information for this member. - hr = pItfMT->GetModule()->GetPropertyInfoForMethodDef(pItfMD->GetMemberDef(), &pd, &strMemberName, &uSemantic); - if (hr == S_OK) - { - // We are dealing with a property accessor. - tkMember = pd; - - // Determine which type of accessor we are dealing with. - switch (uSemantic) - { - case msGetter: - { - // We are dealing with a INVOKE_PROPERTYGET. - BindingFlags |= BINDER_GetProperty; - break; - } - - case msSetter: - { - // We are dealing with a INVOKE_PROPERTYPUT or a INVOKE_PROPERTYPUTREF. - ULONG cAssoc; - ASSOCIATE_RECORD* pAssoc; - HENUMInternal henum; - BOOL bPropHasOther = FALSE; - - // Retrieve all the associates. - IfFailThrow(pMDImport->EnumAssociateInit(pd,&henum)); - - cAssoc = pMDImport->EnumGetCount(&henum); - _ASSERTE(cAssoc > 0); - - ULONG allocSize = cAssoc * sizeof(ASSOCIATE_RECORD); - if (allocSize < cAssoc) - COMPlusThrow(kTypeLoadException, IDS_EE_TOOMANYASSOCIATES); - - pAssoc = (ASSOCIATE_RECORD*) _alloca((size_t) allocSize); - IfFailThrow(pMDImport->GetAllAssociates(&henum, pAssoc, cAssoc)); - - pMDImport->EnumClose(&henum); - - // Check to see if there is both a set and an other. If this is the case - // then the setter is a INVOKE_PROPERTYPUTREF otherwise we will make it a - // INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF. - for (ULONG i = 0; i < cAssoc; i++) - { - if (pAssoc[i].m_dwSemantics == msOther) - { - bPropHasOther = TRUE; - break; - } - } - - if (bPropHasOther) - { - // There is both a INVOKE_PROPERTYPUT and a INVOKE_PROPERTYPUTREF for this - // property so we need to be specific and make this invoke a INVOKE_PROPERTYPUTREF. - BindingFlags |= BINDER_PutRefDispProperty; - } - else - { - // There is only a setter so we need to make the invoke a Set which will map to - // INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF. - BindingFlags = BINDER_SetProperty; - } - break; - } - - case msOther: - { - // We are dealing with a INVOKE_PROPERTYPUT - BindingFlags |= BINDER_PutDispProperty; - break; - } - - default: - { - _ASSERTE(!"Invalid method semantic!"); - } - } - } - else - { - // We are dealing with a normal method. - strMemberName = pItfMD->GetName(); - tkMember = pItfMD->GetMemberDef(); - BindingFlags |= BINDER_InvokeMethod; - } - - struct _gc { - OBJECTREF MemberNameObj; - OBJECTREF ItfTypeObj; - OBJECTREF WrapperTypeArr; - } gc; - ZeroMemory(&gc, sizeof(gc)); - GCPROTECT_BEGIN(gc); - { - // Retrieve the exposed type object for the interface. - gc.ItfTypeObj = pItfMT->GetManagedClassObject(); - - // Retrieve the name of the member we will be invoking on. If the member - // has a DISPID then we will use that to optimize the invoke. - hr = pItfMD->GetMDImport()->GetDispIdOfMemberDef(tkMember, (ULONG*)&DispId); - if (hr == S_OK) - { - WCHAR strTmp[64]; - - _snwprintf_s(strTmp, COUNTOF(strTmp), _TRUNCATE, DISPID_NAME_FORMAT_STRING, DispId); - gc.MemberNameObj = StringObject::NewString(strTmp); - } - else - { - gc.MemberNameObj = StringObject::NewString(strMemberName); - } - - // MessageData struct will be used in creating the message object - messageData msgData; - Module *pModule = NULL; - SigTypeContext typeContext; - Signature signature = InitMessageData(&msgData, pFrame, &pModule, &typeContext); - - // If the call requires object wrapping, then set up the array - // of wrapper types. - if (pMD->RequiresArgumentWrapping()) - gc.WrapperTypeArr = SetUpWrapperInfo(pItfMD); - - _ASSERTE(!signature.IsEmpty() && pModule); - - // Allocate metasig on the stack - MetaSig mSig(signature, pModule, &typeContext); - msgData.pSig = &mSig; - - MethodDescCallSite forwardCallToInvoke(METHOD__CLASS__FORWARD_CALL_TO_INVOKE, &gc.ItfTypeObj); - - // Prepare the arguments that will be passed to the method. - ARG_SLOT Args[] = - { - ObjToArgSlot(gc.ItfTypeObj), - ObjToArgSlot(gc.MemberNameObj), - (ARG_SLOT)BindingFlags, - ObjToArgSlot(pFrame->GetThis()), - ObjToArgSlot(gc.WrapperTypeArr), - (ARG_SLOT)&msgData, - }; - - // Retrieve the array of members from the type object. - forwardCallToInvoke.CallWithValueTypes(Args); - - // the return value is written into the Frame's neginfo, so we don't - // need to return it directly. We can just have the stub do that work. - // However, the stub needs to know what type of FP return this is, if - // any, so we return the fpReturnSize info as the return value. - { - mSig.Reset(); - - ArgIterator argit(&mSig); - fpRetSize = argit.GetFPReturnSize(); - } - } - GCPROTECT_END(); - - return fpRetSize; -} -#endif // FEATURE_REMOTING // calls that propagate from CLR to COM @@ -908,14 +682,6 @@ UINT32 STDCALL CLRToCOMWorker(TransitionBlock * pTransitionBlock, ComPlusCallMet { returnValue = CLRToCOMEventCallWorker(pFrame, pMD); } -#ifdef FEATURE_REMOTING - else if (pItfMT->GetComInterfaceType() == ifDispatch) - { - // If the interface is a Dispatch only interface then convert the early bound - // call to a late bound call. - returnValue = CLRToCOMLateBoundWorker(pFrame, pMD); - } -#endif // FEATURE_REMOTING else { LOG((LF_STUBS, LL_INFO1000, "Calling CLRToCOMWorker %s::%s \n", pMD->m_pszDebugClassName, pMD->m_pszDebugMethodName)); diff --git a/src/vm/clsload.cpp b/src/vm/clsload.cpp index 7802521228..8b378dd1ad 100644 --- a/src/vm/clsload.cpp +++ b/src/vm/clsload.cpp @@ -5554,21 +5554,6 @@ static BOOL AssemblyOrFriendAccessAllowed(Assembly *pAccessingAssembly, return TRUE; } -#if defined(FEATURE_REMOTING) && !defined(CROSSGEN_COMPILE) - else if (pAccessingAssembly->GetDomain() != pTargetAssembly->GetDomain() && - pAccessingAssembly->GetFusionAssemblyName()->IsEqual(pTargetAssembly->GetFusionAssemblyName(), ASM_CMPF_NAME | ASM_CMPF_PUBLIC_KEY_TOKEN) == S_OK) - { - // If we're accessing an internal type across AppDomains, we'll end up saying that an assembly is - // not allowed to access internal types in itself, since the Assembly *'s will not compare equal. - // This ends up being confusing for users who don't have a deep understanding of the loader and type - // system, and also creates different behavior if your assembly is shared vs unshared (if you are - // shared, your Assembly *'s will match since they're in the shared domain). - // - // In order to ease the confusion, we'll consider assemblies to be friends of themselves in this - // scenario -- if a name and public key match succeeds, we'll grant internal access across domains. - return TRUE; - } -#endif // FEATURE_REMOTING && !CROSSGEN_COMPILE else if (pOptionalTargetField != NULL) { return pTargetAssembly->GrantsFriendAccessTo(pAccessingAssembly, pOptionalTargetField); diff --git a/src/vm/comcallablewrapper.cpp b/src/vm/comcallablewrapper.cpp index 91e9afcda3..cc4e6d8a86 100644 --- a/src/vm/comcallablewrapper.cpp +++ b/src/vm/comcallablewrapper.cpp @@ -16,9 +16,6 @@ #include "clrtypes.h" #include "comcallablewrapper.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "object.h" #include "field.h" @@ -409,17 +406,6 @@ MethodTable* RefineProxy(OBJECTREF pServer) MethodTable* pRefinedClass = NULL; -#ifdef FEATURE_REMOTING - GCPROTECT_BEGIN(pServer); - if (pServer->IsTransparentProxy()) - { - // if we have a transparent proxy let us refine it fully - // before giving it out to unmanaged code - REFLECTCLASSBASEREF refClass= CRemotingServices::GetClass(pServer); - pRefinedClass = refClass->GetType().GetMethodTable(); - } - GCPROTECT_END(); -#endif RETURN pRefinedClass; } @@ -1286,10 +1272,6 @@ void SimpleComCallWrapper::InitNew(OBJECTREF oref, ComCallWrapperCache *pWrapper MethodTable* pMT = pTemplate->GetClassType().GetMethodTable(); PREFIX_ASSUME(pMT != NULL); -#ifdef FEATURE_REMOTING - if (CRemotingServices::IsTransparentProxy(OBJECTREFToObject(oref))) - m_flags |= enum_IsObjectTP; -#endif m_pMT = pMT; m_pWrap = pWrap; @@ -2736,11 +2718,7 @@ ComCallWrapper* ComCallWrapper::CreateWrapper(OBJECTREF* ppObj, ComCallWrapperTe pServer = *ppObj; -#ifdef FEATURE_REMOTING - Context *pContext = Context::GetExecutionContext(pServer); -#else Context *pContext = GetAppDomain()->GetDefaultContext(); -#endif // Force Refine the object if it is a transparent proxy RefineProxy(pServer); diff --git a/src/vm/comdelegate.cpp b/src/vm/comdelegate.cpp index 272316f5cc..075c473285 100644 --- a/src/vm/comdelegate.cpp +++ b/src/vm/comdelegate.cpp @@ -18,9 +18,6 @@ #include "field.h" #include "dllimportcallback.h" #include "dllimport.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "eeconfig.h" #include "mdaassistants.h" #include "cgensys.h" @@ -919,28 +916,11 @@ void COMDelegate::BindToMethod(DELEGATEREF *pRefThis, { _ASSERTE(pRefFirstArg == NULL || *pRefFirstArg == NULL); -#ifdef FEATURE_REMOTING - if (!pTargetMethod->IsStatic()) - { - // Open-instance delegate may have remoted target if the method is declared by - // an interface, by a type deriving from MarshalByRefObject, or by System.Object. - // The following condition is necessary but not sufficient as it's always possible - // to invoke the delegate on a local instance. Precise check would require doing - // the check at invocation time. We are secure because we demand MemberAccess when - // there is a possibility that the invocation will be remote. - // - MethodTable *pMT = pTargetMethod->GetMethodTable(); - targetPossiblyRemoted = (pMT == g_pObjectClass || pMT->IsInterface() || pMT->IsMarshaledByRef()); - } -#endif // FEATURE_REMOTING } else { // closed-static is OK and we can check the target in the closed-instance case pInstanceMT = (*pRefFirstArg == NULL ? NULL : (*pRefFirstArg)->GetMethodTable()); -#ifdef FEATURE_REMOTING - targetPossiblyRemoted = InvokeUtil::IsTargetRemoted(pTargetMethod, pInstanceMT); -#endif } RefSecContext sCtx(InvokeUtil::GetInvocationAccessCheckType(targetPossiblyRemoted)); @@ -2407,29 +2387,8 @@ PCODE COMDelegate::GetInvokeMethodStub(EEImplMethodDesc* pMD) ret = COMDelegate::TheDelegateInvokeStub(); } -#ifdef FEATURE_REMOTING - else if (pMD == pClass->m_pBeginInvokeMethod) - { - CRemotingServices::EnsureRemotingStarted(); - - if (!ValidateBeginInvoke(pClass)) - COMPlusThrow(kInvalidProgramException); - - ret = CTPMethodTable::GetDelegateStubEntryPoint(); - } - else if (pMD == pClass->m_pEndInvokeMethod) - { - CRemotingServices::EnsureRemotingStarted(); - - if (!ValidateEndInvoke(pClass)) - COMPlusThrow(kInvalidProgramException); - - ret = CTPMethodTable::GetDelegateStubEntryPoint(); - } -#endif // FEATURE_REMOTING else { -#ifndef FEATURE_REMOTING // Since we do not support asynchronous delegates in CoreCLR, we much ensure that it was indeed a async delegate call // and not an invalid-delegate-layout condition. @@ -2440,7 +2399,6 @@ PCODE COMDelegate::GetInvokeMethodStub(EEImplMethodDesc* pMD) COMPlusThrow(kPlatformNotSupportedException); } -#endif //FEATURE_REMOTING _ASSERTE(!"Bad Delegate layout"); COMPlusThrow(kInvalidProgramException); diff --git a/src/vm/cominterfacemarshaler.cpp b/src/vm/cominterfacemarshaler.cpp index 58dd504d6a..2eb06b3734 100644 --- a/src/vm/cominterfacemarshaler.cpp +++ b/src/vm/cominterfacemarshaler.cpp @@ -18,10 +18,6 @@ #include "runtimecallablewrapper.h" #include "cominterfacemarshaler.h" #include "interopconverter.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#include "crossdomaincalls.h" -#endif #include "notifyexternals.h" #include "comdelegate.h" #include "winrttypenameconverter.h" @@ -395,92 +391,6 @@ OBJECTREF COMInterfaceMarshaler::HandleInProcManagedComponent() return oref; } -#ifdef FEATURE_REMOTING - -OBJECTREF COMInterfaceMarshaler::GetObjectForRemoteManagedComponentNoThrow() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - } - CONTRACTL_END; - - OBJECTREF oref = NULL; - - EX_TRY - { - oref = GetObjectForRemoteManagedComponent(); - } - EX_CATCH - { - oref = NULL; - } - EX_END_CATCH(RethrowTerminalExceptions); - - return oref; -} - - -//-------------------------------------------------------------------- -// OBJECTREF COMInterfaceMarshaler::GetObjectForRemoteManagedComponent() -// setup managed proxy to remote object -//-------------------------------------------------------------------- -OBJECTREF COMInterfaceMarshaler::GetObjectForRemoteManagedComponent() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - PRECONDITION(m_fIsRemote == true); - PRECONDITION(CheckPointer(m_pIManaged)); - } - CONTRACTL_END; - - OBJECTREF oref = NULL; - - GCPROTECT_BEGIN(oref) - { - BSTR bstr; - HRESULT hr; - - { - GCX_PREEMP(); - hr = m_pIManaged->GetSerializedBuffer(&bstr); - } - - if (hr == S_OK) - { - if (bstr != NULL) - { - // this could throw an exception - // also this would free up the BSTR that we pass in - BOOL fLegacyMode = (GetAppDomain()->GetComOrRemotingFlag() == COMorRemoting_LegacyMode); - oref = ConvertBSTRToObject(bstr, !fLegacyMode); - - if (oref != NULL) - { - // setup a COM call wrapper - ComCallWrapper* pComCallWrap = ComCallWrapper::InlineGetWrapper(&oref); - _ASSERTE(pComCallWrap != NULL); - - // InlineGetWrapper AddRef's the wrapper - pComCallWrap->Release(); - } - } - } - else - { - COMPlusThrowHR(hr); - } - } - GCPROTECT_END(); - - return oref; -} -#endif // FEATURE_REMOTING //-------------------------------------------------------------------------------- // void COMInterfaceMarshaler::CreateObjectRef(BOOL fDuplicate, OBJECTREF *pComObj) @@ -1046,49 +956,6 @@ OBJECTREF COMInterfaceMarshaler::HandleTPComponents() } CONTRACTL_END; -#ifdef FEATURE_REMOTING - OBJECTREF oref = NULL; - - if (m_fIsRemote || CRemotingServices::IsTransparentProxy(OBJECTREFToObject(GetCCWObject()))) - { - if (!m_fIsRemote) - { - oref = HandleInProcManagedComponent(); - } - else - { - if (!m_typeHandle.IsNull() && !m_typeHandle.IsComObjectType()) - { - // if the user wants explicit calls, - // we better serialize/deserialize - oref = GetObjectForRemoteManagedComponent(); - } - else - { - oref = GetObjectForRemoteManagedComponentNoThrow(); - } - } - - if (oref != NULL) - { - OBJECTREF realProxy = ObjectToOBJECTREF(CRemotingServices::GetRealProxy(OBJECTREFToObject(oref))); - if(realProxy != NULL) - { - // call setIUnknown on real proxy - GCPROTECT_BEGIN(oref) - { - CRemotingServices::CallSetDCOMProxy(realProxy, m_pUnknown); - } - GCPROTECT_END(); - return oref; - } - else - { - return oref; - } - } - } -#endif // FEATURE_REMOTING return NULL; } diff --git a/src/vm/commodule.cpp b/src/vm/commodule.cpp index d9fd02eaf6..cb14967295 100644 --- a/src/vm/commodule.cpp +++ b/src/vm/commodule.cpp @@ -1046,12 +1046,7 @@ Object* GetTypesInner(Module* pModule) // Allocate the COM+ array bSystemAssembly = (pModule->GetAssembly() == SystemDomain::SystemAssembly()); -#ifdef FEATURE_REMOTING - // we skip the TransparentProxy type if this is mscorlib, so we can make the array one element smaller - AllocSize = !bSystemAssembly ? dwNumTypeDefs : dwNumTypeDefs - 1; -#else AllocSize = dwNumTypeDefs; -#endif refArrClasses = (PTRARRAYREF) AllocateObjectArray(AllocSize, MscorlibBinder::GetClass(CLASS__CLASS)); int curPos = 0; diff --git a/src/vm/comsynchronizable.cpp b/src/vm/comsynchronizable.cpp index 4c05f0eb68..043be4944a 100644 --- a/src/vm/comsynchronizable.cpp +++ b/src/vm/comsynchronizable.cpp @@ -24,20 +24,10 @@ #include "comsynchronizable.h" #include "dbginterface.h" #include "comdelegate.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "eeconfig.h" -#ifdef FEATURE_REMOTING -#include "objectclone.h" -#else #include "callhelpers.h" -#endif #include "appdomain.hpp" #include "appdomain.inl" -#ifdef FEATURE_REMOTING -#include "crossdomaincalls.h" -#endif #include "newapis.h" @@ -1533,189 +1523,6 @@ LPVOID F_CALL_CONV ThreadNative::FastGetDomain() } #endif // _TARGET_X86_ && _MSC_VER -#ifdef FEATURE_REMOTING -// This is just a helper method that lets BCL get to the managed context -// from the contextID. -FCIMPL1(Object*, ThreadNative::GetContextFromContextID, LPVOID ContextID) -{ - FCALL_CONTRACT; - - OBJECTREF rv = NULL; - Context* pCtx = (Context *) ContextID; - // Get the managed context backing this unmanaged context - rv = pCtx->GetExposedObjectRaw(); - - // This assert maintains the following invariant: - // Only default unmanaged contexts can have a null managed context - // (All non-deafult contexts are created as managed contexts first, and then - // hooked to the unmanaged context) - _ASSERTE((rv != NULL) || (pCtx->GetDomain()->GetDefaultContext() == pCtx)); - - return OBJECTREFToObject(rv); -} -FCIMPLEND - - -FCIMPL6(Object*, ThreadNative::InternalCrossContextCallback, ThreadBaseObject* refThis, ContextBaseObject* refContext, LPVOID contextID, INT32 appDomainId, Object* oDelegateUNSAFE, PtrArray* oArgsUNSAFE) -{ - FCALL_CONTRACT; - - _ASSERTE(refThis != NULL); - VALIDATEOBJECT(refThis); - Thread *pThread = refThis->GetInternal(); - Context *pCtx = (Context *)contextID; - - - _ASSERTE(pCtx && (refContext == NULL || pCtx->GetExposedObjectRaw() == NULL || - ObjectToOBJECTREF(refContext) == pCtx->GetExposedObjectRaw())); - LOG((LF_APPDOMAIN, LL_INFO1000, "ThreadNative::InternalCrossContextCallback: %p, %p\n", refContext, pCtx)); - // install our frame. We have to put it here before we put the helper frame on - - // Set the VM conext - - struct _gc { - OBJECTREF oRetVal; - OBJECTREF oDelegate; - OBJECTREF oArgs; - // We need to report the managed context object because it may become unreachable in the caller, - // however we have to keep it alive, otherwise its finalizer could free the unmanaged internal context - OBJECTREF oContext; - } gc; - - gc.oRetVal = NULL; - gc.oDelegate = ObjectToOBJECTREF(oDelegateUNSAFE); - gc.oArgs = ObjectToOBJECTREF(oArgsUNSAFE); - gc.oContext = ObjectToOBJECTREF(refContext); - - HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); - - if (pThread == NULL) - COMPlusThrow(kThreadStateException, IDS_EE_THREAD_CANNOT_GET); - -#ifdef _DEBUG - MethodDesc* pTargetMD = COMDelegate::GetMethodDesc(gc.oDelegate); - _ASSERTE(pTargetMD->IsStatic()); -#endif - - // If we have a non-zero appDomain index, this is a x-domain call - // We must verify that the AppDomain is not unloaded - PREPARE_NONVIRTUAL_CALLSITE(METHOD__THREAD__COMPLETE_CROSSCONTEXTCALLBACK); - - AppDomainFromIDHolder ad; - if (appDomainId != 0) - { - // - // NOTE: there is a potential race between the time we retrieve the app domain pointer, - // and the time which this thread enters the domain. - // - // To solve the race, we rely on the fact that there is a thread sync - // between releasing an app domain's handle, and destroying the app domain. Thus - // it is important that we not go into preemptive gc mode in that window. - // - { - ad.Assign(ADID(appDomainId), TRUE); - - if (ad.IsUnloaded() || !ad->CanThreadEnter(pThread)) - COMPlusThrow(kAppDomainUnloadedException, W("Remoting_AppDomainUnloaded")); - } - } - - // Verify that the Context is valid. - if ( !Context::ValidateContext(pCtx) ) - COMPlusThrow(kRemotingException, W("Remoting_InvalidContext")); - - DEBUG_ASSURE_NO_RETURN_BEGIN(COMSYNCH) - - FrameWithCookie<ContextTransitionFrame> frame; - - Context* pCurrContext = pThread->GetContext(); - bool fTransition = (pCurrContext != pCtx); - BOOL fSameDomain = (appDomainId==0) || (pCurrContext->GetDomain()->GetId() == (ADID)appDomainId); - _ASSERTE( fTransition || fSameDomain); - if (fTransition) - if (appDomainId!=0) - ad->EnterContext(pThread,pCtx, &frame); - else - pThread->EnterContextRestricted(pCtx,&frame); - ad.Release(); - - - LOG((LF_EH, LL_INFO100, "MSCORLIB_ENTER_CONTEXT( %s::%s ): %s\n", - pTargetMD->m_pszDebugClassName, - pTargetMD->m_pszDebugMethodName, - fTransition ? "ENTERED" : "NOP")); - - Exception* pOriginalException=NULL; - - EX_TRY - { - DECLARE_ARGHOLDER_ARRAY(callArgs, 2); - -#if CHECK_APP_DOMAIN_LEAKS - // We're passing the delegate object to another appdomain - // without marshaling, that is OK - it's a static function delegate - // but we should mark it as agile then. - gc.oDelegate->SetSyncBlockAppDomainAgile(); -#endif - callArgs[ARGNUM_0] = OBJECTREF_TO_ARGHOLDER(gc.oDelegate); - callArgs[ARGNUM_1] = OBJECTREF_TO_ARGHOLDER(gc.oArgs); - - CATCH_HANDLER_FOUND_NOTIFICATION_CALLSITE; - CALL_MANAGED_METHOD_RETREF(gc.oRetVal, OBJECTREF, callArgs); - } - EX_CATCH - { - LOG((LF_EH, LL_INFO100, "MSCORLIB_CONTEXT_TRANSITION( %s::%s ): exception in flight\n", pTargetMD->m_pszDebugClassName, pTargetMD->m_pszDebugMethodName)); - - if (!fTransition || fSameDomain) - { - if (fTransition) - { - GCX_FORBID(); - pThread->ReturnToContext(&frame); - } -#ifdef FEATURE_TESTHOOKS - if (appDomainId!=0) - { - TESTHOOKCALL(LeftAppDomain(appDomainId)); - } -#endif - EX_RETHROW; - } - - pOriginalException=EXTRACT_EXCEPTION(); - CAPTURE_BUCKETS_AT_TRANSITION(pThread, CLRException::GetThrowableFromException(pOriginalException)); - goto lAfterCtxUnwind; - } - EX_END_CATCH_UNREACHABLE; - if (0) - { -lAfterCtxUnwind: - LOG((LF_EH, LL_INFO100, "MSCORLIB_RaiseCrossContextException( %s::%s )\n", pTargetMD->m_pszDebugClassName, pTargetMD->m_pszDebugMethodName)); - pThread->RaiseCrossContextException(pOriginalException,&frame); - } - - LOG((LF_EH, LL_INFO100, "MSCORLIB_LEAVE_CONTEXT_TRANSITION( %s::%s )\n", pTargetMD->m_pszDebugClassName, pTargetMD->m_pszDebugMethodName)); - - if (fTransition) - { - GCX_FORBID(); - pThread->ReturnToContext(&frame); - } -#ifdef FEATURE_TESTHOOKS - if(appDomainId!=0) - { - TESTHOOKCALL(LeftAppDomain(appDomainId)); - } -#endif - - DEBUG_ASSURE_NO_RETURN_END(COMSYNCH) - - HELPER_METHOD_FRAME_END(); - return OBJECTREFToObject(gc.oRetVal); -} -FCIMPLEND -#endif //FEATURE_REMOTING // // nativeGetSafeCulture is used when the culture get requested from the thread object. diff --git a/src/vm/comsynchronizable.h b/src/vm/comsynchronizable.h index 61f93fa3d1..68da7d54d9 100644 --- a/src/vm/comsynchronizable.h +++ b/src/vm/comsynchronizable.h @@ -88,10 +88,6 @@ public: static FCDECL1(void, StartupSetApartmentState, ThreadBaseObject* pThis); #endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT static FCDECL0(Object*, GetDomain); -#ifdef FEATURE_REMOTING - static FCDECL1(Object*, GetContextFromContextID, LPVOID ContextID); - static FCDECL6(Object*, InternalCrossContextCallback, ThreadBaseObject* refThis, ContextBaseObject* refContext, LPVOID contextID, INT32 appDomainId, Object* oDelegateUNSAFE, PtrArray* oArgsUNSAFE); -#endif static void QCALLTYPE nativeInitCultureAccessors(); static diff --git a/src/vm/comthreadpool.cpp b/src/vm/comthreadpool.cpp index c26242e85d..d8ef0be181 100644 --- a/src/vm/comthreadpool.cpp +++ b/src/vm/comthreadpool.cpp @@ -28,11 +28,7 @@ #include "corhost.h" #include "nativeoverlapped.h" #include "comsynchronizable.h" -#ifdef FEATURE_REMOTING -#include "crossdomaincalls.h" -#else #include "callhelpers.h" -#endif #include "appdomain.inl" /*****************************************************************************************************/ #ifdef _DEBUG diff --git a/src/vm/comwaithandle.cpp b/src/vm/comwaithandle.cpp index 610bb867be..50bff8b71e 100644 --- a/src/vm/comwaithandle.cpp +++ b/src/vm/comwaithandle.cpp @@ -188,18 +188,7 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitOneNative, SafeHandle* safeWaitHandleUNS // array. HANDLE handles[1]; handles[0] = sh->GetHandle(); -#ifdef FEATURE_REMOTING - if (exitContext != NULL && - targetContext != defaultContext) - { - Context::WaitArgs waitOneArgs = {1, handles, TRUE, timeout, TRUE, &res}; - Context::CallBackInfo callBackInfo = {Context::Wait_callback, (void*) &waitOneArgs}; - Context::RequestCallBack(CURRENT_APPDOMAIN_ID,defaultContext, &callBackInfo); - } - else -#else _ASSERTE(exitContext == NULL || targetContext == defaultContext); -#endif { // Support for pause/resume (FXFREEZE) while(true) @@ -269,18 +258,7 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitMultipleNative, Object* waitObjectsUNSAF Context* defaultContext; defaultContext = pThread->GetDomain()->GetDefaultContext(); _ASSERTE(defaultContext); -#ifdef FEATURE_REMOTING - if (exitContext != NULL && - targetContext != defaultContext) - { - Context::WaitArgs waitMultipleArgs = {numWaiters, internalHandles, waitForAll, timeout, TRUE, &res}; - Context::CallBackInfo callBackInfo = {Context::Wait_callback, (void*) &waitMultipleArgs}; - Context::RequestCallBack(CURRENT_APPDOMAIN_ID,defaultContext, &callBackInfo); - } - else -#else _ASSERTE(exitContext == NULL || targetContext == defaultContext); -#endif { // Support for pause/resume (FXFREEZE) while(true) @@ -345,18 +323,7 @@ FCIMPL5(INT32, WaitHandleNative::CorSignalAndWaitOneNative, SafeHandle* safeWait HANDLE handles[2]; handles[0] = shSignal->GetHandle(); handles[1] = shWait->GetHandle(); -#ifdef FEATURE_REMOTING - if (exitContext != NULL && - targetContext != defaultContext) - { - Context::SignalAndWaitArgs signalAndWaitArgs = {handles, timeout, TRUE, &res}; - Context::CallBackInfo callBackInfo = {Context::SignalAndWait_callback, (void*) &signalAndWaitArgs}; - Context::RequestCallBack(CURRENT_APPDOMAIN_ID,defaultContext, &callBackInfo); - } - else -#else _ASSERTE(exitContext == NULL || targetContext == defaultContext); -#endif { res = pThread->DoSignalAndWait(handles,timeout,TRUE /*alertable*/); } diff --git a/src/vm/context.h b/src/vm/context.h index 70d9456b43..3c746b647f 100644 --- a/src/vm/context.h +++ b/src/vm/context.h @@ -15,185 +15,8 @@ class RCWCache; typedef DPTR(class Context) PTR_Context; -#ifdef FEATURE_REMOTING -class Context -{ -public: - enum CallbackType - { - Wait_callback = 0, - MonitorWait_callback = 1, - ADTransition_callback = 2, - SignalAndWait_callback = 3 - }; - - typedef struct - { - int numWaiters; - HANDLE* waitHandles; - BOOL waitAll; - DWORD millis; - BOOL alertable; - DWORD* pResult; - } WaitArgs; - - typedef struct - { - HANDLE* waitHandles; - DWORD millis; - BOOL alertable; - DWORD* pResult; - } SignalAndWaitArgs; - - typedef struct - { - INT32 millis; - PendingSync* syncState; - BOOL* pResult; - } MonitorWaitArgs; - - - typedef struct - { - enum CallbackType callbackId; - void* callbackData; - } CallBackInfo; - - typedef void (*ADCallBackFcnType)(LPVOID); - - struct ADCallBackArgs - { - ADCallBackFcnType pTarget; - LPVOID pArguments; - }; - -#ifdef DACCESS_COMPILE - void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); -#endif - -friend class Thread; -friend class ThreadNative; -friend class ContextBaseObject; -friend class CRemotingServices; -friend struct PendingSync; - - Context(AppDomain *pDomain); - ~Context(); - static void Initialize(); - PTR_AppDomain GetDomain() - { - LIMITED_METHOD_DAC_CONTRACT; - return m_pDomain; - } - - // Get and Set the exposed System.Runtime.Remoting.Context - // object which corresponds to this context. - OBJECTREF GetExposedObject(); - OBJECTREF GetExposedObjectRaw(); - PTR_Object GetExposedObjectRawUnchecked(); - PTR_PTR_Object GetExposedObjectRawUncheckedPtr(); - void SetExposedObject(OBJECTREF exposed); - - // Query whether the exposed object exists - BOOL IsExposedObjectSet(); - - static LPVOID GetStaticFieldAddress(FieldDesc *pFD); - - PTR_VOID GetStaticFieldAddrNoCreate(FieldDesc *pFD); - - static Context* CreateNewContext(AppDomain *pDomain); - - static void FreeContext(Context* victim) - { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(CheckPointer(victim)); - } - CONTRACTL_END; - - delete victim; - } - - static Context* GetExecutionContext(OBJECTREF pObj); - static void RequestCallBack(ADID appDomain, Context* targetCtxID, void* privateData); - - // <TODO>Made public to get around the context GC issue </TODO> - static BOOL ValidateContext(Context *pCtx); - - inline STATIC_DATA *GetSharedStaticData() - { - LIMITED_METHOD_CONTRACT; - return m_pSharedStaticData; - } - - inline void SetSharedStaticData(STATIC_DATA *pData) - { - LIMITED_METHOD_CONTRACT; - m_pSharedStaticData = PTR_STATIC_DATA(pData); - } - - inline STATIC_DATA *GetUnsharedStaticData() - { - LIMITED_METHOD_CONTRACT; - return m_pUnsharedStaticData; - } - - inline void SetUnsharedStaticData(STATIC_DATA *pData) - { - LIMITED_METHOD_CONTRACT; - m_pUnsharedStaticData = PTR_STATIC_DATA(pData); - } - - // Functions called from BCL on a managed context object - static FCDECL2(void, SetupInternalContext, ContextBaseObject* pThisUNSAFE, CLR_BOOL bDefault); - static FCDECL1(void, CleanupInternalContext, ContextBaseObject* pThisUNSAFE); - static FCDECL1(void, ExecuteCallBack, LPVOID privateData); - -private: - // Static helper functions: - - static void ExecuteWaitCallback(WaitArgs* waitArgs); - static void ExecuteMonitorWaitCallback(MonitorWaitArgs* waitArgs); - static void ExecuteSignalAndWaitCallback(SignalAndWaitArgs* signalAndWaitArgs); - void GetStaticFieldAddressSpecial(FieldDesc *pFD, MethodTable *pMT, int *pSlot, LPVOID *ppvAddress); - PTR_VOID CalculateAddressForManagedStatic(int slot); - - // Static Data Members: - - static CrstStatic s_ContextCrst; - - - // Non-static Data Members: - // Pointer to native context static data - PTR_STATIC_DATA m_pUnsharedStaticData; - - // Pointer to native context static data - PTR_STATIC_DATA m_pSharedStaticData; - - typedef SimpleList<OBJECTHANDLE> ObjectHandleList; - - ObjectHandleList m_PinnedContextStatics; - - // <TODO> CTS. Domains should really be policies on a context and not - // entry in the context object. When AppDomains become an attribute of - // a context then add the policy.</TODO> - PTR_AppDomain m_pDomain; - - OBJECTHANDLE m_ExposedObjectHandle; - - DWORD m_Signature; - // NOTE: please maintain the signature as the last member field!!! -}; - -FCDECL0(LPVOID, GetPrivateContextsPerfCountersEx); - -#else // FEATURE_REMOTING - -// if FEATURE_REMOTING is not defined there will be only the default context for each appdomain +// there will be only the default context for each appdomain // and contexts will not be exposed to users (so there will be no managed Context class) class Context @@ -225,6 +48,5 @@ public: #endif }; -#endif // FEATURE_REMOTING #endif diff --git a/src/vm/contexts.cpp b/src/vm/contexts.cpp index eb957570ea..47cc81813f 100644 --- a/src/vm/contexts.cpp +++ b/src/vm/contexts.cpp @@ -11,917 +11,6 @@ #include "common.h" -#ifdef FEATURE_REMOTING - -#include "context.h" -#include "excep.h" -#include "field.h" -#include "remoting.h" -#include "perfcounters.h" -#include "specialstatics.h" -#include "appdomain.inl" - -#ifdef FEATURE_COMINTEROP -#include "runtimecallablewrapper.h" -#endif // FEATURE_COMINTEROP - -#ifndef DACCESS_COMPILE - -#define CONTEXT_SIGNATURE (0x2b585443) // CTX+ -#define CONTEXT_DESTROYED (0x2d585443) // CTX- - -// Lock for safe operations -CrstStatic Context::s_ContextCrst; - - -Context::Context(AppDomain *pDomain) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); - PRECONDITION(CheckPointer(pDomain)); - } - CONTRACTL_END; - - m_pDomain = pDomain; - m_Signature = CONTEXT_SIGNATURE; - - // This needs to be a LongWeakHandle since we want to be able - // to run finalizers on Proxies while the Context itself - // unreachable. When running the finalizer we will have to - // transition into the context like a regular remote call. - // If this is a short weak handle, it ceases being updated - // as soon as the context is unreachable. By making it a strong - // handle, it is updated till the context::finalize is run. - - m_ExposedObjectHandle = pDomain->CreateLongWeakHandle(NULL); - - // Set the pointers to the static data storage - m_pUnsharedStaticData = NULL; - m_pSharedStaticData = NULL; - - COUNTER_ONLY(GetPerfCounters().m_Context.cContexts++); -} - -Context::~Context() -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END; - - BOOL fADUnloaded = m_pDomain->NoAccessToHandleTable(); - if (!fADUnloaded) - { - DestroyLongWeakHandle(m_ExposedObjectHandle); - } - - m_pDomain = NULL; - m_Signature = CONTEXT_DESTROYED; - - // Cleanup the static data storage - if(m_pUnsharedStaticData) - { - for(WORD i = 0; i < m_pUnsharedStaticData->cElem; i++) - { - delete [] (BYTE *) (m_pUnsharedStaticData->dataPtr[i]); - } - delete [] m_pUnsharedStaticData; - m_pUnsharedStaticData = NULL; - } - - if(m_pSharedStaticData) - { - for(WORD i = 0; i < m_pSharedStaticData->cElem; i++) - { - delete [] (BYTE *) (m_pSharedStaticData->dataPtr[i]); - } - delete [] m_pSharedStaticData; - m_pSharedStaticData = NULL; - } - - // Destroy pinning handles associated with this context - ObjectHandleList::NodeType* pHandleNode; - while ((pHandleNode = m_PinnedContextStatics.UnlinkHead() ) != NULL) - { - if (!fADUnloaded) - { - DestroyPinningHandle(pHandleNode->data); - } - delete pHandleNode; - } - - COUNTER_ONLY(GetPerfCounters().m_Context.cContexts--); -} - -Context* Context::CreateNewContext(AppDomain *pDomain) -{ - CONTRACT (Context*) - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); - PRECONDITION(CheckPointer(pDomain)); - } - CONTRACT_END; - - Context *p = new Context(pDomain); - RETURN p; -} - -void Context::Initialize() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - // Initialize the context critical section - s_ContextCrst.Init(CrstContexts, (CrstFlags)(CRST_REENTRANCY|CRST_HOST_BREAKABLE)); -} - -BOOL Context::ValidateContext(Context *pCtx) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - SO_TOLERANT; - PRECONDITION(CheckPointer(pCtx)); - } - CONTRACTL_END; - - BOOL bRet = FALSE; - - EX_TRY - { - if (pCtx->m_Signature == CONTEXT_SIGNATURE) - bRet = TRUE; - } - EX_CATCH - { - // Swallow exceptions - if not a valid ctx, just return false. - } - EX_END_CATCH(RethrowTerminalExceptions); - - return bRet; -} - -// if the object we are creating is a proxy to another appdomain, want to create the wrapper for the -// new object in the appdomain of the proxy target -Context* Context::GetExecutionContext(OBJECTREF pObj) -{ - CONTRACT (Context*) - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - PRECONDITION(pObj != NULL); - POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); - } - CONTRACT_END; - - Context *pContext = NULL; - if (pObj->IsTransparentProxy()) - pContext = CRemotingServices::GetServerContextForProxy(pObj); - if (pContext == NULL) - pContext = GetAppDomain()->GetDefaultContext(); - - RETURN pContext; -} - -OBJECTREF Context::GetExposedObject() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - } - CONTRACTL_END; - - if (ObjectFromHandle(m_ExposedObjectHandle) == NULL) - { - // This call should fault in the managed context for the thread - MethodDescCallSite getCurrentContext(METHOD__THREAD__GET_CURRENT_CONTEXT); - CONTEXTBASEREF ctx = (CONTEXTBASEREF) getCurrentContext.Call_RetOBJECTREF((ARG_SLOT*)NULL); - - GCPROTECT_BEGIN(ctx); - { - // Take a lock to make sure that only one thread creates the object. - // This locking may be too severe! - CrstHolder ch(&s_ContextCrst); - - // Check to see if another thread has not already created the exposed object. - if (ObjectFromHandle(m_ExposedObjectHandle) == NULL) - { - // Keep a weak reference to the exposed object. - StoreObjectInHandle(m_ExposedObjectHandle, (OBJECTREF) ctx); - - ctx->SetInternalContext(this); - } - } - GCPROTECT_END(); - - } - return ObjectFromHandle(m_ExposedObjectHandle); -} - -void Context::SetExposedObject(OBJECTREF exposed) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(exposed != NULL); - PRECONDITION(ObjectFromHandle(m_ExposedObjectHandle) == NULL); - } - CONTRACTL_END; - - StoreObjectInHandle(m_ExposedObjectHandle, exposed); -} - -// This is called by EE to transition into a context(possibly in -// another appdomain) and execute the method Context::ExecuteCallBack -// with the private data provided to this method -void Context::RequestCallBack(ADID appDomainID, Context* targetCtxID, void* privateData) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - PRECONDITION(CheckPointer(targetCtxID)); - PRECONDITION(CheckPointer(privateData)); - PRECONDITION(ValidateContext((Context*)targetCtxID)); - } - CONTRACTL_END; - // a warning: don't touch targetCtxID until you verified appDomainID, - // unless the latter is CURRENT_APPDOMAIN_ID - - // Get the current context of the thread. This is assumed as - // the context where the request originated - Context *pCurrCtx; - pCurrCtx = GetCurrentContext(); - - // Check that the target context is not the same (presumably the caller has checked for it). - _ASSERTE(pCurrCtx != targetCtxID); - - // Check if we might be going to a context in another appDomain. - ADID targetDomainID; - - if (appDomainID == CURRENT_APPDOMAIN_ID) - { - targetDomainID = (ADID)0; - _ASSERTE(targetCtxID->GetDomain()==::GetAppDomain()); - } - else - { - targetDomainID=appDomainID; -#ifdef _DEBUG - AppDomainFromIDHolder ad(appDomainID, FALSE); - if (!ad.IsUnloaded()) - _ASSERTE(targetCtxID->GetDomain()->GetId()==appDomainID); -#endif - } - - // we need to be co-operative mode for jitting - GCX_COOP(); - - MethodDescCallSite callback(METHOD__CONTEXT__CALLBACK); - - ARG_SLOT args[3]; - args[0] = PtrToArgSlot(targetCtxID); - args[1] = PtrToArgSlot(privateData); - args[2] = (ARG_SLOT) (size_t)targetDomainID.m_dwId; - - callback.Call(args); -} - -/*** Definitions of callback executions for the various callbacks that are known to EE ***/ - -// Callback for waits on waithandle -void Context::ExecuteWaitCallback(WaitArgs* waitArgs) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - PRECONDITION(CheckPointer(waitArgs)); - } - CONTRACTL_END; - - Thread* pCurThread = GetThread(); - _ASSERTE(pCurThread != NULL); - - // DoAppropriateWait switches to preemptive GC before entering the wait - *(waitArgs->pResult) = pCurThread->DoAppropriateWait( waitArgs->numWaiters, - waitArgs->waitHandles, - waitArgs->waitAll, - waitArgs->millis, - waitArgs->alertable?WaitMode_Alertable:WaitMode_None); -} - -// Callback for monitor wait on objects -void Context::ExecuteMonitorWaitCallback(MonitorWaitArgs* waitArgs) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - PRECONDITION(CheckPointer(waitArgs)); - } - CONTRACTL_END; - - Thread* pCurThread = GetThread(); - _ASSERTE(pCurThread != NULL); - - GCX_PREEMP(); - - *(waitArgs->pResult) = pCurThread->Block(waitArgs->millis, - waitArgs->syncState); -} - -// Callback for signalandwait on waithandles -void Context::ExecuteSignalAndWaitCallback(SignalAndWaitArgs* signalAndWaitArgs) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - PRECONDITION(CheckPointer(signalAndWaitArgs)); - } - CONTRACTL_END; - - Thread* pCurThread = GetThread(); - _ASSERTE(pCurThread != NULL); - - // DoAppropriateWait switches to preemptive GC before entering the wait - *(signalAndWaitArgs->pResult) = pCurThread->DoSignalAndWait( signalAndWaitArgs->waitHandles, - signalAndWaitArgs->millis, - signalAndWaitArgs->alertable); -} - -//+---------------------------------------------------------------------------- -// -// Method: Context::GetStaticFieldAddress private -// -// Synopsis: Get the address of the field relative to the current context. -// If an address has not been assigned yet then create one. -// - -// -//+---------------------------------------------------------------------------- -LPVOID Context::GetStaticFieldAddress(FieldDesc *pFD) -{ - CONTRACT (LPVOID) - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM()); - PRECONDITION(CheckPointer(pFD)); - PRECONDITION(!s_ContextCrst.OwnedByCurrentThread()); - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - LPVOID pvAddress = NULL; - Context* pCtx = NULL; - // for static field the MethodTable is exact even for generic classes - MethodTable* pMT = pFD->GetEnclosingMethodTable(); - BOOL fIsShared = pMT->IsDomainNeutral(); - DWORD dwClassOffset = pMT->GetContextStaticsOffset(); - DWORD currElem = 0; - STATIC_DATA* pData; - - // NOTE: if you change this method, you must also change - // GetStaticFieldAddrNoCreate below. - - if (dwClassOffset == (DWORD)-1) - { - dwClassOffset = pMT->AllocateContextStaticsOffset(); - } - - // Retrieve the current context - pCtx = GetCurrentContext(); - _ASSERTE(NULL != pCtx); - - // Acquire the context lock before accessing the static data pointer - { - CrstHolder ch(&s_ContextCrst); - - if(!fIsShared) - pData = pCtx->m_pUnsharedStaticData; - else - pData = pCtx->m_pSharedStaticData; - - if(NULL != pData) - currElem = pData->cElem; - - // Check whether we have allocated space for storing a pointer to - // this class' context static store - if(dwClassOffset >= currElem) - { - // Allocate space for storing pointers - DWORD dwNewElem = (currElem == 0 ? 4 : currElem*2); - - // Ensure that we grow to a size larger than the index we intend to use - while (dwNewElem <= dwClassOffset) - dwNewElem = 2*dwNewElem; - - STATIC_DATA *pNew = (STATIC_DATA *)new BYTE[sizeof(STATIC_DATA) + dwNewElem*sizeof(LPVOID)]; - - // Set the new count. - pNew->cElem = dwNewElem; - - if(NULL != pData) - { - // Copy the old data into the new data - memcpy(&pNew->dataPtr[0], &pData->dataPtr[0], currElem*sizeof(LPVOID)); - - // Delete the old data - delete [] (BYTE*) pData; - } - - // Zero init any new elements. - ZeroMemory(&pNew->dataPtr[currElem], (dwNewElem - currElem)* sizeof(LPVOID)); - - // Update the locals - pData = pNew; - - // Reset the pointers in the context object to point to the - // new memory - if(!fIsShared) - pCtx->m_pUnsharedStaticData = pData; - else - pCtx->m_pSharedStaticData = pData; - } - - _ASSERTE(NULL != pData); - - // Check whether we have to allocate space for - // the context local statics of this class - if(NULL == pData->dataPtr[dwClassOffset]) - { - DWORD dwSize = pMT->GetContextStaticsSize(); - - // Allocate memory for context static fields - LPBYTE pFields = new BYTE[dwSize]; - - // Initialize the memory allocated for the fields - ZeroMemory(pFields, dwSize); - - pData->dataPtr[dwClassOffset] = pFields; - } - - _ASSERTE(NULL != pData->dataPtr[dwClassOffset]); - - pvAddress = (LPVOID)((LPBYTE)pData->dataPtr[dwClassOffset] + pFD->GetOffset()); - - // For object and value class fields we have to allocate storage in the - // __StaticContainer class in the managed heap - if(pFD->IsObjRef() || pFD->IsByValue()) - { - // in this case *pvAddress == bucket|index - int *pSlot = (int*)pvAddress; - pvAddress = NULL; - pCtx->GetStaticFieldAddressSpecial(pFD, pMT, pSlot, &pvAddress); - - if (pFD->IsByValue()) - { - _ASSERTE(pvAddress != NULL); - pvAddress = (*((OBJECTREF*)pvAddress))->GetData(); - } - // ************************************************ - // ************** WARNING ************************* - // Do not provoke GC from here to the point JIT gets - // pvAddress back - // ************************************************ - _ASSERTE(*pSlot > 0); - } - } - - RETURN pvAddress; -} - - -//+---------------------------------------------------------------------------- -// -// Method: Context::GetStaticFieldAddressSpecial private -// -// Synopsis: Allocate an entry in the __StaticContainer class in the -// managed heap for static objects and value classes -// - -// -//+---------------------------------------------------------------------------- - -// NOTE: At one point we used to allocate these in the long lived handle table -// which is per-appdomain. However, that causes them to get rooted and not -// cleaned up until the appdomain gets unloaded. This is not very desirable -// since a context static object may hold a reference to the context itself or -// to a proxy in the context causing a whole lot of garbage to float around. -// Now (2/13/01) these are allocated from a managed structure rooted in each -// managed context. - -void Context::GetStaticFieldAddressSpecial(FieldDesc *pFD, MethodTable *pMT, int *pSlot, LPVOID *ppvAddress) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM()); - PRECONDITION(CheckPointer(pFD)); - PRECONDITION(CheckPointer(pMT)); - PRECONDITION(CheckPointer(pSlot)); - PRECONDITION(CheckPointer(ppvAddress)); - } - CONTRACTL_END; - - OBJECTREF *pObjRef = NULL; - BOOL bNewSlot = (*pSlot == 0); - - if (bNewSlot) - { - // ! this line will trigger a GC, don't move it down - // ! without protecting the args[] and other OBJECTREFS - OBJECTREF orThis = GetExposedObject();; - GCPROTECT_BEGIN(orThis); - - MethodDescCallSite reserveSlot(METHOD__CONTEXT__RESERVE_SLOT, &orThis); - - // We need to assign a location for this static field. - // Call the managed helper - ARG_SLOT args[1] = - { - ObjToArgSlot(orThis) - }; - - // The managed ReserveSlot methods counts on this! - _ASSERTE(s_ContextCrst.OwnedByCurrentThread()); - _ASSERTE(args[0] != 0); - - *pSlot = reserveSlot.Call_RetI4(args); - - _ASSERTE(*pSlot>0); - - GCPROTECT_END(); - - - // to a boxed version of the value class.This allows the standard GC - // algorithm to take care of internal pointers in the value class. - if (pFD->IsByValue()) - { - // Extract the type of the field - TypeHandle th = pFD->GetFieldTypeHandleThrowing(); - - OBJECTHANDLE oh; - OBJECTREF obj = MethodTable::AllocateStaticBox(th.GetMethodTable(), pMT->HasFixedAddressVTStatics(), &oh); - pObjRef = (OBJECTREF*)CalculateAddressForManagedStatic(*pSlot); - - if (oh != NULL) - { - ObjectHandleList::NodeType* pNewNode = new ObjectHandleList::NodeType(oh); - m_PinnedContextStatics.LinkHead(pNewNode); - } - - SetObjectReference( pObjRef, obj, GetAppDomain() ); - } - else - { - pObjRef = (OBJECTREF*)CalculateAddressForManagedStatic(*pSlot); - } - } - else - { - // If the field already has a location assigned we go through here - pObjRef = (OBJECTREF*)CalculateAddressForManagedStatic(*pSlot); - } - - *(ULONG_PTR *)ppvAddress = (ULONG_PTR)pObjRef; -} - -// This is called by the managed context constructor -FCIMPL2(void, Context::SetupInternalContext, ContextBaseObject* pThisUNSAFE, CLR_BOOL bDefault) -{ - CONTRACTL - { - FCALL_CHECK; - PRECONDITION(pThisUNSAFE != NULL); - PRECONDITION(pThisUNSAFE->m_internalContext == NULL); - } - CONTRACTL_END; - - CONTEXTBASEREF pThis = (CONTEXTBASEREF) pThisUNSAFE; - HELPER_METHOD_FRAME_BEGIN_1(pThis); - - Context *pCtx; - - if (bDefault) - { - // We have to hook this up with the internal default - // context for the current appDomain - pCtx = GetThread()->GetDomain()->GetDefaultContext(); - } - else - { - // Create the unmanaged backing context object - pCtx = Context::CreateNewContext(GetThread()->GetDomain()); - } - - // Set the managed & unmanaged objects to point at each other. - pThis->SetInternalContext(pCtx); - pCtx->SetExposedObject((OBJECTREF)pThis); - - // Set the AppDomain field in the Managed context object - pThis->SetExposedDomain(GetThread()->GetDomain()->GetExposedObject()); - - if(bDefault) - ((APPDOMAINREF)GetThread()->GetDomain()->GetExposedObject())->SetDefaultContext(pThis); - - COUNTER_ONLY(GetPerfCounters().m_Context.cContexts++); - - HELPER_METHOD_FRAME_END(); -} -FCIMPLEND - -// This is called by the managed context finalizer -FCIMPL1(void, Context::CleanupInternalContext, ContextBaseObject* pThisUNSAFE) -{ - CONTRACTL - { - FCALL_CHECK; - PRECONDITION(pThisUNSAFE != NULL); - } - CONTRACTL_END; - - CONTEXTBASEREF pThis = (CONTEXTBASEREF) pThisUNSAFE; - HELPER_METHOD_FRAME_BEGIN_1(pThis); - - CONTEXTBASEREF refCtx = pThis; - - Context *pCtx = refCtx->m_internalContext; - _ASSERTE(pCtx != NULL); - - if (ValidateContext(pCtx)) - { - LOG((LF_APPDOMAIN, LL_INFO1000, "Context::CleanupInternalContext: %8.8x, %8.8x\n", OBJECTREFToObject(refCtx), pCtx)); - Context::FreeContext(pCtx); - } - - COUNTER_ONLY(GetPerfCounters().m_Context.cContexts--); - - HELPER_METHOD_FRAME_END(); -} -FCIMPLEND - - -// This is where a call back request made by EE in Context::RequestCallBack -// actually gets "executed". -// At this point we have done a real context transition from the threads -// context when RequestCallBack was called to the destination context. -FCIMPL1(void, Context::ExecuteCallBack, LPVOID privateData) -{ - CONTRACTL - { - FCALL_CHECK; - PRECONDITION(CheckPointer(privateData)); - } - CONTRACTL_END; - - HELPER_METHOD_FRAME_BEGIN_0(); - - switch (((CallBackInfo*) privateData)->callbackId) - { - case Wait_callback: - { - WaitArgs* waitArgs; - waitArgs = (WaitArgs*) ((CallBackInfo*) privateData)->callbackData; - ExecuteWaitCallback(waitArgs); - break; - } - - case MonitorWait_callback: - { - MonitorWaitArgs* waitArgs; - waitArgs = (MonitorWaitArgs*) ((CallBackInfo*) privateData)->callbackData; - ExecuteMonitorWaitCallback(waitArgs); - break; - } - - case ADTransition_callback: - { - ADCallBackArgs* pCallArgs = (ADCallBackArgs*)(((CallBackInfo*) privateData)->callbackData); - pCallArgs->pTarget(pCallArgs->pArguments); - break; - } - - case SignalAndWait_callback: - { - SignalAndWaitArgs* signalAndWaitArgs; - signalAndWaitArgs = (SignalAndWaitArgs*)((CallBackInfo*)privateData)->callbackData; - ExecuteSignalAndWaitCallback(signalAndWaitArgs); - break; - } - // Add other callback types here - default: - _ASSERTE(!"Invalid callback type"); - break; - } - - // This is EE's entry point to do whatever it wanted to do in - // the targetContext. This will return back into the managed - // world and transition back into the original context. - - HELPER_METHOD_FRAME_END(); -} -FCIMPLEND - - - -#ifdef ENABLE_PERF_COUNTERS - -FCIMPL0(LPVOID, GetPrivateContextsPerfCountersEx) -{ - FCALL_CONTRACT; - - return (LPVOID)GetPrivateContextsPerfCounters(); -} -FCIMPLEND - - -#else -FCIMPL0(LPVOID, GetPrivateContextsPerfCountersEx) -{ - FCALL_CONTRACT; - - return NULL; -} -FCIMPLEND - -#endif // ENABLE_PERF_COUNTERS - -#endif // DACCESS_COMPILE - -// This will NOT create the exposed object if there isn't one! -OBJECTREF Context::GetExposedObjectRaw() -{ - WRAPPER_NO_CONTRACT; - - return ObjectFromHandle(m_ExposedObjectHandle); -} - - -PTR_Object Context::GetExposedObjectRawUnchecked() -{ - LIMITED_METHOD_CONTRACT; - - return *PTR_PTR_Object(m_ExposedObjectHandle); -} - -PTR_PTR_Object Context::GetExposedObjectRawUncheckedPtr() -{ - LIMITED_METHOD_CONTRACT; - - return PTR_PTR_Object(m_ExposedObjectHandle); -} - -//+---------------------------------------------------------------------------- -// -// Method: Context::GetStaticFieldAddrNoCreate private -// -// Synopsis: Get the address of the field relative to the context given a thread. -// If an address has not been assigned, return NULL. -// No creating is allowed. -// - -// -//+---------------------------------------------------------------------------- -PTR_VOID Context::GetStaticFieldAddrNoCreate(FieldDesc *pFD) -{ - CONTRACT (PTR_VOID) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(CheckPointer(pFD)); - POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); - SUPPORTS_DAC; - } - CONTRACT_END; - - PTR_VOID pvAddress = NULL; - // for static field the MethodTable is exact even for generic classes - MethodTable* pMT = pFD->GetEnclosingMethodTable(); - BOOL fIsShared = pMT->IsDomainNeutral(); - DWORD dwClassOffset = pMT->GetContextStaticsOffset(); - DWORD currElem = 0; - STATIC_DATA* pData; - - if (dwClassOffset == (DWORD)-1) - RETURN NULL; - - if(!fIsShared) - pData = m_pUnsharedStaticData; - else - pData = m_pSharedStaticData; - - if (NULL == pData) - RETURN NULL; - - currElem = pData->cElem; - - // Check whether we have allocated space for storing a pointer to - // this class' context static store - if(dwClassOffset >= currElem || pData->dataPtr[dwClassOffset] == NULL) - RETURN NULL; - - _ASSERTE(pData->dataPtr[dwClassOffset] != NULL); - - // We have allocated static storage for this data - // Just return the address by getting the offset into the data - pvAddress = PTR_VOID(dac_cast<PTR_BYTE>(pData->dataPtr[dwClassOffset]) + pFD->GetOffset()); - - if(pFD->IsObjRef() || pFD->IsByValue()) - { - if (*dac_cast<PTR_BYTE>(pvAddress) == NULL) - { - pvAddress = NULL; - LOG((LF_SYNC, LL_ALWAYS, "dbgr: pvAddress = NULL")); - } - else - { - pvAddress = CalculateAddressForManagedStatic(*(PTR_int(pvAddress))); - LOG((LF_SYNC, LL_ALWAYS, "dbgr: pvAddress = %lx", pvAddress)); - if (pFD->IsByValue()) - { - _ASSERTE(pvAddress != NULL); - pvAddress = (*(PTR_OBJECTREF(pvAddress)))->GetData(); - } - } - } - - RETURN pvAddress; -} - - -// This is used for context relative statics that are object refs -// These are stored in a structure in the managed context. The first -// time over an index and a bucket are determined and subsequently -// remembered in the location for the field in the per-context-per-class -// data structure. -// Here we map back from the index to the address of the object ref. -PTR_VOID Context::CalculateAddressForManagedStatic(int slot) -{ - CONTRACT (PTR_VOID) - { - NOTHROW; - GC_NOTRIGGER; - MODE_COOPERATIVE; - PRECONDITION(CheckPointer(this)); - POSTCONDITION(CheckPointer(RETVAL)); - SUPPORTS_DAC; - } - CONTRACT_END; - - PTR_OBJECTREF pObjRef; - int bucket = (slot>>16); - int index = (0x0000ffff&slot); - - // Now determine the address of the static field - PTRARRAYREF bucketRef = NULL; - - bucketRef = ((CONTEXTBASEREF)GetExposedObjectRaw())->GetContextStaticsHolder(); - - // walk the chain to our bucket - while (bucket--) - bucketRef = (PTRARRAYREF) bucketRef->GetAt(0); - - // Index 0 is used to point to the next bucket! - _ASSERTE(index > 0); - pObjRef = PTR_OBJECTREF(bucketRef->GetDataPtr())+index; - - RETURN (PTR_VOID(pObjRef)); -} - -#endif // FEATURE_REMOTING #ifdef DACCESS_COMPILE diff --git a/src/vm/crossdomaincalls.h b/src/vm/crossdomaincalls.h deleted file mode 100644 index 6a406547de..0000000000 --- a/src/vm/crossdomaincalls.h +++ /dev/null @@ -1,272 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// -// File: CrossDomainCalls.h -// - -// -// Purpose: Provides a fast path for cross domain calls. -// - - -#ifndef __CROSSDOMAINCALLS_H__ -#define __CROSSDOMAINCALLS_H__ - -#ifndef FEATURE_REMOTING -#error FEATURE_REMOTING is not set, please do no include crossdomaincalls.h -#endif - -#include "methodtable.h" - -class SimpleRWLock; - -// These are flags set inside the real proxy. Indicates what kind of type is the proxy cast to -// whether its method table layout is equivalent to the server type etc -#define OPTIMIZATION_FLAG_INITTED 0x01000000 -#define OPTIMIZATION_FLAG_PROXY_EQUIVALENT 0x02000000 -#define OPTIMIZATION_FLAG_PROXY_SHARED_TYPE 0x04000000 -#define OPTIMIZATION_FLAG_DEPTH_MASK 0x00FFFFFF - -// This struct has info about methods on MBR objects and Interfaces -struct RemotableMethodInfo -{ -#ifdef DACCESS_COMPILE - friend class NativeImageDumper; -#endif - /* - if XAD_BLITTABLE_ARGS is set, (m_OptFlags & XAD_ARG_COUNT_MASK) contains the number of stack dwords to copy - */ - enum XADOptimizationType - { - XAD_FLAGS_INITIALIZED = 0x01000000, - XAD_NOT_OPTIMIZABLE = 0x02000000, // Method call has to go through managed remoting path - XAD_BLITTABLE_ARGS = 0x04000000, // Arguments blittable across domains. Could be scalars or agile gc refs - XAD_BLITTABLE_RET = 0x08000000, // Return Value blittable across domains. Could be scalars or agile gc refs - XAD_BLITTABLE_ALL = XAD_BLITTABLE_ARGS | XAD_BLITTABLE_RET, - - XAD_RET_FLOAT = 0x10000000, - XAD_RET_DOUBLE = 0x20000000, -#ifdef FEATURE_HFA - XAD_RET_HFA_TYPE = 0x40000000, -#endif - XAD_RET_GC_REF = 0x70000000, // To differentiate agile objects like string which can be blitted across domains, but are gc refs - XAD_RET_TYPE_MASK = 0x70000000, - - XAD_METHOD_IS_VIRTUAL = 0x80000000, // MethodDesc::IsVirtual is slow. Should consider fixing IsVirtual rather than have a flag here - XAD_ARGS_HAVE_A_FLOAT = 0x00800000, - - XAD_FLAG_MASK = 0xFF800000, - XAD_ARG_COUNT_MASK = 0x007FFFFF - } ; - - static XADOptimizationType IsCrossAppDomainOptimizable(MethodDesc *pMeth, DWORD *pNumDwordsToCopy); - - static BOOL TypeIsConduciveToBlitting(MethodTable *pFromMT, MethodTable *pToMT); - - static BOOL AreArgsBlittable(XADOptimizationType enumVal) - { - LIMITED_METHOD_CONTRACT; - return (enumVal & XAD_BLITTABLE_ARGS) && IsReturnBlittable(enumVal); - } - static BOOL IsReturnBlittable(XADOptimizationType enumVal) - { - LIMITED_METHOD_CONTRACT; - return enumVal & XAD_BLITTABLE_RET; - } - static BOOL IsReturnGCRef(XADOptimizationType enumVal) - { - LIMITED_METHOD_CONTRACT; - return XAD_RET_GC_REF == (enumVal & XAD_RET_TYPE_MASK); - } - - static UINT GetFPReturnSize(XADOptimizationType enumVal) - { - WRAPPER_NO_CONTRACT; - switch (enumVal & XAD_RET_TYPE_MASK) - { - case XAD_RET_FLOAT: - return sizeof(float); - - case XAD_RET_DOUBLE: - return sizeof(double); - -#ifdef FEATURE_HFA - case XAD_RET_FLOAT | XAD_RET_HFA_TYPE: - return 4 * sizeof(float); - - case XAD_RET_DOUBLE | XAD_RET_HFA_TYPE: - return 4 * sizeof(double); -#endif - - default: - return 0; - } - } - - static DWORD GetRetTypeFlagsFromFPReturnSize(UINT fpRetSize) - { - LIMITED_METHOD_CONTRACT; - - DWORD flags = 0; - switch (fpRetSize) - { - case 0: - break; - - case sizeof(float): - flags = XAD_RET_FLOAT; - break; - - case sizeof(double): - flags = XAD_RET_DOUBLE; - break; - -#ifdef FEATURE_HFA - case 4 * sizeof(float): - flags = XAD_RET_FLOAT | XAD_RET_HFA_TYPE; - break; - - case 4 * sizeof(double): - flags = XAD_RET_DOUBLE | XAD_RET_HFA_TYPE; - break; -#endif - default: - _ASSERTE(false); - break; - } - - _ASSERTE(fpRetSize == GetFPReturnSize((XADOptimizationType)flags)); - - return flags; - } - - static BOOL DoArgsContainAFloat(XADOptimizationType enumVal) - { - LIMITED_METHOD_CONTRACT; - return enumVal & XAD_ARGS_HAVE_A_FLOAT; - } - - static BOOL IsCallNotOptimizable(XADOptimizationType enumVal) - { - LIMITED_METHOD_CONTRACT; - return enumVal & XAD_NOT_OPTIMIZABLE; - } - static BOOL IsMethodVirtual(XADOptimizationType enumVal) - { - LIMITED_METHOD_CONTRACT; - return enumVal & XAD_METHOD_IS_VIRTUAL; - } - - private: - - static DWORD DoStaticAnalysis(MethodDesc *pMeth); - - DWORD m_OptFlags; - -} ; - -class CrossDomainOptimizationInfo -{ -#ifdef DACCESS_COMPILE - friend class NativeImageDumper; -#endif - RemotableMethodInfo m_rmi[0]; - - public: - - static SIZE_T SizeOf(MethodTable *pMT) - { - WRAPPER_NO_CONTRACT; - return SizeOf(pMT->GetNumVtableSlots()); - } - - static SIZE_T SizeOf(DWORD dwNumVtableSlots) - { - LIMITED_METHOD_CONTRACT; - return offsetof(CrossDomainOptimizationInfo, m_rmi) + (sizeof(RemotableMethodInfo) * dwNumVtableSlots); - } - - RemotableMethodInfo *GetRemotableMethodInfo() - { - return &(m_rmi[0]); - } -}; - -class CrossDomainTypeMap -{ - class MTMapEntry - { - public: - MTMapEntry(AppDomain *pFromDomain, MethodTable *pFromMT, AppDomain *pToDomain, MethodTable *pToMT); - UPTR GetHash() - { - LIMITED_METHOD_CONTRACT; - DWORD hash = _rotl((UINT)(SIZE_T)m_pFromMT, 1) + m_dwFromDomain.m_dwId; - hash = _rotl(hash, 1) + m_dwToDomain.m_dwId; - return (UPTR)hash; - } - ADID m_dwFromDomain; - ADID m_dwToDomain; - MethodTable *m_pFromMT; - MethodTable *m_pToMT; - }; - - static BOOL CompareMTMapEntry (UPTR val1, UPTR val2); - static PtrHashMap *s_crossDomainMTMap; // Maps a MT to corresponding MT in another domain - static SimpleRWLock *s_MTMapLock; - static PtrHashMap * GetTypeMap(); - -public: - static MethodTable *GetMethodTableForDomain(MethodTable *pFrom, AppDomain *pFromDomain, AppDomain *pToDomain); - static void SetMethodTableForDomain(MethodTable *pFromMT, AppDomain *pFromDomain, MethodTable *pToMT, AppDomain *pToDomain); - static void FlushStaleEntries(); -}; - -struct MarshalAndCallArgs; -void MarshalAndCall_Wrapper2(MarshalAndCallArgs * pArgs); - -class CrossDomainChannel -{ -private: - friend void MarshalAndCall_Wrapper2(MarshalAndCallArgs * pArgs); - - - BOOL GetTargetAddressFast(DWORD optFlags, MethodTable *pSrvMT, BOOL bFindServerMD); - BOOL GetGenericMethodAddress(MethodTable *pSrvMT); - BOOL GetInterfaceMethodAddressFast(DWORD optFlags, MethodTable *pSrvMT, BOOL bFindServerMD); - BOOL BlitAndCall(); - BOOL MarshalAndCall(); - void MarshalAndCall_Wrapper(MarshalAndCallArgs * pArgs); - BOOL ExecuteCrossDomainCall(); - VOID RenewLease(); - OBJECTREF GetServerObject(); - BOOL InitServerInfo(); - OBJECTREF ReadPrincipal(); - VOID RestorePrincipal(OBJECTREF *prefPrincipal); - VOID ResetPrincipal(); - -public: - - UINT GetFPReturnSize() - { - WRAPPER_NO_CONTRACT; - return RemotableMethodInfo::GetFPReturnSize(m_xret); - } - - BOOL CheckCrossDomainCall(TPMethodFrame *pFrame); - -private: - MethodDesc *m_pCliMD; - MethodDesc *m_pSrvMD; - RemotableMethodInfo::XADOptimizationType m_xret; - DWORD m_numStackSlotsToCopy; - OBJECTHANDLE m_refSrvIdentity; - AppDomain *m_pCliDomain; - ADID m_pSrvDomain; - PCODE m_pTargetAddress; - TPMethodFrame *m_pFrame; -}; - -#endif - diff --git a/src/vm/crossgencompile.cpp b/src/vm/crossgencompile.cpp index 5a4f41e021..09e5cb5ebb 100644 --- a/src/vm/crossgencompile.cpp +++ b/src/vm/crossgencompile.cpp @@ -19,9 +19,6 @@ #include "security.h" #include "invokeutil.h" #include "comcallablewrapper.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif //--------------------------------------------------------------------------------------- // @@ -297,12 +294,6 @@ INT32 rel32UsingJumpStub(INT32 UNALIGNED * pRel32, PCODE target, MethodDesc *pMe } #endif -#if defined(FEATURE_REMOTING) && !defined(HAS_REMOTING_PRECODE) -void CRemotingServices::DestroyThunk(MethodDesc* pMD) -{ - UNREACHABLE(); -} -#endif CORINFO_GENERIC_HANDLE JIT_GenericHandleWorker(MethodDesc * pMD, MethodTable * pMT, LPVOID signature, DWORD dictionaryIndexAndSlot, Module* pModule) { diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h index 739c7dc82e..afff5732f3 100644 --- a/src/vm/ecalllist.h +++ b/src/vm/ecalllist.h @@ -59,48 +59,6 @@ // // -#ifdef FEATURE_REMOTING -FCFuncStart(gMarshalByRefFuncs) - FCFuncElement("GetComIUnknown", RemotingNative::GetComIUnknown) -FCFuncEnd() - -FCFuncStart(gRemotingFuncs) - FCFuncElement("IsTransparentProxy", RemotingNative::FCIsTransparentProxy) - FCFuncElement("GetRealProxy", RemotingNative::FCGetRealProxy) - FCFuncElement("Unwrap", RemotingNative::FCUnwrap) - FCFuncElement("AlwaysUnwrap", RemotingNative::FCAlwaysUnwrap) - FCFuncElement("CheckCast", RemotingNative::NativeCheckCast) - FCFuncElement("nSetRemoteActivationConfigured", RemotingNative::SetRemotingConfiguredFlag) - - FCFuncElement("CORProfilerTrackRemoting", ProfilingFCallHelper::FC_TrackRemoting) - FCFuncElement("CORProfilerTrackRemotingCookie", ProfilingFCallHelper::FC_TrackRemotingCookie) - FCFuncElement("CORProfilerTrackRemotingAsync", ProfilingFCallHelper::FC_TrackRemotingAsync) - FCFuncElement("CORProfilerRemotingClientSendingMessage", ProfilingFCallHelper::FC_RemotingClientSendingMessage) - FCFuncElement("CORProfilerRemotingClientReceivingReply", ProfilingFCallHelper::FC_RemotingClientReceivingReply) - FCFuncElement("CORProfilerRemotingServerReceivingMessage", ProfilingFCallHelper::FC_RemotingServerReceivingMessage) - FCFuncElement("CORProfilerRemotingServerSendingReply", ProfilingFCallHelper::FC_RemotingServerSendingReply) - - FCFuncElement("CreateTransparentProxy", RemotingNative::CreateTransparentProxy) - FCFuncElement("AllocateUninitializedObject", RemotingNative::AllocateUninitializedObject) - FCFuncElement("CallDefaultCtor", RemotingNative::CallDefaultCtor) - FCFuncElement("AllocateInitializedObject", RemotingNative::AllocateInitializedObject) - FCFuncElement("ResetInterfaceCache", RemotingNative::ResetInterfaceCache) -FCFuncEnd() - -FCFuncStart(gRealProxyFuncs) - FCFuncElement("SetStubData", CRealProxy::SetStubData) - FCFuncElement("GetStubData", CRealProxy::GetStubData) - FCFuncElement("GetStub", CRealProxy::GetStub) - FCFuncElement("GetDefaultStub", CRealProxy::GetDefaultStub) - FCFuncElement("GetProxiedType", CRealProxy::GetProxiedType) -FCFuncEnd() - -FCFuncStart(gContextFuncs) - FCFuncElement("SetupInternalContext", Context::SetupInternalContext) - FCFuncElement("CleanupInternalContext", Context::CleanupInternalContext) - FCFuncElement("ExecuteCallBackInEE", Context::ExecuteCallBack) -FCFuncEnd() -#endif FCFuncStart(gDependentHandleFuncs) @@ -132,27 +90,7 @@ FCFuncStart(gRWLockFuncs) FCFuncEnd() #endif // FEATURE_RWLOCK -#ifdef FEATURE_REMOTING -FCFuncStart(gMessageFuncs) - FCFuncElement("InternalGetArgCount", CMessage::GetArgCount) - FCFuncElement("InternalHasVarArgs", CMessage::HasVarArgs) - FCFuncElement("InternalGetArg", CMessage::GetArg) - FCFuncElement("InternalGetArgs", CMessage::GetArgs) - FCFuncElement("PropagateOutParameters", CMessage::PropagateOutParameters) - FCFuncElement("GetReturnValue", CMessage::GetReturnValue) - FCFuncElement("GetAsyncBeginInfo", CMessage::GetAsyncBeginInfo) - FCFuncElement("GetAsyncResult", CMessage::GetAsyncResult) - FCFuncElement("GetThisPtr", CMessage::GetAsyncObject) - FCFuncElement("OutToUnmanagedDebugger", CMessage::DebugOut) - FCFuncElement("Dispatch", CMessage::Dispatch) -FCFuncEnd() -#endif //FEATURE_REMOTING -#ifdef FEATURE_REMOTING -FCFuncStart(gChannelServicesFuncs) - FCFuncElement("GetPrivateContextsPerfCounters", GetPrivateContextsPerfCountersEx) -FCFuncEnd() -#endif // FEATURE_REMOTING FCFuncStart(gEnumFuncs) FCFuncElement("InternalGetUnderlyingType", ReflectionEnum::InternalGetEnumUnderlyingType) @@ -164,11 +102,6 @@ FCFuncStart(gEnumFuncs) FCFuncElement("InternalHasFlag", ReflectionEnum::InternalHasFlag) FCFuncEnd() -#ifdef FEATURE_REMOTING -FCFuncStart(gStackBuilderSinkFuncs) - FCFuncElement("_PrivateProcessMessage", CStackBuilderSink::PrivateProcessMessage) -FCFuncEnd() -#endif FCFuncStart(gSymWrapperCodePunkSafeHandleFuncs) FCFuncElement("nGetDReleaseTarget", COMPunkSafeHandle::nGetDReleaseTarget) @@ -389,10 +322,6 @@ FCFuncStart(gCOMTypeHandleFuncs) QCFuncElement("VerifyInterfaceIsImplemented", RuntimeTypeHandle::VerifyInterfaceIsImplemented) QCFuncElement("GetInterfaceMethodImplementationSlot", RuntimeTypeHandle::GetInterfaceMethodImplementationSlot) FCFuncElement("IsComObject", RuntimeTypeHandle::IsComObject) -#ifdef FEATURE_REMOTING - FCFuncElement("HasProxyAttribute", RuntimeTypeHandle::HasProxyAttribute) - FCFuncElement("IsContextful", RuntimeTypeHandle::IsContextful) -#endif FCFuncElement("IsValueType", RuntimeTypeHandle::IsValueType) FCFuncElement("IsInterface", RuntimeTypeHandle::IsInterface) QCFuncElement("IsSecurityCritical", RuntimeTypeHandle::IsSecurityCritical) @@ -599,15 +528,8 @@ FCFuncEnd() FCFuncStart(gAppDomainFuncs) -#ifdef FEATURE_REMOTING - FCFuncElement("GetDefaultDomain", AppDomainNative::GetDefaultDomain) -#endif FCFuncElement("IsStringInterned", AppDomainNative::IsStringInterned) FCFuncElement("IsUnloadingForcedFinalize", AppDomainNative::IsUnloadingForcedFinalize) -#ifdef FEATURE_REMOTING - FCFuncElement("nCreateDomain", AppDomainNative::CreateDomain) - FCFuncElement("nCreateInstance", AppDomainNative::CreateInstance) -#endif #ifdef FEATURE_LOADER_OPTIMIZATION FCFuncElement("UpdateLoaderOptimization", AppDomainNative::UpdateLoaderOptimization) #endif // FEATURE_LOADER_OPTIMIZATION @@ -626,18 +548,9 @@ FCFuncStart(gAppDomainFuncs) FCFuncElement("nSetDisableInterfaceCache", AppDomainNative::SetDisableInterfaceCache) #endif // FEATURE_COMINTEROP FCFuncElement("nCreateContext", AppDomainNative::CreateContext) -#ifdef FEATURE_REMOTING - FCFuncElement("nUnload", AppDomainNative::Unload) -#endif // FEATURE_REMOTING FCFuncElement("GetId", AppDomainNative::GetId) FCFuncElement("GetOrInternString", AppDomainNative::GetOrInternString) QCFuncElement("GetGrantSet", AppDomainNative::GetGrantSet) -#ifdef FEATURE_REMOTING - FCFuncElement("GetDynamicDir", AppDomainNative::GetDynamicDir) - FCFuncElement("nChangeSecurityPolicy", AppDomainNative::ChangeSecurityPolicy) - FCFuncElement("IsDomainIdValid", AppDomainNative::IsDomainIdValid) - FCFuncElement("nApplyPolicy", AppDomainNative::nApplyPolicy) -#endif // FEATURE_REMOTING QCFuncElement("nSetupBindingPaths", AppDomainNative::SetupBindingPaths) QCFuncElement("nSetNativeDllSearchDirectories", AppDomainNative::SetNativeDllSearchDirectories) FCFuncElement("IsFinalizingForUnload", AppDomainNative::IsFinalizingForUnload) @@ -867,14 +780,8 @@ FCFuncStart(gThreadFuncs) FCFuncElement("SleepInternal", ThreadNative::Sleep) #define Sleep(a) Dont_Use_Sleep(a) FCFuncElement("SetStart", ThreadNative::SetStart) -#ifdef FEATURE_REMOTING - FCFuncElement("GetContextInternal", ThreadNative::GetContextFromContextID) -#endif FCFuncElement("GetDomainInternal", ThreadNative::GetDomain) FCFuncElement("GetFastDomainInternal", ThreadNative::FastGetDomain) -#ifdef FEATURE_REMOTING - FCFuncElement("InternalCrossContextCallback", ThreadNative::InternalCrossContextCallback) -#endif QCFuncElement("InformThreadNameChange", ThreadNative::InformThreadNameChange) FCFuncElement("SpinWaitInternal", ThreadNative::SpinWait) QCFuncElement("YieldInternal", ThreadNative::YieldThread) @@ -1517,9 +1424,6 @@ FCClassElement("CalendarData", "System.Globalization", gCalendarDataFuncs) #endif // !defined(FEATURE_COREFX_GLOBALIZATION) FCClassElement("CompareInfo", "System.Globalization", gCompareInfoFuncs) FCClassElement("CompatibilitySwitch", "System.Runtime.Versioning", gCompatibilitySwitchFuncs) -#ifdef FEATURE_REMOTING -FCClassElement("Context", "System.Runtime.Remoting.Contexts", gContextFuncs) -#endif FCClassElement("CriticalHandle", "System.Runtime.InteropServices", gCriticalHandleFuncs) #if !defined(FEATURE_COREFX_GLOBALIZATION) FCClassElement("CultureData", "System.Globalization", gCultureDataFuncs) @@ -1566,18 +1470,12 @@ FCClassElement("LoaderAllocatorScout", "System.Reflection", gLoaderAllocatorFunc FCClassElement("Log", "System.Diagnostics", gDiagnosticsLog) FCClassElement("ManifestBasedResourceGroveler", "System.Resources", gManifestBasedResourceGrovelerFuncs) FCClassElement("Marshal", "System.Runtime.InteropServices", gInteropMarshalFuncs) -#ifdef FEATURE_REMOTING -FCClassElement("MarshalByRefObject", "System", gMarshalByRefFuncs) -#endif FCClassElement("Math", "System", gMathFuncs) FCClassElement("MathF", "System", gMathFFuncs) #ifdef MDA_SUPPORTED FCClassElement("Mda", "System", gMda) #endif FCClassElement("MemoryFailPoint", "System.Runtime", gMemoryFailPointFuncs) -#ifdef FEATURE_REMOTING -FCClassElement("Message", "System.Runtime.Remoting.Messaging", gMessageFuncs) -#endif FCClassElement("MetadataImport", "System.Reflection", gMetaDataImport) FCClassElement("MissingMemberException", "System", gMissingMemberExceptionFuncs) #ifdef FEATURE_COMINTEROP @@ -1610,9 +1508,6 @@ FCClassElement("PunkSafeHandle", "System.Reflection.Emit", gSymWrapperCodePunkSa #ifdef FEATURE_RWLOCK FCClassElement("ReaderWriterLock", "System.Threading", gRWLockFuncs) #endif // FEATURE_RWLOCK -#ifdef FEATURE_REMOTING -FCClassElement("RealProxy", "System.Runtime.Remoting.Proxies", gRealProxyFuncs) -#endif FCClassElement("RegisteredWaitHandleSafe", "System.Threading", gRegisteredWaitHandleFuncs) #ifdef FEATURE_COMINTEROP #ifdef FEATURE_COMINTEROP_MANAGED_ACTIVATION @@ -1620,9 +1515,6 @@ FCClassElement("RegistrationServices", "System.Runtime.InteropServices", gRegist #endif // FEATURE_COMINTEROP_MANAGED_ACTIVATION #endif // FEATURE_COMINTEROP -#ifdef FEATURE_REMOTING -FCClassElement("RemotingServices", "System.Runtime.Remoting", gRemotingFuncs) -#endif FCClassElement("RtFieldInfo", "System.Reflection", gRuntimeFieldInfoFuncs) FCClassElement("RuntimeAssembly", "System.Reflection", gAssemblyFuncs) #ifdef FEATURE_COMINTEROP @@ -1641,9 +1533,6 @@ FCClassElement("SafeHandle", "System.Runtime.InteropServices", gSafeHandleFuncs) FCClassElement("SafeTypeNameParserHandle", "System", gSafeTypeNameParserHandle) FCClassElement("Signature", "System", gSignatureNative) -#ifdef FEATURE_REMOTING -FCClassElement("StackBuilderSink", "System.Runtime.Remoting.Messaging", gStackBuilderSinkFuncs) -#endif FCClassElement("StackTrace", "System.Diagnostics", gDiagnosticsStackTrace) FCClassElement("Stream", "System.IO", gStreamFuncs) FCClassElement("String", "System", gStringFuncs) diff --git a/src/vm/eeconfig.cpp b/src/vm/eeconfig.cpp index 869a392b1c..a8a3166cf8 100644 --- a/src/vm/eeconfig.cpp +++ b/src/vm/eeconfig.cpp @@ -1068,9 +1068,6 @@ HRESULT EEConfig::sync() dwDisableStackwalkCache = GetConfigDWORD_DontUse_(CLRConfig::EXTERNAL_DisableStackwalkCache, dwDisableStackwalkCache); -#ifdef FEATURE_REMOTING - fUseNewCrossDomainRemoting = GetConfigDWORD_DontUse_(CLRConfig::EXTERNAL_UseNewCrossDomainRemoting, fUseNewCrossDomainRemoting); -#endif #ifdef _DEBUG IfFailRet (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_BreakOnClassLoad, (LPWSTR*) &pszBreakOnClassLoad)); diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index c40797effb..2b45bf5597 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -5417,9 +5417,6 @@ VOID ETW::MethodLog::MethodTableRestored(MethodTable *pMethodTable) TRACE_LEVEL_INFORMATION, CLR_STARTENUMERATION_KEYWORD)) { -#ifdef FEATURE_REMOTING - if(!pMethodTable->IsTransparentProxy()) -#endif { MethodTable::MethodIterator iter(pMethodTable); for (; iter.IsValid(); iter.Next()) diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp index a7117c2ead..f9455d2d3d 100644 --- a/src/vm/excep.cpp +++ b/src/vm/excep.cpp @@ -13837,13 +13837,6 @@ VOID RealCOMPlusThrowInvalidCastException(TypeHandle thCastFrom, TypeHandle thCa InlineSString<MAX_CLASSNAME_LENGTH + 1> strCastToName; thCastTo.GetName(strCastToName); -#ifdef FEATURE_REMOTING - if (thCastFrom.IsTransparentProxy()) - { - COMPlusThrow(kInvalidCastException, IDS_EE_CANNOTCASTPROXY, strCastToName.GetUnicode()); - } - else -#endif { thCastFrom.GetName(strCastFromName); // Attempt to catch the A.T != A.T case that causes so much user confusion. diff --git a/src/vm/field.cpp b/src/vm/field.cpp index da424db038..9cdb16f6b9 100644 --- a/src/vm/field.cpp +++ b/src/vm/field.cpp @@ -15,9 +15,6 @@ #include "encee.h" #include "field.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "generics.h" #include "peimagelayout.inl" @@ -60,9 +57,6 @@ VOID FieldDesc::Init(mdFieldDef mb, CorElementType FieldType, DWORD dwMemberAttr m_isStatic = fIsStatic != 0; m_isRVA = fIsRVA != 0; m_isThreadLocal = fIsThreadLocal != 0; -#ifdef FEATURE_REMOTING - m_isContextLocal = fIsContextLocal != 0; -#endif #ifdef _DEBUG m_debugName = (LPUTF8)pszFieldName; @@ -354,54 +348,6 @@ void FieldDesc::GetInstanceField(OBJECTREF o, VOID * pOutVal) // Check whether we are getting a field value on a proxy. If so, then ask // remoting services to extract the value from the instance. -#ifdef FEATURE_REMOTING - if (o->IsTransparentProxy()) - { -#ifndef DACCESS_COMPILE - o = CRemotingServices::GetObjectFromProxy(o); - - if (o->IsTransparentProxy()) - { -#ifdef PROFILING_SUPPORTED - - GCPROTECT_BEGIN(o); // protect from RemotingClientInvocationStarted - - // If profiling is active, notify it that remoting stuff is kicking in, - // if AlwaysUnwrap returned an identical object pointer which means that - // we are definitely going through remoting for this access. - { - BEGIN_PIN_PROFILER(CORProfilerTrackRemoting()); - { - GCX_PREEMP(); - g_profControlBlock.pProfInterface->RemotingClientInvocationStarted(); - } - END_PIN_PROFILER(); - } -#endif // PROFILING_SUPPORTED - - CRemotingServices::FieldAccessor(this, o, pOutVal, TRUE); - -#ifdef PROFILING_SUPPORTED - { - BEGIN_PIN_PROFILER(CORProfilerTrackRemoting()); - { - GCX_PREEMP(); - g_profControlBlock.pProfInterface->RemotingClientInvocationFinished(); - } - END_PIN_PROFILER(); - } - - GCPROTECT_END(); // protect from RemotingClientInvocationStarted - -#endif // PROFILING_SUPPORTED - - return; - } -#else - DacNotImpl(); -#endif // #ifndef DACCESS_COMPILE - } -#endif // FEATURE_REMOTING // Unbox the value class TADDR pFieldAddress = (TADDR)GetInstanceAddress(o); @@ -449,50 +395,6 @@ void FieldDesc::SetInstanceField(OBJECTREF o, const VOID * pInVal) // class. If so, then ask remoting services to set the value on the // instance -#ifdef FEATURE_REMOTING - if(o->IsTransparentProxy()) - { - o = CRemotingServices::GetObjectFromProxy(o); - - if (o->IsTransparentProxy()) - { -#ifdef PROFILING_SUPPORTED - - GCPROTECT_BEGIN(o); - - // If profiling is active, notify it that remoting stuff is kicking in, - // if AlwaysUnwrap returned an identical object pointer which means that - // we are definitely going through remoting for this access. - - { - BEGIN_PIN_PROFILER(CORProfilerTrackRemoting()); - { - GCX_PREEMP(); - g_profControlBlock.pProfInterface->RemotingClientInvocationStarted(); - } - END_PIN_PROFILER(); - } -#endif // PROFILING_SUPPORTED - - CRemotingServices::FieldAccessor(this, o, (void *)pInVal, FALSE); - -#ifdef PROFILING_SUPPORTED - { - BEGIN_PIN_PROFILER(CORProfilerTrackRemoting()); - { - GCX_PREEMP(); - g_profControlBlock.pProfInterface->RemotingClientInvocationFinished(); - } - END_PIN_PROFILER(); - } - GCPROTECT_END(); - -#endif // PROFILING_SUPPORTED - - return; - } - } -#endif // FEATURE_REMOTING #ifdef _DEBUG // diff --git a/src/vm/field.h b/src/vm/field.h index e3e3ccd013..8e762eb4e4 100644 --- a/src/vm/field.h +++ b/src/vm/field.h @@ -55,9 +55,6 @@ class FieldDesc // 8 bits... unsigned m_isStatic : 1; unsigned m_isThreadLocal : 1; -#ifdef FEATURE_REMOTING - unsigned m_isContextLocal : 1; -#endif unsigned m_isRVA : 1; unsigned m_prot : 3; // Does this field's mb require all 24 bits @@ -295,9 +292,6 @@ public: LIMITED_METHOD_CONTRACT; return m_isStatic && (m_isRVA || m_isThreadLocal -#ifdef FEATURE_REMOTING - || m_isContextLocal -#endif ); } @@ -335,11 +329,7 @@ public: { LIMITED_METHOD_DAC_CONTRACT; -#ifdef FEATURE_REMOTING - return m_isContextLocal; -#else return FALSE; -#endif } // Indicate that this field was added by EnC @@ -619,11 +609,6 @@ public: _ASSERTE(IsStatic()); -#ifdef FEATURE_REMOTING - if (IsContextStatic()) - return Context::GetStaticFieldAddress(this); - else -#endif if (IsThreadStatic()) { return Thread::GetStaticFieldAddress(this); diff --git a/src/vm/finalizerthread.cpp b/src/vm/finalizerthread.cpp index d52d599db2..befd4c34d0 100644 --- a/src/vm/finalizerthread.cpp +++ b/src/vm/finalizerthread.cpp @@ -12,9 +12,6 @@ #include "runtimecallablewrapper.h" #endif -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #ifdef FEATURE_PROFAPI_ATTACH_DETACH #include "profattach.h" @@ -94,48 +91,6 @@ void CallFinalizer(Object* obj) { if (!((obj->GetHeader()->GetBits()) & BIT_SBLK_FINALIZER_RUN)) { -#ifdef FEATURE_REMOTING - if (pMT->IsContextful()) - { - Object *proxy = OBJECTREFToObject(CRemotingServices::GetProxyFromObject(ObjectToOBJECTREF(obj))); - - _ASSERTE(proxy && "finalizing an object that was never wrapped?????"); - if (proxy == NULL) - { - // Quite possibly the app abruptly shutdown while a proxy - // was being setup for a contextful object. We will skip - // finalizing this object. - _ASSERTE (g_fEEShutDown); - return; - } - else - { - // This saves us from the situation where an object gets GC-ed - // after its Context. - OBJECTREF stub = ((TRANSPARENTPROXYREF)ObjectToOBJECTREF(proxy))->GetStubData(); - Context *pServerCtx = *((Context **)stub->UnBox()); - // Check if the context is valid - if (!Context::ValidateContext(pServerCtx)) - { - // Since the server context is gone (GC-ed) - // we will associate the server with the default - // context for a good faith attempt to run - // the finalizer - // We want to do this only if we are using RemotingProxy - // and not for other types of proxies (eg. SvcCompPrxy) - OBJECTREF orRP = ObjectToOBJECTREF(CRemotingServices::GetRealProxy(proxy)); - if(CTPMethodTable::IsInstanceOfRemotingProxy( - orRP->GetMethodTable())) - { - *((Context **)stub->UnBox()) = (Context*) GetThread()->GetContext(); - } - } - // call Finalize on the proxy of the server object. - obj = proxy; - pMT = obj->GetMethodTable(); - } - } -#endif // FEATURE_REMOTING _ASSERTE(obj->GetMethodTable() == pMT); _ASSERTE(pMT->HasFinalizer() || pMT->IsTransparentProxy()); diff --git a/src/vm/fptrstubs.cpp b/src/vm/fptrstubs.cpp index 62f6df966b..6502a43c55 100644 --- a/src/vm/fptrstubs.cpp +++ b/src/vm/fptrstubs.cpp @@ -7,9 +7,6 @@ #include "common.h" #include "fptrstubs.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif // ------------------------------------------------------- // FuncPtr stubs @@ -93,18 +90,6 @@ PCODE FuncPtrStubs::GetFuncPtrStub(MethodDesc * pMD, PrecodeType type) PCODE target = NULL; -#ifdef FEATURE_REMOTING - if (pMD->IsInterface() && !pMD->IsStatic()) - { - // FuncPtrStubs on interface virtuals are used to transition - // into the remoting system with the exact interface method. - - _ASSERTE(type == PRECODE_STUB); - - target = CRemotingServices::GetDispatchInterfaceHelper(pMD); - } - else -#endif // FEATURE_REMOTING if (type != GetDefaultType(pMD) && // Always use stable entrypoint for LCG. If the cached precode pointed directly to JITed code, // we would not be able to reuse it when the DynamicMethodDesc got reused for a new DynamicMethod. diff --git a/src/vm/frames.cpp b/src/vm/frames.cpp index f93ae0a823..fa5c7875eb 100644 --- a/src/vm/frames.cpp +++ b/src/vm/frames.cpp @@ -24,9 +24,6 @@ #include "dbginterface.h" #include "gms.h" #include "eeconfig.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "ecall.h" #include "clsload.hpp" #include "cgensys.h" @@ -1013,34 +1010,6 @@ void GCFrame::GcScanRoots(promote_func *fn, ScanContext* sc) } } -#ifdef FEATURE_REMOTING -#include "objectclone.h" -void GCSafeCollectionFrame::GcScanRoots(promote_func *fn, ScanContext* sc) -{ - WRAPPER_NO_CONTRACT; - - PTR_GCSafeCollection collection = dac_cast<PTR_GCSafeCollection>(m_pCollection); - collection->ReportGCRefs(fn, sc); -} - -#ifndef DACCESS_COMPILE -GCSafeCollectionFrame::GCSafeCollectionFrame(void *collection) -{ - WRAPPER_NO_CONTRACT; - - _ASSERTE(collection != NULL); - m_pCollection = collection; - - Frame::Push(); -} - -VOID GCSafeCollectionFrame::Pop() -{ - LIMITED_METHOD_CONTRACT; - Frame::Pop(); -} -#endif // !DACCESS_COMPILE -#endif // FEATURE_REMOTING #ifndef DACCESS_COMPILE //-------------------------------------------------------------------- @@ -1537,76 +1506,6 @@ BOOL TransitionFrame::Protects(OBJECTREF * ppORef) // //+---------------------------------------------------------------------------- -#ifdef FEATURE_REMOTING - -#ifndef DACCESS_COMPILE -TPMethodFrame::TPMethodFrame(TransitionBlock * pTransitionBlock) - : FramedMethodFrame(pTransitionBlock, NULL) -{ - LIMITED_METHOD_CONTRACT; -} -#endif // #ifndef DACCESS_COMPILE - -void TPMethodFrame::GcScanRoots(promote_func *fn, ScanContext* sc) -{ - WRAPPER_NO_CONTRACT; - - // Delegate to FramedMethodFrame - FramedMethodFrame::GcScanRoots(fn, sc); - FramedMethodFrame::PromoteCallerStack(fn, sc); - - MetaSig::RETURNTYPE returnType = GetFunction()->ReturnsObject(); - - // Promote the returned object - if(returnType == MetaSig::RETOBJ) - { - (*fn)(GetReturnObjectPtr(), sc, CHECK_APP_DOMAIN); - } - else if (returnType == MetaSig::RETBYREF) - { - PromoteCarefully(fn, GetReturnObjectPtr(), sc, GC_CALL_INTERIOR|CHECK_APP_DOMAIN); - } - - return; -} - -//+---------------------------------------------------------------------------- -// -// Method: TPMethodFrame::TraceFrame public -// -// Synopsis: Return where the frame will execute next - the result is filled -// into the given "trace" structure. The frame is responsible for -// detecting where it is in its execution lifetime. -// -// - -// -//+---------------------------------------------------------------------------- -BOOL TPMethodFrame::TraceFrame(Thread *thread, BOOL fromPatch, - TraceDestination *trace, REGDISPLAY *regs) -{ - WRAPPER_NO_CONTRACT; - - // We want to set a frame patch, unless we're already at the - // frame patch, in which case we'll trace stable entrypoint which - // should be set by now. - - if (fromPatch) - { - trace->InitForStub(GetFunction()->GetStableEntryPoint()); - } - else - { -#ifdef DACCESS_COMPILE - DacNotImpl(); -#else - trace->InitForStub(GetEEFuncEntryPoint(TransparentProxyStubPatchLabel)); -#endif - } - return TRUE; - -} -#endif // FEATURE_REMOTING #ifdef FEATURE_COMINTEROP @@ -2096,38 +1995,6 @@ void ContextTransitionFrame::GcScanRoots(promote_func *fn, ScanContext* sc) // The dac only cares about strong references at the moment. Since this is always // in a weak ref, we don't report it here. -#if defined(FEATURE_REMOTING) && !defined(DACCESS_COMPILE) - Context *returnContext = GetReturnContext(); - PREFIX_ASSUME(returnContext != NULL); - _ASSERTE(returnContext); - _ASSERTE(returnContext->GetDomain()); // this will make sure is a valid pointer - - // In the VM we operate on a local to avoid double relocation. In the dac we actually want - // to know the real location. -#ifdef DACCESS_COMPILE - PTR_PTR_Object ppRef = returnContext->GetExposedObjectRawUncheckedPtr(); - - if (*ppRef == NULL) - return; - - (*fn)(ppRef, sc, 0); - -#else // DACCESS_COMPILE - // We are in the middle of the GC. OBJECTREFs can't be used here since their built-in validation - // chokes on objects that have been relocated already - Object *pRef = returnContext->GetExposedObjectRawUnchecked(); - - if (pRef == NULL) - return; - - LOG((LF_GC, INFO3, "ContextTransitionFrame Protection Frame Promoting" FMT_ADDR "to ", DBG_ADDR(pRef) )); - // Don't check app domains here - the objects are in the parent frame's app domain - - (*fn)(&pRef, sc, 0); - LOG((LF_GC, INFO3, FMT_ADDR "\n", DBG_ADDR(pRef))); -#endif // !DACCESS_COMPILE - -#endif } diff --git a/src/vm/frames.h b/src/vm/frames.h index 2217879ef0..b009f22b3c 100644 --- a/src/vm/frames.h +++ b/src/vm/frames.h @@ -49,11 +49,6 @@ #endif // FEATURE_HIJACK // | // | -#ifdef FEATURE_REMOTING -// +-GCSafeCollectionFrame - this handles reporting for GCSafeCollections, which are -// | generally used during appdomain transitions -// | -#endif // FEATURE_REMOTING // | // +-InlinedCallFrame - if a call to unmanaged code is hoisted into // | a JIT'ted caller, the calling method keeps @@ -224,9 +219,6 @@ FRAME_TYPE_NAME(HelperMethodFrame_1OBJ) FRAME_TYPE_NAME(HelperMethodFrame_2OBJ) FRAME_TYPE_NAME(HelperMethodFrame_PROTECTOBJ) FRAME_ABSTRACT_TYPE_NAME(FramedMethodFrame) -#ifdef FEATURE_REMOTING -FRAME_TYPE_NAME(TPMethodFrame) -#endif FRAME_TYPE_NAME(SecureDelegateFrame) FRAME_TYPE_NAME(MulticastFrame) FRAME_ABSTRACT_TYPE_NAME(UnmanagedToManagedFrame) @@ -254,9 +246,6 @@ FRAME_TYPE_NAME(InterpreterFrame) #endif // FEATURE_INTERPRETER FRAME_TYPE_NAME(ProtectByRefsFrame) FRAME_TYPE_NAME(ProtectValueClassFrame) -#ifdef FEATURE_REMOTING -FRAME_TYPE_NAME(GCSafeCollectionFrame) -#endif // FEATURE_REMOTING FRAME_TYPE_NAME(DebuggerClassInitMarkFrame) FRAME_TYPE_NAME(DebuggerSecurityCodeMarkFrame) FRAME_TYPE_NAME(DebuggerExitFrame) @@ -650,9 +639,6 @@ public: TYPE_SECURITY, TYPE_CALL, TYPE_FUNC_EVAL, -#ifdef FEATURE_REMOTING - TYPE_TP_METHOD_FRAME, -#endif TYPE_MULTICAST, // HMFs and derived classes should use this so the profiling API knows it needs @@ -1747,48 +1733,6 @@ protected: // // //+---------------------------------------------------------------------------- -#ifdef FEATURE_REMOTING -class TPMethodFrame : public FramedMethodFrame -{ - VPTR_VTABLE_CLASS(TPMethodFrame, FramedMethodFrame) - -public: - TPMethodFrame(TransitionBlock * pTransitionBlock); - - virtual int GetFrameType() - { - LIMITED_METHOD_DAC_CONTRACT; - return TYPE_TP_METHOD_FRAME; - } - - // GC protect arguments - virtual void GcScanRoots(promote_func *fn, ScanContext* sc); - - // Our base class is a a M2U TransitionType; but we're not. So override and set us back to None. - ETransitionType GetTransitionType() - { - LIMITED_METHOD_DAC_CONTRACT; - return TT_NONE; - } - -#if defined(_TARGET_X86_) && !defined(DACCESS_COMPILE) - void SetCbStackPop(UINT cbStackPop) - { - LIMITED_METHOD_CONTRACT; - // Number of bytes to pop for x86 is stored right before the return value - void * pReturnValue = GetReturnValuePtr(); - *(((DWORD *)pReturnValue) - 1) = cbStackPop; - } -#endif - - // Aid the debugger in finding the actual address of callee - virtual BOOL TraceFrame(Thread *thread, BOOL fromPatch, - TraceDestination *trace, REGDISPLAY *regs); - - // Keep as last entry in class - DEFINE_VTABLE_GETTER_AND_CTOR_AND_DTOR(TPMethodFrame) -}; -#endif // FEATURE_REMOTING //------------------------------------------------------------------------ // This represents a call Delegate.Invoke for secure delegate @@ -2588,28 +2532,6 @@ public: typedef VPTR(class InterpreterFrame) PTR_InterpreterFrame; #endif // FEATURE_INTERPRETER -#ifdef FEATURE_REMOTING -class GCSafeCollectionFrame : public Frame -{ - VPTR_VTABLE_CLASS(GCSafeCollectionFrame, Frame) - PTR_VOID m_pCollection; - - public: - //-------------------------------------------------------------------- - // This constructor pushes a new GCFrame on the frame chain. - //-------------------------------------------------------------------- -#ifndef DACCESS_COMPILE - GCSafeCollectionFrame() { } - GCSafeCollectionFrame(void *collection); -#endif - - virtual void GcScanRoots(promote_func *fn, ScanContext* sc); - - VOID Pop(); - // Keep as last entry in class - DEFINE_VTABLE_GETTER_AND_DTOR(GCSafeCollectionFrame) -}; -#endif // FEATURE_REMOTING //----------------------------------------------------------------------------- diff --git a/src/vm/gcenv.h b/src/vm/gcenv.h index 2e23b270b5..2e234b1432 100644 --- a/src/vm/gcenv.h +++ b/src/vm/gcenv.h @@ -35,9 +35,6 @@ #include "runtimecallablewrapper.h" #endif // FEATURE_COMINTEROP -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #ifdef FEATURE_UEF_CHAINMANAGER // This is required to register our UEF callback with the UEF chain manager diff --git a/src/vm/generics.cpp b/src/vm/generics.cpp index 3ff3d5aa2e..a04bde19fd 100644 --- a/src/vm/generics.cpp +++ b/src/vm/generics.cpp @@ -224,13 +224,8 @@ ClassLoader::CreateTypeHandleForNonCanonicalGenericInstantiation( // These are all copied across from the old MT, i.e. don't depend on the // instantiation. -#ifdef FEATURE_REMOTING - BOOL fHasRemotingVtsInfo = pOldMT->HasRemotingVtsInfo(); - BOOL fHasContextStatics = pOldMT->HasContextStatics(); -#else BOOL fHasRemotingVtsInfo = FALSE; BOOL fHasContextStatics = FALSE; -#endif BOOL fHasGenericsStaticsInfo = pOldMT->HasGenericsStaticsInfo(); BOOL fHasThreadStatics = (pOldMT->GetNumThreadStaticFields() > 0); @@ -479,12 +474,6 @@ ClassLoader::CreateTypeHandleForNonCanonicalGenericInstantiation( // enum_flag_NGEN_NeedsRestore #endif // FEATURE_PREJIT -#if defined(_DEBUG) && defined (FEATURE_REMOTING) - if (pOldMT->IsContextful() || pOldMT->GetClass()->HasRemotingProxyAttribute()) - { - _ASSERTE(pOldMT->RequiresManagedActivation()); - } -#endif // _DEBUG if (pOldMT->RequiresManagedActivation()) { // Will also set enum_flag_RemotingConfigChecked @@ -497,12 +486,6 @@ ClassLoader::CreateTypeHandleForNonCanonicalGenericInstantiation( if (fHasGenericsStaticsInfo) pMT->SetDynamicStatics(TRUE); -#ifdef FEATURE_REMOTING - if (fHasRemotingVtsInfo) - pMT->SetHasRemotingVtsInfo(); - if (fHasContextStatics) - pMT->SetHasContextStatics(); -#endif #ifdef FEATURE_COMINTEROP if (fHasCCWTemplate) @@ -621,35 +604,12 @@ ClassLoader::CreateTypeHandleForNonCanonicalGenericInstantiation( pMT->SetupGenericsStaticsInfo(pStaticFieldDescs); } -#ifdef FEATURE_REMOTING - // We do not cache the data for for non-canonical methods. - _ASSERTE(!pMT->HasRemotableMethodInfo()); -#endif // VTS info doesn't depend on the exact instantiation but we make a copy // anyway since we can't currently deal with the possibility of having a // cross module pointer to the data block. Eventually we might be able to // tokenize this reference, but determine first whether there's enough // performance degradation to justify the extra complexity. -#ifdef FEATURE_REMOTING - if (fHasRemotingVtsInfo) - { - RemotingVtsInfo *pOldInfo = pOldMT->GetRemotingVtsInfo(); - DWORD cbInfo = RemotingVtsInfo::GetSize(pOldMT->GetNumIntroducedInstanceFields()); - RemotingVtsInfo *pNewInfo = (RemotingVtsInfo*)pamTracker->Track(pAllocator->GetLowFrequencyHeap()->AllocMem(S_SIZE_T(cbInfo))); - - memcpyNoGCRefs(pNewInfo, pOldInfo, cbInfo); - - *(pMT->GetRemotingVtsInfoPtr()) = pNewInfo; - } - - // if there are thread or context static make room for them there is no sharing with the other MethodTable - if (fHasContextStatics) - { - // this is responsible for setting the flag and allocation in the loader heap - pMT->SetupContextStatics(pamTracker, pOldMT->GetContextStaticsSize()); - } -#endif //FEATURE_REMOTING pMT->SetCl(pOldMT->GetCl()); @@ -657,10 +617,6 @@ ClassLoader::CreateTypeHandleForNonCanonicalGenericInstantiation( _ASSERTE(!fContainsGenericVariables == !pMT->ContainsGenericVariables()); _ASSERTE(!fHasGenericsStaticsInfo == !pMT->HasGenericsStaticsInfo()); _ASSERTE(!pLoaderModule->GetAssembly()->IsDomainNeutral() == !pMT->IsDomainNeutral()); -#ifdef FEATURE_REMOTING - _ASSERTE(!fHasRemotingVtsInfo == !pMT->HasRemotingVtsInfo()); - _ASSERTE(!fHasContextStatics == !pMT->HasContextStatics()); -#endif #ifdef FEATURE_COMINTEROP _ASSERTE(!fHasDynamicInterfaceMap == !pMT->HasDynamicInterfaceMap()); _ASSERTE(!fHasRCWPerTypeData == !pMT->HasRCWPerTypeData()); diff --git a/src/vm/i386/asmconstants.h b/src/vm/i386/asmconstants.h index 6be010bd63..4ad08ba133 100644 --- a/src/vm/i386/asmconstants.h +++ b/src/vm/i386/asmconstants.h @@ -42,16 +42,6 @@ #define DynamicHelperFrameFlags_ObjectArg 1 #define DynamicHelperFrameFlags_ObjectArg2 2 -#ifdef FEATURE_REMOTING -#define TransparentProxyObject___stubData 0x8 -ASMCONSTANTS_C_ASSERT(TransparentProxyObject___stubData == offsetof(TransparentProxyObject, _stubData)) - -#define TransparentProxyObject___stub 0x14 -ASMCONSTANTS_C_ASSERT(TransparentProxyObject___stub == offsetof(TransparentProxyObject, _stub)) - -#define TransparentProxyObject___pMT 0xc -ASMCONSTANTS_C_ASSERT(TransparentProxyObject___pMT == offsetof(TransparentProxyObject, _pMT)) -#endif // FEATURE_REMOTING // CONTEXT from rotor_pal.h #define CONTEXT_Edi 0x9c diff --git a/src/vm/i386/asmhelpers.asm b/src/vm/i386/asmhelpers.asm index 196fe82260..2315b3ebb2 100644 --- a/src/vm/i386/asmhelpers.asm +++ b/src/vm/i386/asmhelpers.asm @@ -83,10 +83,6 @@ ifdef FEATURE_COMINTEROP EXTERN _CLRToCOMWorker@8:PROC endif -ifdef FEATURE_REMOTING -EXTERN _TransparentProxyStubWorker@8:PROC -endif - ifdef FEATURE_PREJIT EXTERN _ExternalMethodFixupWorker@16:PROC EXTERN _VirtualMethodFixupWorker@8:PROC @@ -101,10 +97,6 @@ ifdef FEATURE_READYTORUN EXTERN _DynamicHelperWorker@20:PROC endif -ifdef FEATURE_REMOTING -EXTERN _InContextTPQuickDispatchAsmStub@0:PROC -endif - EXTERN @JIT_InternalThrow@4:PROC EXTERN @ProfileEnter@8:PROC @@ -1091,182 +1083,6 @@ _UMThunkStubRareDisable proc public _UMThunkStubRareDisable endp -;+---------------------------------------------------------------------------- -; -; Method: CRemotingServices::CheckForContextMatch public -; -; Synopsis: This code generates a check to see if the current context and -; the context of the proxy match. -; -;+---------------------------------------------------------------------------- -; -; returns zero if contexts match -; returns non-zero if contexts do not match -; -; UINT_PTR __stdcall CRemotingServices__CheckForContextMatch(Object* pStubData) -ifdef FEATURE_REMOTING -_CRemotingServices__CheckForContextMatch@4 proc public - push ebx ; spill ebx - mov ebx, [eax+4] ; Get the internal context id by unboxing - ; the stub data - call _GetThread@0 ; Get the current thread, assumes that the - ; registers are preserved - mov eax, [eax+Thread_m_Context] ; Get the current context from the - ; thread - sub eax, ebx ; Get the pointer to the context from the - ; proxy and compare with the current context - pop ebx ; restore the value of ebx - retn -_CRemotingServices__CheckForContextMatch@4 endp -endif ; FEATURE_REMOTING - -;+---------------------------------------------------------------------------- -; -; Method: CRemotingServices::DispatchInterfaceCall public -; -; Synopsis: -; Push that method desc on the stack and jump to the -; transparent proxy stub to execute the call. -; WARNING!! This MethodDesc is not the methoddesc in the vtable -; of the object instead it is the methoddesc in the vtable of -; the interface class. Since we use the MethodDesc only to probe -; the stack via the signature of the method call we are safe. -; If we want to get any object vtable/class specific -; information this is not safe. -; -; -;+---------------------------------------------------------------------------- -; void __stdcall CRemotingServices__DispatchInterfaceCall() -ifdef FEATURE_REMOTING -_CRemotingServices__DispatchInterfaceCall@0 proc public - ; push MethodDesc* passed in eax by precode and forward to the worker - push eax - - ; NOTE: At this point the stack looks like - ; - ; esp---> saved MethodDesc of Interface method - ; return addr of calling function - ; - mov eax, [ecx + TransparentProxyObject___stubData] - call [ecx + TransparentProxyObject___stub] -ifdef _DEBUG - nop ; Mark this as a special call site that can directly - ; call managed code -endif - test eax, eax - jnz CtxMismatch - jmp _InContextTPQuickDispatchAsmStub@0 - -CtxMismatch: - pop eax ; restore MethodDesc * - jmp _TransparentProxyStub_CrossContext@0 ; jump to slow TP stub -_CRemotingServices__DispatchInterfaceCall@0 endp -endif ; FEATURE_REMOTING - - -;+---------------------------------------------------------------------------- -; -; Method: CRemotingServices::CallFieldGetter private -; -; Synopsis: Calls the field getter function (Object::__FieldGetter) in -; managed code by setting up the stack and calling the target -; -; -;+---------------------------------------------------------------------------- -; void __stdcall CRemotingServices__CallFieldGetter( -; MethodDesc *pMD, -; LPVOID pThis, -; LPVOID pFirst, -; LPVOID pSecond, -; LPVOID pThird) -ifdef FEATURE_REMOTING -CRemotingServices__CallFieldGetter proc stdcall public, - pMD : DWORD, - pThis : DWORD, - pFirst : DWORD, - pSecond : DWORD, - pThird : DWORD - - push [pSecond] ; push the second argument on the stack - push [pThird] ; push the third argument on the stack - - mov ecx, [pThis] ; enregister pThis, the 'this' pointer - mov edx, [pFirst] ; enregister pFirst, the first argument - - mov eax, [pMD] ; load MethodDesc of object::__FieldGetter - call _TransparentProxyStub_CrossContext@0 ; call the TP stub - - ret -CRemotingServices__CallFieldGetter endp -endif ; FEATURE_REMOTING - -;+---------------------------------------------------------------------------- -; -; Method: CRemotingServices::CallFieldSetter private -; -; Synopsis: Calls the field setter function (Object::__FieldSetter) in -; managed code by setting up the stack and calling the target -; -; -;+---------------------------------------------------------------------------- -; void __stdcall CRemotingServices__CallFieldSetter( -; MethodDesc *pMD, -; LPVOID pThis, -; LPVOID pFirst, -; LPVOID pSecond, -; LPVOID pThird) -ifdef FEATURE_REMOTING -CRemotingServices__CallFieldSetter proc stdcall public, - pMD : DWORD, - pThis : DWORD, - pFirst : DWORD, - pSecond : DWORD, - pThird : DWORD - - push [pSecond] ; push the field name (second arg) - push [pThird] ; push the object (third arg) on the stack - - mov ecx, [pThis] ; enregister pThis, the 'this' pointer - mov edx, [pFirst] ; enregister the first argument - - mov eax, [pMD] ; load MethodDesc of object::__FieldGetter - call _TransparentProxyStub_CrossContext@0 ; call the TP stub - - ret -CRemotingServices__CallFieldSetter endp -endif ; FEATURE_REMOTING - -;+---------------------------------------------------------------------------- -; -; Method: CTPMethodTable::GenericCheckForContextMatch private -; -; Synopsis: Calls the stub in the TP & returns TRUE if the contexts -; match, FALSE otherwise. -; -; Note: 1. Called during FieldSet/Get, used for proxy extensibility -; -;+---------------------------------------------------------------------------- -; BOOL __stdcall CTPMethodTable__GenericCheckForContextMatch(Object* orTP) -ifdef FEATURE_REMOTING -CTPMethodTable__GenericCheckForContextMatch proc stdcall public uses ecx, tp : DWORD - - mov ecx, [tp] - mov eax, [ecx + TransparentProxyObject___stubData] - call [ecx + TransparentProxyObject___stub] -ifdef _DEBUG - nop ; Mark this as a special call site that can directly - ; call managed code -endif - test eax, eax - mov eax, 0 - setz al - ; NOTE: In the CheckForXXXMatch stubs (for URT ctx/ Ole32 ctx) eax is - ; non-zero if contexts *do not* match & zero if they do. - ret -CTPMethodTable__GenericCheckForContextMatch endp -endif ; FEATURE_REMOTING - - ; void __stdcall JIT_ProfilerEnterLeaveTailcallStub(UINT_PTR ProfilerHandle) _JIT_ProfilerEnterLeaveTailcallStub@4 proc public ; this function must preserve all registers, including scratch @@ -2053,98 +1869,6 @@ _GenericComPlusCallStub@0 proc public _GenericComPlusCallStub@0 endp endif ; FEATURE_COMINTEROP -ifdef FEATURE_REMOTING -_TransparentProxyStub@0 proc public - ; push slot passed in eax - push eax - - ; Move into eax the stub data and call the stub - mov eax, [ecx + TransparentProxyObject___stubData] - call [ecx + TransparentProxyObject___stub] -ifdef _DEBUG - nop ; Mark this as a special call site that can directly - ; call managed code -endif - test eax, eax - jnz CtxMismatch2 - - mov eax, [ecx + TransparentProxyObject___pMT] - - push ebx ; spill EBX - - ; Convert the slot number into the code address - ; See MethodTable.h for details on vtable layout - - mov ebx, [esp + 4] ; Reload the slot - shr ebx, ASM__VTABLE_SLOTS_PER_CHUNK_LOG2 ; indirectionSlotNumber - - mov eax,[eax + ebx*4 + SIZEOF_MethodTable] - - mov ebx, [esp + 4] ; use unchanged slot from above - and ebx, ASM__VTABLE_SLOTS_PER_CHUNK-1 ; offsetInChunk - mov eax, [eax + ebx*4] - - ; At this point, eax contains the code address - - ; Restore EBX - pop ebx - - ; Remove the slot number from the stack - lea esp, [esp+4] - - jmp eax - - ; CONTEXT MISMATCH CASE, call out to the real proxy to dispatch - -CtxMismatch2: - pop eax ; restore MethodDesc * - jmp _TransparentProxyStub_CrossContext@0 ; jump to slow TP stub - -_TransparentProxyStub@0 endp - -_TransparentProxyStub_CrossContext@0 proc public - - STUB_PROLOG - - ; pTransitionBlock - mov esi, esp - - ; return value - sub esp, 3*4 ; 64-bit return value + cb stack pop - - push eax ; pMD - push esi ; pTransitionBlock - call _TransparentProxyStubWorker@8 - - pop ebx ; cbStackPop - - push eax - call _setFPReturn@12 ; pop & set the return value - - ; From here on, mustn't trash eax:edx - mov ecx, ebx ; cbStackPop - - mov ebx, [esp+6*4] ; get retaddr - mov [esp+6*4+ecx], ebx ; put it where it belongs - - STUB_EPILOG_RETURN - - add esp, ecx ; pop all the args - ret - -_TransparentProxyStub_CrossContext@0 endp - -; This method does nothing. It's just a fixed function for the debugger to put a breakpoint -; on so that it can trace a call target. -_TransparentProxyStubPatch@0 proc public - ; make sure that the basic block is unique - test eax,12 -_TransparentProxyStubPatchLabel@0: -public _TransparentProxyStubPatchLabel@0 - ret -_TransparentProxyStubPatch@0 endp - -endif ; FEATURE_REMOTING ifdef FEATURE_COMINTEROP ;-------------------------------------------------------------------------- diff --git a/src/vm/i386/cgencpu.h b/src/vm/i386/cgencpu.h index 6dc53beb92..ac239533f7 100644 --- a/src/vm/i386/cgencpu.h +++ b/src/vm/i386/cgencpu.h @@ -92,9 +92,6 @@ BOOL Runtime_Test_For_SSE2(); // Needed for PInvoke inlining in ngened images #define HAS_NDIRECT_IMPORT_PRECODE 1 -#ifdef FEATURE_REMOTING -#define HAS_REMOTING_PRECODE 1 -#endif #ifdef FEATURE_PREJIT #define HAS_FIXUP_PRECODE 1 #define HAS_FIXUP_PRECODE_CHUNKS 1 diff --git a/src/vm/i386/cgenx86.cpp b/src/vm/i386/cgenx86.cpp index 030f211496..2444fef027 100644 --- a/src/vm/i386/cgenx86.cpp +++ b/src/vm/i386/cgenx86.cpp @@ -24,9 +24,6 @@ #include "array.h" #include "jitinterface.h" #include "codeman.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "dbginterface.h" #include "eeprofinterfaces.h" #include "eeconfig.h" diff --git a/src/vm/i386/excepx86.cpp b/src/vm/i386/excepx86.cpp index 2997c5784f..2c863b2ec3 100644 --- a/src/vm/i386/excepx86.cpp +++ b/src/vm/i386/excepx86.cpp @@ -27,8 +27,6 @@ #include "eedbginterfaceimpl.inl" #include "dllimportcallback.h" #include "threads.h" -#ifdef FEATURE_REMOTING -#endif #include "eeconfig.h" #include "vars.hpp" #include "generics.h" diff --git a/src/vm/i386/jithelp.asm b/src/vm/i386/jithelp.asm index 9d2f6b7589..8285c42455 100644 --- a/src/vm/i386/jithelp.asm +++ b/src/vm/i386/jithelp.asm @@ -87,11 +87,6 @@ EXTERN g_GCShadowEnd:DWORD INVALIDGCVALUE equ 0CCCCCCCDh endif -ifdef FEATURE_REMOTING -EXTERN _TransparentProxyStub_CrossContext@0:PROC -EXTERN _InContextTPQuickDispatchAsmStub@0:PROC -endif - EXTERN _COMPlusEndCatch@20:PROC .686P @@ -2377,50 +2372,6 @@ _JIT_PatchedWriteBarrierLast@0 PROC ret _JIT_PatchedWriteBarrierLast@0 ENDP -;********************************************************************** -; PrecodeRemotingThunk is patched at runtime to activate it -ifdef FEATURE_REMOTING - ALIGN 16 -_PrecodeRemotingThunk@0 proc public - - ret ; This is going to be patched to "test ecx,ecx" - nop - - jz RemotingDone ; predicted not taken - - cmp dword ptr [ecx],11111111h ; This is going to be patched to address of the transparent proxy - je RemotingCheck ; predicted not taken - -RemotingDone: - ret - -RemotingCheck: - push eax ; save method desc - mov eax, dword ptr [ecx + TransparentProxyObject___stubData] - call [ecx + TransparentProxyObject___stub] - test eax, eax - jnz RemotingCtxMismatch - mov eax, [esp] - mov ax, [eax + MethodDesc_m_wFlags] - and ax, MethodDesc_mdcClassification - cmp ax, MethodDesc_mcComInterop - je ComPlusCall - pop eax ; throw away method desc - jmp RemotingDone - -RemotingCtxMismatch: - pop eax ; restore method desc - add esp, 4 ; pop return address into the precode - jmp _TransparentProxyStub_CrossContext@0 - -ComPlusCall: - pop eax ; restore method desc - mov [esp],eax ; replace return address into the precode with method desc (argument for TP stub) - jmp _InContextTPQuickDispatchAsmStub@0 - -_PrecodeRemotingThunk@0 endp -endif ; FEATURE_REMOTING - _JIT_PatchedCodeLast@0 proc public ret _JIT_PatchedCodeLast@0 endp diff --git a/src/vm/i386/jitinterfacex86.cpp b/src/vm/i386/jitinterfacex86.cpp index 01d8119c63..9af3a3ce20 100644 --- a/src/vm/i386/jitinterfacex86.cpp +++ b/src/vm/i386/jitinterfacex86.cpp @@ -16,9 +16,6 @@ #include "eeconfig.h" #include "excep.h" #include "comdelegate.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" // create context bound and remote class instances -#endif #include "field.h" #include "ecall.h" #include "asmconstants.h" @@ -205,7 +202,7 @@ extern "C" __declspec(naked) Object* F_CALL_CONV JIT_IsInstanceOfClass(MethodTab STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; -#if defined(FEATURE_TYPEEQUIVALENCE) || defined(FEATURE_REMOTING) +#if defined(FEATURE_TYPEEQUIVALENCE) enum { MTEquivalenceFlags = MethodTable::public_enum_flag_HasTypeEquivalence, @@ -241,7 +238,7 @@ extern "C" __declspec(naked) Object* F_CALL_CONV JIT_IsInstanceOfClass(MethodTab jne CheckParent // Check if the instance is a proxy. -#if defined(FEATURE_TYPEEQUIVALENCE) || defined(FEATURE_REMOTING) +#if defined(FEATURE_TYPEEQUIVALENCE) mov eax, [ARGUMENT_REG2] test dword ptr [eax]MethodTable.m_dwFlags, MTEquivalenceFlags jne SlowPath @@ -251,7 +248,7 @@ extern "C" __declspec(naked) Object* F_CALL_CONV JIT_IsInstanceOfClass(MethodTab ret // Cast didn't match, so try the worker to check for the proxy/equivalence case. -#if defined(FEATURE_TYPEEQUIVALENCE) || defined(FEATURE_REMOTING) +#if defined(FEATURE_TYPEEQUIVALENCE) SlowPath: jmp JITutil_IsInstanceOfAny #endif @@ -354,37 +351,6 @@ HCIMPLEND FCDECL1(Object*, JIT_New, CORINFO_CLASS_HANDLE typeHnd_); -#ifdef FEATURE_REMOTING -HCIMPL1(Object*, JIT_NewCrossContextHelper, CORINFO_CLASS_HANDLE typeHnd_) -{ - CONTRACTL - { - FCALL_CHECK; - } - CONTRACTL_END; - - TypeHandle typeHnd(typeHnd_); - - OBJECTREF newobj = NULL; - HELPER_METHOD_FRAME_BEGIN_RET_0(); // Set up a frame - - _ASSERTE(!typeHnd.IsTypeDesc()); // we never use this helper for arrays - MethodTable *pMT = typeHnd.AsMethodTable(); - pMT->CheckRestore(); - - // Remoting services determines if the current context is appropriate - // for activation. If the current context is OK then it creates an object - // else it creates a proxy. - // Note: 3/20/03 Added fIsNewObj flag to indicate that CreateProxyOrObject - // is being called from Jit_NewObj ... the fIsCom flag is FALSE by default - - // which used to be the case before this change as well. - newobj = CRemotingServices::CreateProxyOrObject(pMT,FALSE /*fIsCom*/,TRUE/*fIsNewObj*/); - - HELPER_METHOD_FRAME_END(); - return(OBJECTREFToObject(newobj)); -} -HCIMPLEND -#endif // FEATURE_REMOTING HCIMPL1(Object*, AllocObjectWrapper, MethodTable *pMT) { @@ -408,69 +374,6 @@ HCIMPLEND // have remote activation. If not, we use the superfast allocator to // allocate the object. Otherwise, we take the slow path of allocating // the object via remoting services. -#ifdef FEATURE_REMOTING -__declspec(naked) Object* F_CALL_CONV JIT_NewCrossContext(CORINFO_CLASS_HANDLE typeHnd_) -{ - STATIC_CONTRACT_SO_TOLERANT; - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_TRIGGERS; - - _asm - { - // Check if remoting has been configured - push ARGUMENT_REG1 // save registers - push ARGUMENT_REG1 - call CRemotingServices::RequiresManagedActivation - test eax, eax - // Jump to the slow path - jne SpecialOrXCtxHelper -#ifdef _DEBUG - push LL_INFO10 - push LF_GCALLOC - call LoggingOn - test eax, eax - jne AllocWithLogHelper -#endif // _DEBUG - - // if the object doesn't have a finalizer and the size is small, jump to super fast asm helper - mov ARGUMENT_REG1, [esp] - call MethodTable::CannotUseSuperFastHelper - test eax, eax - jne FastHelper - - pop ARGUMENT_REG1 - // Jump to the super fast helper - jmp dword ptr [hlpDynamicFuncTable + DYNAMIC_CORINFO_HELP_NEWSFAST * SIZE VMHELPDEF]VMHELPDEF.pfnHelper - -FastHelper: - pop ARGUMENT_REG1 - // Jump to the helper - jmp JIT_New - -SpecialOrXCtxHelper: -#ifdef FEATURE_COMINTEROP - test eax, ComObjectType - jz XCtxHelper - pop ARGUMENT_REG1 - // Jump to the helper - jmp JIT_New - -XCtxHelper: -#endif // FEATURE_COMINTEROP - - pop ARGUMENT_REG1 - // Jump to the helper - jmp JIT_NewCrossContextHelper - -#ifdef _DEBUG -AllocWithLogHelper: - pop ARGUMENT_REG1 - // Jump to the helper - jmp AllocObjectWrapper -#endif // _DEBUG - } -} -#endif // FEATURE_REMOTING /*********************************************************************/ diff --git a/src/vm/i386/stublinkerx86.cpp b/src/vm/i386/stublinkerx86.cpp index 63b9e87367..cfb5854cbb 100644 --- a/src/vm/i386/stublinkerx86.cpp +++ b/src/vm/i386/stublinkerx86.cpp @@ -26,9 +26,6 @@ #include "array.h" #include "jitinterface.h" #include "codeman.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "dbginterface.h" #include "eeprofinterfaces.h" #include "eeconfig.h" diff --git a/src/vm/i386/virtualcallstubcpu.hpp b/src/vm/i386/virtualcallstubcpu.hpp index 8c16854d22..67737a2d72 100644 --- a/src/vm/i386/virtualcallstubcpu.hpp +++ b/src/vm/i386/virtualcallstubcpu.hpp @@ -16,9 +16,6 @@ #ifdef DECLARE_DATA #include "asmconstants.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #endif #include <pshpack1.h> // Since we are placing code, we want byte packing of the structs @@ -539,120 +536,6 @@ __declspec (naked) void ResolveWorkerAsmStub() } } -#ifdef FEATURE_REMOTING -/* For an in-context dispatch, we will find the target. This - is the slow path, and erects a MachState structure for - creating a HelperMethodFrame - - Entry stack: - dispatch token - return address of caller to stub - - Call stack: - pointer to StubDispatchFrame - call site - dispatch token - StubDispatchFrame - GSCookie - negspace - vptr - datum - ArgumentRegisters (ecx, edx) - CalleeSavedRegisters (ebp, ebx, esi, edi) - return address of caller to stub -*/ -__declspec (naked) void InContextTPDispatchAsmStub() -{ - CANNOT_HAVE_CONTRACT; - - __asm { - // Pop dispatch token - pop eax - - // push ebp-frame - push ebp - mov ebp,esp - - // save CalleeSavedRegisters - push ebx - push esi - push edi - - // push ArgumentRegisters - push ecx - push edx - - mov esi, esp - - push eax // token - push esi // pTransitionContext - - // Make the call - call VSD_GetTargetForTPWorker - - // From here on, mustn't trash eax - - // pop ArgumentRegisters - pop edx - pop ecx - - // pop CalleeSavedRegisters - pop edi - pop esi - pop ebx - pop ebp - - // Now jump to the target - jmp eax // continue on into the method - } -} - -/* For an in-context dispatch, we will try to find the target in - the resolve cache. If this fails, we will jump to the full - version of InContextTPDispatchAsmStub - - Entry stack: - dispatch slot number of interface MD - caller return address - ECX: this object -*/ -__declspec (naked) void InContextTPQuickDispatchAsmStub() -{ - CANNOT_HAVE_CONTRACT; - - __asm { - // Spill registers - push ecx - push edx - - // Arg 2 - token - mov eax, [esp + 8] - push eax - - // Arg 1 - this - push ecx - - // Make the call - call VSD_GetTargetForTPWorkerQuick - - // Restore registers - pop edx - pop ecx - - // Test to see if we found a target - test eax, eax - jnz TargetFound - - // If no target, jump to the slow worker - jmp InContextTPDispatchAsmStub - - TargetFound: - // We got a target, so pop off the token and jump to it - add esp,4 - jmp eax - } -} -#endif // FEATURE_REMOTING /* Call the callsite back patcher. The fail stub piece of the resolver is being call too often, i.e. dispatch stubs are failing the expect MT test too often. diff --git a/src/vm/interopconverter.cpp b/src/vm/interopconverter.cpp index 5e7f53ef75..cb42f9cdfe 100644 --- a/src/vm/interopconverter.cpp +++ b/src/vm/interopconverter.cpp @@ -8,9 +8,6 @@ #include "excep.h" #include "interoputil.h" #include "interopconverter.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "olevariant.h" #include "comcallablewrapper.h" @@ -46,12 +43,6 @@ IUnknown* GetIUnknownForMarshalByRefInServerDomain(OBJECTREF* poref) Context *pContext = NULL; -#ifdef FEATURE_REMOTING - // so this is an proxy type, - // now get it's underlying appdomain which will be null if non-local - if ((*poref)->IsTransparentProxy()) - pContext = CRemotingServices::GetServerContextForProxy(*poref); -#endif if (pContext == NULL) pContext = GetCurrentContext(); @@ -65,48 +56,6 @@ IUnknown* GetIUnknownForMarshalByRefInServerDomain(OBJECTREF* poref) RETURN pUnk; } -#ifdef FEATURE_REMOTING -//+---------------------------------------------------------------------------- -// IUnknown* GetIUnknownForTransparentProxy(OBJECTREF otp) -//+---------------------------------------------------------------------------- - -IUnknown* GetIUnknownForTransparentProxy(OBJECTREF* poref, BOOL fIsBeingMarshalled) -{ - CONTRACT (IUnknown*) - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - PRECONDITION(CheckPointer(poref)); - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - GCX_COOP(); - - IUnknown* pUnk; - - OBJECTREF realProxy = ObjectToOBJECTREF(CRemotingServices::GetRealProxy(OBJECTREFToObject(*poref))); - _ASSERTE(realProxy != NULL); - - GCPROTECT_BEGIN(realProxy); - - MethodDescCallSite getDCOMProxy(METHOD__REAL_PROXY__GETDCOMPROXY, &realProxy); - - ARG_SLOT args[] = { - ObjToArgSlot(realProxy), - BoolToArgSlot(fIsBeingMarshalled), - }; - - ARG_SLOT ret = getDCOMProxy.Call_RetArgSlot(args); - - pUnk = (IUnknown*)ret; - - GCPROTECT_END(); - - RETURN pUnk; -} -#endif // FEATURE_REMOTING //-------------------------------------------------------------------------------- // IUnknown *GetComIPFromObjectRef(OBJECTREF *poref, MethodTable *pMT, ...) @@ -133,47 +82,6 @@ IUnknown *GetComIPFromObjectRef(OBJECTREF *poref, MethodTable *pMT, BOOL bSecuri if (*poref == NULL) RETURN NULL; -#ifdef FEATURE_REMOTING - if ((*poref)->IsTransparentProxy()) - { - // Retrieve the IID of the interface to QI for. - IID iid; - if (pMT->IsInterface()) - { - pMT->GetGuid(&iid, TRUE); - } - else - { - ComCallWrapperTemplate *pTemplate = ComCallWrapperTemplate::GetTemplate(TypeHandle(pMT)); - if (pTemplate->SupportsIClassX()) - { - ComMethodTable *pComMT = pTemplate->GetClassComMT(); - iid = pComMT->GetIID(); - } - else - { - // if IClassX is not supported, we try the default interface of the class - MethodTable *pDefItfMT = pMT->GetDefaultWinRTInterface(); - if (pDefItfMT != NULL) - { - pDefItfMT->GetGuid(&iid, TRUE); - } - else - { - // else we fail because the class has no IID associated with it - IfFailThrow(E_NOINTERFACE); - } - } - } - - // Retrieve an IUnknown for the TP. - SafeComHolder<IUnknown> pProxyUnk = GetIUnknownForTransparentProxy(poref, FALSE); - - // QI for the requested interface. - IfFailThrow(SafeQueryInterface(pProxyUnk, iid, &pUnk)); - goto LExit; - } -#endif // FEATURE_REMOTING SyncBlock* pBlock = (*poref)->GetSyncBlock(); @@ -202,9 +110,6 @@ IUnknown *GetComIPFromObjectRef(OBJECTREF *poref, MethodTable *pMT, BOOL bSecuri RCWPROTECT_END(pRCW); } -#ifdef FEATURE_REMOTING -LExit: -#endif // If we failed to retrieve an IP then throw an exception. if (pUnk == NULL) COMPlusThrowHR(hr); @@ -244,47 +149,6 @@ IUnknown *GetComIPFromObjectRef(OBJECTREF *poref, ComIpType ReqIpType, ComIpType RETURN NULL; MethodTable *pMT = (*poref)->GetMethodTable(); -#ifdef FEATURE_REMOTING - if (pMT->IsTransparentProxy()) - { - SafeComHolder<IUnknown> pProxyUnk = GetIUnknownForTransparentProxy(poref, FALSE); - - if (ReqIpType & ComIpType_Dispatch) - { - hr = SafeQueryInterface(pProxyUnk, IID_IDispatch, &pUnk); - if (SUCCEEDED(hr)) - { - // In Whidbey we used to return ComIpType_Unknown here to maintain backward compatibility with - // previous releases where we had mistakenly returned ComIpType_None (which was interpreted as - // ComIpType_Unknown by the callers of this method). - FetchedIpType = ComIpType_Dispatch; - goto LExit; - } - } - - if (ReqIpType & ComIpType_Inspectable) - { - hr = SafeQueryInterface(pProxyUnk, IID_IInspectable, &pUnk); - if (SUCCEEDED(hr)) - { - FetchedIpType = ComIpType_Inspectable; - goto LExit; - } - } - - if (ReqIpType & ComIpType_Unknown) - { - hr = SafeQueryInterface(pProxyUnk, IID_IUnknown, &pUnk); - if (SUCCEEDED(hr)) - { - FetchedIpType = ComIpType_Unknown; - goto LExit; - } - } - - goto LExit; - } -#endif // FEATURE_REMOTING SyncBlock* pBlock = (*poref)->GetSyncBlock(); @@ -507,9 +371,6 @@ IUnknown *GetComIPFromObjectRef(OBJECTREF *poref, ComIpType ReqIpType, ComIpType } } -#ifdef FEATURE_REMOTING -LExit: -#endif // If we failed to retrieve an IP then throw an exception. if (pUnk == NULL) COMPlusThrowHR(hr); @@ -553,14 +414,6 @@ IUnknown *GetComIPFromObjectRef(OBJECTREF *poref, REFIID iid, bool throwIfNoComI RETURN NULL; MethodTable *pMT = (*poref)->GetMethodTable(); -#ifdef FEATURE_REMOTING - if (pMT->IsTransparentProxy()) - { - SafeComHolder<IUnknown> pProxyUnk = GetIUnknownForTransparentProxy(poref, FALSE); - IfFailThrow(SafeQueryInterface(pProxyUnk, iid, &pUnk)); - goto LExit; - } -#endif SyncBlock* pBlock = (*poref)->GetSyncBlock(); @@ -586,47 +439,12 @@ IUnknown *GetComIPFromObjectRef(OBJECTREF *poref, REFIID iid, bool throwIfNoComI pUnk = pUnkHolder.Extract(); } -#ifdef FEATURE_REMOTING -LExit: -#endif if (throwIfNoComIP && pUnk == NULL) COMPlusThrowHR(hr); RETURN pUnk; } -#ifdef FEATURE_REMOTING -OBJECTREF GetObjectRefFromComIP_CrossDomain(ADID objDomainId, ComCallWrapper* pWrap) -{ - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - MODE_COOPERATIVE; - } - CONTRACTL_END; - - OBJECTREF oref = NULL; - - EX_TRY - { - // the CCW belongs to a different domain.. - // unmarshal the object to the current domain - if (!UnMarshalObjectForCurrentDomain(objDomainId, pWrap, &oref)) - oref = NULL; - } - EX_CATCH - { - // fall back to creating an RCW if we were unable to - // marshal the object (most commonly because the object - // graph is not serializable) - oref = NULL; - } - EX_END_CATCH(SwallowAllExceptions) - - return oref; -} -#endif //#ifdef FEATURE_REMOTING //+---------------------------------------------------------------------------- // GetObjectRefFromComIP @@ -692,15 +510,8 @@ void GetObjectRefFromComIP(OBJECTREF* pObjOut, IUnknown **ppUnk, MethodTable *pM _ASSERTE(pWrap != NULL); AppDomain* pCurrDomain = pThread->GetDomain(); ADID pObjDomain = pWrap->GetDomainID(); -#ifdef FEATURE_REMOTING - if (pObjDomain == pCurrDomain->GetId()) - *pObjOut = pWrap->GetObjectRef(); - else - *pObjOut = GetObjectRefFromComIP_CrossDomain(pObjDomain, pWrap); -#else _ASSERTE(pObjDomain == pCurrDomain->GetId()); *pObjOut = pWrap->GetObjectRef(); -#endif } if (*pObjOut != NULL) @@ -812,173 +623,3 @@ void GetObjectRefFromComIP(OBJECTREF* pObjOut, IUnknown **ppUnk, MethodTable *pM #endif // FEATURE_COMINTEROP -#ifdef FEATURE_REMOTING -//-------------------------------------------------------- -// ConvertObjectToBSTR -// serializes object to a BSTR, caller needs to SysFree the Bstr -// and GCPROTECT the oref parameter. -//-------------------------------------------------------------------------------- -BOOL ConvertObjectToBSTR(OBJECTREF* oref, BOOL fCrossRuntime, BSTR* pBStr) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - PRECONDITION(CheckPointer(pBStr)); - PRECONDITION(IsProtectedByGCFrame (oref)); - } - CONTRACTL_END; - - *pBStr = NULL; - - MethodTable *pMT = (*oref)->GetMethodTable(); - if (!pMT->IsTransparentProxy() && !pMT->IsMarshaledByRef() && !pMT->IsSerializable()) - { - // The object is not serializable - don't waste time calling to managed and trying to - // serialize it with a formatter. This is an optimization so we don't throw and catch - // SerializationException unnecessarily. - return FALSE; - } - - // We will be using the remoting services so make sure remoting is started up. - CRemotingServices::EnsureRemotingStarted(); - - MethodDescCallSite marshalToBuffer(METHOD__REMOTING_SERVICES__MARSHAL_TO_BUFFER); - - ARG_SLOT args[] = - { - ObjToArgSlot(*oref), - BoolToArgSlot(fCrossRuntime) - }; - - BASEARRAYREF aref = (BASEARRAYREF) marshalToBuffer.Call_RetOBJECTREF(args); - - if (aref != NULL) - { - _ASSERTE(!aref->IsMultiDimArray()); - //@todo ASSERTE that the array is a byte array - - ULONG cbSize = aref->GetNumComponents(); - BYTE* pBuf = (BYTE *)aref->GetDataPtr(); - - BSTR bstr = SysAllocStringByteLen(NULL, cbSize); - if (bstr == NULL) - COMPlusThrowOM(); - - CopyMemory(bstr, pBuf, cbSize); - *pBStr = bstr; - } - - return TRUE; -} - -//-------------------------------------------------------------------------------- -// ConvertBSTRToObject -// deserializes a BSTR, created using ConvertObjectToBSTR, this api SysFree's the BSTR -//-------------------------------------------------------------------------------- -OBJECTREF ConvertBSTRToObject(BSTR bstr, BOOL fCrossRuntime) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - } - CONTRACTL_END; - - BSTRHolder localBstr(bstr); - - OBJECTREF oref = NULL; - - // We will be using the remoting services so make sure remoting is started up. - CRemotingServices::EnsureRemotingStarted(); - - MethodDescCallSite unmarshalFromBuffer(METHOD__REMOTING_SERVICES__UNMARSHAL_FROM_BUFFER); - - // convert BSTR to a byte array - - // allocate a byte array - INT32 elementCount = SysStringByteLen(bstr); - TypeHandle t = OleVariant::GetArrayForVarType(VT_UI1, TypeHandle((MethodTable *)NULL)); - BASEARRAYREF aref = (BASEARRAYREF) AllocateArrayEx(t, &elementCount, 1); - // copy the bstr data into the managed byte array - memcpyNoGCRefs(aref->GetDataPtr(), bstr, elementCount); - - ARG_SLOT args[] = - { - ObjToArgSlot((OBJECTREF)aref), - BoolToArgSlot(fCrossRuntime) - }; - - oref = unmarshalFromBuffer.Call_RetOBJECTREF(args); - - return oref; -} - -//-------------------------------------------------------------------------------- -// UnMarshalObjectForCurrentDomain -// unmarshal the managed object for the current domain -//-------------------------------------------------------------------------------- -struct ConvertObjectToBSTR_Args -{ - OBJECTREF* oref; - BOOL fCrossRuntime; - BSTR *pBStr; - BOOL fResult; -}; - -void ConvertObjectToBSTR_Wrapper(LPVOID ptr) -{ - WRAPPER_NO_CONTRACT; - - ConvertObjectToBSTR_Args *args = (ConvertObjectToBSTR_Args *)ptr; - args->fResult = ConvertObjectToBSTR(args->oref, args->fCrossRuntime, args->pBStr); -} - - -BOOL UnMarshalObjectForCurrentDomain(ADID pObjDomain, ComCallWrapper* pWrap, OBJECTREF* pResult) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - PRECONDITION(CheckPointer(pWrap)); - PRECONDITION(CheckPointer(pResult)); - } - CONTRACTL_END; - - Thread* pThread = GetThread(); - _ASSERTE(pThread); - - _ASSERTE(pThread->GetDomain() != NULL); - _ASSERTE(pThread->GetDomain()->GetId()!= pObjDomain); - - BSTR bstr = NULL; - ConvertObjectToBSTR_Args args; - args.fCrossRuntime = FALSE; - args.pBStr = &bstr; - - OBJECTREF oref = pWrap->GetObjectRef(); - - GCPROTECT_BEGIN(oref); - { - args.oref = &oref; - pThread->DoADCallBack(pObjDomain, ConvertObjectToBSTR_Wrapper, &args); - } - GCPROTECT_END(); - - if (args.fResult) - { - _ASSERTE(bstr != NULL); - *pResult = ConvertBSTRToObject(bstr, FALSE); - } - else - { - *pResult = NULL; - } - - return args.fResult; -} -#endif //FEATURE_REMOTING diff --git a/src/vm/interopconverter.h b/src/vm/interopconverter.h index d0e2186ba2..21368dd8a3 100644 --- a/src/vm/interopconverter.h +++ b/src/vm/interopconverter.h @@ -157,21 +157,6 @@ inline void GetObjectRefFromComIP(OBJECTREF* pObjOut, IUnknown *pUnk, MethodTabl return GetObjectRefFromComIP(pObjOut, &pUnk, pMTClass, pItfMT, dwFlags); } -#ifdef FEATURE_REMOTING // used only by remoting -//-------------------------------------------------------- -// managed serialization helpers -//-------------------------------------------------------- -// ConvertObjectToBSTR -// serializes object to a BSTR, caller needs to SysFree the Bstr -// and GCPROTECT the oref parameter. -BOOL ConvertObjectToBSTR(OBJECTREF* oref, BOOL fCrossRuntime, BSTR* pBStr); - - -//-------------------------------------------------------------------------------- -// ConvertBSTRToObject -// deserializes a BSTR, created using ConvertObjectToBSTR, this api SysFree's the BSTR -OBJECTREF ConvertBSTRToObject(BSTR bstr, BOOL fCrossRuntime); -#endif //-------------------------------------------------------------------------------- // UnMarshalObjectForCurrentDomain diff --git a/src/vm/interoputil.cpp b/src/vm/interoputil.cpp index 809704235e..f3eac1b4ee 100644 --- a/src/vm/interoputil.cpp +++ b/src/vm/interoputil.cpp @@ -14,9 +14,6 @@ #include "eeconfig.h" #include "mlinfo.h" #include "comdelegate.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "appdomain.hpp" #include "prettyprintsig.h" #include "util.hpp" diff --git a/src/vm/interpreter.cpp b/src/vm/interpreter.cpp index b74672f4f0..010fee674b 100644 --- a/src/vm/interpreter.cpp +++ b/src/vm/interpreter.cpp @@ -23,9 +23,6 @@ #include "runtimehandles.h" #include "vars.hpp" #include "cycletimer.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif inline CORINFO_CALLINFO_FLAGS combine(CORINFO_CALLINFO_FLAGS flag1, CORINFO_CALLINFO_FLAGS flag2) { @@ -5993,20 +5990,6 @@ void Interpreter::NewObj() MethodTable * pNewObjMT = GetMethodTableFromClsHnd(methTok.hClass); switch (newHelper) { -#ifdef FEATURE_REMOTING - case CORINFO_HELP_NEW_CROSSCONTEXT: - { - if (CRemotingServices::RequiresManagedActivation(pNewObjMT) && !pNewObjMT->IsComObjectType()) - { - thisArgObj = CRemotingServices::CreateProxyOrObject(pNewObjMT); - } - else - { - thisArgObj = AllocateObject(pNewObjMT); - } - } - break; -#endif // FEATURE_REMOTING case CORINFO_HELP_NEWFAST: default: thisArgObj = AllocateObject(pNewObjMT); @@ -7330,12 +7313,6 @@ void Interpreter::LdFld(FieldDesc* fldIn) { OBJECTREF obj = OBJECTREF(OpStackGet<Object*>(stackInd)); ThrowOnInvalidPointer(OBJECTREFToObject(obj)); -#ifdef FEATURE_REMOTING - if (obj->IsTransparentProxy()) - { - NYI_INTERP("Thunking objects not supported"); - } -#endif if (valCit == CORINFO_TYPE_VALUECLASS) { void* srcPtr = fld->GetInstanceAddress(obj); diff --git a/src/vm/invokeutil.cpp b/src/vm/invokeutil.cpp index 1e06cba0da..1c7173a12b 100644 --- a/src/vm/invokeutil.cpp +++ b/src/vm/invokeutil.cpp @@ -18,9 +18,6 @@ #include "method.hpp" #include "threads.h" #include "excep.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "security.h" #include "field.h" #include "customattribute.h" @@ -940,13 +937,6 @@ void InvokeUtil::ValidateObjectTarget(FieldDesc *pField, TypeHandle enclosingTyp // Give a second chance to thunking classes to do the // correct cast if (ty.IsNull()) { -#ifdef FEATURE_REMOTING - BOOL fCastOK = FALSE; - if ((*target)->IsTransparentProxy()) { - fCastOK = CRemotingServices::CheckCast(*target, enclosingType); - } - if(!fCastOK) -#endif { COMPlusThrow(kArgumentException,W("Arg_ObjObj")); } @@ -1151,37 +1141,6 @@ void InvokeUtil::SetValidField(CorElementType fldType, { _ASSERTE(!fldTH.IsTypeDesc()); MethodTable *pMT = fldTH.AsMethodTable(); -#ifdef FEATURE_REMOTING - if((*target) != NULL && (*target)->IsTransparentProxy()) { - OBJECTREF val = *valueObj; - GCPROTECT_BEGIN(val) - - void* valueData; - if (Nullable::IsNullableType(fldTH)) { - // Special case for Nullable<T>, we need a true nullable that is gc protected. The easiest - // way to make one is to allocate an object on the heap - OBJECTREF trueNullable = fldTH.AsMethodTable()->Allocate(); - BOOL typesChecked; - typesChecked = Nullable::UnBox(trueNullable->GetData(), val, fldTH.AsMethodTable()); - _ASSERTE(typesChecked); - val = trueNullable; - valueData = val->GetData(); - } - else if (val == NULL) { - // Null is the universal null object. (Is this a good idea?) - int size = pMT->GetNumInstanceFieldBytes(); - valueData = _alloca(size); - memset(valueData, 0, size); - } - else - valueData = val->GetData(); - - OBJECTREF unwrapped = CRemotingServices::GetObjectFromProxy(*target); - CRemotingServices::FieldAccessor(pField, unwrapped, valueData, FALSE); - GCPROTECT_END(); - } - else -#endif { void* pFieldData; if (pField->IsStatic()) @@ -1336,14 +1295,6 @@ OBJECTREF InvokeUtil::GetFieldValue(FieldDesc* pField, TypeHandle fieldType, OBJ if (pField->IsStatic()) p = pField->GetCurrentStaticAddress(); else { -#ifdef FEATURE_REMOTING - OBJECTREF o = *target; - if(o->IsTransparentProxy()) { - OBJECTREF unwrapped = CRemotingServices::GetObjectFromProxy(o); - CRemotingServices::FieldAccessor(pField, unwrapped, (void*)obj->GetData(), TRUE); - } - else -#endif p = (*((BYTE**)target)) + pField->GetOffset() + sizeof(Object); } GCPROTECT_END(); diff --git a/src/vm/invokeutil.h b/src/vm/invokeutil.h index b991674cec..06aac9aaa3 100644 --- a/src/vm/invokeutil.h +++ b/src/vm/invokeutil.h @@ -55,9 +55,6 @@ public: : m_fCheckedCaller(false), m_fCheckedPerm(false), m_fCallerHasPerm(false), -#ifdef FEATURE_REMOTING - m_fSkippingRemoting(false), -#endif m_pCaller(NULL), m_pCallerDomain(NULL), m_accessCheckType(accessCheckType) @@ -91,9 +88,6 @@ private: bool m_fCheckedPerm; bool m_fCallerHasPerm; -#ifdef FEATURE_REMOTING - bool m_fSkippingRemoting; -#endif // @review GENERICS: // These method descriptors may be shared between compatible instantiations @@ -271,10 +265,6 @@ public: if (pTargetMT == NULL) return FALSE; -#ifdef FEATURE_REMOTING - if (pTargetMT->IsTransparentProxy()) - return TRUE; -#endif return FALSE; } diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp index b4dc4c1382..1f73a40cda 100644 --- a/src/vm/jithelpers.cpp +++ b/src/vm/jithelpers.cpp @@ -34,9 +34,6 @@ #include "process.h" #endif // !FEATURE_PAL -#ifdef FEATURE_REMOTING -#include "remoting.h" // create context bound and remote class instances -#endif #include "perfcounters.h" #ifdef PROFILING_SUPPORTED #include "proftoeeinterfaceimpl.h" @@ -782,14 +779,6 @@ HCIMPL2(void*, JIT_GetFieldAddr_Framed, Object *obj, FieldDesc* pFD) if (objRef == NULL) COMPlusThrow(kNullReferenceException); -#ifdef FEATURE_REMOTING - if(objRef->IsTransparentProxy()) - { - objRef = CRemotingServices::GetObjectFromProxy(objRef); - if (objRef->IsTransparentProxy()) - COMPlusThrow(kInvalidOperationException, W("Remoting_InvalidValueTypeFieldAccess")); - } -#endif // FEATURE_REMOTING fldAddr = pFD->GetAddress(OBJECTREFToObject(objRef)); @@ -1180,17 +1169,6 @@ HCIMPL4(VOID, JIT_GetFieldStruct_Framed, LPVOID retBuff, Object *obj, FieldDesc // the server object. BOOL fRemoted = FALSE; -#ifdef FEATURE_REMOTING - if (objRef->IsTransparentProxy()) - { - objRef = CRemotingServices::GetObjectFromProxy(objRef); - if (objRef->IsTransparentProxy()) - { - CRemotingServices::FieldAccessor(pFD, objRef, retBuff, TRUE); - fRemoted = TRUE; - } - } -#endif if (!fRemoted) { @@ -1245,18 +1223,6 @@ HCIMPL4(VOID, JIT_SetFieldStruct_Framed, Object *obj, FieldDesc *pFD, MethodTabl // the server object. BOOL fRemoted = FALSE; -#ifdef FEATURE_REMOTING - if(objRef->IsTransparentProxy()) - { - objRef = CRemotingServices::GetObjectFromProxy(objRef); - - if(objRef->IsTransparentProxy()) - { - CRemotingServices::FieldAccessor(pFD, objRef, valuePtr, FALSE); - fRemoted = TRUE; - } - } -#endif if (!fRemoted) { @@ -1296,32 +1262,6 @@ HCIMPLEND //======================================================================== -#ifdef FEATURE_REMOTING -HCIMPL1(void*, JIT_GetStaticFieldAddr_Context, FieldDesc *pFD) -{ - CONTRACTL { - FCALL_CHECK; - PRECONDITION(CheckPointer(pFD)); - PRECONDITION(pFD->IsStatic()); - PRECONDITION(pFD->IsContextStatic()); - } CONTRACTL_END; - - void *addr = NULL; - - HELPER_METHOD_FRAME_BEGIN_RET_0(); - - MethodTable *pMT = pFD->GetEnclosingMethodTable(); - pMT->CheckRestore(); - pMT->CheckRunClassInitThrowing(); - - addr = Context::GetStaticFieldAddress(pFD); - - HELPER_METHOD_FRAME_END(); - - return addr; -} -HCIMPLEND -#endif // Slow helper to tailcall from the fast one NOINLINE HCIMPL1(void, JIT_InitClass_Framed, MethodTable* pMT) @@ -2375,13 +2315,6 @@ BOOL ObjIsInstanceOf(Object *pObject, TypeHandle toTypeHnd, BOOL throwCastExcept // If we are trying to cast a proxy we need to delegate to remoting // services which will determine whether the proxy and the type are compatible. -#ifdef FEATURE_REMOTING - if (fromTypeHnd.IsTransparentProxy()) - { - fCast = CRemotingServices::CheckCast(obj, toTypeHnd); - } - else -#endif // Start by doing a quick static cast check to see if the type information captured in // the metadata indicates that the cast is legal. if (fromTypeHnd.CanCastTo(toTypeHnd)) @@ -2893,53 +2826,6 @@ HCIMPL1(Object*, JIT_New, CORINFO_CLASS_HANDLE typeHnd_) } HCIMPLEND -#ifdef FEATURE_REMOTING -/*************************************************************/ -HCIMPL1(Object*, JIT_NewCrossContext_Portable, CORINFO_CLASS_HANDLE typeHnd_) -{ - FCALL_CONTRACT; - - OBJECTREF newobj = NULL; - HELPER_METHOD_FRAME_BEGIN_RET_0(); // Set up a frame - - TypeHandle typeHnd(typeHnd_); - - _ASSERTE(!typeHnd.IsTypeDesc()); // we never use this helper for arrays - MethodTable *pMT = typeHnd.AsMethodTable(); - - // Don't bother to restore the method table; assume that the prestub of the - // constructor will do that check. - -#ifdef _DEBUG - if (g_pConfig->FastGCStressLevel()) { - GetThread()->DisableStressHeap(); - } -#endif // _DEBUG - - if (CRemotingServices::RequiresManagedActivation(typeHnd)) - { - if (pMT->IsComObjectType()) - { - newobj = AllocateObject(pMT); - } - else - { - // Remoting services determines if the current context is appropriate - // for activation. If the current context is OK then it creates an object - // else it creates a proxy. - newobj = CRemotingServices::CreateProxyOrObject(pMT); - } - } - else - { - newobj = AllocateObject(pMT); - } - - HELPER_METHOD_FRAME_END(); - return(OBJECTREFToObject(newobj)); -} -HCIMPLEND -#endif // FEATURE_REMOTING //======================================================================== diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 0a71d959a2..2c3f0b3fe4 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -32,9 +32,6 @@ #include "jitperf.h" // to track jit perf #include "corprof.h" #include "eeprofinterfaces.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" // create context bound and remote class instances -#endif #include "perfcounters.h" #ifdef PROFILING_SUPPORTED #include "proftoeeinterfaceimpl.h" @@ -1728,36 +1725,6 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, } else #endif // CHECK_APP_DOMAIN_LEAKS -#ifdef FEATURE_REMOTING - // are we a contextful class? (approxMT is OK to use here) - if (pFieldMT->IsContextful()) - { - // Allow the JIT to optimize special cases - - // If the caller is states that we have a 'this reference' - // and he is also willing to unwrap it himself - // then we won't require a helper call. - if (!(flags & CORINFO_ACCESS_THIS ) || - !(flags & CORINFO_ACCESS_UNWRAP)) - { - // Normally a helper call is required. - fInstanceHelper = TRUE; - } - } - // are we a marshaled by ref class? (approxMT is OK to use here) - else if (pFieldMT->IsMarshaledByRef()) - { - // Allow the JIT to optimize special cases - - // If the caller is states that we have a 'this reference' - // then we won't require a helper call. - if (!(flags & CORINFO_ACCESS_THIS)) - { - // Normally a helper call is required. - fInstanceHelper = TRUE; - } - } -#endif // FEATURE_REMOTING if (fInstanceHelper) { @@ -6007,21 +5974,10 @@ CorInfoHelpFunc CEEInfo::getNewHelperStatic(MethodTable * pMT) { STANDARD_VM_CONTRACT; -#ifdef FEATURE_REMOTING - if (pMT->MayRequireManagedActivation()) - { - return CORINFO_HELP_NEW_CROSSCONTEXT; - } -#endif // Slow helper is the default CorInfoHelpFunc helper = CORINFO_HELP_NEWFAST; -#ifdef FEATURE_REMOTING - // We shouldn't get here with a COM object (they're all potentially - // remotable, so they're covered by the case above). - _ASSERTE(!pMT->IsComObjectType() || pMT->IsWinRTObjectType()); -#endif if (pMT->IsComObjectType()) { diff --git a/src/vm/jitinterfacegen.cpp b/src/vm/jitinterfacegen.cpp index f8a95bb759..99e03f4b6b 100644 --- a/src/vm/jitinterfacegen.cpp +++ b/src/vm/jitinterfacegen.cpp @@ -20,9 +20,6 @@ #include "eeconfig.h" #include "excep.h" #include "comdelegate.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" // create context bound and remote class instances -#endif #include "field.h" #include "ecall.h" diff --git a/src/vm/marshalnative.cpp b/src/vm/marshalnative.cpp index f72b74c224..8f1b23a703 100644 --- a/src/vm/marshalnative.cpp +++ b/src/vm/marshalnative.cpp @@ -34,9 +34,6 @@ #include "marshalnative.h" #include "fcall.h" #include "dllimportcallback.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "comdelegate.h" #include "handletablepriv.h" #include "mdaassistants.h" @@ -1490,17 +1487,6 @@ FCIMPL2(Object*, MarshalNative::InternalCreateWrapperOfType, Object* objUNSAFE, BOOL fSet = FALSE; // Start by checking if we can cast the obj to the wrapper type. -#ifdef FEATURE_REMOTING - if (pObjMT->IsTransparentProxy()) - { - if (CRemotingServices::CheckCast(gc.obj, pNewWrapMT)) - { - gc.refRetVal = gc.obj; - fSet = TRUE; - } - } - else -#endif if (TypeHandle(pObjMT).CanCastTo(TypeHandle(pNewWrapMT))) { gc.refRetVal = gc.obj; @@ -2285,9 +2271,6 @@ FCIMPL2(void, MarshalNative::ChangeWrapperHandleStrength, Object* orefUNSAFE, CL COMPlusThrowArgumentNull(W("otp")); if ( -#ifdef FEATURE_REMOTING - CRemotingServices::IsTransparentProxy(OBJECTREFToObject(oref)) || -#endif !oref->GetMethodTable()->IsComImport()) { CCWHolder pWrap = ComCallWrapper::InlineGetWrapper(&oref); diff --git a/src/vm/memberload.cpp b/src/vm/memberload.cpp index 1b24300a68..d19a4f6d61 100644 --- a/src/vm/memberload.cpp +++ b/src/vm/memberload.cpp @@ -35,9 +35,6 @@ #include "dbginterface.h" #include "comdelegate.h" #include "sigformat.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "eeprofinterfaces.h" #include "dllimportcallback.h" #include "listlock.h" @@ -49,9 +46,6 @@ #include "virtualcallstub.h" #include "eeconfig.h" #include "contractimpl.h" -#ifdef FEATURE_REMOTING -#include "objectclone.h" -#endif #include "listlock.inl" #include "generics.h" #include "instmethhash.h" diff --git a/src/vm/message.h b/src/vm/message.h deleted file mode 100644 index 06c0402067..0000000000 --- a/src/vm/message.h +++ /dev/null @@ -1,200 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** File: message.h -** -** Purpose: Encapsulates a function call frame into a message -** object with an interface that can enumerate the -** arguments of the messagef -** -** - -===========================================================*/ -#ifndef ___MESSAGE_H___ -#define ___MESSAGE_H___ - -#ifndef FEATURE_REMOTING -#error FEATURE_REMOTING is not set, please do not include message.h -#endif - -#include "fcall.h" - -//+---------------------------------------------------------- -// -// Struct: MessageObject -// -// Synopsis: Physical mapping of the System.Runtime.Remoting.Message -// object. -// -// -//------------------------------------------------------------ -class MessageObject : public Object -{ - friend class MscorlibBinder; - -public: - MetaSig* GetResetMetaSig() - { - CONTRACT(MetaSig*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_COOPERATIVE; - PRECONDITION(CheckPointer(pMetaSigHolder)); - POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; - } - CONTRACT_END; - - pMetaSigHolder->Reset(); - RETURN pMetaSigHolder; - } - - FramedMethodFrame *GetFrame() - { - CONTRACT(FramedMethodFrame *) - { - NOTHROW; - GC_NOTRIGGER; - MODE_COOPERATIVE; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN pFrame; - } - - MethodDesc *GetMethodDesc() - { - CONTRACT(MethodDesc *) - { - NOTHROW; - GC_NOTRIGGER; - MODE_COOPERATIVE; - POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; - } - CONTRACT_END; - - RETURN pMethodDesc; - } - - MethodDesc *GetDelegateMD() - { - CONTRACT(MethodDesc *) - { - NOTHROW; - GC_NOTRIGGER; - MODE_COOPERATIVE; - POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); - SO_TOLERANT; - } - CONTRACT_END; - - RETURN pDelegateMD; - } - - INT32 GetFlags() - { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_COOPERATIVE; - SO_TOLERANT; - } - CONTRACTL_END; - - return iFlags; - } - -private: - STRINGREF pMethodName; // Method name - BASEARRAYREF pMethodSig; // Array of parameter types - OBJECTREF pMethodBase; // Reflection method object - OBJECTREF pHashTable; // hashtable for properties - STRINGREF pURI; // object's URI - STRINGREF pTypeName; // not used in VM, placeholder - OBJECTREF pFault; // exception - - OBJECTREF pID; // not used in VM, placeholder - OBJECTREF pSrvID; // not used in VM, placeholder - OBJECTREF pArgMapper; // not used in VM, placeholder - OBJECTREF pCallCtx; // not used in VM, placeholder - - FramedMethodFrame *pFrame; - MethodDesc *pMethodDesc; - MetaSig *pMetaSigHolder; - MethodDesc *pDelegateMD; - TypeHandle thGoverningType; - INT32 iFlags; - CLR_BOOL initDone; // called the native Init routine -}; - -#ifdef USE_CHECKED_OBJECTREFS -typedef REF<MessageObject> MESSAGEREF; -#else -typedef MessageObject* MESSAGEREF; -#endif - -// ******* -// Note: Needs to be in sync with flags in Message.cs -// ******* -enum -{ - MSGFLG_BEGININVOKE = 0x01, - MSGFLG_ENDINVOKE = 0x02, - MSGFLG_CTOR = 0x04, - MSGFLG_ONEWAY = 0x08, - MSGFLG_FIXEDARGS = 0x10, - MSGFLG_VARARGS = 0x20 -}; - -//+---------------------------------------------------------- -// -// Class: CMessage -// -// Synopsis: EE counterpart to Microsoft.Runtime.Message. -// Encapsulates code to read a function call -// frame into an interface that can enumerate -// the parameters. -// -// -//------------------------------------------------------------ -class CMessage -{ -public: - // public fcalls. - static FCDECL1(INT32, GetArgCount, MessageObject *pMsg); - static FCDECL2(Object*, GetArg, MessageObject* pMessage, INT32 argNum); - static FCDECL1(Object*, GetArgs, MessageObject* pMessageUNSAFE); - static FCDECL3(void, PropagateOutParameters, MessageObject* pMessageUNSAFE, ArrayBase* pOutPrmsUNSAFE, Object* RetValUNSAFE); - static FCDECL1(Object*, GetReturnValue, MessageObject* pMessageUNSAFE); - static FCDECL3(void, GetAsyncBeginInfo, MessageObject* pMessageUNSAFE, OBJECTREF* ppACBD, OBJECTREF* ppState); - static FCDECL1(LPVOID, GetAsyncResult, MessageObject* pMessageUNSAFE); - static FCDECL1(Object*, GetAsyncObject, MessageObject* pMessageUNSAFE); - static FCDECL1(void, DebugOut, StringObject* pOutUNSAFE); - static FCDECL2(FC_BOOL_RET, Dispatch, MessageObject* pMessageUNSAFE, Object* pServerUNSAFE); - static FCDECL1(FC_BOOL_RET, HasVarArgs, MessageObject * poMessage); - -public: - // public helper - static void GetObjectFromStack(OBJECTREF* ppDest, PVOID val, const CorElementType eType, TypeHandle ty, BOOL fIsByRef = FALSE, FramedMethodFrame *pFrame = NULL); - -private: - // private helpers - static PVOID GetStackPtr(INT32 ndx, FramedMethodFrame *pFrame, MetaSig *pSig); - static int GetStackOffset (FramedMethodFrame *pFrame, ArgIterator *pArgIter, MetaSig *pSig); - static INT64 __stdcall CallMethod(const void *pTarget, - INT32 cArgs, - FramedMethodFrame *pFrame, - OBJECTREF pObj); - static INT64 CopyOBJECTREFToStack(PVOID pvDest, OBJECTREF *pSrc, CorElementType typ, TypeHandle ty, MetaSig *pSig, BOOL fCopyClassContents); - static LPVOID GetLastArgument(MESSAGEREF *pMsg); - static void AppendAssemblyName(CQuickBytes &out, const CHAR* str); -}; - -#endif // ___MESSAGE_H___ diff --git a/src/vm/metasig.h b/src/vm/metasig.h index d21bf12aa4..a874a20da2 100644 --- a/src/vm/metasig.h +++ b/src/vm/metasig.h @@ -284,9 +284,6 @@ DEFINE_METASIG(GM(RefT_T, IMAGE_CEE_CS_CALLCONV_DEFAULT, 1, r(M(0)) M(0), v)) DEFINE_METASIG_T(SM(SafeHandle_RefBool_RetIntPtr, C(SAFE_HANDLE) r(F), I )) DEFINE_METASIG_T(SM(SafeHandle_RetVoid, C(SAFE_HANDLE), v )) -#ifdef FEATURE_REMOTING -DEFINE_METASIG_T(SM(RetContext, _, C(CONTEXT))) -#endif DEFINE_METASIG_T(SM(RetMethodBase, _, C(METHOD_BASE))) DEFINE_METASIG(SM(RetVoid, _, v)) DEFINE_METASIG(SM(Str_IntPtr_Int_RetVoid, s I i, v)) @@ -301,9 +298,6 @@ DEFINE_METASIG(SM(Int_IntPtr_RetObj, i I, j)) DEFINE_METASIG(SM(IntPtr_IntPtr_Int_RetVoid, I I i, v)) DEFINE_METASIG_T(SM(Exception_RetInt, C(EXCEPTION), i)) -#ifdef FEATURE_REMOTING -DEFINE_METASIG_T(SM(ContextBoundObject_RetObj, C(CONTEXT_BOUND_OBJECT), j)) -#endif DEFINE_METASIG(SM(IntPtr_RetVoid, I, v)) DEFINE_METASIG(SM(IntPtr_Bool_RetVoid, I F, v)) @@ -320,9 +314,6 @@ DEFINE_METASIG(SM(Obj_RetIntPtr, j, I)) DEFINE_METASIG(SM(Obj_RetObj, j, j)) DEFINE_METASIG(SM(Obj_RetArrByte, j, a(b))) DEFINE_METASIG(SM(Obj_Bool_RetArrByte, j F, a(b))) -#ifdef FEATURE_REMOTING -DEFINE_METASIG_T(SM(Obj_RefMessageData_RetVoid, j r(g(MESSAGE_DATA)), v)) -#endif DEFINE_METASIG(SM(Obj_Obj_RefArrByte_RetArrByte, j j r(a(b)), a(b))) #ifdef FEATURE_COMINTEROP @@ -335,9 +326,6 @@ DEFINE_METASIG_T(SM(RefDateTimeOffset_RefDateTimeNative_RetVoid, r(g(DATE_TIME_O #endif -#ifdef FEATURE_REMOTING -DEFINE_METASIG_T(SM(RealProxy_Class_RetBool, C(REAL_PROXY) C(CLASS), F)) -#endif DEFINE_METASIG(SM(Str_RetInt, s, i)) DEFINE_METASIG_T(SM(Str_RetICustomMarshaler, s, C(ICUSTOM_MARSHALER))) @@ -347,9 +335,6 @@ DEFINE_METASIG(SM(Str_IntPtr_RetIntPtr, s I, I)) DEFINE_METASIG(SM(Str_Bool_Int_RetV, s F i, v)) DEFINE_METASIG_T(SM(Type_RetInt, C(TYPE), i)) -#ifdef FEATURE_REMOTING -DEFINE_METASIG_T(SM(Class_ArrObject_Bool_RetMarshalByRefObject, C(CLASS) a(j) F, C(MARSHAL_BY_REF_OBJECT))) -#endif DEFINE_METASIG(SM(ArrByte_RetObj, a(b), j)) DEFINE_METASIG(SM(ArrByte_Bool_RetObj, a(b) F, j)) DEFINE_METASIG(SM(ArrByte_ArrByte_RefObj_RetObj, a(b) a(b) r(j), j)) @@ -362,9 +347,6 @@ DEFINE_METASIG_T(SM(Void_RetRuntimeTypeHandle, _, g(RT_TYPE_HANDLE))) DEFINE_METASIG(SM(Void_RetIntPtr, _, I)) DEFINE_METASIG_T(SM(UInt_UInt_PtrNativeOverlapped_RetVoid, K K P(g(NATIVEOVERLAPPED)), v)) -#ifdef FEATURE_REMOTING -DEFINE_METASIG_T(SM(CrossContextDelegate_ArrObj_RetObj, C(CROSS_CONTEXT_DELEGATE) a(j), j)) -#endif DEFINE_METASIG(IM(Long_RetVoid, l, v)) DEFINE_METASIG(IM(IntPtr_Int_RetVoid, I i, v)) @@ -422,9 +404,6 @@ DEFINE_METASIG(IM(Int_RefIntPtr_RefIntPtr_RefIntPtr_RetVoid, i r(I) r(I) r(I), v DEFINE_METASIG(IM(Int_RetStr, i, s)) DEFINE_METASIG(IM(Int_RetVoid, i, v)) DEFINE_METASIG(IM(Int_RetBool, i, F)) -#ifdef FEATURE_REMOTING -DEFINE_METASIG_T(IM(RefMessageData_Int_RetVoid, r(g(MESSAGE_DATA)) i, v)) -#endif // FEATURE_REMOTING DEFINE_METASIG(IM(Int_Int_Int_Int_RetVoid, i i i i, v)) DEFINE_METASIG_T(IM(Obj_EventArgs_RetVoid, j C(EVENT_ARGS), v)) DEFINE_METASIG_T(IM(Obj_UnhandledExceptionEventArgs_RetVoid, j C(UNHANDLED_EVENTARGS), v)) @@ -453,9 +432,6 @@ DEFINE_METASIG(IM(Obj_Bool_RetVoid, j F, v)) #ifdef FEATURE_COMINTEROP DEFINE_METASIG(SM(Obj_RetStr, j, s)) #endif // FEATURE_COMINTEROP -#ifdef FEATURE_REMOTING -DEFINE_METASIG_T(IM(Str_BindingFlags_Obj_ArrInt_RefMessageData_RetObj, s g(BINDING_FLAGS) j a(i) r(g(MESSAGE_DATA)), j)) -#endif // FEATURE_REMOTING DEFINE_METASIG_T(IM(Obj_Obj_BindingFlags_Binder_CultureInfo_RetVoid, j j g(BINDING_FLAGS) C(BINDER) C(CULTURE_INFO), v)) DEFINE_METASIG_T(IM(Obj_Obj_BindingFlags_Binder_ArrObj_CultureInfo_RetVoid, j j g(BINDING_FLAGS) C(BINDER) a(j) C(CULTURE_INFO), v)) DEFINE_METASIG_T(IM(Obj_BindingFlags_Binder_ArrObj_CultureInfo_RetObj, j g(BINDING_FLAGS) C(BINDER) a(j) C(CULTURE_INFO), j)) diff --git a/src/vm/method.cpp b/src/vm/method.cpp index 135787257b..bfd9c73e32 100644 --- a/src/vm/method.cpp +++ b/src/vm/method.cpp @@ -12,9 +12,6 @@ #include "common.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "security.h" #include "verifier.hpp" #include "excep.h" @@ -946,29 +943,6 @@ BOOL MethodDesc::IsTightlyBoundToMethodTable() #ifndef DACCESS_COMPILE -#if defined(FEATURE_REMOTING) && !defined(HAS_REMOTING_PRECODE) -//******************************************************************************* -void MethodDesc::Destruct() -{ - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - FORBID_FAULT; - } - CONTRACTL_END - - if (!IsRestored()) - return; - - MethodTable *pMT = GetMethodTable(); - if(pMT->IsMarshaledByRef() || (pMT == g_pObjectClass)) - { - // Destroy the thunk generated to intercept calls for remoting - CRemotingServices::DestroyThunk(this); - } -} -#endif // FEATURE_REMOTING && !HAS_REMOTING_PRECODE //******************************************************************************* HRESULT MethodDesc::Verify(COR_ILMETHOD_DECODER* ILHeader, @@ -2143,13 +2117,6 @@ PCODE MethodDesc::GetSingleCallableAddrOfVirtualizedCode(OBJECTREF *orThis, Type // where we could end up bypassing the remoting system), but it serves // our purpose here (basically pushes our correctly instantiated, // resolved method desc on the stack and calls the remoting code). -#ifdef FEATURE_REMOTING - if (pObjMT->IsTransparentProxy()) - if (IsInterface()) - return CRemotingServices::GetStubForInterfaceMethod(pResultMD); - else - return CRemotingServices::GetNonVirtualEntryPointForVirtualMethod(pResultMD); -#endif return pResultMD->GetSingleCallableAddrOfCode(); } @@ -2201,13 +2168,6 @@ PCODE MethodDesc::GetMultiCallableAddrOfVirtualizedCode(OBJECTREF *orThis, TypeH // where we could end up bypassing the remoting system), but it serves // our purpose here (basically pushes our correctly instantiated, // resolved method desc on the stack and calls the remoting code). -#ifdef FEATURE_REMOTING - if (pObjMT->IsTransparentProxy()) - if (pStaticMD->IsInterface()) - RETURN(CRemotingServices::GetStubForInterfaceMethod(pTargetMD)); - else - RETURN(CRemotingServices::GetNonVirtualEntryPointForVirtualMethod(pTargetMD)); -#endif RETURN(pTargetMD->GetMultiCallableAddrOfCode()); } @@ -2218,12 +2178,6 @@ PCODE MethodDesc::GetMultiCallableAddrOfVirtualizedCode(OBJECTREF *orThis, TypeH RETURN(pTargetMD->GetMultiCallableAddrOfCode()); } -#ifdef FEATURE_REMOTING - if (pObjMT->IsTransparentProxy()) - { - RETURN(pObjMT->GetRestoredSlot(pStaticMD->GetSlot())); - } -#endif // FEATURE_REMOTING pTargetMD = pObjMT->GetMethodDescForSlot(pStaticMD->GetSlot()); @@ -2319,10 +2273,6 @@ PCODE MethodDesc::TryGetMultiCallableAddrOfCode(CORINFO_ACCESS_FLAGS accessFlags if (IsWrapperStub() || IsEnCAddedMethod()) return GetStableEntryPoint(); -#ifdef FEATURE_REMOTING - if (!(accessFlags & CORINFO_ACCESS_THIS) && IsRemotingInterceptedViaVirtualDispatch()) - return CRemotingServices::GetNonVirtualEntryPointForVirtualMethod(this); -#endif // For EnC always just return the stable entrypoint so we can update the code if (IsEnCMethod()) @@ -2434,19 +2384,6 @@ MethodDesc* Entry2MethodDesc(PCODE entryPoint, MethodTable *pMT) if (pMD != NULL) RETURN(pMD); -#ifdef FEATURE_REMOTING - -#ifndef HAS_REMOTING_PRECODE - pMD = CNonVirtualThunkMgr::Entry2MethodDesc(entryPoint, pMT); - if (pMD != NULL) - RETURN(pMD); -#endif // HAS_REMOTING_PRECODE - - pMD = CVirtualThunkMgr::Entry2MethodDesc(entryPoint, pMT); - if (pMD != NULL) - RETURN(pMD); - -#endif // FEATURE_REMOTING // Is it an FCALL? pMD = ECall::MapTargetBackToMethod(entryPoint); @@ -2767,31 +2704,6 @@ BOOL MethodDesc::RequiresMethodDescCallingConvention(BOOL fEstimateForChunk /*=F if (IsNDirect() || IsComPlusCall() || IsGenericComPlusCall()) return TRUE; -#ifdef FEATURE_REMOTING - MethodTable * pMT = GetMethodTable(); - - if (fEstimateForChunk) - { - // Make a best guess based on the method table of the chunk. - if (pMT->IsInterface()) - return TRUE; - } - else - { - // CRemotingServices::GetDispatchInterfaceHelper that needs method desc - if (pMT->IsInterface() && !IsStatic()) - return TRUE; - - // Asynchronous delegate methods are forwarded to shared TP stub - if (IsEEImpl()) - { - DelegateEEClass *pClass = (DelegateEEClass*)(pMT->GetClass()); - - if (this != pClass->m_pInvokeMethod) - return TRUE; - } - } -#endif // FEATURE_REMOTING return FALSE; } @@ -2877,60 +2789,6 @@ BOOL MethodDesc::IsClassConstructorTriggeredViaPrestub() #endif // !DACCESS_COMPILE -#ifdef FEATURE_REMOTING - -//******************************************************************************* -BOOL MethodDesc::MayBeRemotingIntercepted() -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - } - CONTRACTL_END; - - if (IsStatic()) - return FALSE; - - MethodTable *pMT = GetMethodTable(); - - if (pMT->IsMarshaledByRef()) - return TRUE; - - if (g_pObjectClass == pMT) - { - if ((this == g_pObjectCtorMD) || (this == g_pObjectFinalizerMD)) - return FALSE; - - // Make sure that the above check worked well - _ASSERTE(this->GetSlot() != g_pObjectCtorMD->GetSlot()); - _ASSERTE(this->GetSlot() != g_pObjectFinalizerMD->GetSlot()); - - return TRUE; - } - - return FALSE; -} - -//******************************************************************************* -BOOL MethodDesc::IsRemotingInterceptedViaPrestub() -{ - WRAPPER_NO_CONTRACT; - // We do not insert a remoting stub around the shared code method descriptor - // for instantiated generic methods, i.e. anything which requires a hidden - // instantiation argument. Instead we insert it around the instantiating stubs - // and ensure that we call the instantiating stubs directly. - return MayBeRemotingIntercepted() && !IsVtableMethod() && !RequiresInstArg(); -} - -//******************************************************************************* -BOOL MethodDesc::IsRemotingInterceptedViaVirtualDispatch() -{ - WRAPPER_NO_CONTRACT; - return MayBeRemotingIntercepted() && IsVtableMethod(); -} - -#endif // FEATURE_REMOTING //******************************************************************************* BOOL MethodDesc::MayHaveNativeCode() diff --git a/src/vm/method.hpp b/src/vm/method.hpp index c62c3c0827..bbcb012d54 100644 --- a/src/vm/method.hpp +++ b/src/vm/method.hpp @@ -797,24 +797,6 @@ public: //================================================================ // Does it represent a one way method call with no out/return parameters? -#ifdef FEATURE_REMOTING - inline BOOL IsOneWay() - { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END - - return (S_OK == GetMDImport()->GetCustomAttributeByName(GetMemberDef(), - "System.Runtime.Remoting.Messaging.OneWayAttribute", - NULL, - NULL)); - - } -#endif // FEATURE_REMOTING //================================================================ // FCalls. @@ -2930,12 +2912,7 @@ struct ComPlusCallInfo kHasCopyCtorArgs = 0x4, }; -#if defined(FEATURE_REMOTING) && !defined(HAS_REMOTING_PRECODE) - // These two fields cannot overlap in this case because of AMD64 GenericComPlusCallStub uses m_pILStub on the COM event provider path - struct -#else union -#endif { // IL stub for CLR to COM call PCODE m_pILStub; diff --git a/src/vm/method.inl b/src/vm/method.inl index d668216243..cdd137b84b 100644 --- a/src/vm/method.inl +++ b/src/vm/method.inl @@ -152,7 +152,6 @@ inline void MethodDesc::SetupGenericComPlusCall() } #endif // FEATURE_COMINTEROP -#ifndef FEATURE_REMOTING inline BOOL MethodDesc::MayBeRemotingIntercepted() { @@ -172,7 +171,6 @@ inline BOOL MethodDesc::IsRemotingInterceptedViaVirtualDispatch() return FALSE; } -#endif // FEATURE_REMOTING #ifdef FEATURE_COMINTEROP diff --git a/src/vm/methodtable.cpp b/src/vm/methodtable.cpp index 44f047e528..7a74642b1b 100644 --- a/src/vm/methodtable.cpp +++ b/src/vm/methodtable.cpp @@ -40,9 +40,6 @@ #include "eventtrace.h" #include "fieldmarshaler.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "eeprofinterfaces.h" #include "dllimportcallback.h" @@ -76,9 +73,6 @@ #include "genericdict.h" #include "typestring.h" #include "typedesc.h" -#ifdef FEATURE_REMOTING -#include "crossdomaincalls.h" -#endif #include "array.h" #ifdef FEATURE_INTERPRETER @@ -623,7 +617,7 @@ void MethodTable::SetComObjectType() #endif // FEATURE_COMINTEROP -#if defined(FEATURE_TYPEEQUIVALENCE) || defined(FEATURE_REMOTING) +#if defined(FEATURE_TYPEEQUIVALENCE) void MethodTable::SetHasTypeEquivalence() { LIMITED_METHOD_CONTRACT; @@ -967,56 +961,6 @@ MethodTable* CreateMinimalMethodTable(Module* pContainingModule, return pMT; } -#ifdef FEATURE_REMOTING -//========================================================================================== -void MethodTable::SetupRemotableMethodInfo(AllocMemTracker *pamTracker) -{ - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END; - // Make RMI for a method table. - CrossDomainOptimizationInfo *pRMIBegin = NULL; - if (GetNumMethods() > 0) - { - SIZE_T requiredSize = CrossDomainOptimizationInfo::SizeOf(GetNumVtableSlots()); - pRMIBegin = (CrossDomainOptimizationInfo*) pamTracker->Track(GetLoaderAllocator()->GetLowFrequencyHeap()->AllocMem(S_SIZE_T(requiredSize))); - _ASSERTE(IS_ALIGNED(pRMIBegin, sizeof(void*))); - } - *(GetRemotableMethodInfoPtr()) = pRMIBegin; -} - -//========================================================================================== -PTR_RemotingVtsInfo MethodTable::AllocateRemotingVtsInfo(AllocMemTracker *pamTracker, DWORD dwNumFields) -{ - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END; - - // Size the data structure to contain enough bit flags for all the - // instance fields. - DWORD cbInfo = RemotingVtsInfo::GetSize(dwNumFields); - RemotingVtsInfo *pInfo = (RemotingVtsInfo*)pamTracker->Track(GetLoaderAllocator()->GetLowFrequencyHeap()->AllocMem(S_SIZE_T(cbInfo))); - - // Note: Memory allocated on loader heap is zero filled - // ZeroMemory(pInfo, cbInfo); - -#ifdef _DEBUG - pInfo->m_dwNumFields = dwNumFields; -#endif - - *(GetRemotingVtsInfoPtr()) = pInfo; - - return pInfo; -} -#endif // FEATURE_REMOTING #ifdef FEATURE_COMINTEROP #ifndef CROSSGEN_COMPILE @@ -4287,25 +4231,6 @@ void MethodTable::Save(DataImage *image, DWORD profilingFlags) } #endif // FEATURE_COMINTEROP -#ifdef FEATURE_REMOTING - if (HasRemotableMethodInfo()) - { - if (GetNumMethods() > 0) - { - // The CrossDomainOptimizationInfo was populated earlier in Module::PrepareTypesForSave - CrossDomainOptimizationInfo* pRMI = GetRemotableMethodInfo(); - SIZE_T sizeToBeSaved = CrossDomainOptimizationInfo::SizeOf(this); - image->StoreStructure(pRMI, sizeToBeSaved, - DataImage::ITEM_CROSS_DOMAIN_INFO); - } - } - - // Store any optional VTS (Version Tolerant Serialization) info. - if (HasRemotingVtsInfo()) - image->StoreStructure(GetRemotingVtsInfo(), - RemotingVtsInfo::GetSize(GetNumIntroducedInstanceFields()), - DataImage::ITEM_VTS_INFO); -#endif //FEATURE_REMOTING #ifdef _DEBUG if (GetDebugClassName() != NULL && !image->IsStored(GetDebugClassName())) @@ -4451,19 +4376,6 @@ void MethodTable::Save(DataImage *image, DWORD profilingFlags) // MethodTable WriteableData -#ifdef FEATURE_REMOTING - // Store any context static info. - if (HasContextStatics()) - { - DataImage::ItemKind kindWriteable = DataImage::ITEM_METHOD_TABLE_DATA_COLD_WRITEABLE; - if ((profilingFlags & (1 << WriteMethodTableWriteableData)) != 0) - kindWriteable = DataImage::ITEM_METHOD_TABLE_DATA_HOT_WRITEABLE; - - image->StoreStructure(GetContextStaticsBucket(), - sizeof(ContextStaticsBucket), - kindWriteable); - } -#endif // FEATURE_REMOTING PTR_Const_MethodTableWriteableData pWriteableData = GetWriteableData_NoLogging(); _ASSERTE(pWriteableData != NULL); @@ -4927,27 +4839,6 @@ void MethodTable::Fixup(DataImage *image) } #endif // FEATURE_COMINTEROP -#ifdef FEATURE_REMOTING - if (HasRemotableMethodInfo()) - { - CrossDomainOptimizationInfo **pRMI = GetRemotableMethodInfoPtr(); - if (*pRMI != NULL) - { - image->FixupPointerField(this, (BYTE *)pRMI - (BYTE *)this); - } - } - - // Optional VTS (Version Tolerant Serialization) fixups. - if (HasRemotingVtsInfo()) - { - RemotingVtsInfo **ppVtsInfo = GetRemotingVtsInfoPtr(); - image->FixupPointerField(this, (BYTE *)ppVtsInfo - (BYTE *)this); - - RemotingVtsInfo *pVtsInfo = *ppVtsInfo; - for (DWORD i = 0; i < RemotingVtsInfo::VTS_NUM_CALLBACK_TYPES; i++) - image->FixupMethodDescPointer(pVtsInfo, &pVtsInfo->m_pCallbacks[i]); - } -#endif //FEATURE_REMOTING // // Fix flags @@ -5174,16 +5065,6 @@ void MethodTable::Fixup(DataImage *image) _ASSERTE(!NeedsCrossModuleGenericsStaticsInfo()); } -#ifdef FEATURE_REMOTING - if (HasContextStatics()) - { - ContextStaticsBucket **ppInfo = GetContextStaticsBucketPtr(); - image->FixupPointerField(this, (BYTE *)ppInfo - (BYTE *)this); - - ContextStaticsBucket *pNewInfo = (ContextStaticsBucket*)image->GetImagePointer(*ppInfo); - pNewInfo->m_dwContextStaticsOffset = (DWORD)-1; - } -#endif // FEATURE_REMOTING LOG((LF_ZAP, LL_INFO10000, "MethodTable::Fixup %s (%p) complete\n", GetDebugClassName(), this)); @@ -6253,9 +6134,6 @@ MethodTable* MethodTable::GetComPlusParentMethodTable() // Skip over System.__ComObject, expect System.MarshalByRefObject pParent=pParent->GetParentMethodTable(); _ASSERTE(pParent != NULL); -#ifdef FEATURE_REMOTING - _ASSERTE(pParent->IsMarshaledByRef()); -#endif _ASSERTE(pParent->GetParentMethodTable() != NULL); _ASSERTE(pParent->GetParentMethodTable() == g_pObjectClass); } @@ -9736,44 +9614,6 @@ LPCWSTR MethodTable::GetPathForErrorMessages() } } -#ifdef FEATURE_REMOTING -//========================================================================================== -// context static functions -void MethodTable::SetupContextStatics(AllocMemTracker *pamTracker, WORD wContextStaticsSize) -{ - STANDARD_VM_CONTRACT; - - ContextStaticsBucket* pCSInfo = (ContextStaticsBucket*) pamTracker->Track(GetLoaderAllocator()->GetLowFrequencyHeap()->AllocMem(S_SIZE_T(sizeof(ContextStaticsBucket)))); - *(GetContextStaticsBucketPtr()) = pCSInfo; - - pCSInfo->m_dwContextStaticsOffset = (DWORD)-1; // Initialized lazily - pCSInfo->m_wContextStaticsSize = wContextStaticsSize; -} - -#ifndef CROSSGEN_COMPILE -//========================================================================================== -DWORD MethodTable::AllocateContextStaticsOffset() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - g_IBCLogger.LogMethodTableWriteableDataWriteAccess(this); - - BaseDomain* pDomain = IsDomainNeutral() ? SystemDomain::System() : GetDomain(); - - ContextStaticsBucket* pCSInfo = GetContextStaticsBucket(); - DWORD* pOffsetSlot = &pCSInfo->m_dwContextStaticsOffset; - - return pDomain->AllocateContextStaticsOffset(pOffsetSlot); -} -#endif // CROSSGEN_COMPILE - -#endif // FEATURE_REMOTING bool MethodTable::ClassRequiresUnmanagedCodeCheck() { diff --git a/src/vm/methodtable.h b/src/vm/methodtable.h index 529145a726..6e04b8a783 100644 --- a/src/vm/methodtable.h +++ b/src/vm/methodtable.h @@ -59,10 +59,6 @@ class Object; class Stub; class Substitution; class TypeHandle; -#ifdef FEATURE_REMOTING -class CrossDomainOptimizationInfo; -typedef DPTR(CrossDomainOptimizationInfo) PTR_CrossDomainOptimizationInfo; -#endif class Dictionary; class AllocMemTracker; class SimpleRWLock; @@ -878,7 +874,7 @@ public: // mark the class type as COM object class void SetComObjectType(); -#if defined(FEATURE_TYPEEQUIVALENCE) || defined(FEATURE_REMOTING) +#if defined(FEATURE_TYPEEQUIVALENCE) // mark the type as opted into type equivalence void SetHasTypeEquivalence(); #endif @@ -1963,43 +1959,6 @@ public: // The following service adjusts a MethodTable based on the supplied instance. As // we add new thunking layers, we just need to teach this service how to navigate // through them. -#ifdef FEATURE_REMOTING - inline BOOL IsTransparentProxy() - { - LIMITED_METHOD_DAC_CONTRACT; - return GetFlag(enum_flag_Category_Mask) == enum_flag_Category_TransparentProxy; - } - inline void SetTransparentProxy() - { - LIMITED_METHOD_CONTRACT; - _ASSERTE(GetFlag(enum_flag_Category_Mask) == 0); - SetFlag(enum_flag_Category_TransparentProxy); - } - - inline BOOL IsMarshaledByRef() - { - LIMITED_METHOD_DAC_CONTRACT; - return GetFlag(enum_flag_Category_MarshalByRef_Mask) == enum_flag_Category_MarshalByRef; - } - inline void SetMarshaledByRef() - { - LIMITED_METHOD_CONTRACT; - _ASSERTE(GetFlag(enum_flag_Category_Mask) == 0); - SetFlag(enum_flag_Category_MarshalByRef); - } - - inline BOOL IsContextful() - { - LIMITED_METHOD_DAC_CONTRACT; - return GetFlag(enum_flag_Category_Mask) == enum_flag_Category_Contextful; - } - inline void SetIsContextful() - { - LIMITED_METHOD_CONTRACT; - _ASSERTE(GetFlag(enum_flag_Category_Mask) == 0); - SetFlag(enum_flag_Category_Contextful); - } -#else // FEATURE_REMOTING inline BOOL IsTransparentProxy() { return FALSE; @@ -2014,7 +1973,6 @@ public: { return FALSE; } -#endif // FEATURE_REMOTING inline bool RequiresFatDispatchTokens() { @@ -2974,39 +2932,6 @@ public: //------------------------------------------------------------------- // REMOTEABLE METHOD INFO // -#ifdef FEATURE_REMOTING - BOOL HasRemotableMethodInfo(); - - PTR_CrossDomainOptimizationInfo GetRemotableMethodInfo() - { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - SO_TOLERANT; - MODE_ANY; - } - CONTRACTL_END; - _ASSERTE(HasRemotableMethodInfo()); - return *GetRemotableMethodInfoPtr(); - } - void SetupRemotableMethodInfo(AllocMemTracker *pamTracker); - - //------------------------------------------------------------------- - // REMOTING VTS INFO - // - // This optional addition to MethodTables allows us to locate VTS (Version - // Tolerant Serialization) event callback methods and optionally - // serializable fields quickly. We also store the NotSerialized field - // information in here so remoting can avoid one more touch of the metadata - // during cross appdomain cloning. - // - - void SetHasRemotingVtsInfo(); - BOOL HasRemotingVtsInfo(); - PTR_RemotingVtsInfo GetRemotingVtsInfo(); - PTR_RemotingVtsInfo AllocateRemotingVtsInfo( AllocMemTracker *pamTracker, DWORD dwNumFields); -#endif // FEATURE_REMOTING #ifdef FEATURE_COMINTEROP void SetHasGuidInfo(); @@ -3150,9 +3075,6 @@ public: inline DWORD GetAttrClass(); inline BOOL IsSerializable(); -#ifdef FEATURE_REMOTING - inline BOOL CannotBeBlittedByObjectCloner(); -#endif inline BOOL HasFieldsWhichMustBeInited(); inline BOOL SupportsAutoNGen(); inline BOOL RunCCTorAsIfNGenImageExists(); @@ -3871,9 +3793,6 @@ private: enum_flag_GenericsMask_SharedInst = 0x00000020, // shared instantiation, e.g. List<__Canon> or List<MyValueType<__Canon>> enum_flag_GenericsMask_TypicalInst = 0x00000030, // the type instantiated at its formal parameters, e.g. List<T> -#ifdef FEATURE_REMOTING - enum_flag_ContextStatic = 0x00000040, -#endif enum_flag_HasRemotingVtsInfo = 0x00000080, // Optional data present indicating VTS methods and optional fields enum_flag_HasVariance = 0x00000100, // This is an instantiated type some of whose type parameters are co or contra-variant @@ -3914,9 +3833,6 @@ private: enum_flag_StringArrayValues = SET_TRUE(enum_flag_StaticsMask_NonDynamic) | SET_FALSE(enum_flag_NotInPZM) | SET_TRUE(enum_flag_GenericsMask_NonGeneric) | -#ifdef FEATURE_REMOTING - SET_FALSE(enum_flag_ContextStatic) | -#endif SET_FALSE(enum_flag_HasVariance) | SET_FALSE(enum_flag_HasDefaultCtor) | SET_FALSE(enum_flag_HasPreciseInitCctors), @@ -4249,14 +4165,7 @@ private: #define METHODTABLE_COMINTEROP_OPTIONAL_MEMBERS() #endif -#ifdef FEATURE_REMOTING -#define METHODTABLE_REMOTING_OPTIONAL_MEMBERS() \ - METHODTABLE_OPTIONAL_MEMBER(RemotingVtsInfo, PTR_RemotingVtsInfo, GetRemotingVtsInfoPtr ) \ - METHODTABLE_OPTIONAL_MEMBER(RemotableMethodInfo, PTR_CrossDomainOptimizationInfo,GetRemotableMethodInfoPtr ) \ - METHODTABLE_OPTIONAL_MEMBER(ContextStatics, PTR_ContextStaticsBucket, GetContextStaticsBucketPtr ) -#else #define METHODTABLE_REMOTING_OPTIONAL_MEMBERS() -#endif enum OptionalMemberId { @@ -4368,25 +4277,6 @@ private: ************************************/ public: -#ifdef FEATURE_REMOTING - inline BOOL HasContextStatics(); - inline void SetHasContextStatics(); - - inline PTR_ContextStaticsBucket GetContextStaticsBucket() - { - LIMITED_METHOD_DAC_CONTRACT; - _ASSERTE(HasContextStatics()); - PTR_ContextStaticsBucket pBucket = *GetContextStaticsBucketPtr(); - _ASSERTE(pBucket != NULL); - return pBucket; - } - - inline DWORD GetContextStaticsOffset(); - inline WORD GetContextStaticsSize(); - - void SetupContextStatics(AllocMemTracker *pamTracker, WORD dwContextStaticsSize); - DWORD AllocateContextStaticsOffset(); -#endif BOOL Validate (); diff --git a/src/vm/methodtable.inl b/src/vm/methodtable.inl index cf79ffe2e0..c762512bf1 100644 --- a/src/vm/methodtable.inl +++ b/src/vm/methodtable.inl @@ -346,14 +346,6 @@ inline BOOL MethodTable::SupportsGenericInterop(TypeHandle::InteropKind interopK #endif // FEATURE_COMINTEROP } -#ifdef FEATURE_REMOTING -//========================================================================================== -inline BOOL MethodTable::CannotBeBlittedByObjectCloner() -{ - WRAPPER_NO_CONTRACT; - return GetClass()->CannotBeBlittedByObjectCloner(); -} -#endif //========================================================================================== inline BOOL MethodTable::IsNotTightlyPacked() @@ -395,35 +387,6 @@ inline BOOL MethodTable::IsAbstract() } //========================================================================================== -#ifdef FEATURE_REMOTING -inline BOOL MethodTable::HasRemotableMethodInfo() -{ - WRAPPER_NO_CONTRACT; - return (IsMarshaledByRef() || IsInterface() || this == g_pObjectClass || g_pObjectClass == NULL) && IsCanonicalMethodTable(); -} - -//========================================================================================== -inline void MethodTable::SetHasRemotingVtsInfo() -{ - LIMITED_METHOD_CONTRACT; - SetFlag(enum_flag_HasRemotingVtsInfo); -} - -//========================================================================================== -inline BOOL MethodTable::HasRemotingVtsInfo() -{ - LIMITED_METHOD_DAC_CONTRACT; - return GetFlag(enum_flag_HasRemotingVtsInfo); -} - -//========================================================================================== -inline PTR_RemotingVtsInfo MethodTable::GetRemotingVtsInfo() -{ - WRAPPER_NO_CONTRACT; - _ASSERTE(HasRemotingVtsInfo()); - return *GetRemotingVtsInfoPtr(); -} -#endif // FEATURE_REMOTING #ifdef FEATURE_COMINTEROP //========================================================================================== @@ -529,14 +492,7 @@ inline BOOL MethodTable::IsFieldNotSerialized(DWORD dwFieldIndex) { LIMITED_METHOD_CONTRACT; _ASSERTE(IsSerializable()); -#ifdef FEATURE_REMOTING - if (!HasRemotingVtsInfo()) - return FALSE; - - return GetRemotingVtsInfo()->IsNotSerialized(dwFieldIndex); -#else return FALSE; -#endif } //========================================================================================== @@ -544,14 +500,7 @@ inline BOOL MethodTable::IsFieldOptionallySerialized(DWORD dwFieldIndex) { LIMITED_METHOD_CONTRACT; _ASSERTE(IsSerializable()); -#ifdef FEATURE_REMOTING - if (!HasRemotingVtsInfo()) - return FALSE; - - return GetRemotingVtsInfo()->IsOptionallySerialized(dwFieldIndex); -#else return FALSE; -#endif } //========================================================================================== @@ -1633,35 +1582,6 @@ inline OBJECTREF MethodTable::AllocateNoChecks() return AllocateObject(this); } -#ifdef FEATURE_REMOTING -//========================================================================================== -inline BOOL MethodTable::HasContextStatics() -{ - LIMITED_METHOD_DAC_CONTRACT; - return GetFlag(enum_flag_ContextStatic); -} - -//========================================================================================== -inline void MethodTable::SetHasContextStatics() -{ - LIMITED_METHOD_CONTRACT; - SetFlag(enum_flag_ContextStatic); -} - -//========================================================================================== -inline DWORD MethodTable::GetContextStaticsOffset() -{ - LIMITED_METHOD_DAC_CONTRACT; - return GetContextStaticsBucket()->m_dwContextStaticsOffset; -} - -//========================================================================================== -inline WORD MethodTable::GetContextStaticsSize() -{ - LIMITED_METHOD_DAC_CONTRACT; - return GetContextStaticsBucket()->m_wContextStaticsSize; -} -#endif // FEATURE_REMOTING //========================================================================================== inline DWORD MethodTable::GetClassIndex() diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp index 5b40131aa5..fbf9246db5 100644 --- a/src/vm/methodtablebuilder.cpp +++ b/src/vm/methodtablebuilder.cpp @@ -24,9 +24,6 @@ #include "security.h" #include "customattribute.h" -#ifdef FEATURE_REMOTING -#include "objectclone.h" -#endif #ifdef FEATURE_COMINTEROP #endif @@ -1796,16 +1793,6 @@ MethodTableBuilder::BuildMethodTableThrowing( VerifySelfReferencingStaticValueTypeFields_WithRVA(pByValueClassCache); } -#ifdef FEATURE_REMOTING - // If the class is serializable we scan it for VTS (Version Tolerant - // Serialization) event methods or NotSerialized or OptionalField - // fields. Any such info found will be attached to the method as - // optional data later. - if (IsTdSerializable(GetAttrClass())) - { - ScanTypeForVtsInfo(); - } -#endif // FEATURE_REMOTING // Now setup the method table @@ -1939,19 +1926,6 @@ MethodTableBuilder::BuildMethodTableThrowing( // // if there are context or thread static set the info in the method table optional members // -#ifdef FEATURE_REMOTING - DWORD contextStaticsSize = bmtCSInfo->dwContextStaticsSize; - if (contextStaticsSize != 0) - { - if (!FitsIn<WORD>(contextStaticsSize)) - { - BuildMethodTableThrowException(IDS_EE_TOOMANYFIELDS); - } - - // this is responsible for setting the flag and allocation in the loader heap - pMT->SetupContextStatics(GetMemTracker(), (WORD)contextStaticsSize); - } -#endif // !FEATURE_REMOTING if (!bmtProp->fNoSanityChecks) { @@ -1968,27 +1942,6 @@ MethodTableBuilder::BuildMethodTableThrowing( } // Check for the RemotingProxy Attribute -#ifdef FEATURE_REMOTING - if (IsContextful()) - { - PREFIX_ASSUME(g_pObjectClass != NULL); - // Skip mscorlib marshal-by-ref classes since they all - // are assumed to have the default proxy attribute - if (pModule != g_pObjectClass->GetModule()) - { - CONTRACT_VIOLATION(LoadsTypeViolation); // This api can cause the ProxyAttribute class to be loaded. - CheckForRemotingProxyAttrib(); - } - } - - if (IsContextful() || HasRemotingProxyAttribute()) - { - // Contextful and classes that have a remoting proxy attribute - // (whether they are MarshalByRef or ContextFul) always take the slow - // path of managed activation - pMT->SetRequiresManagedActivation(); - } -#endif // FEATURE_REMOTING // structs with GC poitners MUST be pointer sized aligned because the GC assumes it if (IsValueClass() && pMT->ContainsPointers() && (bmtFP->NumInstanceFieldBytes % sizeof(void*) != 0)) { @@ -2043,11 +1996,6 @@ MethodTableBuilder::BuildMethodTableThrowing( } #endif // _DEBUG -#ifdef FEATURE_REMOTING - // Make sure the object cloner won't attempt to blit types that aren't serializable. - if (!IsTdSerializable(GetAttrClass()) && !IsEnum()) - SetCannotBeBlittedByObjectCloner(); -#endif //If this is a value type, then propagate the UnsafeValueTypeAttribute from //its instance members to this type. @@ -2151,22 +2099,6 @@ MethodTableBuilder::BuildMethodTableThrowing( #pragma warning(pop) #endif -#ifdef FEATURE_REMOTING -BOOL -IsSerializerRelatedInterface(MethodTable *pItfMT) -{ - STANDARD_VM_CONTRACT; - - if (MscorlibBinder::IsClass(pItfMT, CLASS__ISERIALIZABLE)) - return TRUE; - if (MscorlibBinder::IsClass(pItfMT, CLASS__IOBJECTREFERENCE)) - return TRUE; - if (MscorlibBinder::IsClass(pItfMT, CLASS__IDESERIALIZATIONCB)) - return TRUE; - - return FALSE; -} -#endif //--------------------------------------------------------------------------------------- // @@ -2190,15 +2122,6 @@ MethodTableBuilder::ResolveInterfaces( // resolve unresolved interfaces and determine the size of the largest interface (in # slots) -#ifdef FEATURE_REMOTING // code for objectcloner - // First look through the interfaces explicitly declared by this class - for (DWORD i = 0; i < cBuildingInterfaceList; i++) - { - MethodTable *pInterface = pBuildingInterfaceList[i].m_pMethodTable; - if (IsSerializerRelatedInterface(pInterface)) - SetCannotBeBlittedByObjectCloner(); - } -#endif // FEATURE_REMOTING // code for objectcloner LoadApproxInterfaceMap(); @@ -2216,12 +2139,6 @@ MethodTableBuilder::ResolveInterfaces( { SetHasFieldsWhichMustBeInited(); } -#ifdef FEATURE_REMOTING - if (pParentClass->CannotBeBlittedByObjectCloner()) - { - SetCannotBeBlittedByObjectCloner(); - } -#endif #ifdef FEATURE_READYTORUN if (!(IsValueClass() || (pParentClass == g_pObjectClass))) { @@ -2785,12 +2702,6 @@ MethodTableBuilder::EnumerateClassMethods() numGenericMethodArgs = hEnumTyPars.EnumGetCount(); // We do not want to support context-bound objects with generic methods. -#ifdef FEATURE_REMOTING - if (IsContextful() && numGenericMethodArgs > 0) - { - BuildMethodTableThrowException(IDS_CLASSLOAD_CONTEXT_BOUND_GENERIC_METHOD); - } -#endif // FEATURE_REMOTING if (numGenericMethodArgs != 0) { @@ -3841,9 +3752,6 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, DWORD dwCurrentStaticField = 0; DWORD dwCurrentThreadStaticField = 0; -#ifdef FEATURE_REMOTING - DWORD dwContextStaticsOffset = 0; -#endif DWORD dwR8Fields = 0; // Number of R8's the class has @@ -3883,11 +3791,7 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, MethodTable * pByValueClass = NULL; BOOL fIsByValue = FALSE; BOOL fIsThreadStatic = FALSE; -#ifdef FEATURE_REMOTING - BOOL fIsContextStatic = FALSE; -#else static const BOOL fIsContextStatic = FALSE; -#endif BOOL fHasRVA = FALSE; MetaSig fsig(pMemberSignature, @@ -3924,16 +3828,6 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, fIsThreadStatic = TRUE; } -#ifdef FEATURE_REMOTING - hr = pInternalImport->GetCustomAttributeByName(bmtMetaData->pFields[i], - g_ContextStaticAttributeClassName, - NULL, NULL); - IfFailThrow(hr); - if (hr == S_OK) - { - fIsContextStatic = TRUE; - } -#endif // FEATURE_REMOTING if (ElementType == ELEMENT_TYPE_VALUETYPE) { @@ -3950,12 +3844,6 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, // Do some sanity checks that we are not mixing context and thread // relative statics. -#ifdef FEATURE_REMOTING - if (fIsThreadStatic && fIsContextStatic) - { - IfFailThrow(COR_E_TYPELOAD); - } -#endif if (fHasRVA && (fIsThreadStatic || fIsContextStatic)) { IfFailThrow(COR_E_TYPELOAD); @@ -4236,10 +4124,6 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, SetHasNonPublicFields(); if (pFieldClass->HasFieldsWhichMustBeInited()) SetHasFieldsWhichMustBeInited(); -#ifdef FEATURE_REMOTING - if (pFieldClass->CannotBeBlittedByObjectCloner()) - SetCannotBeBlittedByObjectCloner(); -#endif #ifdef FEATURE_READYTORUN if (!(pByValueClass->IsTruePrimitive() || pByValueClass->IsEnum())) @@ -4531,18 +4415,6 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, if (fIsByValue) bmtFP->NumThreadStaticGCBoxedFields++; } -#ifdef FEATURE_REMOTING - else if (fIsContextStatic) - { - DWORD size = 1 << dwLog2FieldSize; - - dwContextStaticsOffset = (DWORD)ALIGN_UP(dwContextStaticsOffset, size); - - IfFailThrow(pFD->SetOffset(dwContextStaticsOffset)); // offset is the bucket index - - dwContextStaticsOffset += size; - } -#endif // FEATURE_REMOTING else { bmtFP->NumRegularStaticFieldsOfSize[dwLog2FieldSize]++; @@ -4623,12 +4495,6 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, } #endif // FEATURE_DOUBLE_ALIGNMENT_HINT -#ifdef FEATURE_REMOTING - if (pbmtCSInfo) - { - pbmtCSInfo->dwContextStaticsSize = dwContextStaticsOffset; - } -#endif //======================================================================== // END: @@ -7165,13 +7031,6 @@ MethodTableBuilder::NeedsNativeCodeSlot(bmtMDMethod * pMDMethod) { LIMITED_METHOD_CONTRACT; -#ifdef FEATURE_REMOTING - // Approximation of code:MethodDesc::IsRemotingInterceptedViaPrestub - if (MayBeRemotingIntercepted(pMDMethod) && !IsMdVirtual(pMDMethod->GetDeclAttrs())) - { - return TRUE; - } -#endif return GetModule()->IsEditAndContinueEnabled(); } @@ -7182,11 +7041,7 @@ MethodTableBuilder::MayBeRemotingIntercepted(bmtMDMethod * pMDMethod) { LIMITED_METHOD_CONTRACT; -#ifdef FEATURE_REMOTING - return (IsMarshaledByRef() || g_pObjectClass == NULL) && !IsMdStatic(pMDMethod->GetDeclAttrs()); -#else return FALSE; -#endif } //******************************************************************************* @@ -9904,267 +9759,6 @@ void MethodTableBuilder::InterfaceAmbiguityCheck(bmtInterfaceAmbiguityCheckInfo InterfacesAmbiguityCheck(bmtCheckInfo,pIntf->GetModule(),pIntf->GetCl(),pItfSubstChain); } -#ifdef FEATURE_REMOTING // affects only remoting-related info -//******************************************************************************* -// Private helper method used by the code below to check whether the given -// method is annotated to be a VTS event callback. -BOOL MethodTableBuilder::CheckForVtsEventMethod(IMDInternalImport *pImport, - MethodDesc *pMD, - DWORD dwAttrs, - LPCUTF8 szAttrName, - MethodDesc **ppMethodDesc) -{ - STANDARD_VM_CONTRACT; - - // For each method with an attriubte we need to check that: - // o The method is not static, virtual, abstract or generic. - // o The signature is correct. - // o No other method on the same type is marked with the same - // attribute. - - if (pImport->GetCustomAttributeByName(pMD->GetMemberDef(), - szAttrName, - NULL, - NULL) == S_OK) - { - if (IsMdStatic(dwAttrs) || - IsMdVirtual(dwAttrs) || - IsMdAbstract(dwAttrs) || - pMD->IsGenericMethodDefinition()) - { - BuildMethodTableThrowException(IDS_CLASSLOAD_INVALID_VTS_METHOD, pMD->GetMemberDef()); - } - - // Check whether we've seen one of these methods before. - if (*ppMethodDesc != NULL) - { - BuildMethodTableThrowException(IDS_CLASSLOAD_TOO_MANY_VTS_METHODS, szAttrName); - } - - // Check the signature, it should be "void M(StreamingContext)". - DWORD cbSig; - PCCOR_SIGNATURE pSig; - if (FAILED(pImport->GetSigOfMethodDef(pMD->GetMemberDef(), &cbSig, &pSig))) - { - BuildMethodTableThrowException(IDS_CLASSLOAD_BADFORMAT); - } - - // Should be an instance method with no generic type parameters. - if (CorSigUncompressCallingConv(pSig) != IMAGE_CEE_CS_CALLCONV_HASTHIS) - goto BadSignature; - - // Should have one argument. - if (CorSigUncompressData(pSig) != 1) - goto BadSignature; - - // And a return type of void. - if (*pSig++ != (BYTE)ELEMENT_TYPE_VOID) - goto BadSignature; - - // The argument should be a value type. - if (*pSig++ != (BYTE)ELEMENT_TYPE_VALUETYPE) - goto BadSignature; - - // Now the tricky bit: we want to verify the value type is - // StreamingContext, but we don't want to simply load the type since it - // might be any other arbitrary type and cause recursive loading - // problems. SO we manually check the type via the metadata APIs - // instead. - mdToken tkType = CorSigUncompressToken(pSig); - LPCUTF8 szType; - LPCUTF8 szNamespace; - - // Compute type name and namespace. - if (TypeFromToken(tkType) == mdtTypeDef) - { - if (FAILED(pImport->GetNameOfTypeDef(tkType, &szType, &szNamespace))) - { - goto BadSignature; - } - } - else - { - _ASSERTE(TypeFromToken(tkType) == mdtTypeRef); - if (FAILED(pImport->GetNameOfTypeRef(tkType, &szNamespace, &szType))) - { - goto BadSignature; - } - } - - // Do the names match? - if (strcmp(szType, g_StreamingContextName) != 0 || - strcmp(szNamespace, g_SerializationNS)) - goto BadSignature; - - // For typedefs we can directly check whether the current module is - // part of mscorlib. For refs we have to dig deeper (into the token - // resolution scope). - if (TypeFromToken(tkType) == mdtTypeDef) - { - if (bmtError->pModule->GetAssembly()->GetManifestModule() != SystemDomain::SystemAssembly()->GetManifestModule()) - goto BadSignature; - } - else - { - // The scope needs to be an assembly ref. - mdToken tkScope; - if (FAILED(pImport->GetResolutionScopeOfTypeRef(tkType, &tkScope))) - { - goto BadSignature; - } - if (TypeFromToken(tkScope) != mdtAssemblyRef) - goto BadSignature; - - // Fetch the name and public key or public key token. - BYTE *pbPublicKeyOrToken; - DWORD cbPublicKeyOrToken; - LPCSTR szAssembly; - DWORD dwAssemblyFlags; - if (FAILED(pImport->GetAssemblyRefProps( - tkScope, - (const void**)&pbPublicKeyOrToken, - &cbPublicKeyOrToken, - &szAssembly, - NULL, // AssemblyMetaDataInternal: we don't care about version, culture etc. - NULL, // Hash value pointer, obsolete information - NULL, // Byte count for above - &dwAssemblyFlags))) - { - goto BadSignature; - } - - // Validate the name. - if (stricmpUTF8(szAssembly, g_psBaseLibraryName) != 0) - goto BadSignature; - - // And the public key or token, whichever was burned into the reference by the compiler. For mscorlib this is the ECMA key or - // token. - if (IsAfPublicKeyToken(dwAssemblyFlags)) - { - if (cbPublicKeyOrToken != sizeof(g_rbNeutralPublicKeyToken) || - memcmp(pbPublicKeyOrToken, g_rbNeutralPublicKeyToken, cbPublicKeyOrToken) != 0) - goto BadSignature; - } - else - { - if (cbPublicKeyOrToken != sizeof(g_rbNeutralPublicKey) || - memcmp(pbPublicKeyOrToken, g_rbNeutralPublicKey, cbPublicKeyOrToken) != 0) - goto BadSignature; - } - } - - // We managed to pass all tests; record this method. - *ppMethodDesc = pMD; - - return TRUE; - } - - return FALSE; - - BadSignature: - BuildMethodTableThrowException(IDS_CLASSLOAD_INVALID_VTS_SIG, pMD->GetMemberDef()); -} - -//******************************************************************************* -// Names of the various VTS custom attributes -#define VTS_ON_SERIALIZING_ATTRIBUTE "System.Runtime.Serialization.OnSerializingAttribute" -#define VTS_ON_SERIALIZED_ATTRIBUTE "System.Runtime.Serialization.OnSerializedAttribute" -#define VTS_ON_DESERIALIZING_ATTRIBUTE "System.Runtime.Serialization.OnDeserializingAttribute" -#define VTS_ON_DESERIALIZED_ATTRIBUTE "System.Runtime.Serialization.OnDeserializedAttribute" -#define VTS_OPTIONAL_FIELD_ATTRIBUTE "System.Runtime.Serialization.OptionalFieldAttribute" - -//******************************************************************************* -// Look for VTS event methods or fields with interesting serialization -// attributes on this type (only called for serializable types). - -VOID MethodTableBuilder::ScanTypeForVtsInfo() -{ - CONTRACTL - { - STANDARD_VM_CHECK; - PRECONDITION(IsTdSerializable(GetAttrClass())); - } - CONTRACTL_END; - - // - // Do not mark System.String as needing vts info. The MethodTable bit used for VtsInfo - // is used for other purpose on System.String, and System.String does need VtsInfo anyway - // because of it is special-cased by the object cloner. - // - if (g_pStringClass == NULL) - { - LPCUTF8 name, nameSpace; - - if (FAILED(GetMDImport()->GetNameOfTypeDef(GetCl(), &name, &nameSpace))) - { - BuildMethodTableThrowException(IDS_CLASSLOAD_BADFORMAT); - } - - if (strcmp(name, g_StringName) == 0 && strcmp(nameSpace, g_SystemNS) == 0) - { - return; - } - } - - DWORD i; - // Scan all the non-virtual, non-abstract, non-generic instance methods for - // one of the special custom attributes indicating a VTS event method. - DeclaredMethodIterator it(*this); - while (it.Next()) - { - if (CheckForVtsEventMethod(GetMDImport(), - it->GetMethodDesc(), - it.Attrs(), - VTS_ON_SERIALIZING_ATTRIBUTE, - &bmtMFDescs->pOnSerializingMethod)) - bmtMFDescs->fNeedsRemotingVtsInfo = true; - - if (CheckForVtsEventMethod(GetMDImport(), - it->GetMethodDesc(), - it.Attrs(), - VTS_ON_SERIALIZED_ATTRIBUTE, - &bmtMFDescs->pOnSerializedMethod)) - bmtMFDescs->fNeedsRemotingVtsInfo = true; - - if (CheckForVtsEventMethod(GetMDImport(), - it->GetMethodDesc(), - it.Attrs(), - VTS_ON_DESERIALIZING_ATTRIBUTE, - &bmtMFDescs->pOnDeserializingMethod)) - bmtMFDescs->fNeedsRemotingVtsInfo = true; - - if (CheckForVtsEventMethod(GetMDImport(), - it->GetMethodDesc(), - it.Attrs(), - VTS_ON_DESERIALIZED_ATTRIBUTE, - &bmtMFDescs->pOnDeserializedMethod)) - bmtMFDescs->fNeedsRemotingVtsInfo = true; - } - - // Scan all the instance fields introduced on this type for NotSerialized or - // OptionalField attributes. - DWORD dwNumIntroducedInstanceFields = bmtEnumFields->dwNumInstanceFields; - FieldDesc *pFieldDescList = GetApproxFieldDescListRaw(); - for (i = 0; i < dwNumIntroducedInstanceFields; i++) - { - FieldDesc *pFD = &pFieldDescList[i]; - DWORD dwFlags; - - if (FAILED(GetMDImport()->GetFieldDefProps(pFD->GetMemberDef(), &dwFlags))) - { - BuildMethodTableThrowException(IDS_CLASSLOAD_BADFORMAT); - } - if (IsFdNotSerialized(dwFlags)) - bmtMFDescs->SetFieldNotSerialized(i, dwNumIntroducedInstanceFields); - - if (GetMDImport()->GetCustomAttributeByName(pFD->GetMemberDef(), - VTS_OPTIONAL_FIELD_ATTRIBUTE, - NULL, - NULL) == S_OK) - bmtMFDescs->SetFieldOptionallySerialized(i, dwNumIntroducedInstanceFields); - } -} -#endif // FEATURE_REMOTING //******************************************************************************* void MethodTableBuilder::CheckForSystemTypes() @@ -10319,15 +9913,6 @@ void MethodTableBuilder::CheckForSystemTypes() // we'll set the bit here. pMT->SetHasCriticalFinalizer(); } -#ifdef FEATURE_REMOTING - else if (strcmp(name, g_TransparentProxyName) == 0 && strcmp(nameSpace, g_ProxiesNS) == 0) - { - pMT->SetTransparentProxy(); - - // This ensures that we take the slow path in JIT_IsInstanceOfClass - pMT->SetHasTypeEquivalence(); - } -#endif // FEATURE_REMOTING #ifdef FEATURE_COMINTEROP else { @@ -10682,15 +10267,9 @@ MethodTableBuilder::SetupMethodTable2( : 0; -#ifdef FEATURE_REMOTING - BOOL fHasContextStatics = (bmtCSInfo) ? (bmtCSInfo->dwContextStaticsSize) : FALSE; - BOOL fNeedsRemotableMethodInfo = (IsMarshaledByRef() || IsInterface() || g_pObjectClass == NULL); - BOOL fNeedsRemotingVtsInfo = bmtMFDescs->fNeedsRemotingVtsInfo; -#else // !FEATURE_REMOTING BOOL fHasContextStatics = FALSE; BOOL fNeedsRemotableMethodInfo=FALSE; BOOL fNeedsRemotingVtsInfo = FALSE; -#endif // !FEATURE_REMOTING #ifdef FEATURE_COLLECTIBLE_TYPES BOOL fCollectible = pLoaderModule->IsCollectible(); @@ -10755,26 +10334,6 @@ MethodTableBuilder::SetupMethodTable2( pMT->SetHasRCWPerTypeData(); #endif // FEATURE_COMINTEROP -#ifdef FEATURE_REMOTING - if (bmtMFDescs->fNeedsRemotingVtsInfo) - pMT->SetHasRemotingVtsInfo(); - - if (fHasContextStatics) - pMT->SetHasContextStatics(); - - if (IsMarshaledByRef()) - { - if (IsContextful()) - { - COUNTER_ONLY(GetPerfCounters().m_Context.cClasses++); - pMT->SetIsContextful(); - } - else - { - pMT->SetMarshaledByRef(); - } - } -#endif // FEATURE_REMOTING if (IsInterface()) pMT->SetIsInterface(); @@ -11388,59 +10947,6 @@ MethodTableBuilder::SetupMethodTable2( // (event callbacks or OptionalField attributes) we've previously cached the // additional information in the bmtMFDescs structure. Now it's time to add // this information as an optional extension to the MethodTable. -#ifdef FEATURE_REMOTING - if (bmtMFDescs->fNeedsRemotingVtsInfo) - { - DWORD dwNumIntroducedInstanceFields = bmtEnumFields->dwNumInstanceFields; - _ASSERTE(bmtAllocator == pMT->GetLoaderAllocator()); - PTR_RemotingVtsInfo pInfo = pMT->AllocateRemotingVtsInfo(GetMemTracker(), dwNumIntroducedInstanceFields); - - pInfo->m_pCallbacks[RemotingVtsInfo::VTS_CALLBACK_ON_SERIALIZING].SetValue(bmtMFDescs->pOnSerializingMethod); - pInfo->m_pCallbacks[RemotingVtsInfo::VTS_CALLBACK_ON_SERIALIZED].SetValue(bmtMFDescs->pOnSerializedMethod); - pInfo->m_pCallbacks[RemotingVtsInfo::VTS_CALLBACK_ON_DESERIALIZING].SetValue(bmtMFDescs->pOnDeserializingMethod); - pInfo->m_pCallbacks[RemotingVtsInfo::VTS_CALLBACK_ON_DESERIALIZED].SetValue(bmtMFDescs->pOnDeserializedMethod); - - for (i = 0; i < dwNumIntroducedInstanceFields; i++) - { - if (bmtMFDescs->prfNotSerializedFields && bmtMFDescs->prfNotSerializedFields[i]) - pInfo->SetIsNotSerialized(i); - if (bmtMFDescs->prfOptionallySerializedFields && bmtMFDescs->prfOptionallySerializedFields[i]) - pInfo->SetIsOptionallySerialized(i); - } - -#if 0 - printf("%s has VTS info:\n", pMT->GetDebugClassName()); - if (bmtMFDescs->pOnSerializingMethod) - printf(" OnSerializing: %s\n", bmtMFDescs->pOnSerializingMethod->m_pszDebugMethodName); - if (bmtMFDescs->pOnSerializedMethod) - printf(" OnSerialized: %s\n", bmtMFDescs->pOnSerializedMethod->m_pszDebugMethodName); - if (bmtMFDescs->pOnDeserializingMethod) - printf(" OnDeserializing: %s\n", bmtMFDescs->pOnDeserializingMethod->m_pszDebugMethodName); - if (bmtMFDescs->pOnDeserializedMethod) - printf(" OnDeserialized: %s\n", bmtMFDescs->pOnDeserializedMethod->m_pszDebugMethodName); - for (i = 0; i < dwNumIntroducedInstanceFields; i++) - { - if (bmtMFDescs->prfNotSerializedFields && bmtMFDescs->prfNotSerializedFields[i]) - { - printf(" [NotSerialized] %s\n", GetApproxFieldDescListRaw()[i].m_debugName); - _ASSERTE(pInfo->IsNotSerialized(i)); - } - else - _ASSERTE(!pInfo->IsNotSerialized(i)); - if (bmtMFDescs->prfOptionallySerializedFields && bmtMFDescs->prfOptionallySerializedFields[i]) - { - printf(" [OptionalField] %s\n", GetApproxFieldDescListRaw()[i].m_debugName); - _ASSERTE(pInfo->IsOptionallySerialized(i)); - } - else - _ASSERTE(!pInfo->IsOptionallySerialized(i)); - } - printf("------------\n\n"); -#endif // 0 - } - if (fNeedsRemotableMethodInfo) - pMT->SetupRemotableMethodInfo(GetMemTracker()); -#endif // FEATURE_REMOTING } #ifdef _PREFAST_ #pragma warning(pop) @@ -11623,30 +11129,6 @@ VOID MethodTableBuilder::CheckForRemotingProxyAttrib() { STANDARD_VM_CONTRACT; -#ifdef FEATURE_REMOTING - // See if our parent class has a proxy attribute - _ASSERTE(g_pObjectClass != NULL); - - if (!GetParentMethodTable()->GetClass()->HasRemotingProxyAttribute()) - { - // Call the metadata api to look for a proxy attribute on this type - // Note: the api does not check for inherited attributes - - // Set the flag is the type has a non-default proxy attribute - if(IsDefined( - GetModule(), - bmtInternal->pType->GetTypeDefToken(), - TypeHandle(MscorlibBinder::GetClass(CLASS__PROXY_ATTRIBUTE)))) - { - SetHasRemotingProxyAttribute(); - } - } - else - { - // parent has proxyAttribute ... mark this class as having one too! - SetHasRemotingProxyAttribute(); - } -#endif // FEATURE_REMOTING } @@ -11901,70 +11383,6 @@ VOID MethodTableBuilder::SetContextfulOrByRef() } CONTRACTL_END; -#ifdef FEATURE_REMOTING - - if (GetModule()->IsSystem()) - { - // Check whether these classes are the root classes of contextful - // and marshalbyref classes i.e. System.ContextBoundObject and - // System.MarshalByRefObject respectively. - - // Extract the class name - LPCUTF8 pszClassName = NULL; - LPCUTF8 pszNameSpace = NULL; - if (FAILED(GetMDImport()->GetNameOfTypeDef(GetCl(), &pszClassName, &pszNameSpace))) - { - BuildMethodTableThrowException(IDS_CLASSLOAD_BADFORMAT); - } - - StackSString ssFullyQualifiedName; - ns::MakePath(ssFullyQualifiedName, - StackSString(SString::Utf8, pszNameSpace), - StackSString(SString::Utf8, pszClassName)); - - if(ssFullyQualifiedName.Equals(SL(g_ContextBoundObjectClassName))) - { // Set the contextful and marshalbyref flag - bmtProp->fIsContextful = true; - bmtProp->fMarshaledByRef = true; - return; - } - - if(ssFullyQualifiedName.Equals(SL(g_MarshalByRefObjectClassName))) - { // Set the marshalbyref flag - bmtProp->fMarshaledByRef = true; - return; - } - } - - // First check whether the parent class is contextful or - // marshalbyref - if(HasParent()) - { - MethodTable * pParent = GetParentMethodTable(); - if(pParent->IsContextful()) - { // Set the contextful and marshalbyref flag - bmtProp->fIsContextful = true; - bmtProp->fMarshaledByRef = true; - - if (bmtGenerics->GetNumGenericArgs() > 0) - { // While these could work with a bit of work in the JIT, - // we will not support generic context-bound objects in V2.0. - BuildMethodTableThrowException(IDS_CLASSLOAD_GENERIC_CONTEXT_BOUND_OBJECT); - } - - if (GetAssembly()->IsCollectible()) - { - // Collectible assemblies do not support ContextBoundObject - BuildMethodTableThrowException(IDS_CLASSLOAD_COLLECTIBLE_CONTEXT_BOUND_OBJECT); - } - } - - else if (pParent->IsMarshaledByRef()) - { // Set the marshalbyref flag - bmtProp->fMarshaledByRef = true; - } - } -#endif // FEATURE_REMOTING } //******************************************************************************* diff --git a/src/vm/methodtablebuilder.h b/src/vm/methodtablebuilder.h index 1cf71499e6..8bfffcc6e0 100644 --- a/src/vm/methodtablebuilder.h +++ b/src/vm/methodtablebuilder.h @@ -84,10 +84,6 @@ public: // setting up a MethodTable struct bmtContextStaticInfo { -#ifdef FEATURE_REMOTING - // size of context statics - DWORD dwContextStaticsSize; -#endif inline bmtContextStaticInfo() { LIMITED_METHOD_CONTRACT; memset((void *)this, NULL, sizeof(*this)); } }; @@ -225,10 +221,6 @@ private: BOOL IsAbstract() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->IsAbstract(); } BOOL HasLayout() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->HasLayout(); } BOOL IsDelegate() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->IsDelegate(); } -#ifdef FEATURE_REMOTING - BOOL IsMarshaledByRef() { WRAPPER_NO_CONTRACT; return bmtProp->fMarshaledByRef; } - BOOL IsContextful() { WRAPPER_NO_CONTRACT; return bmtProp->fIsContextful; } -#endif BOOL IsNested() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->IsNested(); } BOOL HasFieldsWhichMustBeInited() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->HasFieldsWhichMustBeInited(); } BOOL HasRemotingProxyAttribute() { WRAPPER_NO_CONTRACT; return GetHalfBakedClass()->HasRemotingProxyAttribute(); } @@ -1328,10 +1320,6 @@ private: bool fIsEnum; bool fNoSanityChecks; bool fSparse; // Set to true if a sparse interface is being used. -#ifdef FEATURE_REMOTING - bool fMarshaledByRef; - bool fIsContextful; -#endif #ifdef FEATURE_COMINTEROP // Com Interop, ComWrapper classes extend from ComObject @@ -2024,44 +2012,6 @@ private: //----------------------------------------------------------------------------------------- FieldDesc **ppFieldDescList; // FieldDesc pointer (or NULL if field not preserved) for each field -#ifdef FEATURE_REMOTING - //----------------------------------------------------------------------------------------- - // Tracking info for VTS (Version Tolerant Serialization) - MethodDesc *pOnSerializingMethod; - MethodDesc *pOnSerializedMethod; - MethodDesc *pOnDeserializingMethod; - MethodDesc *pOnDeserializedMethod; - bool *prfNotSerializedFields; - bool *prfOptionallySerializedFields; - bool fNeedsRemotingVtsInfo; - - //----------------------------------------------------------------------------------------- - inline void SetFieldNotSerialized(DWORD dwIndex, DWORD dwNumInstanceFields) - { - WRAPPER_NO_CONTRACT; - if (prfNotSerializedFields == NULL) - { - DWORD cbSize = sizeof(bool) * dwNumInstanceFields; - prfNotSerializedFields = new (&GetThread()->m_MarshalAlloc) bool[dwNumInstanceFields]; - ZeroMemory(prfNotSerializedFields, cbSize); - } - prfNotSerializedFields[dwIndex] = true; - fNeedsRemotingVtsInfo = true; - } - - //----------------------------------------------------------------------------------------- - inline void SetFieldOptionallySerialized(DWORD dwIndex, DWORD dwNumInstanceFields) - { - WRAPPER_NO_CONTRACT; - if (prfOptionallySerializedFields == NULL) - { - prfOptionallySerializedFields = new (&GetThread()->m_MarshalAlloc) bool[dwNumInstanceFields]; - ZeroMemory(prfOptionallySerializedFields, sizeof(bool) * dwNumInstanceFields); - } - prfOptionallySerializedFields[dwIndex] = true; - fNeedsRemotingVtsInfo = true; - } -#endif // FEATURE_REMOTING //----------------------------------------------------------------------------------------- inline bmtMethAndFieldDescs() { LIMITED_METHOD_CONTRACT; memset((void *)this, NULL, sizeof(*this)); } @@ -2897,9 +2847,6 @@ private: LPCUTF8 szAttrName, MethodDesc **ppMethodDesc); -#ifdef FEATURE_REMOTING // affects only remoting-related info - VOID ScanTypeForVtsInfo(); -#endif // FEATURE_REMOTING VOID CheckForSystemTypes(); diff --git a/src/vm/mngstdinterfaces.cpp b/src/vm/mngstdinterfaces.cpp index ade3fbd483..ec1475dec6 100644 --- a/src/vm/mngstdinterfaces.cpp +++ b/src/vm/mngstdinterfaces.cpp @@ -24,9 +24,6 @@ #include "excep.h" #include "security.h" #include "typeparse.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif // // Declare the static field int the ManagedStdInterfaceMap class. @@ -215,28 +212,7 @@ LPVOID MngStdItfBase::ForwardCallToManagedView( _ASSERTE(Lr.Obj != NULL); MethodTable *pTargetMT = Lr.Obj->GetMethodTable(); -#ifdef FEATURE_REMOTING - if (pTargetMT->IsTransparentProxy()) - { - // If we get here with a transparent proxy instead of a COM object we need to re-dispatch the call to the TP stub. - // This can be tricky since the stack is no longer in the right state to make the call directly. Instead we build a - // small thunk that directly transitions into the remoting system. That way we can use the existing - // MethodDesc::CallTarget routine to dispatch the call and get the extra argument on the stack (the method desc - // pointer for the interface method needed by the TP stub) without re-routing ourselves through the fcall stub that - // would just get us back to here. - - MethodDescCallSite mngItf(pMngItfMD, CRemotingServices::GetStubForInterfaceMethod(pMngItfMD)); - - // Call the stub with the args we were passed originally. - Result = (Object*)mngItf.Call_RetArgSlot(pArgs); - if (mngItf.GetMetaSig()->IsObjectRefReturnType()) - { - Lr.Result = ObjectToOBJECTREF(Result); - RetValIsProtected = TRUE; - } - } - else -#endif // FEATURE_REMOTING + { // The target isn't a TP so it better be a COM object. _ASSERTE(Lr.Obj->GetMethodTable()->IsComObjectType()); diff --git a/src/vm/mscorlib.cpp b/src/vm/mscorlib.cpp index dad0126f29..a2d33f90fe 100644 --- a/src/vm/mscorlib.cpp +++ b/src/vm/mscorlib.cpp @@ -47,11 +47,6 @@ #include "comdatetime.h" #include "number.h" #include "compatibilityswitch.h" -#ifdef FEATURE_REMOTING -#include "remotingnative.h" -#include "message.h" -#include "stackbuildersink.h" -#endif #include "debugdebugger.h" #include "assemblyname.hpp" #include "assemblynative.hpp" diff --git a/src/vm/mscorlib.h b/src/vm/mscorlib.h index a824627f88..86af1a4898 100644 --- a/src/vm/mscorlib.h +++ b/src/vm/mscorlib.h @@ -76,13 +76,7 @@ DEFINE_FIELD_U(AssemblyLoad, AppDomainBaseObject, m_pAssemblyEvent DEFINE_FIELD_U(_TypeResolve, AppDomainBaseObject, m_pTypeEventHandler) DEFINE_FIELD_U(_ResourceResolve, AppDomainBaseObject, m_pResourceEventHandler) DEFINE_FIELD_U(_AssemblyResolve, AppDomainBaseObject, m_pAsmResolveEventHandler) -#ifdef FEATURE_REMOTING -DEFINE_FIELD_U(_DefaultContext, AppDomainBaseObject, m_pDefaultContext) -#endif DEFINE_FIELD_U(_applicationTrust, AppDomainBaseObject, m_pApplicationTrust) -#ifdef FEATURE_REMOTING -DEFINE_FIELD_U(_RemotingData, AppDomainBaseObject, m_pURITable) -#endif DEFINE_FIELD_U(_processExit, AppDomainBaseObject, m_pProcessExitEventHandler) DEFINE_FIELD_U(_domainUnload, AppDomainBaseObject, m_pDomainUnloadEventHandler) DEFINE_FIELD_U(_unhandledException, AppDomainBaseObject, m_pUnhandledExceptionEventHandler) @@ -104,16 +98,6 @@ DEFINE_METHOD(APP_DOMAIN, ON_ASSEMBLY_RESOLVE, OnAssemblyResolveEve DEFINE_METHOD(APP_DOMAIN, ON_DESIGNER_NAMESPACE_RESOLVE, OnDesignerNamespaceResolveEvent, IM_Str_RetArrStr) #endif //FEATURE_COMINTEROP DEFINE_METHOD(APP_DOMAIN, SETUP_DOMAIN, SetupDomain, IM_Bool_Str_Str_ArrStr_ArrStr_RetVoid) -#ifdef FEATURE_REMOTING -DEFINE_METHOD(APP_DOMAIN, CREATE_DOMAIN, CreateDomain, SM_Str_Evidence_AppDomainSetup_RetAppDomain) -DEFINE_METHOD(APP_DOMAIN, VAL_CREATE_DOMAIN, InternalCreateDomain, SM_Str_RetAppDomain) -#endif -#ifdef FEATURE_REMOTING -DEFINE_METHOD(APP_DOMAIN, MARSHAL_OBJECT, MarshalObject, SM_Obj_RetArrByte) -DEFINE_METHOD(APP_DOMAIN, MARSHAL_OBJECTS, MarshalObjects, SM_Obj_Obj_RefArrByte_RetArrByte) -DEFINE_METHOD(APP_DOMAIN, UNMARSHAL_OBJECT, UnmarshalObject, SM_ArrByte_RetObj) -DEFINE_METHOD(APP_DOMAIN, UNMARSHAL_OBJECTS, UnmarshalObjects, SM_ArrByte_ArrByte_RefObj_RetObj) -#endif DEFINE_METHOD(APP_DOMAIN, CREATE_APP_DOMAIN_MANAGER, CreateAppDomainManager, IM_RetVoid) DEFINE_METHOD(APP_DOMAIN, INITIALIZE_COMPATIBILITY_FLAGS, InitializeCompatibilityFlags, IM_RetVoid) DEFINE_METHOD(APP_DOMAIN, INITIALIZE_DOMAIN_SECURITY, InitializeDomainSecurity, IM_Evidence_Evidence_Bool_IntPtr_Bool_RetVoid) @@ -224,15 +208,6 @@ DEFINE_FIELD(ASSEMBLY, HANDLE, m_assembly) DEFINE_METHOD(ASSEMBLY, GET_NAME, GetName, IM_RetAssemblyName) DEFINE_METHOD(ASSEMBLY, ON_MODULE_RESOLVE, OnModuleResolveEvent, IM_Str_RetModule) -#ifdef FEATURE_REMOTING -DEFINE_CLASS(ACTIVATION_SERVICES, Activation, ActivationServices) -DEFINE_METHOD(ACTIVATION_SERVICES, IS_CURRENT_CONTEXT_OK, IsCurrentContextOK, SM_Class_ArrObject_Bool_RetMarshalByRefObject) - -#ifdef FEATURE_CLASSIC_COMINTEROP -DEFINE_METHOD(ACTIVATION_SERVICES, CREATE_OBJECT_FOR_COM, CreateObjectForCom, SM_Class_ArrObject_Bool_RetMarshalByRefObject) - -#endif // FEATURE_CLASSIC_COMINTEROP -#endif // FEATURE_REMOTING DEFINE_CLASS(ASYNCCALLBACK, System, AsyncCallback) DEFINE_CLASS(ATTRIBUTE, System, Attribute) @@ -260,9 +235,6 @@ DEFINE_METHOD(CLASS, GET_PROPERTIES, GetProperties, DEFINE_METHOD(CLASS, GET_FIELDS, GetFields, IM_BindingFlags_RetArrFieldInfo) DEFINE_METHOD(CLASS, GET_METHODS, GetMethods, IM_BindingFlags_RetArrMethodInfo) DEFINE_METHOD(CLASS, INVOKE_MEMBER, InvokeMember, IM_Str_BindingFlags_Binder_Obj_ArrObj_ArrParameterModifier_CultureInfo_ArrStr_RetObj) -#if defined(FEATURE_CLASSIC_COMINTEROP) && defined(FEATURE_REMOTING) -DEFINE_METHOD(CLASS, FORWARD_CALL_TO_INVOKE, ForwardCallToInvokeMember, IM_Str_BindingFlags_Obj_ArrInt_RefMessageData_RetObj) -#endif DEFINE_METHOD(CLASS, GET_METHOD_BASE, GetMethodBase, SM_RuntimeType_RuntimeMethodHandleInternal_RetMethodBase) DEFINE_METHOD(CLASS, GET_FIELD_INFO, GetFieldInfo, SM_RuntimeType_IRuntimeFieldInfo_RetFieldInfo) DEFINE_METHOD(CLASS, GET_PROPERTY_INFO, GetPropertyInfo, SM_RuntimeType_Int_RetPropertyInfo) @@ -332,29 +304,7 @@ DEFINE_FIELD_U(m_encodedEnumType, CustomAttributeType, m_enumType) DEFINE_FIELD_U(m_encodedArrayType, CustomAttributeType, m_arrayType) DEFINE_FIELD_U(m_padding, CustomAttributeType, m_padding) -#ifdef FEATURE_REMOTING -DEFINE_CLASS_U(Contexts, Context, ContextBaseObject) -DEFINE_FIELD_U(_ctxProps, ContextBaseObject, m_ctxProps) -DEFINE_FIELD_U(_dphCtx, ContextBaseObject, m_dphCtx) -DEFINE_FIELD_U(_localDataStore, ContextBaseObject, m_localDataStore) -DEFINE_FIELD_U(_serverContextChain, ContextBaseObject, m_serverContextChain) -DEFINE_FIELD_U(_clientContextChain, ContextBaseObject, m_clientContextChain) -DEFINE_FIELD_U(_appDomain, ContextBaseObject, m_exposedAppDomain) -DEFINE_FIELD_U(_ctxStatics, ContextBaseObject, m_ctxStatics) -DEFINE_FIELD_U(_internalContext, ContextBaseObject, m_internalContext) -DEFINE_FIELD_U(_ctxID, ContextBaseObject, _ctxID) -DEFINE_FIELD_U(_ctxFlags, ContextBaseObject, _ctxFlags) -DEFINE_FIELD_U(_numCtxProps, ContextBaseObject, _numCtxProps) -DEFINE_FIELD_U(_ctxStaticsCurrentBucket, ContextBaseObject, _ctxStaticsCurrentBucket) -DEFINE_FIELD_U(_ctxStaticsFreeIndex, ContextBaseObject, _ctxStaticsFreeIndex) -DEFINE_CLASS(CONTEXT, Contexts, Context) -DEFINE_METHOD(CONTEXT, CALLBACK, DoCallBackFromEE, SM_IntPtr_IntPtr_Int_RetVoid) -DEFINE_METHOD(CONTEXT, RESERVE_SLOT, ReserveSlot, IM_RetInt) -#endif -#ifdef FEATURE_REMOTING -DEFINE_CLASS(CONTEXT_BOUND_OBJECT, System, ContextBoundObject) -#endif #ifndef FEATURE_COREFX_GLOBALIZATION @@ -671,12 +621,6 @@ DEFINE_METHOD(ICUSTOM_QUERYINTERFACE, GET_INTERFACE, GetInterface, DEFINE_CLASS(CUSTOMQUERYINTERFACERESULT, Interop, CustomQueryInterfaceResult) #endif //FEATURE_COMINTEROP -#ifdef FEATURE_REMOTING -DEFINE_CLASS(IDENTITY, Remoting, Identity) -DEFINE_FIELD(IDENTITY, TP_OR_OBJECT, _tpOrObject) -DEFINE_FIELD(IDENTITY, LEASE, _lease) -DEFINE_FIELD(IDENTITY, OBJURI, _ObjURI) -#endif DEFINE_CLASS(ISERIALIZABLE, Serialization, ISerializable) DEFINE_CLASS(IOBJECTREFERENCE, Serialization, IObjectReference) @@ -684,11 +628,6 @@ DEFINE_CLASS(IDESERIALIZATIONCB, Serialization, IDeserializationCall DEFINE_CLASS(STREAMING_CONTEXT, Serialization, StreamingContext) DEFINE_CLASS(SERIALIZATION_INFO, Serialization, SerializationInfo) -#ifdef FEATURE_REMOTING -DEFINE_CLASS(OBJECTCLONEHELPER, Serialization, ObjectCloneHelper) -DEFINE_METHOD(OBJECTCLONEHELPER, GET_OBJECT_DATA, GetObjectData, SM_Obj_OutStr_OutStr_OutArrStr_OutArrObj_RetObj) -DEFINE_METHOD(OBJECTCLONEHELPER, PREPARE_DATA, PrepareConstructorArgs, SM_Obj_ArrStr_ArrObj_OutStreamingContext_RetSerializationInfo) -#endif DEFINE_CLASS(IENUMERATOR, Collections, IEnumerator) @@ -722,16 +661,6 @@ DEFINE_CLASS(LCID_CONVERSION_TYPE, Interop, LCIDConversionAttrib DEFINE_CLASS(LOADER_OPTIMIZATION, System, LoaderOptimization) -#ifdef FEATURE_REMOTING -DEFINE_CLASS_U(Messaging, LogicalCallContext, LogicalCallContextObject) -DEFINE_FIELD_U(m_Datastore, LogicalCallContextObject, m_Datastore) -DEFINE_FIELD_U(m_RemotingData, LogicalCallContextObject, m_RemotingData) -DEFINE_FIELD_U(m_SecurityData, LogicalCallContextObject, m_SecurityData) -DEFINE_FIELD_U(m_HostContext, LogicalCallContextObject, m_HostContext) -DEFINE_FIELD_U(m_IsCorrelationMgr, LogicalCallContextObject, m_IsCorrelationMgr) -DEFINE_FIELD_U(_sendHeaders, LogicalCallContextObject, _sendHeaders) -DEFINE_FIELD_U(_recvHeaders, LogicalCallContextObject, _recvHeaders) -#endif DEFINE_CLASS(MARSHAL, Interop, Marshal) #ifdef FEATURE_COMINTEROP @@ -745,37 +674,9 @@ DEFINE_METHOD(MARSHAL, GET_DELEGATE_FOR_FUNCTION_POINTER, GetDelega DEFINE_METHOD(MARSHAL, ALLOC_CO_TASK_MEM, AllocCoTaskMem, SM_Int_RetIntPtr) DEFINE_FIELD(MARSHAL, SYSTEM_MAX_DBCS_CHAR_SIZE, SystemMaxDBCSCharSize) -#ifdef FEATURE_REMOTING -DEFINE_CLASS_U(System, MarshalByRefObject, MarshalByRefObjectBaseObject) -DEFINE_FIELD_U(__identity, MarshalByRefObjectBaseObject, m_ServerIdentity) -DEFINE_CLASS(MARSHAL_BY_REF_OBJECT, System, MarshalByRefObject) -#endif DEFINE_CLASS(MEMBER, Reflection, MemberInfo) -#ifdef FEATURE_REMOTING -DEFINE_CLASS_U(Messaging, Message, MessageObject) -DEFINE_FIELD_U(_MethodName, MessageObject, pMethodName) -DEFINE_FIELD_U(_MethodSignature, MessageObject, pMethodSig) -DEFINE_FIELD_U(_MethodBase, MessageObject, pMethodBase) -DEFINE_FIELD_U(_properties, MessageObject, pHashTable) -DEFINE_FIELD_U(_URI, MessageObject, pURI) -DEFINE_FIELD_U(_typeName, MessageObject, pTypeName) -DEFINE_FIELD_U(_Fault, MessageObject, pFault) -DEFINE_FIELD_U(_ID, MessageObject, pID) -DEFINE_FIELD_U(_srvID, MessageObject, pSrvID) -DEFINE_FIELD_U(_argMapper, MessageObject, pArgMapper) -DEFINE_FIELD_U(_callContext, MessageObject, pCallCtx) -DEFINE_FIELD_U(_frame, MessageObject, pFrame) -DEFINE_FIELD_U(_methodDesc, MessageObject, pMethodDesc) -DEFINE_FIELD_U(_metaSigHolder, MessageObject, pMetaSigHolder) -DEFINE_FIELD_U(_delegateMD, MessageObject, pDelegateMD) -DEFINE_FIELD_U(_governingType, MessageObject, thGoverningType) -DEFINE_FIELD_U(_flags, MessageObject, iFlags) -DEFINE_FIELD_U(_initDone, MessageObject, initDone) - -DEFINE_CLASS(MESSAGE_DATA, Proxies, MessageData) -#endif // FEATURE_REMOTING DEFINE_CLASS_U(Reflection, RuntimeMethodInfo, NoClass) DEFINE_FIELD_U(m_handle, ReflectMethodObject, m_pMD) @@ -991,26 +892,6 @@ DEFINE_METHOD(PROPERTY, GET_GETTER, GetGetMethod, DEFINE_CLASS(PROPERTY_INFO, Reflection, PropertyInfo) -#ifdef FEATURE_REMOTING -DEFINE_CLASS(PROXY_ATTRIBUTE, Proxies, ProxyAttribute) - -DEFINE_CLASS_U(Proxies, RealProxy, RealProxyObject) -DEFINE_FIELD_U(_tp, RealProxyObject, _tp) -DEFINE_FIELD_U(_identity, RealProxyObject, _identity) -DEFINE_FIELD_U(_serverObject, RealProxyObject, _serverObject) -DEFINE_FIELD_U(_flags, RealProxyObject, _flags) -DEFINE_FIELD_U(_optFlags, RealProxyObject, _optFlags) -DEFINE_FIELD_U(_domainID, RealProxyObject, _domainID) -DEFINE_FIELD_U(_srvIdentity, RealProxyObject, _srvIdentity) -DEFINE_CLASS(REAL_PROXY, Proxies, RealProxy) -DEFINE_METHOD(REAL_PROXY, PRIVATE_INVOKE, PrivateInvoke, IM_RefMessageData_Int_RetVoid) -#ifdef FEATURE_COMINTEROP -DEFINE_METHOD(REAL_PROXY, GETDCOMPROXY, GetCOMIUnknown, IM_Bool_RetIntPtr) -DEFINE_METHOD(REAL_PROXY, SETDCOMPROXY, SetCOMIUnknown, IM_IntPtr_RetVoid) -DEFINE_METHOD(REAL_PROXY, SUPPORTSINTERFACE, SupportsInterface, IM_RefGuid_RetIntPtr) - -#endif // FEATURE_COMINTEROP -#endif // FEATURE_REMOTING #ifdef FEATURE_RWLOCK DEFINE_CLASS_U(Threading, ReaderWriterLock, CRWLock) @@ -1025,24 +906,6 @@ DEFINE_FIELD_U(_dwWriterSeqNum, CRWLock, _dwWriterSeqNum) DEFINE_FIELD_U(_wWriterLevel, CRWLock, _wWriterLevel) #endif // FEATURE_RWLOCK -#ifdef FEATURE_REMOTING -DEFINE_CLASS(LEASE, Lifetime, Lease) -DEFINE_METHOD(LEASE, RENEW_ON_CALL, RenewOnCall, IM_RetVoid) - -DEFINE_CLASS(REMOTING_PROXY, Proxies, RemotingProxy) -DEFINE_METHOD(REMOTING_PROXY, INVOKE, Invoke, SM_Obj_RefMessageData_RetVoid) - -DEFINE_CLASS(REMOTING_SERVICES, Remoting, RemotingServices) -DEFINE_METHOD(REMOTING_SERVICES, CHECK_CAST, CheckCast, SM_RealProxy_Class_RetBool) -DEFINE_METHOD(REMOTING_SERVICES, GET_TYPE, GetType, SM_Obj_RetObj) -DEFINE_METHOD(REMOTING_SERVICES, WRAP, Wrap, SM_ContextBoundObject_RetObj) -DEFINE_METHOD(REMOTING_SERVICES, CREATE_PROXY_FOR_DOMAIN,CreateProxyForDomain, SM_Int_IntPtr_RetObj) -DEFINE_METHOD(REMOTING_SERVICES, GET_SERVER_CONTEXT_FOR_PROXY,GetServerContextForProxy, SM_Obj_RetIntPtr) -DEFINE_METHOD(REMOTING_SERVICES, GET_SERVER_DOMAIN_ID_FOR_PROXY,GetServerDomainIdForProxy, SM_Obj_RetInt) -DEFINE_METHOD(REMOTING_SERVICES, MARSHAL_TO_BUFFER, MarshalToBuffer, SM_Obj_Bool_RetArrByte) -DEFINE_METHOD(REMOTING_SERVICES, UNMARSHAL_FROM_BUFFER, UnmarshalFromBuffer, SM_ArrByte_Bool_RetObj) -DEFINE_METHOD(REMOTING_SERVICES, DOMAIN_UNLOADED, DomainUnloaded, SM_Int_RetVoid) -#endif // FEATURE_REMOTING DEFINE_CLASS(METADATA_IMPORT, Reflection, MetadataImport) @@ -1123,18 +986,10 @@ DEFINE_CLASS(SAFE_TYPENAMEPARSER_HANDLE, System, SafeTypeNameParserHa DEFINE_CLASS(SECURITY_EXCEPTION, Security, SecurityException) -#ifdef FEATURE_REMOTING -DEFINE_CLASS(SERVER_IDENTITY, Remoting, ServerIdentity) -DEFINE_FIELD(SERVER_IDENTITY, SERVER_CONTEXT, _srvCtx) -#endif // FEATURE_REMOTING DEFINE_CLASS(SHARED_STATICS, System, SharedStatics) DEFINE_FIELD(SHARED_STATICS, SHARED_STATICS, _sharedStatics) -#ifdef FEATURE_REMOTING -DEFINE_CLASS(STACK_BUILDER_SINK, Messaging, StackBuilderSink) -DEFINE_METHOD(STACK_BUILDER_SINK, PRIVATE_PROCESS_MESSAGE,_PrivateProcessMessage, IM_IntPtr_ArrObj_Obj_RefArrObj_RetObj) -#endif DEFINE_CLASS_U(Diagnostics, StackFrameHelper, StackFrameHelper) DEFINE_FIELD_U(targetThread, StackFrameHelper, targetThread) @@ -1218,9 +1073,6 @@ DEFINE_CLASS(STACKCRAWMARK, Threading, StackCrawlMark) DEFINE_CLASS(CROSS_CONTEXT_DELEGATE, Threading, InternalCrossContextDelegate) DEFINE_CLASS_U(Threading, Thread, ThreadBaseObject) -#ifdef FEATURE_REMOTING -DEFINE_FIELD_U(m_Context, ThreadBaseObject, m_ExposedContext) -#endif DEFINE_FIELD_U(m_Name, ThreadBaseObject, m_Name) DEFINE_FIELD_U(m_Delegate, ThreadBaseObject, m_Delegate) DEFINE_FIELD_U(m_ThreadStartArg, ThreadBaseObject, m_ThreadStartArg) @@ -1229,15 +1081,9 @@ DEFINE_FIELD_U(m_Priority, ThreadBaseObject, m_Priority) DEFINE_CLASS(THREAD, Threading, Thread) DEFINE_FIELD(THREAD, CULTURE, m_CurrentCulture) DEFINE_FIELD(THREAD, UI_CULTURE, m_CurrentUICulture) -#ifdef FEATURE_REMOTING -DEFINE_STATIC_PROPERTY(THREAD, CURRENT_CONTEXT, CurrentContext, Context) -#endif DEFINE_SET_PROPERTY(THREAD, CULTURE, CurrentCulture, CultureInfo) DEFINE_SET_PROPERTY(THREAD, UI_CULTURE, CurrentUICulture, CultureInfo) DEFINE_STATIC_PROPERTY(THREAD, CURRENT_THREAD, CurrentThread, Thread) -#ifdef FEATURE_REMOTING -DEFINE_METHOD(THREAD, COMPLETE_CROSSCONTEXTCALLBACK, CompleteCrossContextCallback, SM_CrossContextDelegate_ArrObj_RetObj) -#endif DEFINE_METHOD(THREAD, INTERNAL_GET_CURRENT_THREAD, InternalGetCurrentThread, SM_RetIntPtr) DEFINE_CLASS(PARAMETERIZEDTHREADSTART, Threading, ParameterizedThreadStart) @@ -1256,15 +1102,6 @@ DEFINE_METHOD(TIMER_QUEUE, APPDOMAIN_TIMER_CALLBACK, AppDomainTimerCall DEFINE_CLASS(TIMESPAN, System, TimeSpan) -#ifdef FEATURE_REMOTING -DEFINE_CLASS_U(Proxies, __TransparentProxy, TransparentProxyObject) -DEFINE_FIELD_U(_rp, TransparentProxyObject, _rp) -DEFINE_FIELD_U(_pMT, TransparentProxyObject, _pMT) -DEFINE_FIELD_U(_pInterfaceMT, TransparentProxyObject, _pInterfaceMT) -DEFINE_FIELD_U(_stub, TransparentProxyObject, _stub) -DEFINE_FIELD_U(_stubData, TransparentProxyObject, _stubData) -DEFINE_CLASS(TRANSPARENT_PROXY, Proxies, __TransparentProxy) -#endif DEFINE_CLASS(TYPE, System, Type) DEFINE_METHOD(TYPE, GET_TYPE_FROM_HANDLE, GetTypeFromHandle, SM_RuntimeTypeHandle_RetType) diff --git a/src/vm/object.cpp b/src/vm/object.cpp index 23f46edb3c..dc53757bac 100644 --- a/src/vm/object.cpp +++ b/src/vm/object.cpp @@ -18,9 +18,6 @@ #include "excep.h" #include "eeconfig.h" #include "gcheaputilities.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "field.h" #include "gcscan.h" #include "argdestination.h" @@ -158,13 +155,6 @@ MethodTable *Object::GetTrueMethodTable() MethodTable *mt = GetMethodTable(); -#ifdef FEATURE_REMOTING - if(mt->IsTransparentProxy()) - { - mt = ((TransparentProxyObject *)this)->GetMethodTableBeingProxied(); - } - _ASSERTE(!mt->IsTransparentProxy()); -#endif RETURN mt; } @@ -1383,9 +1373,6 @@ void Object::ValidateHeap(Object *from, BOOL bDeep) //special case:thread object is allowed to hold a context belonging to current domain if (from->GetGCSafeMethodTable() == g_pThreadClass && ( -#ifdef FEATURE_REMOTING - this == OBJECTREFToObject(((ThreadBaseObject *)from)->m_ExposedContext) || -#endif false)) { if (((ThreadBaseObject *)from)->m_InternalThread) diff --git a/src/vm/object.h b/src/vm/object.h index d5fb903dad..1702e8cac5 100644 --- a/src/vm/object.h +++ b/src/vm/object.h @@ -226,13 +226,8 @@ class Object // advance to the true method table or class. BOOL IsTransparentProxy() { -#ifdef FEATURE_REMOTING - WRAPPER_NO_CONTRACT; - return( GetMethodTable()->IsTransparentProxy() ); -#else LIMITED_METHOD_CONTRACT; return FALSE; -#endif } #define MARKED_BIT 0x1 @@ -1273,10 +1268,6 @@ inline STRINGREF* StringObject::GetEmptyStringRefPtr() { // RuntimeMethodInfo, and RtFieldInfo. class BaseObjectWithCachedData : public Object { -#ifdef FEATURE_REMOTING - protected: - OBJECTREF m_CachedData; -#endif //FEATURE_REMOTING }; // This is the Class version of the Reflection object. @@ -1547,114 +1538,6 @@ public: } }; -#ifdef FEATURE_REMOTING -class CallContextRemotingDataObject : public Object -{ -private: - // These field are also defined in the managed representation. (SecurityContext.cs)If you - // add or change these field you must also change the managed code so that - // it matches these. This is necessary so that the object is the proper - // size. - OBJECTREF _logicalCallID; -public: - OBJECTREF GetLogicalCallID() - { - LIMITED_METHOD_CONTRACT; - return _logicalCallID; - } -}; - -class CallContextSecurityDataObject : public Object -{ -private: - // These field are also defined in the managed representation. (SecurityContext.cs)If you - // add or change these field you must also change the managed code so that - // it matches these. This is necessary so that the object is the proper - // size. - OBJECTREF _principal; -public: - OBJECTREF GetPrincipal() - { - LIMITED_METHOD_CONTRACT; - return _principal; - } - - void SetPrincipal(OBJECTREF ref) - { - WRAPPER_NO_CONTRACT; - SetObjectReferenceUnchecked(&_principal, ref); - } -}; - -#ifdef USE_CHECKED_OBJECTREFS -typedef REF<CallContextSecurityDataObject> CCSECURITYDATAREF; -typedef REF<CallContextRemotingDataObject> CCREMOTINGDATAREF; -#else -typedef CallContextSecurityDataObject* CCSECURITYDATAREF; -typedef CallContextRemotingDataObject* CCREMOTINGDATAREF; -#endif - -class LogicalCallContextObject : public Object -{ - friend class MscorlibBinder; - - // These field are also defined in the managed representation. (CallContext.cs) If you - // add or change these field you must also change the managed code so that - // it matches these. This is necessary so that the object is the proper - // size. -private : - OBJECTREF m_Datastore; - CCREMOTINGDATAREF m_RemotingData; - CCSECURITYDATAREF m_SecurityData; - OBJECTREF m_HostContext; - OBJECTREF _sendHeaders; - OBJECTREF _recvHeaders; - CLR_BOOL m_IsCorrelationMgr; - -public: - CCSECURITYDATAREF GetSecurityData() - { - LIMITED_METHOD_CONTRACT; - return m_SecurityData; - } - - // This is an unmanaged equivalent of System.Runtime.Remoting.Messaging.LogicalCallContext.HasInfo - BOOL ContainsDataForSerialization() - { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - SO_TOLERANT; - MODE_COOPERATIVE; - } - CONTRACTL_END; - return (ContainsNonSecurityDataForSerialization() || - (m_SecurityData != NULL && m_SecurityData->GetPrincipal() != NULL)); - } - - BOOL ContainsNonSecurityDataForSerialization() - { - LIMITED_METHOD_CONTRACT; - - // m_Datastore may contain 0 items even if it's non-NULL in which case it does - // not really contain any useful data for serialization and this function could - // return FALSE. However we don't waste time trying to detect this case - it will - // be reset to NULL the first time a call is made due to how LogicalCallContext's - // ISerializable implementation works. - return (m_Datastore != NULL || - (m_RemotingData != NULL && m_RemotingData->GetLogicalCallID() != NULL) || - m_HostContext != NULL); - } -}; - -#ifdef USE_CHECKED_OBJECTREFS -typedef REF<LogicalCallContextObject> LOGICALCALLCONTEXTREF; -#else -typedef LogicalCallContextObject* LOGICALCALLCONTEXTREF; -#endif - -#endif // FEATURE_REMOTING @@ -1886,9 +1769,6 @@ private: // size. The order here must match that order which the loader will choose // when laying out the managed class. Note that the layouts are checked // at run time, not compile time. -#ifdef FEATURE_REMOTING - OBJECTREF m_ExposedContext; -#endif OBJECTREF m_ExecutionContext; OBJECTREF m_SynchronizationContext; OBJECTREF m_Name; @@ -1963,23 +1843,6 @@ public: void ResetCurrentUserCulture(); void ResetCurrentUICulture(); -#ifdef FEATURE_REMOTING - // These expose the remoting context (System\Remoting\Context) - OBJECTREF GetExposedContext() { LIMITED_METHOD_CONTRACT; return m_ExposedContext; } - OBJECTREF SetExposedContext(OBJECTREF newContext) - { - WRAPPER_NO_CONTRACT; - - OBJECTREF oldContext = m_ExposedContext; - - // Note: this is a very dangerous unchecked assignment. We are taking - // responsibilty here for cleaning out the ExposedContext field when - // an app domain is unloaded. - SetObjectReferenceUnchecked( (OBJECTREF *)&m_ExposedContext, newContext ); - - return oldContext; - } -#endif OBJECTREF GetSynchronizationContext() @@ -2024,22 +1887,6 @@ public: // class MarshalByRefObjectBaseObject : public Object { -#ifdef FEATURE_REMOTING - friend class MscorlibBinder; - - public: - static int GetOffsetOfServerIdentity() { LIMITED_METHOD_CONTRACT; return offsetof(MarshalByRefObjectBaseObject, m_ServerIdentity); } - - protected: - // READ ME: - // Modifying the order or fields of this object may require other changes to the - // classlib class definition of this object. - OBJECTREF m_ServerIdentity; - - protected: - MarshalByRefObjectBaseObject() {LIMITED_METHOD_CONTRACT;} - ~MarshalByRefObjectBaseObject() {LIMITED_METHOD_CONTRACT;} -#endif }; @@ -2137,13 +1984,7 @@ class AppDomainBaseObject : public MarshalByRefObjectBaseObject OBJECTREF m_pTypeEventHandler; // Delegate for 'resolve type' event OBJECTREF m_pResourceEventHandler; // Delegate for 'resolve resource' event OBJECTREF m_pAsmResolveEventHandler; // Delegate for 'resolve assembly' event -#ifdef FEATURE_REMOTING - OBJECTREF m_pDefaultContext; // Default managed context for this AD. -#endif OBJECTREF m_pApplicationTrust; // App ApplicationTrust. -#ifdef FEATURE_REMOTING - OBJECTREF m_pURITable; // Identity table for remoting -#endif OBJECTREF m_pProcessExitEventHandler; // Delegate for 'process exit' event. Only used in Default appdomain. OBJECTREF m_pDomainUnloadEventHandler; // Delegate for 'about to unload domain' event OBJECTREF m_pUnhandledExceptionEventHandler; // Delegate for 'unhandled exception' event @@ -2205,13 +2046,6 @@ class AppDomainBaseObject : public MarshalByRefObjectBaseObject WRAPPER_NO_CONTRACT; SetObjectReference(&m_pPolicies, ref, m_pDomain ); } -#ifdef FEATURE_REMOTING - void SetDefaultContext(OBJECTREF ref) - { - WRAPPER_NO_CONTRACT; - SetObjectReference(&m_pDefaultContext,ref,m_pDomain); - } -#endif BOOL HasSetPolicy() { LIMITED_METHOD_CONTRACT; diff --git a/src/vm/objectclone.h b/src/vm/objectclone.h deleted file mode 100644 index c2e237b91a..0000000000 --- a/src/vm/objectclone.h +++ /dev/null @@ -1,1268 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// -// File: ObjectClone.h -// - -// - - -#ifndef _OBJECTCLONE_H_ -#define _OBJECTCLONE_H_ - -#ifndef FEATURE_REMOTING -#error FEATURE_REMOTING is not set, please do no include objectclone.h -#endif - -#include "invokeutil.h" -#include "runtimehandles.h" - -enum QueueType -{ - FIFO, - LIFO -}; - -enum ObjectProperties -{ - enum_Array = 0x01, - enum_NeedsUnboxing = 0x02, - enum_ISerializableMember = 0x04, // This is set on member of an ISerializable instance - enum_Iserializable = 0x08, // This is set on an ISerializable instance - enum_IObjRef = 0x10, // This is set on an IObjRef instance -}; - -// This is the base class of all the different records that get -// stored in different tables during cloning -class QueuedObjectInfo -{ -protected: - BYTE m_properties; -public: - QueuedObjectInfo() { LIMITED_METHOD_CONTRACT; m_properties = 0; } - BOOL IsArray() { LIMITED_METHOD_CONTRACT; return m_properties & enum_Array; } - BOOL NeedsUnboxing() { LIMITED_METHOD_CONTRACT; return m_properties & enum_NeedsUnboxing; } - void SetIsArray() { LIMITED_METHOD_CONTRACT; m_properties |= enum_Array; } - void SetNeedsUnboxing() { LIMITED_METHOD_CONTRACT; m_properties |= enum_NeedsUnboxing; } - BOOL IsISerializableMember() { LIMITED_METHOD_CONTRACT; return m_properties & enum_ISerializableMember; } - void SetIsISerializableMember() { LIMITED_METHOD_CONTRACT; m_properties |= enum_ISerializableMember; } - BOOL IsISerializableInstance() { LIMITED_METHOD_CONTRACT; return m_properties & enum_Iserializable; } - void SetIsISerializableInstance() { LIMITED_METHOD_CONTRACT; m_properties |= enum_Iserializable; } - BOOL IsIObjRefInstance() { LIMITED_METHOD_CONTRACT; return m_properties & enum_IObjRef; } - void SetIsIObjRefInstance() { LIMITED_METHOD_CONTRACT; m_properties |= enum_IObjRef; } - virtual DWORD GetSize() - { - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - DWORD size = sizeof(QueuedObjectInfo); -#if defined(_WIN64) || defined(ALIGN_ACCESS) - size = (DWORD)ALIGN_UP(size, sizeof(SIZE_T)); -#endif // _WIN64 || ALIGN_ACCESS - return size; - } -}; - -// These are records in QOF. Represents a parent object which has at least one member to -// be marshalled and fixed up. -class ParentInfo : public QueuedObjectInfo -{ - DWORD m_fixupCount; - DWORD m_numSpecialMembers; - DWORD m_IserIndexInTSOTable; - DWORD m_IObjRefIndexInTSOTable; - DWORD m_BoxedValIndexIntoTSOTable; -public: - ParentInfo(DWORD count) - { - LIMITED_METHOD_CONTRACT; - m_fixupCount = count; - m_numSpecialMembers = 0; - m_IserIndexInTSOTable = (DWORD) -1; - m_IObjRefIndexInTSOTable = (DWORD) -1; - m_BoxedValIndexIntoTSOTable = (DWORD) -1; - } - DWORD DecrementFixupCount() { LIMITED_METHOD_CONTRACT; return --m_fixupCount; } - DWORD GetNumSpecialMembers() { LIMITED_METHOD_CONTRACT; return m_numSpecialMembers; } - DWORD IncrementSpecialMembers() { LIMITED_METHOD_CONTRACT; return ++m_numSpecialMembers; } - DWORD GetISerIndexIntoTSO() { LIMITED_METHOD_CONTRACT; return m_IserIndexInTSOTable; } - void SetISerIndexIntoTSO(DWORD index) { LIMITED_METHOD_CONTRACT; m_IserIndexInTSOTable = index; } - DWORD GetIObjRefIndexIntoTSO() { LIMITED_METHOD_CONTRACT; return m_IObjRefIndexInTSOTable; } - void SetIObjRefIndexIntoTSO(DWORD index) { LIMITED_METHOD_CONTRACT; m_IObjRefIndexInTSOTable = index; } - DWORD GetBoxedValIndexIntoTSO() { LIMITED_METHOD_CONTRACT; return m_BoxedValIndexIntoTSOTable; } - void SetBoxedValIndexIntoTSO(DWORD index) { LIMITED_METHOD_CONTRACT; m_BoxedValIndexIntoTSOTable = index; } - virtual DWORD GetSize() - { - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - DWORD size = sizeof(ParentInfo); -#if defined(_WIN64) || defined(ALIGN_ACCESS) - size = (DWORD)ALIGN_UP(size, sizeof(SIZE_T)); -#endif // _WIN64 || ALIGN_ACCESS - return size; - } -}; - -// Represents an object whose parent is a regular object (not an array, not ISerializable etc) -// Contains enough information to fix this object into its parent -class ObjectMemberInfo : public QueuedObjectInfo -{ - FieldDesc *m_fieldDesc; -public: - ObjectMemberInfo(FieldDesc *field) { LIMITED_METHOD_CONTRACT; m_fieldDesc = field; } - FieldDesc *GetFieldDesc() { LIMITED_METHOD_CONTRACT; return m_fieldDesc; } - VOID SetFieldDesc(FieldDesc* field) { LIMITED_METHOD_CONTRACT; m_fieldDesc = field; } - virtual DWORD GetSize() - { - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - DWORD size = sizeof(ObjectMemberInfo); -#if defined(_WIN64) || defined(ALIGN_ACCESS) - size = (DWORD)ALIGN_UP(size, sizeof(SIZE_T)); -#endif // _WIN64 || ALIGN_ACCESS - return size; - } -}; - -// Represents an object whose parent is an array -// Contains index information to fix this object into its parent -class NDimArrayMemberInfo : public QueuedObjectInfo -{ - DWORD m_numDimensions; - DWORD m_index[0]; -public: - NDimArrayMemberInfo(DWORD rank) - { - LIMITED_METHOD_CONTRACT; - m_numDimensions = rank; - SetIsArray(); - } - virtual DWORD GetSize() - { - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - DWORD size = sizeof(NDimArrayMemberInfo) + (sizeof(DWORD) * (m_numDimensions)); -#if defined(_WIN64) || defined(ALIGN_ACCESS) - size = (DWORD)ALIGN_UP(size, sizeof(SIZE_T)); -#endif // _WIN64 || ALIGN_ACCESS - return size; - } - DWORD *GetIndices() - { LIMITED_METHOD_CONTRACT; return &m_index[0]; } - void SetIndices(DWORD* indices) - { - LIMITED_METHOD_CONTRACT; - memcpy(GetIndices(), indices, GetNumDimensions() * sizeof(DWORD)); - } - DWORD GetNumDimensions() - { LIMITED_METHOD_CONTRACT; return m_numDimensions; } - void SetNumDimensions(DWORD rank) - { LIMITED_METHOD_CONTRACT; m_numDimensions = rank; } -}; - -// Represents an object whose parent is an ISerializable object -// Contains index information to fix this object into its parent -class ISerializableMemberInfo : public QueuedObjectInfo -{ - DWORD m_TIOIndex; - DWORD m_fieldIndex; -public: - ISerializableMemberInfo(DWORD tableIndex, DWORD fieldIndex) - { - WRAPPER_NO_CONTRACT; - m_TIOIndex = tableIndex; - m_fieldIndex = fieldIndex; - SetIsISerializableMember(); - } - DWORD GetTableIndex() - { LIMITED_METHOD_CONTRACT; return m_TIOIndex; } - DWORD GetFieldIndex() - { LIMITED_METHOD_CONTRACT; STATIC_CONTRACT_SO_TOLERANT; return m_fieldIndex; } - virtual DWORD GetSize() - { - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - DWORD size = sizeof(ISerializableMemberInfo); -#if defined(_WIN64) || defined(ALIGN_ACCESS) - size = (DWORD)ALIGN_UP(size, sizeof(SIZE_T)); -#endif // _WIN64 || ALIGN_ACCESS - return size; - } -}; - -// Represents a special object (ISerializable, Boxed value type, IObjectReference) -// Entries in TSO are of this type -class SpecialObjectInfo : public QueuedObjectInfo -{ -protected: - DWORD m_specialObjectProperties; - int m_objectId; - DWORD m_numSpecialMembers; - DWORD m_mappingTableIndex; -public: - SpecialObjectInfo() - { - LIMITED_METHOD_CONTRACT; - m_specialObjectProperties = 0; - m_mappingTableIndex = 0; - m_numSpecialMembers = 0; - m_objectId = 0; - } - void SetHasBeenProcessed() { LIMITED_METHOD_CONTRACT; m_specialObjectProperties |= 0x01; } - DWORD HasBeenProcessed() { LIMITED_METHOD_CONTRACT; return m_specialObjectProperties & 0x01; } - void SetHasFixupInfo() { LIMITED_METHOD_CONTRACT; m_specialObjectProperties |= 0x02; } - DWORD HasFixupInfo() { LIMITED_METHOD_CONTRACT; return m_specialObjectProperties & 0x02; } - void SetIsRepeatObject() { LIMITED_METHOD_CONTRACT; m_specialObjectProperties |= 0x04; } - DWORD IsRepeatObject() { LIMITED_METHOD_CONTRACT; return m_specialObjectProperties & 0x04; } - void SetIsBoxedObject() { LIMITED_METHOD_CONTRACT; m_specialObjectProperties |= 0x08; } - DWORD IsBoxedObject() { LIMITED_METHOD_CONTRACT; return m_specialObjectProperties & 0x08; } - void SetTargetNotISerializable() { LIMITED_METHOD_CONTRACT; m_specialObjectProperties |= 0x10; } - DWORD IsTargetNotISerializable() { LIMITED_METHOD_CONTRACT; return m_specialObjectProperties & 0x10; } - - void SetMappingTableIndex(DWORD index) { LIMITED_METHOD_CONTRACT; m_mappingTableIndex = index; } - DWORD GetMappingTableIndex() { LIMITED_METHOD_CONTRACT; return m_mappingTableIndex; } - DWORD GetNumSpecialMembers() { LIMITED_METHOD_CONTRACT; return m_numSpecialMembers; } - void SetNumSpecialMembers(DWORD numSpecialMembers) { LIMITED_METHOD_CONTRACT; m_numSpecialMembers = numSpecialMembers;} - void SetObjectId(int id) { LIMITED_METHOD_CONTRACT; m_objectId = id; } - int GetObjectId() { LIMITED_METHOD_CONTRACT; return m_objectId; } -}; - -// Represents a special object (ISerializable) -// Contains the number of IObjRef members it has -class ISerializableInstanceInfo : public SpecialObjectInfo -{ -public: - ISerializableInstanceInfo(int objectId, DWORD numIObjRefMembers) - { - LIMITED_METHOD_CONTRACT; - m_numSpecialMembers = numIObjRefMembers; - m_objectId = objectId; - SetIsISerializableInstance(); - } - virtual DWORD GetSize() - { - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - DWORD size = sizeof(ISerializableInstanceInfo); -#if defined(_WIN64) || defined(ALIGN_ACCESS) - size = (DWORD)ALIGN_UP(size, sizeof(SIZE_T)); -#endif // _WIN64 || ALIGN_ACCESS - return size; - } -}; - -// Represents a special object (IObjectReference) -// Contains fixup information to fix the completed object into its parent -class IObjRefInstanceInfo : public SpecialObjectInfo -{ - DWORD m_ISerTSOIndex; // If this is also an Iserializable instance, index of the iser entry in TSO -#if defined(_WIN64) || defined(ALIGN_ACCESS) - DWORD m_padding; -#endif // _WIN64 || ALIGN_ACCESS - BYTE m_fixupData[0]; -public: - IObjRefInstanceInfo(int objectId, DWORD numIObjRefMembers, DWORD numISerMembers) - { - WRAPPER_NO_CONTRACT; - static_assert_no_msg((offsetof(IObjRefInstanceInfo, m_fixupData) % sizeof(SIZE_T)) == 0); - m_numSpecialMembers = numIObjRefMembers + numISerMembers; - m_ISerTSOIndex = (DWORD) -1; - m_objectId = objectId; - SetIsIObjRefInstance(); - } - DWORD GetISerTSOIndex() {LIMITED_METHOD_CONTRACT; return m_ISerTSOIndex; } - void SetISerTSOIndex(DWORD index) - { LIMITED_METHOD_CONTRACT; m_ISerTSOIndex = index; } - void SetFixupInfo(QueuedObjectInfo *pData) - { - WRAPPER_NO_CONTRACT; - if (pData->GetSize() > 0) - { - SetHasFixupInfo(); - memcpy(m_fixupData, pData, pData->GetSize()); - } - } - QueuedObjectInfo *GetFixupInfo() - { - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - return (HasFixupInfo() ? (QueuedObjectInfo *)&m_fixupData[0] : NULL); - } - virtual DWORD GetSize() - { - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - DWORD size = sizeof(IObjRefInstanceInfo) + (HasFixupInfo() ? ((QueuedObjectInfo *)&m_fixupData[0])->GetSize() : 0); -#if defined(_WIN64) || defined(ALIGN_ACCESS) - size = (DWORD)ALIGN_UP(size, sizeof(SIZE_T)); -#endif // _WIN64 || ALIGN_ACCESS - return size; - } -}; - -// Represents a special object (Boxed value type) -// Contains fixup information to fix the completed object into its parent -class ValueTypeInfo : public SpecialObjectInfo -{ -protected: - DWORD m_ISerTSOIndex; // If this is also an Iserializable instance, index of the iser entry in TSO - DWORD m_IObjRefTSOIndex; // If this is also an IObjRef instance, index of the iser entry in TSO - BYTE m_fixupData[0]; -public: - ValueTypeInfo(int objectId, QueuedObjectInfo *pFixupInfo) - { - WRAPPER_NO_CONTRACT; - static_assert_no_msg((offsetof(ValueTypeInfo, m_fixupData) % sizeof(SIZE_T)) == 0); - m_ISerTSOIndex = (DWORD) -1; - m_IObjRefTSOIndex = (DWORD) -1; - m_objectId = objectId; - SetNeedsUnboxing(); - SetIsBoxedObject(); - SetFixupInfo(pFixupInfo); - } - DWORD GetISerTSOIndex() {LIMITED_METHOD_CONTRACT; return m_ISerTSOIndex; } - void SetISerTSOIndex(DWORD index) - { LIMITED_METHOD_CONTRACT; m_ISerTSOIndex = index; } - DWORD GetIObjRefTSOIndex() {LIMITED_METHOD_CONTRACT; return m_IObjRefTSOIndex; } - void SetIObjRefTSOIndex(DWORD index) - { LIMITED_METHOD_CONTRACT; m_IObjRefTSOIndex = index; } - void SetFixupInfo(QueuedObjectInfo *pData) - { - WRAPPER_NO_CONTRACT; - if (pData->GetSize() > 0) - { - SetHasFixupInfo(); - memcpy(m_fixupData, pData, pData->GetSize()); - } - } - QueuedObjectInfo *GetFixupInfo() - { - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - return (HasFixupInfo() ? (QueuedObjectInfo *)&m_fixupData[0] : NULL); - } - virtual DWORD GetSize() - { - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - DWORD size = sizeof(ValueTypeInfo) + (HasFixupInfo() ? ((QueuedObjectInfo *)&m_fixupData[0])->GetSize() : 0); -#if defined(_WIN64) || defined(ALIGN_ACCESS) - size = (DWORD)ALIGN_UP(size, sizeof(SIZE_T)); -#endif // _WIN64 || ALIGN_ACCESS - return size; - } -}; - -// Threshold beyond which the collections switch to using the heap -// STACK_TO_HEAP_THRESHOLD/NUM_SLOTS_PER_BUCKET must be 1 or a prime, because -// it is used in GCSafeObjectHashTable as the number of hash table buckets. -#ifdef _DEBUG -#define STACK_TO_HEAP_THRESHOLD 5 -#define QOM_STACK_TO_HEAP_THRESHOLD 5 -#define QOF_STACK_TO_HEAP_THRESHOLD 5 -#define TSO_STACK_TO_HEAP_THRESHOLD 5 -#define TDC_STACK_TO_HEAP_THRESHOLD 5 -#define VSC_STACK_TO_HEAP_THRESHOLD 5 -#define VDC_STACK_TO_HEAP_THRESHOLD 5 -#else -#define STACK_TO_HEAP_THRESHOLD (NUM_SLOTS_PER_BUCKET * 29) -#define QOM_STACK_TO_HEAP_THRESHOLD 100 -#define QOF_STACK_TO_HEAP_THRESHOLD 16 -#define TSO_STACK_TO_HEAP_THRESHOLD 8 -#define TDC_STACK_TO_HEAP_THRESHOLD 8 -#define VSC_STACK_TO_HEAP_THRESHOLD 8 -#define VDC_STACK_TO_HEAP_THRESHOLD 8 -#endif - -#define NUM_SLOTS_PER_BUCKET 4 - -#define MAGIC_FACTOR 12 - -#define LIFO_QUEUE 1 -#define FIFO_QUEUE 2 - - -class GCSafeCollection -{ - VPTR_BASE_VTABLE_CLASS(GCSafeCollection) -protected: - // AppDomain object leak protection: pointer to predicate which flips to false once we should stop reporting GC references. - PTR_BOOL m_pfReportRefs; - -public: - GCSafeCollection(){} - virtual void Cleanup() = 0; - virtual void ReportGCRefs(promote_func *fn, ScanContext* sc) = 0; -}; - -typedef VPTR(GCSafeCollection) PTR_GCSafeCollection; - -class GCSafeObjectTable : public GCSafeCollection -{ - VPTR_VTABLE_CLASS(GCSafeObjectTable, GCSafeCollection); -protected: - - PTR_OBJECTREF m_Objects1; - PTR_OBJECTREF m_Objects2; - PTR_OBJECTREF m_Objects3; - - PTR_DWORD m_dataIndices; - PTR_BYTE m_data; - - DWORD m_currArraySize; - // Objects - DWORD m_count; - DWORD m_head; - // Data - DWORD m_numDataBytes; - DWORD m_dataHead; - - // LIFO/FIFO - DWORD m_QueueType; - BOOL m_usingHeap; - - BOOL m_fCleanedUp; - -#ifndef DACCESS_COMPILE - void EnsureSize(DWORD requiredDataSize); - void Resize(); -#endif - -public: -#ifndef DACCESS_COMPILE - void Init(OBJECTREF *ref1, OBJECTREF *ref2, OBJECTREF *ref3, DWORD *dwIndices, BYTE *bData, DWORD currArraySize, DWORD qType, BOOL *pfReportRefs) - { - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_INTOLERANT; - m_Objects1 = ref1; - m_Objects2 = ref2; - m_Objects3 = ref3; - m_dataIndices = dwIndices; - m_data = bData; - m_QueueType = qType; - m_currArraySize = currArraySize; - m_usingHeap = FALSE; - m_count = 0; - m_head = 0; - m_numDataBytes = 0; - m_dataHead = 0; - _ASSERTE(m_QueueType == LIFO_QUEUE || m_QueueType == FIFO_QUEUE); - // If this is a lifo queue, then the data indices are definitely needed - _ASSERTE(m_QueueType != LIFO_QUEUE || m_dataIndices != NULL); - m_pfReportRefs = pfReportRefs; - m_fCleanedUp = FALSE; -#ifdef USE_CHECKED_OBJECTREFS - ZeroMemory(m_Objects1, sizeof(OBJECTREF) * m_currArraySize); - if (m_Objects2 != NULL) - ZeroMemory(m_Objects2, sizeof(OBJECTREF) * m_currArraySize); - if (m_Objects3 != NULL) - ZeroMemory(m_Objects3, sizeof(OBJECTREF) * m_currArraySize); - for(DWORD i = 0; i < m_currArraySize; i++) - { - Thread::ObjectRefProtected(&m_Objects1[i]); - if (m_Objects2) - Thread::ObjectRefProtected(&m_Objects2[i]); - if (m_Objects3) - Thread::ObjectRefProtected(&m_Objects3[i]); - } -#endif - } - - void Init(OBJECTREF *ref1, BYTE *bData, DWORD currArraySize, DWORD qType, BOOL *pfReportRefs) - { - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_INTOLERANT; - - m_Objects1 = ref1; - m_Objects2 = NULL; - m_Objects3 = NULL; - m_dataIndices = NULL; - m_data = bData; - m_QueueType = qType; - m_currArraySize = currArraySize; - m_usingHeap = FALSE; - m_count = 0; - m_head = 0; - m_numDataBytes = 0; - m_dataHead = 0; - _ASSERTE(m_QueueType == LIFO_QUEUE || m_QueueType == FIFO_QUEUE); - // If this is a lifo queue, then the data indices are definitely needed - _ASSERTE(m_QueueType != LIFO_QUEUE || m_dataIndices != NULL); - m_pfReportRefs = pfReportRefs; - m_fCleanedUp = FALSE; -#ifdef USE_CHECKED_OBJECTREFS - ZeroMemory(m_Objects1, sizeof(OBJECTREF) * m_currArraySize); - if (m_Objects2 != NULL) - ZeroMemory(m_Objects2, sizeof(OBJECTREF) * m_currArraySize); - if (m_Objects3 != NULL) - ZeroMemory(m_Objects3, sizeof(OBJECTREF) * m_currArraySize); - for(DWORD i = 0; i < m_currArraySize; i++) - { - Thread::ObjectRefProtected(&m_Objects1[i]); - if (m_Objects2) - Thread::ObjectRefProtected(&m_Objects2[i]); - if (m_Objects3) - Thread::ObjectRefProtected(&m_Objects3[i]); - } -#endif - } - -#endif // !DACCESS_COMPILE - - virtual void Cleanup() - { - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - -#ifndef DACCESS_COMPILE - // Set this first, we must disable GC reporting of our objects before we start ripping down the data structures that record - // those objects. See ReportGCRefs for a more detailed explanation. - m_fCleanedUp = TRUE; - - if (m_usingHeap == TRUE) - { - if (m_Objects1) - delete[] m_Objects1; - m_Objects1 = NULL; - if (m_Objects2) - delete[] m_Objects2; - m_Objects2 = NULL; - if (m_Objects3) - delete[] m_Objects3; - m_Objects3 = NULL; - if (m_data) - delete[] m_data; - m_data = NULL; - if (m_dataIndices) - delete[] m_dataIndices; - m_dataIndices = NULL; - } - -#endif // !DACCESS_COMPILE - } - - virtual void ReportGCRefs(promote_func *fn, ScanContext* sc) - { - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - - // Due to the wacky way that frames are cleaned up (they're popped en masse by exception handling code in finally blocks) - // it's possible that this object may be destructed before the custom GC frame is popped. If there's a GC in the timing - // window then we end up here with the object destructed. It happens that the underlying storage (the stack) is still valid - // since the exception handling code that's doing all this unwinding hasn't actually physically unwound the stack yet, but - // the destructor has been run and may have left the object in an inconsistent state. To solve this in a really obvious - // manner (less likely to be broken by a random change in the future) we keep a boolean that's set to true once the object - // has been destructed (actually, once Cleanup has been called, because that's the destructive part). We don't need to - // report anything beyond this point (and to do so would be dangerous given the state of the collection). - if (m_fCleanedUp) - return; - - // We track a predicate (actually embedded in the cloner which owns us) that tells us whether to report any GC refs at all. - // This is used as a rip cord if the server appdomain is unloaded while we're processing in it (because this collection can - // survive for a little while after that which is long enough to cause server objects to outlive their domain). - if (!*m_pfReportRefs) - { - m_count = 0; - if (m_Objects1) - ZeroMemory(m_Objects1, m_currArraySize * sizeof(OBJECTREF)); - if (m_Objects2) - ZeroMemory(m_Objects2, m_currArraySize * sizeof(OBJECTREF)); - if (m_Objects3) - ZeroMemory(m_Objects3, m_currArraySize * sizeof(OBJECTREF)); - return; - } - - PTR_PTR_Object pRefs1 = dac_cast<PTR_PTR_Object>(m_Objects1); - PTR_PTR_Object pRefs2 = dac_cast<PTR_PTR_Object>(m_Objects2); - PTR_PTR_Object pRefs3 = dac_cast<PTR_PTR_Object>(m_Objects3); - - if (m_QueueType == LIFO_QUEUE) - { - for (DWORD i = 0; i < m_count; i++) - { - _ASSERTE(i < m_currArraySize); - if (m_Objects1) - (*fn)(pRefs1 + i, sc, 0); - if (m_Objects2) - (*fn)(pRefs2 + i, sc, 0); - if (m_Objects3) - (*fn)(pRefs3 + i, sc, 0); - } - } - else - { - for (DWORD i = m_head, count = 0; count < m_count; i++, count++) - { - i = i % m_currArraySize; - if (m_Objects1) - (*fn)(pRefs1 + i, sc, 0); - if (m_Objects2) - (*fn)(pRefs2 + i, sc, 0); - if (m_Objects3) - (*fn)(pRefs3 + i, sc, 0); - } - } - } - -#ifndef DACCESS_COMPILE - void Enqueue(OBJECTREF refObj, OBJECTREF refParent, OBJECTREF refAux, QueuedObjectInfo *pQOI); - void Push(OBJECTREF refObj, OBJECTREF refParent, OBJECTREF refAux, QueuedObjectInfo *pQOI); - void SetAt(DWORD index, OBJECTREF refObj, OBJECTREF refParent, OBJECTREF refAux, QueuedObjectInfo *pQOI); - OBJECTREF Dequeue(OBJECTREF *refParent, OBJECTREF *refAux, QueuedObjectInfo **pQOI); - OBJECTREF Pop(OBJECTREF *refParent, OBJECTREF *refAux, QueuedObjectInfo **pQOI); - OBJECTREF GetAt(DWORD index, OBJECTREF *refParent, OBJECTREF *refAux, QueuedObjectInfo **pQOI); - OBJECTREF Peek(OBJECTREF *refParent, OBJECTREF *refAux, QueuedObjectInfo **pQOI); - void BeginEnumeration(DWORD *dwIndex) - { - LIMITED_METHOD_CONTRACT; - if (m_QueueType == LIFO_QUEUE) - *dwIndex = m_count; - else - *dwIndex = 0; - } - - OBJECTREF GetNext(DWORD *dwIndex, OBJECTREF *refParent, OBJECTREF *refAux, QueuedObjectInfo **pQOI) - { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - SO_TOLERANT; - MODE_COOPERATIVE; - } - CONTRACTL_END; - - OBJECTREF refRet = NULL; - if (m_QueueType == LIFO_QUEUE) - { - if (*dwIndex == 0) - return NULL; - - (*dwIndex)--; - refRet = GetAt(*dwIndex, refParent, refAux, pQOI); - } - else - { - if (*dwIndex == m_count) - return NULL; - - refRet = GetAt(*dwIndex, refParent, refAux, pQOI); - (*dwIndex)++; - } - return refRet; - } - - DWORD GetCount() { LIMITED_METHOD_CONTRACT; return m_count; } -#endif // !DACCESS_COMPILE -}; - -#ifndef DACCESS_COMPILE -class DwordArrayList -{ - DWORD m_dwordsOnStack[STACK_TO_HEAP_THRESHOLD]; - DWORD *m_dwords; - - DWORD m_count; - DWORD m_currSize; -public: - - void Init() - { - LIMITED_METHOD_CONTRACT; - m_dwords = &m_dwordsOnStack[0]; - m_currSize = STACK_TO_HEAP_THRESHOLD; - m_count = 0; - } - - void Add(DWORD i) - { - WRAPPER_NO_CONTRACT; - EnsureSize(); - m_dwords[m_count++] = i; - } - - void EnsureSize() - { - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - MODE_COOPERATIVE; - STATIC_CONTRACT_SO_INTOLERANT; - } - CONTRACTL_END - if (m_count < m_currSize) - return; - - DWORD newSize = m_currSize * 2; - // Does not need a holder because this is the only allocation in this method - DWORD *pTemp = new DWORD[newSize]; - ZeroMemory(pTemp, sizeof(DWORD) * newSize); - - memcpy((BYTE*)pTemp, m_dwords, sizeof(DWORD) * m_currSize); - if (m_dwords != &m_dwordsOnStack[0]) - { - delete[] m_dwords; - } - m_dwords = pTemp; - m_count = m_currSize; - m_currSize = newSize; - } - - void Cleanup() - { - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - if (m_dwords != &m_dwordsOnStack[0]) - { - delete[] m_dwords; - m_dwords = &m_dwordsOnStack[0]; - } - } - - DWORD GetCount() { LIMITED_METHOD_CONTRACT; return m_count; } - DWORD GetAt(DWORD index) - { - LIMITED_METHOD_CONTRACT; - _ASSERTE(index >= 0 && index < m_count); - return m_dwords[index]; - } -}; -#endif // !DACCESS_COMPILE - -class GCSafeObjectHashTable : public GCSafeCollection -{ - VPTR_VTABLE_CLASS(GCSafeObjectHashTable, GCSafeCollection); -private: - OBJECTREF m_objectsOnStack[STACK_TO_HEAP_THRESHOLD]; - OBJECTREF m_newObjectsOnStack[STACK_TO_HEAP_THRESHOLD]; - DWORD m_dataOnStack[STACK_TO_HEAP_THRESHOLD]; - DWORD m_count; - DWORD m_currArraySize; - PTR_int m_ids; - PTR_OBJECTREF m_objects; - PTR_OBJECTREF m_newObjects; - BOOL m_fCleanedUp; - -#ifndef DACCESS_COMPILE - void Resize(); - int FindElement(OBJECTREF refObj, BOOL &seenBefore); -#endif // !DACCESS_COMPILE - -public: - -#ifndef DACCESS_COMPILE - virtual void Init(BOOL *pfReportRefs) - { - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - ZeroMemory(&m_objectsOnStack[0], sizeof(m_objectsOnStack)); - ZeroMemory(&m_dataOnStack[0], sizeof(m_dataOnStack)); - m_objects = &m_objectsOnStack[0]; - m_newObjects = &m_newObjectsOnStack[0]; - m_currArraySize = STACK_TO_HEAP_THRESHOLD; - m_count = 0; - m_ids = (int *) &m_dataOnStack[0]; - m_pfReportRefs = pfReportRefs; - m_fCleanedUp = FALSE; -#ifdef USE_CHECKED_OBJECTREFS - ZeroMemory(&m_newObjects[0], sizeof(m_newObjectsOnStack)); - for(DWORD i = 0; i < m_currArraySize; i++) - { - Thread::ObjectRefProtected(&m_objects[i]); - Thread::ObjectRefProtected(&m_newObjects[i]); - } -#endif - } -#endif // !DACCESS_COMPILE - - virtual void Cleanup() - { - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - -#ifndef DACCESS_COMPILE - // Set this first, we must disable GC reporting of our objects before we start ripping down the data structures that record - // those objects. See ReportGCRefs for a more detailed explanation. - m_fCleanedUp = TRUE; - - if (m_newObjects != &m_newObjectsOnStack[0]) - { - delete[] m_ids; - m_ids = (int *) &m_dataOnStack[0]; - delete[] m_newObjects; - m_newObjects = &m_newObjectsOnStack[0]; - delete[] m_objects; - m_objects = &m_objectsOnStack[0]; - m_currArraySize = STACK_TO_HEAP_THRESHOLD; - } -#endif // !DACCESS_COMPILE - } - - virtual void ReportGCRefs(promote_func *fn, ScanContext* sc) - { - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_SO_TOLERANT; - // Due to the wacky way that frames are cleaned up (they're popped en masse by exception handling code in finally blocks) - // it's possible that this object may be destructed before the custom GC frame is popped. If there's a GC in the timing - // window then we end up here with the object destructed. It happens that the underlying storage (the stack) is still valid - // since the exception handling code that's doing all this unwinding hasn't actually physically unwound the stack yet, but - // the destructor has been run and may have left the object in an inconsistent state. To solve this in a really obvious - // manner (less likely to be broken by a random change in the future) we keep a boolean that's set to true once the object - // has been destructed (actually, once Cleanup has been called, because that's the destructive part). We don't need to - // report anything beyond this point (and to do so would be dangerous given the state of the collection). - if (m_fCleanedUp) - return; - - // We track a predicate (actually embedded in the cloner which owns us) that tells us whether to report any GC refs at all. - // This is used as a rip cord if the server appdomain is unloaded while we're processing in it (because this collection can - // survive for a little while after that which is long enough to cause server objects to outlive their domain). - if (!*m_pfReportRefs) - { - m_count = 0; - ZeroMemory(m_ids, m_currArraySize * sizeof(int)); - ZeroMemory(m_objects, m_currArraySize * sizeof(OBJECTREF)); - ZeroMemory(m_newObjects, m_currArraySize * sizeof(OBJECTREF)); - return; - } - - PTR_PTR_Object pRefs = dac_cast<PTR_PTR_Object>(m_objects); - PTR_PTR_Object pNewRefs = dac_cast<PTR_PTR_Object>(m_newObjects); - - for (DWORD i = 0; i < m_currArraySize; i++) - { - if (m_ids[i] != 0) - { - (*fn)(pRefs + i, sc, 0); - (*fn)(pNewRefs + i, sc, 0); - } - } - } - -#ifndef DACCESS_COMPILE - int HasID(OBJECTREF refObj, OBJECTREF *newObj); - int AddObject(OBJECTREF refObj, OBJECTREF newObj); - int UpdateObject(OBJECTREF refObj, OBJECTREF newObj); -#endif // !DACCESS_COMPILE -}; - -#ifndef DACCESS_COMPILE - -enum SpecialObjects -{ - ISerializable = 1, - IObjectReference, - BoxedValueType -}; - -enum CloningContext -{ - CrossAppDomain = 1, - ObjectFreezer -}; - -class CrossAppDomainClonerCallback -{ - public: - OBJECTREF AllocateObject(OBJECTREF, MethodTable * pMT) - { - WRAPPER_NO_CONTRACT; - return pMT->Allocate(); - } - - OBJECTREF AllocateArray(OBJECTREF, TypeHandle arrayType, INT32 *pArgs, DWORD dwNumArgs, BOOL bAllocateInLargeHeap) - { - WRAPPER_NO_CONTRACT; - return ::AllocateArrayEx(arrayType, pArgs, dwNumArgs, bAllocateInLargeHeap DEBUG_ARG(FALSE)); - } - - STRINGREF AllocateString(STRINGREF refSrc) - { - LIMITED_METHOD_CONTRACT; - return refSrc; - } - - void ValidateFromType(MethodTable *pFromMT) - { - WRAPPER_NO_CONTRACT; - CheckSerializable(pFromMT); - } - - void ValidateToType(MethodTable *pToMT) - { - WRAPPER_NO_CONTRACT; - CheckSerializable(pToMT); - } - - BOOL IsRemotedType(MethodTable *pMT, AppDomain* pFromAD, AppDomain* pToDomain) - { - WRAPPER_NO_CONTRACT; - if ((pMT->IsMarshaledByRef() && pFromAD != pToDomain) || - pMT->IsTransparentProxy()) - return TRUE; - - return FALSE; - } - - BOOL IsISerializableType(MethodTable *pMT) - { - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - } - CONTRACTL_END; - return pMT->CanCastToNonVariantInterface(MscorlibBinder::GetClass(CLASS__ISERIALIZABLE)); - } - - BOOL IsIObjectReferenceType(MethodTable *pMT) - { - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - } - CONTRACTL_END; - return pMT->CanCastToNonVariantInterface(MscorlibBinder::GetClass(CLASS__IOBJECTREFERENCE)); - } - - BOOL RequiresDeserializationCallback(MethodTable *pMT) - { - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - } - CONTRACTL_END; - return pMT->CanCastToNonVariantInterface(MscorlibBinder::GetClass(CLASS__IDESERIALIZATIONCB)); - } - - BOOL RequiresDeepCopy(OBJECTREF refObj) - { - LIMITED_METHOD_CONTRACT; - return TRUE; - } - - private: - void CheckSerializable(MethodTable *pCurrMT) - { - CONTRACTL - { - GC_TRIGGERS; - MODE_COOPERATIVE; - THROWS; - } - CONTRACTL_END; - - // Checking whether the type is marked as Serializable is not enough, all of its ancestor types must be marked this way - // also. THe only exception is that any type that also implements ISerializable doesn't require a serializable parent. - if (pCurrMT->IsSerializable()) - { - MethodTable *pISerializableMT = MscorlibBinder::GetClass(CLASS__ISERIALIZABLE); - MethodTable *pMT = pCurrMT; - for (;;) - { - // We've already checked this particular type is marked Serializable, so if it implements ISerializable then - // we're done. - if (pMT->ImplementsInterface(pISerializableMT)) - return; - - // Else we get the parent type and check it is marked Serializable as well. - pMT = pMT->GetParentMethodTable(); - - // If we've run out of parents we're done and the type is serializable. - if (pMT == NULL) - return; - - // Otherwise check for the attribute. - if (!pMT->IsSerializable()) - break; - } - } - - if (pCurrMT->IsMarshaledByRef()) - return; - - if (pCurrMT->IsTransparentProxy()) - return; - - if (pCurrMT->IsEnum()) - return; - - if (pCurrMT->IsDelegate()) - return; - - DefineFullyQualifiedNameForClassW(); - LPCWSTR wszCliTypeName = GetFullyQualifiedNameForClassNestedAwareW(pCurrMT); - - SString ssAssemblyName; - pCurrMT->GetAssembly()->GetDisplayName(ssAssemblyName); - COMPlusThrow(kSerializationException, IDS_SERIALIZATION_NONSERTYPE, wszCliTypeName, ssAssemblyName.GetUnicode()); - } -}; - -class CrossDomainFieldMap -{ - struct FieldMapEntry - { - ADID m_dwSrcDomain; - ADID m_dwDstDomain; - MethodTable *m_pSrcMT; - MethodTable *m_pDstMT; - FieldDesc **m_pFieldMap; - - FieldMapEntry(MethodTable *pSrcMT, MethodTable *pDstMT, FieldDesc **pFieldMap); - ~FieldMapEntry() - { - LIMITED_METHOD_CONTRACT; - delete [] m_pFieldMap; - } - - UPTR GetHash() - { - LIMITED_METHOD_CONTRACT; - return (UINT)(SIZE_T)m_pSrcMT + ((UINT)(SIZE_T)m_pDstMT >> 2); - } - }; - - static PtrHashMap *s_pFieldMap; - static SimpleRWLock *s_pFieldMapLock; - - static BOOL CompareFieldMapEntry(UPTR val1, UPTR val2); - -public: - static void FlushStaleEntries(); - static FieldDesc **LookupOrCreateFieldMapping(MethodTable *pDstMT, MethodTable *pSrcMT); -}; - -// Currently the object cloner uses DWORDs as indices. We may have to use QWORDs instead -// if we start to have extremely large object graphs. -class ObjectClone -{ - OBJECTREF m_QOMObjects[QOM_STACK_TO_HEAP_THRESHOLD]; - BYTE m_QOMData[QOM_STACK_TO_HEAP_THRESHOLD * MAGIC_FACTOR]; - - OBJECTREF m_QOFObjects[QOF_STACK_TO_HEAP_THRESHOLD]; - BYTE m_QOFData[QOF_STACK_TO_HEAP_THRESHOLD * MAGIC_FACTOR]; - - OBJECTREF m_TSOObjects1[TSO_STACK_TO_HEAP_THRESHOLD]; - OBJECTREF m_TSOObjects2[TSO_STACK_TO_HEAP_THRESHOLD]; - OBJECTREF m_TSOObjects3[TSO_STACK_TO_HEAP_THRESHOLD]; - BYTE m_TSOData[TSO_STACK_TO_HEAP_THRESHOLD * MAGIC_FACTOR]; - DWORD m_TSOIndices[TSO_STACK_TO_HEAP_THRESHOLD]; - - OBJECTREF m_TDCObjects[TDC_STACK_TO_HEAP_THRESHOLD]; - BYTE m_TDCData[TDC_STACK_TO_HEAP_THRESHOLD * MAGIC_FACTOR]; - - OBJECTREF m_VSCObjects[VSC_STACK_TO_HEAP_THRESHOLD]; - - OBJECTREF m_VDCObjects[VDC_STACK_TO_HEAP_THRESHOLD]; - - GCSafeObjectTable QOM; // Queue_of_Object_to_be_Marshalled - GCSafeObjectTable QOF; // Queue_of_Objects_to_be_Fixed_Up - GCSafeObjectHashTable TOS; // Table_of_Objects_Seen - GCSafeObjectTable TSO; // Table_of_Special_Objects - GCSafeObjectTable TDC; // Table_of_Deserialization_Callbacks - GCSafeObjectTable VSC; // Vts_Serialization_Callbacks - GCSafeObjectTable VDC; // Vts_Deserialization_Callbacks - DwordArrayList TMappings; - - FrameWithCookie<GCSafeCollectionFrame> QOM_Protector; - FrameWithCookie<GCSafeCollectionFrame> QOF_Protector; - FrameWithCookie<GCSafeCollectionFrame> TOS_Protector; - FrameWithCookie<GCSafeCollectionFrame> TSO_Protector; - FrameWithCookie<GCSafeCollectionFrame> TDC_Protector; - FrameWithCookie<GCSafeCollectionFrame> VSC_Protector; - FrameWithCookie<GCSafeCollectionFrame> VDC_Protector; - - BOOL m_skipFieldScan; - - AppDomain* m_fromDomain; - AppDomain* m_toDomain; - - OBJECTREF m_currObject; // Updated within the loop in Clone method - OBJECTREF m_newObject; // Updated within the loop in Clone method - OBJECTREF m_topObject; - OBJECTREF m_fromExecutionContext; // Copy of the execution context on the way in (used during callbacks to the from domain) - - BOOL m_securityChecked; - - // AppDomain object leak protection: predicate which flips to false once we should stop reporting GC references in the - // collections this cloner owns. - BOOL m_fReportRefs; - - CrossAppDomainClonerCallback *m_cbInterface; - CloningContext m_context; - - PTRARRAYREF AllocateISerializable(int objectId, BOOL bIsRemotingObject); - void AllocateArray(); - void AllocateObject(); - - PTRARRAYREF MakeObjectLookLikeISerializable(int objectId); - - void HandleISerializableFixup(OBJECTREF refParent, QueuedObjectInfo *currObjFixupInfo); - void HandleArrayFixup(OBJECTREF refParent, QueuedObjectInfo *currObjFixupInfo); - void HandleObjectFixup(OBJECTREF refParent, QueuedObjectInfo *currObjFixupInfo); - void Fixup(OBJECTREF newObj, OBJECTREF refParent, QueuedObjectInfo *currObjFixupInfo); - - void ScanMemberFields(DWORD IObjRefTSOIndex, DWORD BoxedValTSOIndex); - DWORD CloneField(FieldDesc *pSrcField, FieldDesc *pDstField); - static BOOL AreTypesEmittedIdentically(MethodTable *pMT1, MethodTable *pMT2); - void ScanISerializableMembers(DWORD IObjRefTSOIndex, DWORD ISerTSOIndex, DWORD BoxedValTSOIndex, PTRARRAYREF refValues); - void ScanArrayMembers(); - Object *GetObjectFromArray(BASEARRAYREF* arrObj, DWORD dwOffset); - - void CompleteValueTypeFields(OBJECTREF newObj, OBJECTREF refParent, QueuedObjectInfo *valTypeInfo); - void CompleteSpecialObjects(); - void CompleteISerializableObject(OBJECTREF IserObj, OBJECTREF refNames, OBJECTREF refValues, ISerializableInstanceInfo *); - BOOL CompleteIObjRefObject(OBJECTREF IObjRef, DWORD index, IObjRefInstanceInfo *iorInfo); - void CompleteIDeserializationCallbacks(); - void CompleteVtsOnDeserializedCallbacks(); - void CompleteVtsOnSerializedCallbacks(); - BOOL CheckForUnresolvedMembers(SpecialObjectInfo *splInfo); - - TypeHandle GetCorrespondingTypeForTargetDomain(TypeHandle thCli); - MethodTable * GetCorrespondingTypeForTargetDomain(MethodTable * pCliMT); - TypeHandle GetType(const SString &ssTypeName, const SString &ssAssemName); - - DWORD FindObjectInTSO(int objId, SpecialObjects kind); - ARG_SLOT HandleFieldTypeMismatch(CorElementType srcTy, CorElementType destTy, void *pData, MethodTable *pSrcMT); - BOOL IsDelayedFixup(MethodTable *newMT, QueuedObjectInfo *); - OBJECTREF BoxValueTypeInWrongDomain(OBJECTREF refParent, DWORD offset, MethodTable *pValueTypeMT); - - BOOL HasVtsCallbacks(MethodTable *pMT, RemotingVtsInfo::VtsCallbackType eCallbackType); - void InvokeVtsCallbacks(OBJECTREF refTarget, RemotingVtsInfo::VtsCallbackType eCallbackType, AppDomain* pDomain); - - RuntimeMethodHandle::StreamingContextStates GetStreamingContextState() - { - LIMITED_METHOD_CONTRACT; - - if (m_context == CrossAppDomain) - return RuntimeMethodHandle::CONTEXTSTATE_CrossAppDomain; - - if (m_context == ObjectFreezer) - return RuntimeMethodHandle::CONTEXTSTATE_Other; - - _ASSERTE(!"Should not get here; using the cloner with a context we don't understand"); - return RuntimeMethodHandle::CONTEXTSTATE_Other; - } -public: - - void Init(BOOL bInitialInit) - { - WRAPPER_NO_CONTRACT; - - if (bInitialInit) - { - TOS.Init(&m_fReportRefs); - TSO.Init(&m_TSOObjects1[0], &m_TSOObjects2[0], &m_TSOObjects3[0], &m_TSOIndices[0], &m_TSOData[0], TSO_STACK_TO_HEAP_THRESHOLD, LIFO_QUEUE, &m_fReportRefs); - } - QOM.Init(&m_QOMObjects[0], &m_QOMData[0], QOM_STACK_TO_HEAP_THRESHOLD, FIFO_QUEUE, &m_fReportRefs); - QOF.Init(&m_QOFObjects[0], &m_QOFData[0], QOF_STACK_TO_HEAP_THRESHOLD, FIFO_QUEUE, &m_fReportRefs); - TDC.Init(&m_TDCObjects[0], &m_TDCData[0], TDC_STACK_TO_HEAP_THRESHOLD, FIFO_QUEUE, &m_fReportRefs); - VSC.Init(&m_VSCObjects[0], NULL, VSC_STACK_TO_HEAP_THRESHOLD, FIFO_QUEUE, &m_fReportRefs); - VDC.Init(&m_VDCObjects[0], NULL, VDC_STACK_TO_HEAP_THRESHOLD, FIFO_QUEUE, &m_fReportRefs); - TMappings.Init(); - } - void Cleanup(BOOL bFinalCleanup) - { - WRAPPER_NO_CONTRACT; - if (bFinalCleanup) - { - TOS.Cleanup(); - TSO.Cleanup(); - } - - QOM.Cleanup(); - QOF.Cleanup(); - TDC.Cleanup(); - VSC.Cleanup(); - VDC.Cleanup(); - TMappings.Cleanup(); - } - - ObjectClone(CrossAppDomainClonerCallback *cbInterface, CloningContext cc=CrossAppDomain, BOOL bNeedSecurityCheck = TRUE) - { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_COOPERATIVE; - } - CONTRACTL_END; - static_assert_no_msg((offsetof(ObjectClone, m_QOMObjects) % sizeof(SIZE_T)) == 0); - static_assert_no_msg((offsetof(ObjectClone, m_QOFObjects) % sizeof(SIZE_T)) == 0); - static_assert_no_msg((offsetof(ObjectClone, m_TSOData) % sizeof(SIZE_T)) == 0); - static_assert_no_msg((offsetof(ObjectClone, m_TDCData) % sizeof(SIZE_T)) == 0); - static_assert_no_msg((offsetof(ObjectClone, m_VSCObjects) % sizeof(SIZE_T)) == 0); - static_assert_no_msg((offsetof(ObjectClone, m_VDCObjects) % sizeof(SIZE_T)) == 0); - - m_securityChecked = !bNeedSecurityCheck; - m_context = cc; - m_cbInterface = cbInterface; - m_fReportRefs = true; - - Init(TRUE); - - // Order of these is important. The frame lowest on the stack (ie declared last inside ObjectClone) has to be pushed first - (void)new (VDC_Protector.GetGSCookiePtr()) FrameWithCookie<GCSafeCollectionFrame>(&VDC); - (void)new (VSC_Protector.GetGSCookiePtr()) FrameWithCookie<GCSafeCollectionFrame>(&VSC); - (void)new (TDC_Protector.GetGSCookiePtr()) FrameWithCookie<GCSafeCollectionFrame>(&TDC); - (void)new (TSO_Protector.GetGSCookiePtr()) FrameWithCookie<GCSafeCollectionFrame>(&TSO); - (void)new (TOS_Protector.GetGSCookiePtr()) FrameWithCookie<GCSafeCollectionFrame>(&TOS); - (void)new (QOF_Protector.GetGSCookiePtr()) FrameWithCookie<GCSafeCollectionFrame>(&QOF); - (void)new (QOM_Protector.GetGSCookiePtr()) FrameWithCookie<GCSafeCollectionFrame>(&QOM); - } - - void RemoveGCFrames() - { - LIMITED_METHOD_CONTRACT; - // Order of these is important. The frame highest on the stack has to be pushed first - QOM_Protector.Pop(); - QOF_Protector.Pop(); - TOS_Protector.Pop(); - TSO_Protector.Pop(); - TDC_Protector.Pop(); - VSC_Protector.Pop(); - VDC_Protector.Pop(); - } - - ~ObjectClone() - { - WRAPPER_NO_CONTRACT; - Cleanup(TRUE); - } - - OBJECTREF Clone(OBJECTREF refObj, AppDomain* fromDomain, AppDomain* toDomain, OBJECTREF refExecutionContext) - { - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - } - CONTRACTL_END; - TypeHandle thDummy; - OBJECTREF refResult = Clone(refObj, thDummy, fromDomain, toDomain, refExecutionContext); - return refResult; - } - - OBJECTREF Clone(OBJECTREF refObj, - TypeHandle expectedType, - AppDomain *fromDomain, - AppDomain *toDomain, - OBJECTREF refExecutionContext); - - static void StopReportingRefs(ObjectClone *pThis) - { - pThis->m_fReportRefs = false; - } -}; - -typedef Holder<ObjectClone *, DoNothing<ObjectClone*>, ObjectClone::StopReportingRefs> ReportClonerRefsHolder; - -#endif -#endif diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp index 8e158d2fb9..e52e2b2238 100644 --- a/src/vm/prestub.cpp +++ b/src/vm/prestub.cpp @@ -17,9 +17,6 @@ #include "eeconfig.h" #include "dllimport.h" #include "comdelegate.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "dbginterface.h" #include "listlock.inl" #include "stubgen.h" @@ -1304,13 +1301,6 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT) { pStub = MakeUnboxingStubWorker(this); } -#ifdef FEATURE_REMOTING - else if (pMT->IsInterface() && !IsStatic() && !IsFCall()) - { - pCode = CRemotingServices::GetDispatchInterfaceHelper(this); - GetOrCreatePrecode(); - } -#endif // FEATURE_REMOTING #if defined(FEATURE_SHARE_GENERIC_CODE) else if (IsInstantiatingStub()) { @@ -1579,24 +1569,6 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT) // stub that performs declarative checks prior to calling the real stub. // record if security needs to intercept this call (also depends on whether we plan to use stubs for declarative security) -#if !defined( HAS_REMOTING_PRECODE) && defined (FEATURE_REMOTING) - /************************** REMOTING *************************/ - - // check for MarshalByRef scenarios ... we need to intercept - // Non-virtual calls on MarshalByRef types - if (fRemotingIntercepted) - { - // let us setup a remoting stub to intercept all the calls - Stub *pRemotingStub = CRemotingServices::GetStubForNonVirtualMethod(this, - (pStub != NULL) ? (LPVOID)pStub->GetEntryPoint() : (LPVOID)pCode, pStub); - - if (pRemotingStub != NULL) - { - pStub = pRemotingStub; - pCode = NULL; - } - } -#endif // HAS_REMOTING_PRECODE _ASSERTE((pStub != NULL) ^ (pCode != NULL)); diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp index b7a0eb75e6..40f0864d72 100644 --- a/src/vm/proftoeeinterfaceimpl.cpp +++ b/src/vm/proftoeeinterfaceimpl.cpp @@ -3557,90 +3557,7 @@ HRESULT ProfToEEInterfaceImpl::GetContextStaticAddress(ClassID classId, fieldToken, contextId)); -#ifdef FEATURE_REMOTING - - // - // Check for NULL parameters - // - if ((classId == NULL) || (contextId == NULL) || (ppAddress == NULL)) - { - return E_INVALIDARG; - } - - if (GetThread() == NULL) - { - return CORPROF_E_NOT_MANAGED_THREAD; - } - - if (GetAppDomain() == NULL) - { - return E_FAIL; - } - - TypeHandle typeHandle = TypeHandle::FromPtr((void *)classId); - - // - // If this class is not fully restored, that is all the information we can get at this time. - // - if (!typeHandle.IsRestored()) - { - return CORPROF_E_DATAINCOMPLETE; - } - - // - // Get the field descriptor object - // - FieldDesc *pFieldDesc = typeHandle.GetModule()->LookupFieldDef(fieldToken); - - if (pFieldDesc == NULL) - { - return E_INVALIDARG; - } - - // - // Verify this field is of the right type - // - if(!pFieldDesc->IsStatic() || - !pFieldDesc->IsContextStatic() || - pFieldDesc->IsRVA() || - pFieldDesc->IsThreadStatic()) - { - return E_INVALIDARG; - } - - // It may seem redundant to try to retrieve the same method table from GetEnclosingMethodTable, but classId - // leads to the instantiated method table while GetEnclosingMethodTable returns the uninstantiated one. - MethodTable *pMethodTable = pFieldDesc->GetEnclosingMethodTable(); - - // - // Check that the data is available - // - if (!IsClassOfMethodTableInited(pMethodTable, GetAppDomain())) - { - return CORPROF_E_DATAINCOMPLETE; - } - - // - // Get the context - // - Context *pContext = reinterpret_cast<Context *>(contextId); - - // - // Store the result and return - // - PTR_VOID pAddress = pContext->GetStaticFieldAddrNoCreate(pFieldDesc); - if (pAddress == NULL) - { - return E_INVALIDARG; - } - - *ppAddress = pAddress; - - return S_OK; - -#else // FEATURE_REMOTING return E_NOTIMPL; -#endif // FEATURE_REMOTING } /* diff --git a/src/vm/reflectioninvocation.cpp b/src/vm/reflectioninvocation.cpp index 1c93d23946..a116d2affd 100644 --- a/src/vm/reflectioninvocation.cpp +++ b/src/vm/reflectioninvocation.cpp @@ -13,9 +13,6 @@ #include "typehandle.h" #include "field.h" #include "security.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "eeconfig.h" #include "vars.hpp" #include "jitinterface.h" @@ -648,21 +645,7 @@ FCIMPL6(Object*, RuntimeTypeHandle::CreateInstance, ReflectClassBaseObject* refT OBJECTREF o; bool remoting = false; -#ifdef FEATURE_REMOTING - if (pVMT->IsTransparentProxy()) - COMPlusThrow(kMissingMethodException,W("NotSupported_Constructor")); - - if (pVMT->MayRequireManagedActivation()) - { - o = CRemotingServices::CreateProxyOrObject(pVMT); - remoting = true; - } - else - o = AllocateObject(pVMT); - -#else o = AllocateObject(pVMT); -#endif GCPROTECT_BEGIN(o); MethodDescCallSite ctor(pMeth, &o); @@ -731,10 +714,6 @@ FCIMPL2(Object*, RuntimeTypeHandle::CreateInstanceForGenericType, ReflectClassBa MethodDescCallSite ctor(pMeth); // We've got the class, lets allocate it and call the constructor -#ifdef FEATURE_REMOTING - _ASSERTE(!pVMT->IsTransparentProxy()); - _ASSERTE(!pVMT->MayRequireManagedActivation()); -#endif // Nullables don't take this path, if they do we need special logic to make an instance _ASSERTE(!Nullable::IsNullableType(instantiatedType)); @@ -1252,14 +1231,6 @@ FCIMPL4(Object*, RuntimeMethodHandle::InvokeMethod, MethodTable * pMT = ownerType.AsMethodTable(); -#ifdef FEATURE_REMOTING - if (pMT->MayRequireManagedActivation()) - { - gc.retVal = CRemotingServices::CreateProxyOrObject(pMT); - fForceActivationForRemoting = TRUE; - } - else -#endif { if (pMT != g_pStringClass) gc.retVal = pMT->Allocate(); @@ -1267,12 +1238,6 @@ FCIMPL4(Object*, RuntimeMethodHandle::InvokeMethod, } else { -#ifdef FEATURE_REMOTING - if (gc.target != NULL) - { - fForceActivationForRemoting = gc.target->IsTransparentProxy(); - } -#endif } { @@ -2913,10 +2878,6 @@ FCIMPL1(Object*, ReflectionSerialization::GetUninitializedObject, ReflectClassBa // Never allow the allocation of an unitialized ContextBoundObject derived type, these must always be created with a paired // transparent proxy or the jit will get confused. -#ifdef FEATURE_REMOTING - if (pMT->IsContextful()) - COMPlusThrow(kNotSupportedException, W("NotSupported_ManagedActivation")); -#endif #ifdef FEATURE_COMINTEROP // Also do not allow allocation of uninitialized RCWs (COM objects). @@ -2970,10 +2931,6 @@ FCIMPL1(Object*, ReflectionSerialization::GetSafeUninitializedObject, ReflectCla // Never allow the allocation of an unitialized ContextBoundObject derived type, these must always be created with a paired // transparent proxy or the jit will get confused. -#ifdef FEATURE_REMOTING - if (pMT->IsContextful()) - COMPlusThrow(kNotSupportedException, W("NotSupported_ManagedActivation")); -#endif #ifdef FEATURE_COMINTEROP // Also do not allow allocation of uninitialized RCWs (COM objects). diff --git a/src/vm/remoting.h b/src/vm/remoting.h deleted file mode 100644 index 4a63df6295..0000000000 --- a/src/vm/remoting.h +++ /dev/null @@ -1,957 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// -// File: remoting.h -// - -// -// Purpose: Defines various remoting related objects such as -// proxies -// - -// - - -#ifndef __REMOTING_H__ -#define __REMOTING_H__ - -#ifndef FEATURE_REMOTING -#error FEATURE_REMOTING is not set, please do not include remoting.h -#endif - -#include "fcall.h" -#include "stubmgr.h" - -// Forward declaration -class TPMethodFrame; - -// <TODO>@TODO: Set the hashtable to delete the data.</TODO> - -// Thunk hash table - the keys are MethodDesc -typedef EEHashTable<MethodDesc *, EEPtrHashTableHelper<MethodDesc *>, FALSE> EEThunkHashTable; - -// ConstVirtualThunkSize declares the size of the code generated by -// CTPMethodTable::CreateThunkForVirtualMethod -#ifdef _TARGET_X86_ - -static const DWORD ConstVirtualThunkSize = sizeof(BYTE) + sizeof(DWORD) + sizeof(BYTE) + sizeof(LONG); - -#elif defined(_TARGET_AMD64_) - -static const DWORD ConstVirtualThunkSize = sizeof(DWORD) + sizeof(UINT64) + 7; - -#elif defined(_TARGET_ARM_) - -static const DWORD ConstVirtualThunkSize = 12; - -#else -PORTABILITY_WARNING("Remoting thunk size not defined for this platform.") -static const DWORD ConstVirtualThunkSize = sizeof(LPVOID); -#endif - -extern "C" -{ - UINT_PTR __stdcall CRemotingServices__CheckForContextMatch(Object* pStubData); - void __stdcall CRemotingServices__DispatchInterfaceCall(); - void __stdcall CRemotingServices__CallFieldGetter(MethodDesc *pMD, LPVOID pThis, LPVOID pFirst, LPVOID pSecond, LPVOID pThird); - void __stdcall CRemotingServices__CallFieldSetter(MethodDesc *pMD, LPVOID pThis, LPVOID pFirst, LPVOID pSecond, LPVOID pThird); -} - -extern "C" LPVOID __stdcall CTPMethodTable__CallTargetHelper2(const void *pTarget, LPVOID pvFirst, LPVOID pvSecond); -extern "C" LPVOID __stdcall CTPMethodTable__CallTargetHelper3(const void *pTarget, LPVOID pvFirst, LPVOID pvSecond, LPVOID pvThird); -extern "C" BOOL __stdcall CTPMethodTable__GenericCheckForContextMatch(Object* orTP); - - -// These are the values returned by RequiresManagedActivation -enum ManagedActivationType -{ - NoManagedActivation = 0, - ManagedActivation = 0x1, -#ifdef FEATURE_COMINTEROP - ComObjectType = 0x2, -#endif // FEATURE_COMINTEROP -}; - - -struct timingData -{ - DWORD threadId; - BYTE stage; - __int64 cycleCount; -}; - - -// This struct is also accessed from managed world -struct messageData -{ - PVOID pFrame; - MethodDesc *pMethodDesc; - MethodDesc *pDelegateMD; - MetaSig *pSig; - TypeHandle thGoverningType; - INT32 iFlags; -}; - - -// The real proxy class is the class behind the -// transparent proxy class -class CRealProxy -{ -public: - // Native helpers - static FCDECL2(VOID, SetStubData, Object* orRPUNSAFE, Object* orStubDataUNSAFE); - static FCDECL1(Object*, GetStubData, Object* orRPUNSAFE); - static FCDECL1(LPVOID, GetStub, Object* orRPUNSAFE); - static FCDECL0(LPVOID, GetDefaultStub); - static FCDECL1(Object*, GetProxiedType, Object* orRPUNSAFE); - - static VOID UpdateOptFlags(OBJECTREF refTP); - static BOOL ProxyTypeIdentityCheck(MethodTable *pCliHierarchy, MethodTable *pSrvHierarchy); -}; - -// Forward declarations -class CVirtualThunkMgr; -class CNonVirtualThunkMgr; - - - - -// Class that provides various remoting services -// to the exposed world -class CRemotingServices -{ -private: - //+------------------------------------------------------------------- - // - // Struct: FieldArgs - // - // Synopsis: Structure to GC protect arguments for a field accessor call. - // DO NOT add non OBJECTREF data types in the structure - // see GCPROTECT_BEGIN() for a better explanation. - // - //+------------------------------------------------------------------- - typedef struct _FieldArgs - { - OBJECTREF obj; - OBJECTREF val; - STRINGREF typeName; - STRINGREF fieldName; - } FieldArgs; - -public: - - // Methods related to interception of non virtual methods & virtual methods called - // non virtually - static PCODE GetNonVirtualEntryPointForVirtualMethod(MethodDesc* pMD); - -#ifndef HAS_REMOTING_PRECODE - static Stub* GetStubForNonVirtualMethod(MethodDesc* pMD, LPVOID pvAddrOfCode, Stub* pInnerStub); -#endif - - static void DestroyThunk(MethodDesc* pMD); - - // Methods related to interception of interface calls - static PCODE GetDispatchInterfaceHelper(MethodDesc* pMD); - - static OBJECTREF CreateProxyOrObject(MethodTable *pMT, BOOL fIsCom = FALSE, BOOL fIsNewObj = FALSE); - - // Methods related to field accessors - static void FieldAccessor(FieldDesc* pFD, OBJECTREF o, LPVOID pVal, BOOL fIsGetter); - - // Methods related to wrapping/unwrapping of objects - static OBJECTREF WrapHelper(OBJECTREF obj); - - static OBJECTREF Wrap(OBJECTREF obj); - static OBJECTREF GetProxyFromObject(OBJECTREF obj); - static OBJECTREF GetObjectFromProxy(OBJECTREF obj); - static BOOL IsProxyToRemoteObject(OBJECTREF obj); - static OBJECTREF GetServerContext(OBJECTREF obj); - - // Methods related to creation and marshaling of appdomains - static OBJECTREF CreateProxyForDomain(AppDomain *pDomain); - - // Extract the true class of a proxy - static REFLECTCLASSBASEREF GetClass(OBJECTREF pThis); - - // Initialization function. - static VOID Initialize(); - - // Start up function. This actually starts up the remoting services. - static void EnsureRemotingStarted(); - - // Other helper functions. - inline static MethodDesc *MDofPrivateInvoke() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pRPPrivateInvoke; - } - - inline static MethodDesc *MDofInvokeStatic() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pRPInvokeStatic; - } - - inline static MethodDesc *MDofIsCurrentContextOK() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pIsCurrentContextOK; - } - - inline static MethodDesc *MDofCheckCast() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pCheckCast; - } - - inline static MethodDesc *MDofWrap() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pWrapMethodDesc; - } - - inline static MethodDesc *MDofFieldSetter() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pFieldSetterDesc; - } - - inline static MethodDesc *MDofFieldGetter() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pFieldGetterDesc; - } - - inline static MethodDesc *MDofGetType() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pGetTypeDesc; - } - - inline static MethodDesc *MDofObjectGetType() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pObjectGetTypeDesc; - } - -#ifdef FEATURE_COMINTEROP - inline static MethodDesc *MDofCreateObjectForCom() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pCreateObjectForCom; - } - - - static BOOL CallSupportsInterface(OBJECTREF realProxy, REFIID iid, ARG_SLOT *pret); - - // helpers to call methods in real proxy - static VOID CallSetDCOMProxy(OBJECTREF realProxy, IUnknown* pUnk); - -#endif // FEATURE_COMINTEROP - - inline static BOOL IsInstanceOfServerIdentity(MethodTable* pMT) - { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(CheckPointer(pMT)); - } - CONTRACTL_END; - - return s_pServerIdentityClass == pMT; - } - - inline static MethodTable *GetMarshalByRefClass() - { - CONTRACT (MethodTable*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pMarshalByRefObjectClass; - } - - static INT32 IsTransparentProxy(Object* obj); - static Object* GetRealProxy(Object* obj); - - static BOOL CheckCast(OBJECTREF orTP, TypeHandle ty); - static BOOL CheckCast(OBJECTREF orTP, TypeHandle objTy, TypeHandle ty); - static OBJECTREF GetExposedContext(); - static AppDomain *GetServerDomainForProxy(OBJECTREF orTP); - static Context *GetServerContextForProxy(OBJECTREF orTP); - static int GetServerDomainIdForProxy(OBJECTREF orTP); - static UINT_PTR CheckForContextMatch(Object* pStubData); - - static ManagedActivationType __stdcall RequiresManagedActivation(TypeHandle ty); - static BOOL IsRemotingStarted() - { - LIMITED_METHOD_CONTRACT; - return s_fRemotingStarted; - }; - - static DWORD GetOffsetOfSrvIdentityInRP() { return s_dwSrvIdentityOffsetInRealProxy; } - static DWORD GetOffsetOfCliIdentityInRP() { return s_dwIdOffset; } - static DWORD GetOffsetOfTPOrObjInIdentity() { return s_dwTPOrObjOffsetInIdentity; } - static DWORD GetOffsetOfLeaseInIdentity() { return s_dwLeaseOffsetInIdentity; } - static DWORD GetOffsetOfURIInIdentity() { return s_dwURIOffsetInIdentity; } - inline static MethodDesc *MDofRenewLeaseOnCall() { return s_pRenewLeaseOnCallDesc; } - - static PCODE GetStubForInterfaceMethod(MethodDesc *pItfMD); -private: - static void StartRemoting(); - static void CopyDestToSrc(LPVOID pDest, LPVOID pSrc, UINT cbSize); - static void CallFieldAccessor(FieldDesc* pFD, OBJECTREF o, VOID * pVal, - BOOL fIsGetter, BOOL fIsByValue, BOOL fIsGCRef, - TypeHandle ty, TypeHandle fldTy, - CorElementType fieldType, UINT cbSize); - - static void GetTypeAndFieldName(FieldArgs *pArgs, FieldDesc *pFD, TypeHandle thEnclosingClass); - static BOOL MatchField(FieldDesc* pCurField, LPCUTF8 szFieldName); - static OBJECTREF SetExposedContext(OBJECTREF newContext); - static OBJECTREF GetServerIdentityFromProxy(OBJECTREF obj); - inline static MethodDesc *MDOfCreateProxyForDomain() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pProxyForDomainDesc; - } - - inline static MethodDesc *MDofGetServerContextForProxy() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pServerContextForProxyDesc; - } - - inline static MethodDesc *MDofGetServerDomainIdForProxy() - { - CONTRACT (MethodDesc*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN s_pServerDomainIdForProxyDesc; - } - - static VOID InitActivationServicesClass(); - static VOID InitRealProxyClass(); - static VOID InitRemotingProxyClass(); - static VOID InitServerIdentityClass(); - static VOID InitIdentityClass(); - static VOID InitMarshalByRefObjectClass(); - static VOID InitRemotingServicesClass(); - static VOID InitObjectClass(); - static VOID InitLeaseClass(); - - static MethodTable *s_pMarshalByRefObjectClass; - static MethodTable *CRemotingServices::s_pServerIdentityClass; - static MethodTable *CRemotingServices::s_pContextClass; - - static MethodDesc *s_pRPPrivateInvoke; - static MethodDesc *s_pRPInvokeStatic; - static MethodDesc *s_pIsCurrentContextOK; - static MethodDesc *s_pCheckCast; - static MethodDesc *s_pWrapMethodDesc; - static MethodDesc *s_pFieldSetterDesc; - static MethodDesc *s_pFieldGetterDesc; - static MethodDesc *s_pObjectGetTypeDesc; - static MethodDesc *s_pGetTypeDesc; - static MethodDesc *s_pProxyForDomainDesc; - static MethodDesc *s_pServerContextForProxyDesc; - static MethodDesc *s_pServerDomainIdForProxyDesc; - static MethodDesc *s_pRenewLeaseOnCallDesc; - static DWORD s_dwIdOffset; - static DWORD s_dwServerOffsetInRealProxy; - static DWORD s_dwSrvIdentityOffsetInRealProxy; - static DWORD s_dwTPOrObjOffsetInIdentity; - static DWORD s_dwLeaseOffsetInIdentity; - static DWORD s_dwURIOffsetInIdentity; - static DWORD s_dwMBRIDOffset; - static CrstStatic s_RemotingCrst; - static BOOL s_fRemotingStarted; - -#ifdef FEATURE_COMINTEROP - static MethodDesc *s_pCreateObjectForCom; -#endif // FEATURE_COMINTEROP - -}; - -// Class that manages transparent proxy thunks -class CVirtualThunks -{ -public: - inline static CVirtualThunks* GetVirtualThunks() - { - CONTRACT (CVirtualThunks*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); - SO_TOLERANT; - } - CONTRACT_END; - - RETURN s_pVirtualThunks; - } - - inline static CVirtualThunks* SetVirtualThunks(CVirtualThunks* pThunks) - { - CONTRACT (CVirtualThunks*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(CheckPointer(pThunks)); - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN (s_pVirtualThunks = pThunks); - } - - inline CVirtualThunks* GetNextThunk() - { - CONTRACT (CVirtualThunks*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); - SO_TOLERANT; - } - CONTRACT_END; - - RETURN _pNext; - } - - // Public member variables - CVirtualThunks *_pNext; - DWORD _dwReservedThunks; - DWORD _dwStartThunk; - DWORD _dwCurrentThunk; - -#ifdef CVIRTUALTHUNKS_ALIGNPAD_BYTES - BYTE pad[CVIRTUALTHUNKS_ALIGNPAD_BYTES]; -#endif - - struct tagThunkCode - { - BYTE pCode[ConstVirtualThunkSize]; - } ThunkCode[1]; - -private: - // Cannot be created - CVirtualThunks(CVirtualThunks *pNext, DWORD dwCommitedSlots, DWORD dwReservedSlots, DWORD dwStartSlot, DWORD dwCurrentSlot) - { - LIMITED_METHOD_CONTRACT; - } - - // Private statics - static CVirtualThunks *s_pVirtualThunks; -}; - - -#ifndef HAS_REMOTING_PRECODE - -class CNonVirtualThunk -{ -public: - // Constructor - CNonVirtualThunk(const BYTE* pbCode) - : _addrOfCode(pbCode), _pNext(NULL) - { - WRAPPER_NO_CONTRACT; - } - - ~CNonVirtualThunk(); - - inline LPVOID* GetAddrOfCode() - { - CONTRACT (LPVOID*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN (LPVOID*)&_addrOfCode; - } - - inline const BYTE* GetThunkCode() - { - CONTRACT (const BYTE*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; - } - CONTRACT_END; - - RETURN _addrOfCode; - } - - inline CNonVirtualThunk* GetNextThunk() - { - CONTRACT (CNonVirtualThunk*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); - SO_TOLERANT; - } - CONTRACT_END; - - RETURN _pNext; - } - - static void InitializeListLock(); - static CNonVirtualThunk* AddrToThunk(LPVOID pAddr); - inline static CNonVirtualThunk* GetNonVirtualThunks() - { - CONTRACT (CNonVirtualThunk*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); - SO_TOLERANT; - } - CONTRACT_END; - - RETURN s_pNonVirtualThunks; - } - - inline static SimpleRWLock* GetThunksListLock() - { - LIMITED_METHOD_CONTRACT; - - return s_pNonVirtualThunksListLock; - } - - static CNonVirtualThunk* SetNonVirtualThunks(const BYTE* pbCode); - - const BYTE* _addrOfCode; - -private: - - void SetNextThunk(); - - // Private statics - static CNonVirtualThunk *s_pNonVirtualThunks; - - // reader/writer lock to be taken when manipulating s_pNonVirtualThunks - static SimpleRWLock* s_pNonVirtualThunksListLock; - - // Private members - CNonVirtualThunk* _pNext; -}; - -inline void CNonVirtualThunk::InitializeListLock() -{ - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END; - - if (s_pNonVirtualThunksListLock == NULL) - s_pNonVirtualThunksListLock = new SimpleRWLock(COOPERATIVE_OR_PREEMPTIVE, LOCK_TYPE_DEFAULT); -} - -inline void CNonVirtualThunk::SetNextThunk() -{ - LIMITED_METHOD_CONTRACT; - - SimpleRWLock::SimpleWriteLockHolder swlh(s_pNonVirtualThunksListLock); - - _pNext = s_pNonVirtualThunks; - s_pNonVirtualThunks = this; -} - -inline CNonVirtualThunk* CNonVirtualThunk::AddrToThunk(LPVOID pAddr) -{ - CONTRACT (CNonVirtualThunk*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(CheckPointer(pAddr)); - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN (CNonVirtualThunk *)((size_t)pAddr - (size_t)offsetof(CNonVirtualThunk, _addrOfCode)); -} - -#endif // HAS_REMOTING_PRECODE - - -class CTPMethodTable -{ - friend class CRemotingServices; - friend class RemotingNative; - -public: - // Public statics - static DWORD GetCommitedTPSlots() - { - LIMITED_METHOD_CONTRACT; - return s_dwCommitedTPSlots; - } - - static MethodTable *GetMethodTable() - { - CONTRACT (MethodTable*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - SO_TOLERANT; - } - CONTRACT_END; - - RETURN s_pThunkTable; - } - - static VOID Initialize(); - -#ifndef HAS_REMOTING_PRECODE - static PTR_PCODE GetOrCreateNonVirtualSlotForVirtualMethod(MethodDesc* pMD); - static PCODE CreateNonVirtualThunkForVirtualMethod(MethodDesc* pMD); - static Stub* CreateStubForNonVirtualMethod(MethodDesc* pMD, CPUSTUBLINKER *psl, LPVOID pvAddrOfCode, Stub* pInnerStub); -#endif // HAS_REMOTING_PRECODE - - static REALPROXYREF GetRP(OBJECTREF orTP); - static MethodTable * GetMethodTableBeingProxied(OBJECTREF orTP); - - static LPVOID __stdcall CallTarget(MethodDesc* pTargetMD, LPVOID pvFirst, LPVOID pvSecond); - static LPVOID __stdcall CallTarget(MethodDesc* pTargetMD, LPVOID pvFirst, LPVOID pvSecond, LPVOID pvThird); - static BOOL CheckCastHelper(MethodDesc* pTargetMD, LPVOID pvFirst, LPVOID pvSecond); - static BOOL CheckCast(MethodDesc* pTargetMD, TRANSPARENTPROXYREF orTP, TypeHandle ty); - static void RefineProxy(TRANSPARENTPROXYREF orTP, TypeHandle ty); - - static PCODE GetTPStubEntryPoint(); - static PCODE GetDelegateStubEntryPoint(); - - static void DestroyThunk(MethodDesc* pMD); - - // Interpretation of __TransparentProxy._stub - typedef UINT_PTR CheckContextCrossingProc (Object*); - - inline static BOOL IsInstanceOfRemotingProxy(MethodTable *pMT) - { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(CheckPointer(pMT)); - } - CONTRACTL_END; - - return s_pRemotingProxyClass == pMT; - } - -private: - -#ifndef DACCESS_COMPILE - - // Private statics - static void InitThunkTable(DWORD dwCommitedTPSlots, DWORD dwReservedTPSlots, MethodTable* pTPMethodTable) - { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(CheckPointer(pTPMethodTable)); - } - CONTRACTL_END; - - s_dwCommitedTPSlots = dwCommitedTPSlots; - s_dwReservedTPSlots = dwReservedTPSlots; - s_pThunkTable = pTPMethodTable; - } - - - static void DestroyThunkTable() - { - WRAPPER_NO_CONTRACT; - ::ClrVirtualFree(MTToAlloc(s_pThunkTable, s_dwGCInfoBytes), 0, MEM_RELEASE); - s_pThunkTable = NULL; - s_dwCommitedTPSlots = 0; - s_dwReservedTPSlots = 0; - } - -#endif // #ifndef DACCESS_COMPILE - - static void EnsureFieldsInitialized(); - - static void CreateTPOfClassForRP(TypeHandle ty, REALPROXYREF *pRP, TRANSPARENTPROXYREF *pTP); - static void CreateTPMethodTable(MethodTable* pTPMT); - static BOOL ExtendCommitedSlots(_In_range_(1,64*1024) DWORD dwSlots); - static BOOL AllocateThunks(DWORD dwSlots, DWORD dwCommitSize); -#ifdef HAS_REMOTING_PRECODE - static void ActivatePrecodeRemotingThunk(); -#endif // HAS_REMOTING_PRECODE - static MethodTable *AllocToMT(BYTE *Alloc, LONG off) - { - CONTRACT (MethodTable*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(CheckPointer(Alloc)); - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN (MethodTable *) (Alloc + off); - } - - static BYTE *MTToAlloc(MethodTable *MT, LONG off) - { - CONTRACT (BYTE*) - { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - PRECONDITION(CheckPointer(MT)); - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - RETURN (((BYTE *) MT) - off); - } - - static PCODE CreateThunkForVirtualMethod(DWORD dwSlot, BYTE *bCode); - - // Static members - static DWORD s_dwCommitedTPSlots; - static DWORD s_dwReservedTPSlots; - static DWORD s_dwReservedTPIndirectionSlotSize; - SPTR_DECL(MethodTable, s_pThunkTable); - static MethodTable* s_pRemotingProxyClass; - static DWORD s_dwGCInfoBytes; - static DWORD s_dwMTDataSlots; - static CrstStatic s_TPMethodTableCrst; - static EEThunkHashTable *s_pThunkHashTable; - static BOOL s_fTPTableFieldsInitialized; -}; - -extern "C" UINT32 STDCALL TransparentProxyStubWorker(TransitionBlock * pTransitionBlock, TADDR pMethodDescOrSlot); - -// Holder for remoting profiler notifications -class ProfilerRemotingClientCallbackHolder -{ -public: - ProfilerRemotingClientCallbackHolder(); - ~ProfilerRemotingClientCallbackHolder(); -}; - -// These stub manager classes help the debugger to step -// through the various stubs and thunks generated by the -// remoting infrastructure -class CVirtualThunkMgr :public StubManager -{ - friend class CTPMethodTable; - - VPTR_VTABLE_CLASS(CVirtualThunkMgr, StubManager) - -public: - static void InitVirtualThunkManager(); -#ifndef DACCESS_COMPILE - CVirtualThunkMgr() - { - WRAPPER_NO_CONTRACT; - } -#endif - -public: -#ifdef _DEBUG - virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "CVirtualThunkMgr"; } -#endif - - virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress); - - virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace) DAC_EMPTY_RET(FALSE); - - static MethodDesc *Entry2MethodDesc(PCODE StubStartAddress, MethodTable *pMT); - -private: - // Private methods - LPBYTE FindThunk(const BYTE *stubStartAddress); - static MethodDesc *GetMethodDescByASM(PCODE startaddr, MethodTable *pMT); - static BOOL IsThunkByASM(PCODE startaddr); - - // Private statics - static CVirtualThunkMgr *s_pVirtualThunkMgr; - -#ifdef DACCESS_COMPILE -protected: - virtual LPCWSTR GetStubManagerName(PCODE addr) - { LIMITED_METHOD_CONTRACT; return W("CVirtualThunk"); } -#endif -}; - - -#ifndef HAS_REMOTING_PRECODE - -class CNonVirtualThunkMgr :public StubManager -{ - friend class CTPMethodTable; - - VPTR_VTABLE_CLASS(CNonVirtualThunkMgr, StubManager) - -public: - static void InitNonVirtualThunkManager(); - -public: -#ifdef _DEBUG - virtual const char * DbgGetName() { return "CNonVirtualThunkMgr"; } -#endif - - virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress); - - virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace) DAC_EMPTY_RET(FALSE); - - virtual BOOL TraceManager(Thread *thread, - TraceDestination *trace, - CONTEXT *pContext, - BYTE **pRetAddr) DAC_EMPTY_RET(FALSE); - - static MethodDesc *Entry2MethodDesc(PCODE StubStartAddress, MethodTable *pMT); - -private: - // Private methods - CNonVirtualThunk* FindThunk(const BYTE *stubStartAddress); - static MethodDesc *GetMethodDescByASM(PCODE startaddr); - static BOOL IsThunkByASM(PCODE startaddr); - - // Private statics - static CNonVirtualThunkMgr *s_pNonVirtualThunkMgr; - -#ifdef DACCESS_COMPILE -protected: - virtual LPCWSTR GetStubManagerName(PCODE addr) - { LIMITED_METHOD_CONTRACT; return W("CNonVirtualThunk"); } -#endif -}; - -#endif // HAS_REMOTING_PRECODE - -#endif // __REMOTING_H__ diff --git a/src/vm/rexcep.h b/src/vm/rexcep.h index 27f339422a..d084d426a1 100644 --- a/src/vm/rexcep.h +++ b/src/vm/rexcep.h @@ -143,9 +143,6 @@ DEFINE_EXCEPTION(g_SystemNS, BadImageFormatException, true, DEFINE_EXCEPTION(g_CodeContractsNS, ContractException, false, COR_E_CODECONTRACTFAILED) -#ifdef FEATURE_REMOTING -DEFINE_EXCEPTION(g_SystemNS, ContextMarshalException, false, COR_E_CONTEXTMARSHAL) -#endif DEFINE_EXCEPTION(g_ReflectionNS, CustomAttributeFormatException, false, COR_E_CUSTOMATTRIBUTEFORMAT) @@ -256,14 +253,8 @@ DEFINE_EXCEPTION(g_SystemNS, PlatformNotSupportedException, false, C DEFINE_EXCEPTION(g_SystemNS, RankException, false, COR_E_RANK) DEFINE_EXCEPTION(g_ReflectionNS, ReflectionTypeLoadException, false, COR_E_REFLECTIONTYPELOAD) -#ifdef FEATURE_REMOTING -DEFINE_EXCEPTION(g_RemotingNS, RemotingException, false, COR_E_REMOTING) -#endif // FEATURE_REMOTING DEFINE_EXCEPTION(g_CompilerServicesNS, RuntimeWrappedException, false, COR_E_RUNTIMEWRAPPED) -#ifdef FEATURE_REMOTING -DEFINE_EXCEPTION(g_RemotingNS, ServerException, false, COR_E_SERVER) -#endif // FEATURE_REMOTING DEFINE_EXCEPTION(g_SecurityNS, SecurityException, true, COR_E_SECURITY, CORSEC_E_INVALID_STRONGNAME, diff --git a/src/vm/runtimecallablewrapper.cpp b/src/vm/runtimecallablewrapper.cpp index 93b5c2c38a..5e8651452c 100644 --- a/src/vm/runtimecallablewrapper.cpp +++ b/src/vm/runtimecallablewrapper.cpp @@ -35,16 +35,10 @@ class Object; #include "notifyexternals.h" #include "winrttypenameconverter.h" #include "../md/compiler/custattr.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "mdaassistants.h" #include "olevariant.h" #include "interopconverter.h" #include "typestring.h" -#ifdef FEATURE_REMOTING -#include "crossdomaincalls.h" -#endif #include "caparser.h" #include "classnames.h" #include "objectnative.h" @@ -1876,13 +1870,6 @@ HRESULT RCWCleanupList::ReleaseRCWListInCorrectCtx(LPVOID pData) ReleaseRCWList_Args* args = (ReleaseRCWList_Args*)pData; -#ifdef FEATURE_REMOTING - if (InSendMessage()) - { - args->ctxBusy = TRUE; - return S_OK; - } -#endif RCW* pHead = (RCW *)args->pHead; @@ -2409,9 +2396,6 @@ void RCW::Initialize(IUnknown* pUnk, DWORD dwSyncBlockIndex, MethodTable *pClass // calling Marshal.CleanupUnusedObjectsInCurrentContext periodically. The best place // to make that call is within their own message pump. if (!disableEagerCleanup -#ifdef FEATURE_REMOTING - && !InSendMessage() -#endif ) { _ASSERTE(g_pRCWCleanupList != NULL); diff --git a/src/vm/runtimehandles.cpp b/src/vm/runtimehandles.cpp index 32a9674da5..4ff6512a52 100644 --- a/src/vm/runtimehandles.cpp +++ b/src/vm/runtimehandles.cpp @@ -1217,32 +1217,6 @@ FCIMPL1(INT32, RuntimeTypeHandle::GetAttributes, ReflectClassBaseObject *pTypeUN } FCIMPLEND -#ifdef FEATURE_REMOTING -FCIMPL1(FC_BOOL_RET, RuntimeTypeHandle::IsContextful, ReflectClassBaseObject *pTypeUNSAFE) { - CONTRACTL { - FCALL_CHECK; - } - CONTRACTL_END; - - REFLECTCLASSBASEREF refType = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(pTypeUNSAFE); - - if (refType == NULL) - FCThrowRes(kArgumentNullException, W("Arg_InvalidHandle")); - - TypeHandle typeHandle = refType->GetType(); - - if (typeHandle.IsTypeDesc()) - FC_RETURN_BOOL(FALSE); - - MethodTable* pMT= typeHandle.GetMethodTable(); - - if (!pMT) - FCThrowRes(kArgumentException, W("Arg_InvalidHandle")); - - FC_RETURN_BOOL(pMT->IsContextful()); -} -FCIMPLEND -#endif FCIMPL1(FC_BOOL_RET, RuntimeTypeHandle::IsValueType, ReflectClassBaseObject *pTypeUNSAFE) { diff --git a/src/vm/runtimehandles.h b/src/vm/runtimehandles.h index 2450a2b971..d9a1082999 100644 --- a/src/vm/runtimehandles.h +++ b/src/vm/runtimehandles.h @@ -193,9 +193,6 @@ public: void QCALLTYPE GetDefaultConstructor(EnregisteredTypeHandle pTypeHandle, QCall::ObjectHandleOnStack retMethod); static FCDECL1(ReflectClassBaseObject*, GetDeclaringType, ReflectClassBaseObject* pType); -#ifdef FEATURE_REMOTING - static FCDECL1(FC_BOOL_RET, IsContextful, ReflectClassBaseObject* pType); -#endif static FCDECL1(FC_BOOL_RET, IsValueType, ReflectClassBaseObject* pType); static FCDECL1(FC_BOOL_RET, IsInterface, ReflectClassBaseObject* pType); diff --git a/src/vm/securitydeclarative.cpp b/src/vm/securitydeclarative.cpp index 0673e534b4..5771138b7d 100644 --- a/src/vm/securitydeclarative.cpp +++ b/src/vm/securitydeclarative.cpp @@ -12,9 +12,6 @@ #include "securitydeclarative.inl" #include "eventtrace.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif // FEATURE_REMOTING //----------------------------------------------------------------------------- diff --git a/src/vm/securitydescriptorappdomain.cpp b/src/vm/securitydescriptorappdomain.cpp index d62b56582a..173b4c83e1 100644 --- a/src/vm/securitydescriptorappdomain.cpp +++ b/src/vm/securitydescriptorappdomain.cpp @@ -8,11 +8,7 @@ #include "common.h" #include "security.h" -#ifdef FEATURE_REMOTING -#include "crossdomaincalls.h" -#else #include "callhelpers.h" -#endif #ifndef DACCESS_COMPILE diff --git a/src/vm/securitymeta.cpp b/src/vm/securitymeta.cpp index 7cc8b65426..1374d9ff55 100644 --- a/src/vm/securitymeta.cpp +++ b/src/vm/securitymeta.cpp @@ -28,9 +28,6 @@ #include "field.h" #include "threads.h" #include "eventtrace.h" -#ifdef FEATURE_REMOTING -#include "objectclone.h" -#endif //FEATURE_REMOTING #include "typestring.h" #include "securitydeclarative.h" #include "customattribute.h" diff --git a/src/vm/securitystackwalk.h b/src/vm/securitystackwalk.h index f59c958145..57be57f387 100644 --- a/src/vm/securitystackwalk.h +++ b/src/vm/securitystackwalk.h @@ -18,8 +18,6 @@ #include "perfcounters.h" #include "security.h" #include "holder.h" -#ifdef FEATURE_REMOTING -#endif class ApplicationSecurityDescriptor; class DemandStackWalk; @@ -39,9 +37,6 @@ protected: DWORD m_dwFlags; public: -#ifdef FEATURE_REMOTING - MarshalCache m_objects; -#else //!FEATURE_REMOTING struct ObjectCache { struct gc @@ -98,7 +93,6 @@ public: } } m_objects; -#endif //!FEATURE_REMOTING SecurityStackWalk(SecurityStackWalkType eType, DWORD flags) { diff --git a/src/vm/stackbuildersink.h b/src/vm/stackbuildersink.h deleted file mode 100644 index 7c4271e258..0000000000 --- a/src/vm/stackbuildersink.h +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// -// File: StackBuilderSink.h -// - -// -// Purpose: Native implementation for System.Runtime.Remoting.Messaging.StackBuilderSink -// - - -#ifndef __STACKBUILDERSINK_H__ -#define __STACKBUILDERSINK_H__ - -#ifndef FEATURE_REMOTING -#error FEATURE_REMOTING is not set, please do not include stackbuildersink.h -#endif - -void CallDescrWithObjectArray(OBJECTREF& pServer, MethodDesc *pMD, //ReflectMethod *pMD, - PCODE pTarget, MetaSig* sig, VASigCookie *pCookie, - PTRARRAYREF& pArguments, - OBJECTREF* pVarRet, PTRARRAYREF* ppVarOutParams); - -//+---------------------------------------------------------- -// -// Class: CStackBuilderSink -// -// Synopsis: EE counterpart to -// Microsoft.Runtime.StackBuilderSink -// Code helper to build a stack of parameter -// arguments and make a function call on an -// object. -// -// -//------------------------------------------------------------ -class CStackBuilderSink -{ -public: - - static FCDECL5(Object*, PrivateProcessMessage, - Object* pSBSinkUNSAFE, - MethodDesc* pMD, - PTRArray* pArgsUNSAFE, - Object* pServerUNSAFE, - PTRARRAYREF* ppVarOutParams); -}; - -#endif // __STACKBUILDERSINK_H__ diff --git a/src/vm/stdinterfaces.cpp b/src/vm/stdinterfaces.cpp index 5fd8455b2a..4c21835f8a 100644 --- a/src/vm/stdinterfaces.cpp +++ b/src/vm/stdinterfaces.cpp @@ -34,9 +34,6 @@ #include "posterror.h" #include <corerror.h> #include <mscoree.h> -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "mtx.h" #include "cgencpu.h" #include "interopconverter.h" @@ -246,24 +243,6 @@ Unknown_QueryInterface_Internal(ComCallWrapper* pWrap, IUnknown* pUnk, REFIID ri pDestItf = ComCallWrapper::GetComIPFromCCW(pWrap, riid, NULL, GetComIPFromCCW::CheckVisibility); if (pDestItf == NULL) { -#ifdef FEATURE_REMOTING - // Check if the wrapper is a transparent proxy if so delegate the QI to the real proxy - if (pWrap->IsObjectTP()) - { - ARG_SLOT ret = 0; - { - GCX_COOP_THREAD_EXISTS(GET_THREAD()); - OBJECTREF oref = pWrap->GetObjectRef(); - OBJECTREF realProxy = ObjectToOBJECTREF(CRemotingServices::GetRealProxy(OBJECTREFToObject(oref))); - _ASSERTE(realProxy != NULL); - - if (!CRemotingServices::CallSupportsInterface(realProxy, riid, &ret)) - goto ErrExit; - } // end GCX_COOP scope, pDestItf must be assigned to in preemptive mode - - pDestItf = (IUnknown*)ret; - } -#endif // FEATURE_REMOTING } } @@ -2467,44 +2446,6 @@ HRESULT __stdcall WeakReferenceSource_GetWeakReference ( return hr; } -#ifdef FEATURE_REMOTING -// HELPER to call RealProxy::GetIUnknown to get the iunknown to give out -// for this transparent proxy for calls to IMarshal -IUnknown* GetIUnknownForTransparentProxyHelper(SimpleComCallWrapper *pSimpleWrap) -{ - CONTRACT (IUnknown*) - { - DISABLED(NOTHROW); - GC_TRIGGERS; - MODE_PREEMPTIVE; - PRECONDITION(CheckPointer(pSimpleWrap)); - POSTCONDITION(CheckPointer(RETVAL)); - } - CONTRACT_END; - - IUnknown* pMarshalerObj = NULL; - - GCX_COOP(); - - EX_TRY - { - OBJECTREF oref = pSimpleWrap->GetObjectRef(); - GCPROTECT_BEGIN(oref) - { - pMarshalerObj = GetIUnknownForTransparentProxy(&oref, TRUE); - oref = NULL; - } - GCPROTECT_END(); - } - EX_CATCH - { - // ignore - } - EX_END_CATCH(SwallowAllExceptions) - - RETURN pMarshalerObj; -} -#endif // FEATURE_REMOTING // Helper to setup IMarshal HRESULT GetSpecialMarshaler(IMarshal* pMarsh, SimpleComCallWrapper* pSimpleWrap, ULONG dwDestContext, IMarshal **ppMarshalRet) @@ -2521,31 +2462,6 @@ HRESULT GetSpecialMarshaler(IMarshal* pMarsh, SimpleComCallWrapper* pSimpleWrap, HRESULT hr = S_OK; -#ifdef FEATURE_REMOTING - // transparent proxies are special - if (pSimpleWrap->IsObjectTP()) - { - SafeComHolderPreemp<IUnknown> pMarshalerObj = NULL; - - pMarshalerObj = GetIUnknownForTransparentProxyHelper(pSimpleWrap); - // QI for the IMarshal Interface and verify that we don't get back - // a pointer to us (GetIUnknownForTransparentProxyHelper could return - // a pointer back to the same object if realproxy::GetCOMIUnknown - // is not overriden - if (pMarshalerObj != NULL) - { - SafeComHolderPreemp<IMarshal> pMsh = NULL; - hr = SafeQueryInterfacePreemp(pMarshalerObj, IID_IMarshal, (IUnknown**)&pMsh); - - // make sure we don't recurse - if(SUCCEEDED(hr) && pMsh != pMarsh) - { - *ppMarshalRet = pMsh.Extract(); - return S_OK; - } - } - } -#endif // FEATURE_REMOTING // In case of APPX process we always use the standard marshaller. // In Non-APPX process use standard marshalling for everything except in-proc servers. diff --git a/src/vm/stubhelpers.cpp b/src/vm/stubhelpers.cpp index 773cdefd42..95ed8d2dac 100644 --- a/src/vm/stubhelpers.cpp +++ b/src/vm/stubhelpers.cpp @@ -22,9 +22,6 @@ #include "gcheaputilities.h" #include "interoputil.h" #include "gcscan.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #ifdef FEATURE_COMINTEROP #include <oletls.h> diff --git a/src/vm/stubmgr.cpp b/src/vm/stubmgr.cpp index 39f4c25a7d..e30fb3792e 100644 --- a/src/vm/stubmgr.cpp +++ b/src/vm/stubmgr.cpp @@ -9,9 +9,6 @@ #include "dllimportcallback.h" #include "stubhelpers.h" #include "asmconstants.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #ifdef FEATURE_COMINTEROP #include "olecontexthelpers.h" #endif @@ -2102,18 +2099,6 @@ BOOL InteropDispatchStubManager::TraceManager(Thread *thread, Object * pThis = StubManagerHelpers::GetThisPtr(pContext); -#ifdef FEATURE_REMOTING - if (pThis != NULL && pThis->IsTransparentProxy()) - { - // We have remoting proxy in the way -#ifdef DACCESS_COMPILE - DacNotImpl(); -#else - trace->InitForFramePush(GetEEFuncEntryPoint(TransparentProxyStubPatchLabel)); -#endif - } - else -#endif // FEATURE_REMOTING { if (!pCMD->m_pComPlusCallInfo->m_pInterfaceMT->IsComEventItfType() && (pCMD->m_pComPlusCallInfo->m_pILStub != NULL)) { diff --git a/src/vm/syncblk.cpp b/src/vm/syncblk.cpp index 826507e535..b8a818c107 100644 --- a/src/vm/syncblk.cpp +++ b/src/vm/syncblk.cpp @@ -3534,18 +3534,7 @@ BOOL SyncBlock::Wait(INT32 timeOut, BOOL exitContext) Context* defaultContext; defaultContext = pCurThread->GetDomain()->GetDefaultContext(); _ASSERTE(defaultContext); -#ifdef FEATURE_REMOTING - if (exitContext && - targetContext != defaultContext) - { - Context::MonitorWaitArgs waitArgs = {timeOut, &syncState, &isTimedOut}; - Context::CallBackInfo callBackInfo = {Context::MonitorWait_callback, (void*) &waitArgs}; - Context::RequestCallBack(CURRENT_APPDOMAIN_ID, defaultContext, &callBackInfo); - } - else -#else _ASSERTE( exitContext==NULL || targetContext == defaultContext); -#endif { isTimedOut = pCurThread->Block(timeOut, &syncState); } diff --git a/src/vm/threadpoolrequest.cpp b/src/vm/threadpoolrequest.cpp index a5c1c4263d..7dee1273bf 100644 --- a/src/vm/threadpoolrequest.cpp +++ b/src/vm/threadpoolrequest.cpp @@ -25,9 +25,6 @@ #include "eeconfig.h" #include "corhost.h" #include "nativeoverlapped.h" -#ifdef FEATURE_REMOTING -#include "crossdomaincalls.h" -#endif #include "appdomain.inl" BYTE PerAppDomainTPCountList::s_padding[64 - sizeof(LONG)]; diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp index 570a56af0d..007b1016fc 100644 --- a/src/vm/threads.cpp +++ b/src/vm/threads.cpp @@ -30,8 +30,6 @@ #include "jitinterface.h" #include "appdomainstack.inl" #include "eventtrace.h" -#ifdef FEATURE_REMOTING -#endif #include "comutilnative.h" #include "finalizerthread.h" #include "threadsuspend.h" @@ -4930,10 +4928,6 @@ void Thread::SetExposedObject(OBJECTREF exposed) StoreObjectInHandle(m_ExposedObject, exposed); // This makes sure the contexts on the backing thread // and the managed thread start off in sync with each other. -#ifdef FEATURE_REMOTING - _ASSERTE(m_Context); - ((THREADBASEREF)exposed)->SetExposedContext(m_Context->GetExposedObjectRaw()); -#endif // BEWARE: the IncExternalCount call below may cause GC to happen. // IncExternalCount will store exposed in m_StrongHndToExposedObject which is in default domain. @@ -7965,40 +7959,6 @@ void MakeCallWithAppDomainTransition( } -#ifdef FEATURE_REMOTING -void Thread::SetExposedContext(Context *c) -{ - - // Set the ExposedContext ... - - // Note that we use GetxxRaw() here to cover our bootstrap case - // for AppDomain proxy creation - // Leaving the exposed object NULL lets us create the default - // managed context just before we marshal a new AppDomain in - // RemotingServices::CreateProxyForDomain. - - Thread* pThread = GetThread(); - if (!pThread) - return; - - CONTRACTL { - NOTHROW; - MODE_COOPERATIVE; - GC_NOTRIGGER; - } - CONTRACTL_END; - - if(m_ExposedObject != NULL) { - THREADBASEREF threadObj = (THREADBASEREF) ObjectFromHandle(m_ExposedObject); - if(threadObj != NULL) - if (!c) - threadObj->SetExposedContext(NULL); - else - threadObj->SetExposedContext(c->GetExposedObjectRaw()); - - } -} -#endif void Thread::InitContext() { @@ -8013,9 +7973,6 @@ void Thread::InitContext() _ASSERTE(m_pDomain == NULL); GCX_COOP_NO_THREAD_BROKEN(); m_Context = SystemDomain::System()->DefaultDomain()->GetDefaultContext(); -#ifdef FEATURE_REMOTING - SetExposedContext(m_Context); -#endif m_pDomain = m_Context->GetDomain(); _ASSERTE(m_pDomain); m_pDomain->ThreadEnter(this, NULL); @@ -8042,9 +7999,6 @@ void Thread::ClearContext() // must set exposed context to null first otherwise object verification // checks will fail AV when m_Context is null -#ifdef FEATURE_REMOTING - SetExposedContext(NULL); -#endif m_pDomain = NULL; #ifdef FEATURE_COMINTEROP m_fDisableComObjectEagerCleanup = false; @@ -8087,14 +8041,7 @@ void Thread::DoContextCallBack(ADID appDomain, Context *pContext, Context::ADCal } else { -#ifdef FEATURE_REMOTING - _ASSERTE(pContext->GetDomain()==::GetAppDomain()); - Context::ADCallBackArgs callTgtArgs = {pTarget, args}; - Context::CallBackInfo callBackInfo = {Context::ADTransition_callback, (void*) &callTgtArgs}; - Context::RequestCallBack(appDomain,pContext, (void*) &callBackInfo); -#else UNREACHABLE(); -#endif } LOG((LF_APPDOMAIN, LL_INFO100, "Thread::DoADCallBack Done at esp %p\n", espVal)); } @@ -8170,13 +8117,7 @@ void Thread::DoADCallBack(AppDomain* pDomain , Context::ADCallBackFcnType pTarge } else { -#ifdef FEATURE_REMOTING - Context::ADCallBackArgs callTgtArgs = {pTarget, args}; - Context::CallBackInfo callBackInfo = {Context::ADTransition_callback, (void*) &callTgtArgs}; - Context::RequestCallBack(CURRENT_APPDOMAIN_ID, pCurrDomain->GetDefaultContext(), (void*) &callBackInfo); -#else UNREACHABLE(); -#endif } LOG((LF_APPDOMAIN, LL_INFO100, "Thread::DoADCallBack Done at esp %p\n", espVal)); } @@ -8250,13 +8191,7 @@ void Thread::DoADCallBack(ADID appDomainID , Context::ADCallBackFcnType pTarget, } else { -#ifdef FEATURE_REMOTING - Context::ADCallBackArgs callTgtArgs = {pTarget, args}; - Context::CallBackInfo callBackInfo = {Context::ADTransition_callback, (void*) &callTgtArgs}; - Context::RequestCallBack(CURRENT_APPDOMAIN_ID, pCurrDomain->GetDefaultContext(), (void*) &callBackInfo); -#else UNREACHABLE(); -#endif } LOG((LF_APPDOMAIN, LL_INFO100, "Thread::DoADCallBack Done at esp %p\n", espVal)); } @@ -8373,9 +8308,6 @@ void Thread::EnterContextRestricted(Context *pContext, ContextTransitionFrame *p m_pDomain = pDomain; SetAppDomain(m_pDomain); } -#ifdef FEATURE_REMOTING - SetExposedContext(pContext); -#endif } // main difference between EnterContext and ReturnToContext is that are allowed to return @@ -8489,9 +8421,6 @@ void Thread::ReturnToContext(ContextTransitionFrame *pFrame) CantStopHolder hCantStop; m_Context = pReturnContext; -#ifdef FEATURE_REMOTING - SetExposedContext(pReturnContext); -#endif if (fChangedDomains) { @@ -8629,350 +8558,6 @@ void Thread::ReturnToContextAndOOM(ContextTransitionFrame* pFrame) COMPlusThrowOM(); } -#ifdef FEATURE_REMOTING -// for cases when marshaling is not needed -// throws it is able to take a shortcut, otherwise just returns -void Thread::RaiseCrossContextExceptionHelper(Exception* pEx, ContextTransitionFrame* pFrame) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - } - CONTRACTL_END; - -#ifndef FEATURE_PAL - // Ensure that IP for WatsonBucketing has been collected if the exception is preallocated. -#ifdef _DEBUG - - // On CoreCLR, Watson may not be enabled. Thus, we should - // skip this. - if (IsWatsonEnabled()) - { - if (CLRException::IsPreallocatedExceptionObject(CLRException::GetThrowableFromException(pEx))) - { - // If a preallocated exception escapes unhandled till the AD Transition boundary, then - // AppDomainTransitionExceptionFilter will capture the watson buckets and stick them - // in the UE Watson bucket tracker. - // - // This is done *only* for exceptions escaping AD transition boundaries that are NOT - // at the thread base. - PTR_EHWatsonBucketTracker pUEWatsonBucketTracker = GetThread()->GetExceptionState()->GetUEWatsonBucketTracker(); - if(pUEWatsonBucketTracker->RetrieveWatsonBuckets() != NULL) - { - _ASSERTE(pUEWatsonBucketTracker->CapturedAtADTransition() || pUEWatsonBucketTracker->CapturedForThreadAbort()); - } - } - } -#endif // _DEBUG -#endif // !FEATURE_PAL - -#ifdef FEATURE_TESTHOOKS - ADID adid=GetAppDomain()->GetId(); -#endif - -#define RETURNANDTHROWNEWEXCEPTION(pOldException, Type, ExArgs) \ - { \ - Exception::Delete(pOldException); \ - SetLastThrownObject(NULL); \ - ReturnToContext(pFrame); \ - CONTRACT_VIOLATION(ThrowsViolation); \ - TESTHOOKCALL(LeftAppDomain(adid.m_dwId)); \ - Type ex ExArgs; \ - COMPlusThrow(CLRException::GetThrowableFromException(&ex)); \ - } - -#define RETURNANDRETHROW(ex) \ - { \ - SafeSetLastThrownObject (NULL); \ - ReturnToContext(pFrame); \ - CONTRACT_VIOLATION(ThrowsViolation); \ - TESTHOOKCALL(LeftAppDomain(adid.m_dwId)); \ - PAL_CPP_THROW(Exception*,ex); \ - } - - CANNOTTHROWCOMPLUSEXCEPTION(); //no exceptions until returning to context - - Frame* pUnloadBoundary = GetUnloadBoundaryFrame(); - - LOG((LF_EH, LL_INFO100, "Exception crossed into another context. Rethrowing in new context.\n")); - - - // will throw a kAppDomainUnloadedException if necessary - if (ShouldChangeAbortToUnload(pFrame, pUnloadBoundary)) - RETURNANDTHROWNEWEXCEPTION(pEx,EEResourceException,(kAppDomainUnloadedException, W("Remoting_AppDomainUnloaded_ThreadUnwound"))); - - // Can't marshal return value from unloaded appdomain. Haven't - // yet hit the boundary. Throw a generic exception instead. - // ThreadAbort is more consistent with what goes on elsewhere -- - // the AppDomainUnloaded is only introduced at the top-most boundary. - // - - if (GetDomain() == SystemDomain::AppDomainBeingUnloaded() - && GetThread()!=SystemDomain::System()->GetUnloadingThread() && - GetThread()!=FinalizerThread::GetFinalizerThread()) - { - if (pUnloadBoundary) - RETURNANDTHROWNEWEXCEPTION(pEx,EEException,(kThreadAbortException)) - else - RETURNANDTHROWNEWEXCEPTION(pEx,EEResourceException,(kAppDomainUnloadedException, W("Remoting_AppDomainUnloaded_ThreadUnwound"))); - } - - if (IsRudeAbort()) - RETURNANDTHROWNEWEXCEPTION(pEx,EEException,(kThreadAbortException)); - - - // There are a few classes that have the potential to create - // infinite loops if we try to marshal them. For ThreadAbort, - // ExecutionEngine, StackOverflow, and - // OutOfMemory, throw a new exception of the same type. - // - // <TODO>@NICE: We lose the inner stack trace. A little better - // would be to at least check if the inner exceptions are - // all the same type as the outer. They could be - // rethrown if this were true.</TODO> - // - - if(pEx && !pEx->IsDomainBound()) - { - RETURNANDRETHROW(pEx); - } -#undef RETURNANDTHROWNEWEXCEPTION -#undef RETURNANDRETHROW -} - -Thread::RaiseCrossContextResult -Thread::TryRaiseCrossContextException(Exception **ppExOrig, - Exception *pException, - RuntimeExceptionKind *pKind, - OBJECTREF *ppThrowable, - ORBLOBREF *pOrBlob) -{ - CONTRACTL - { - NOTHROW; - WRAPPER(GC_TRIGGERS); - MODE_COOPERATIVE; - } - CONTRACTL_END; - - BOOL bIsClassInitException = FALSE; - RaiseCrossContextResult result = RaiseCrossContextSuccess; - int alreadyMarshaling = StartedMarshalingException(); - - EX_TRY - { - bIsClassInitException = (pException->GetHR() == COR_E_TYPEINITIALIZATION); - - //just in case something throws - //!!!should be released before any call to ReturnToContext !!! - ExceptionHolder exception(*ppExOrig); - - if (IsExceptionOfType(kOutOfMemoryException, pException)) - *pKind = kOutOfMemoryException; - else - if (IsExceptionOfType(kThreadAbortException, pException)) - *pKind = kThreadAbortException; - else - if (IsExceptionOfType(kStackOverflowException, pException)) - *pKind = kStackOverflowException; - else - if (alreadyMarshaling) - { - // If we started marshaling already, something went wrong - // This should only happen in case of busted ResourceManager - _ASSERTE(!"Already marshalling the exception for cross AD transition - perhaps ResourceManager issue?"); - - // ASK: Instead of throwing ExecutionEngineException from here, is there a better - // ResourceManager related exception that can be thrown instead? If none, can - // kContextMarshalException be thrown? Its obsolete but comes close to the usage - // context. - *pKind = kContextMarshalException; - } - - // Serialize the exception - if (*pKind == kLastException) - { - *ppThrowable = CLRException::GetThrowableFromException(exception); - _ASSERTE(*ppThrowable != NULL); - - AppDomainHelper::MarshalObject(ppThrowable, pOrBlob); - } - } - EX_CATCH - { - // We got a new Exception in original domain - *ppExOrig = EXTRACT_EXCEPTION(); - // Got ClassInitException while marshaling ClassInitException. Class is unusable. Do not attempt anymore. - if (bIsClassInitException && *ppExOrig && ((*ppExOrig)->GetHR() == COR_E_TYPEINITIALIZATION)) - result = RaiseCrossContextClassInit; - else - result = RaiseCrossContextRetry; - } - EX_END_CATCH(SwallowAllExceptions); - - FinishedMarshalingException(); - - return result; -} - -// * pEx should be deleted before popping the frame, except for one case -// * SafeSetLastThrownObject is called after pEx is deleted -void DECLSPEC_NORETURN Thread::RaiseCrossContextException(Exception* pExOrig, ContextTransitionFrame* pFrame) -{ - CONTRACTL - { - THROWS; - WRAPPER(GC_TRIGGERS); - } - CONTRACTL_END; - - // <TODO>@TODO: Set the IsInUnmanagedHandler bits (aka IgnoreThreadAbort bits) appropriately.</TODO> - - GCX_COOP(); - - // These are the only data transfered between the appdomains - // Make sure that anything added here is appdomain agile - RuntimeExceptionKind kind = kLastException; - RaiseCrossContextResult result = RaiseCrossContextSuccess; - ORBLOBREF orBlob = NULL; - - // Get the corruption severity for the exception caught at AppDomain transition boundary. -#ifdef FEATURE_CORRUPTING_EXCEPTIONS - CorruptionSeverity severity = GetThread()->GetExceptionState()->GetLastActiveExceptionCorruptionSeverity(); - if (severity == NotSet) - { - // No severity set at this point implies the exception was not corrupting - severity = NotCorrupting; - } -#endif // FEATURE_CORRUPTING_EXCEPTIONS - -#ifdef FEATURE_TESTHOOKS - ADID adid=GetAppDomain()->GetId(); -#endif - -#define MAX_RAISE_RETRY_COUNT 256 - - DWORD dwRaiseRetryCount; - for (dwRaiseRetryCount = 0; dwRaiseRetryCount < MAX_RAISE_RETRY_COUNT; dwRaiseRetryCount++) - { - // pEx is NULL means that the exception is CLRLastThrownObjectException - CLRLastThrownObjectException lastThrown; - Exception* pException = pExOrig?pExOrig:&lastThrown; - - // Set the current frame - SetFrame(pFrame); - RaiseCrossContextExceptionHelper(pExOrig, pFrame); - _ASSERTE(pFrame->GetReturnContext()); - - struct _gc { - OBJECTREF pThrowable; - ORBLOBREF orBlob; - } gc; - ZeroMemory(&gc, sizeof(_gc)); - - GCPROTECT_BEGIN(gc); - result = Thread::TryRaiseCrossContextException(&pExOrig, pException, &kind, &gc.pThrowable, &gc.orBlob); - GCPROTECT_END(); - - if (result != RaiseCrossContextRetry) - { - orBlob = gc.orBlob; - break; - } - - // We got a new exception and therefore need to retry marshaling it. - GCX_COOP_NO_DTOR(); - } - - // Set the exception kind if we exceed MAX_RAISE_RETRY_COUNT, something is really wrong. - if (dwRaiseRetryCount == MAX_RAISE_RETRY_COUNT) - { - LOG((LF_EH, LL_INFO100, "Unable to marshal the exception event after maximum retries (%d). Using ContextMarshalException instead.\n", MAX_RAISE_RETRY_COUNT)); - // This might be a good place to use ContextMarshalException type. However, it is marked obsolete. - kind = kContextMarshalException; - } - - // Return to caller domain - { - // ReturnToContext does not work inside GC_PROTECT and has GC_NOTRIGGER contract. - // GCX_FORBID() ensures that the formerly protected values remain intact. - GCX_FORBID(); - ReturnToContext(pFrame); - } - - { - struct _gc { - OBJECTREF pMarshaledInit; - OBJECTREF pMarshaledThrowable; - ORBLOBREF orBlob; - } gc; - ZeroMemory(&gc, sizeof(_gc)); - - gc.orBlob = orBlob; - - // Create the appropriate exception - GCPROTECT_BEGIN(gc); -#ifdef FEATURE_TESTHOOKS - TESTHOOKCALL(LeftAppDomain(adid.m_dwId)); -#endif - if (result == RaiseCrossContextClassInit) - { - HRESULT hr=S_OK; - EX_TRY - { - WCHAR wszTemplate[30]; - IfFailThrow(UtilLoadStringRC(IDS_EE_NAME_UNKNOWN, - wszTemplate, - sizeof(wszTemplate)/sizeof(wszTemplate[0]), - FALSE)); - - CreateTypeInitializationExceptionObject(wszTemplate, NULL, &gc.pMarshaledInit, &gc.pMarshaledThrowable); - } - EX_CATCH - { - // Unable to create ClassInitException in caller domain - hr=COR_E_TYPEINITIALIZATION; - } - EX_END_CATCH(RethrowTransientExceptions); - IfFailThrow(hr); - } - else - { - switch (kind) - { - case kLastException: - gc.pMarshaledThrowable = gc.orBlob; - - break; - case kOutOfMemoryException: - COMPlusThrowOM(); - break; - case kStackOverflowException: - gc.pMarshaledThrowable = CLRException::GetPreallocatedStackOverflowException(); - break; - default: - { - EEException ex(kind); - gc.pMarshaledThrowable = CLRException::GetThrowableFromException(&ex); - } - } - } - - // ... and throw it. - VALIDATEOBJECTREF(gc.pMarshaledThrowable); - COMPlusThrow(gc.pMarshaledThrowable -#ifdef FEATURE_CORRUPTING_EXCEPTIONS - , severity -#endif // FEATURE_CORRUPTING_EXCEPTIONS - ); - - GCPROTECT_END(); - } -} - -#else // FEATURE_REMOTING void DECLSPEC_NORETURN Thread::RaiseCrossContextException(Exception* pExOrig, ContextTransitionFrame* pFrame) { @@ -8989,7 +8574,6 @@ void DECLSPEC_NORETURN Thread::RaiseCrossContextException(Exception* pExOrig, Co COMPlusThrow(CLRException::GetThrowableFromException(pException)); } -#endif struct FindADCallbackType { AppDomain *pSearchDomain; diff --git a/src/vm/threads.h b/src/vm/threads.h index 9dfa6ef6fb..fc8ed94cef 100644 --- a/src/vm/threads.h +++ b/src/vm/threads.h @@ -2492,9 +2492,6 @@ public: return m_Context; } -#ifdef FEATURE_REMOTING - void SetExposedContext(Context *c); -#endif // This callback is used when we are executing in the EE and discover that we need // to switch appdomains. diff --git a/src/vm/typehandle.cpp b/src/vm/typehandle.cpp index ec46aa8064..32384cc490 100644 --- a/src/vm/typehandle.cpp +++ b/src/vm/typehandle.cpp @@ -491,11 +491,7 @@ BOOL TypeHandle::IsAbstract() const DWORD TypeHandle::IsTransparentProxy() const { WRAPPER_NO_CONTRACT; -#ifdef FEATURE_REMOTING - return !IsTypeDesc() && AsMethodTable()->IsTransparentProxy(); -#else return FALSE; -#endif } #ifdef FEATURE_HFA diff --git a/src/vm/virtualcallstub.cpp b/src/vm/virtualcallstub.cpp index 5fc66f6d6a..6681b312f4 100644 --- a/src/vm/virtualcallstub.cpp +++ b/src/vm/virtualcallstub.cpp @@ -15,9 +15,6 @@ // ============================================================================ #include "common.h" -#ifdef FEATURE_REMOTING -#include "remoting.h" -#endif #include "array.h" #ifdef FEATURE_PREJIT #include "compile.h" @@ -1971,16 +1968,6 @@ PCODE VirtualCallStubManager::ResolveWorker(StubCallSite* pCallSite, // <token, TPMT, target> entry where target is in AD1, and then matching against // this entry from AD2 which happens to be using the same token, perhaps for a // completely different interface. -#ifdef FEATURE_REMOTING - if (token.IsTypedToken() && objectType->IsTransparentProxy()) - { - MethodTable * pItfMT = GetTypeFromToken(token); - if (pItfMT->GetDomain() != SharedDomain::GetDomain()) - { - insertKind = DispatchCache::IK_NONE; - } - } -#endif } if (insertKind != DispatchCache::IK_NONE) @@ -2110,44 +2097,6 @@ VirtualCallStubManager::Resolver( // NOTE: CERs are not hardened against transparent proxy types, // so no need to worry about throwing an exception from here. -#ifdef FEATURE_REMOTING - if (pMT->IsTransparentProxy()) - { - if (IsInterfaceToken(token)) - { - MethodTable * pItfMT = GetTypeFromToken(token); - DispatchSlot ds(pItfMT->FindDispatchSlot(token.GetSlotNumber())); - if (pItfMT->HasInstantiation()) - { - MethodDesc * pTargetMD = ds.GetMethodDesc(); - if (!pTargetMD->HasMethodInstantiation()) - { - MethodDesc * pInstMD = MethodDesc::FindOrCreateAssociatedMethodDesc( - pTargetMD, - pItfMT, - FALSE, // forceBoxedEntryPoint - Instantiation(), // methodInst - FALSE, // allowInstParam - TRUE); // forceRemotableMethod - *ppTarget = CRemotingServices::GetStubForInterfaceMethod(pInstMD); - return TRUE; - } - } - *ppTarget = ds.GetTarget(); - } - else - { - CONSISTENCY_CHECK(IsClassToken(token)); - // All we do here is call the TP thunk stub. - DispatchSlot thunkSlot(CTPMethodTable::GetMethodTable()->FindDispatchSlot(token.GetTypeID(), token.GetSlotNumber())); - CONSISTENCY_CHECK(!thunkSlot.IsNull()); - *ppTarget = thunkSlot.GetTarget(); - } - return TRUE; - } - - CONSISTENCY_CHECK(!pMT->IsTransparentProxy()); -#endif // FEATURE_REMOTING LOG((LF_LOADER, LL_INFO10000, "SD: VCSM::Resolver: (start) looking up %s method in %s\n", token.IsThisToken() ? "this" : "interface", @@ -2455,151 +2404,6 @@ PCODE VirtualCallStubManager::CacheLookup(size_t token, UINT16 tokenHash, Method return (PCODE)(pElem != NULL ? pElem->target : NULL); } -#ifdef FEATURE_REMOTING -//---------------------------------------------------------------------------- -// This is used by TransparentProxyWorkerStub to take a stub address (token), -// and MethodTable and return the target. This is the fast version that only -// checks the cache and returns NULL if a target is not found. -// -PCODE VSD_GetTargetForTPWorkerQuick(TransparentProxyObject * orTP, size_t token) -{ - CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - SO_TOLERANT; - PRECONDITION(CheckPointer(orTP)); - PRECONDITION(orTP->IsTransparentProxy()); - } CONTRACTL_END - - GCX_FORBID(); - - DispatchToken tok; - - // If we have a 16-bit number in the token then we have a slot number - if (((UINT16)token) == token) - { - tok = DispatchToken::CreateDispatchToken((UINT32)token); - } - // Otherwise, we have a MethodDesc - else - { - UINT32 typeID = 0; - MethodDesc * pMD = (MethodDesc *) token; - - if (pMD->IsInterface()) - { - typeID = pMD->GetMethodTable()->LookupTypeID(); - // If this type has never had a TypeID assigned, then it couldn't possibly - // be in the cache. We do this instead of calling GetTypeID because that can - // throw, and this method is not protected from that. - if (typeID == TypeIDProvider::INVALID_TYPE_ID) - { - return NULL; - } - -#ifdef FAT_DISPATCH_TOKENS - if (DispatchToken::RequiresDispatchTokenFat(typeID, pMD->GetSlot())) - { - tok = pMD->GetMethodTable()->GetLoaderAllocator()->TryLookupDispatchToken(typeID, pMD->GetSlot()); - if (!tok.IsValid()) - { - return NULL; - } - } - else -#endif - { - tok = DispatchToken::CreateDispatchToken(typeID, pMD->GetSlot()); - } - } - else - { - // On AMD64 a non-virtual call on an in context transparent proxy - // results in us reaching here with (pMD->IsInterface == FALSE) - return pMD->GetSingleCallableAddrOfCode(); - } - } - - return VirtualCallStubManager::CacheLookup(tok.To_SIZE_T(), DispatchCache::INVALID_HASH, orTP->GetMethodTableBeingProxied()); -} - -//---------------------------------------------------------------------------- -// This is used by TransparentProxyWorkerStub to take a stub address (token), -// and MethodTable and return the target. This is the slow version that can throw -// On x86 we construct a HelperMethodFrame, while on the 64 bit platforms we are -// called by ResolveWorkerStatic which already has constructed a frame -// -PCODE VSD_GetTargetForTPWorker(TransitionBlock * pTransitionBlock, size_t token) -{ - CONTRACTL { - THROWS; - GC_TRIGGERS; - SO_TOLERANT; - INJECT_FAULT(COMPlusThrowOM();); - PRECONDITION(CheckPointer(pTransitionBlock)); - } CONTRACTL_END - - MAKE_CURRENT_THREAD_AVAILABLE(); - - DispatchToken tok; - MethodDesc *pRepresentativeMD = NULL; - PCODE pRet = NULL; - - BEGIN_SO_INTOLERANT_CODE(CURRENT_THREAD); - - FrameWithCookie<StubDispatchFrame> frame(pTransitionBlock); - StubDispatchFrame * pSDFrame = &frame; - - MethodTable * pMT = CTPMethodTable::GetMethodTableBeingProxied(pSDFrame->GetThis()); - - // If we have a 16-bit number in the token then we have a slot number - if (((UINT16)token) == token) { - tok = DispatchToken::CreateDispatchToken((UINT32)token); - pRepresentativeMD = VirtualCallStubManager::GetRepresentativeMethodDescFromToken(tok.To_SIZE_T(), pMT); - } - // Otherwise, we have a MethodDesc - else { - // The token will be calculated after we erect a GC frame. - pRepresentativeMD = (MethodDesc *)token; - } - PREFIX_ASSUME(pRepresentativeMD != NULL); - - // Get the current appdomain - AppDomain *pAD = (AppDomain *) CURRENT_THREAD->GetDomain(); - - // Get the virtual stub manager for this AD. We pick the current - // AD because when the AD is unloaded the cache entry will be cleared. - // If we happen to be calling from shared to shared, it's no big - // deal because we'll just come through here again and add a new - // cache entry. We can't choose the manager based on the return - // address because this could be tail-called or called indirectly - // via helper and so the return address won't be recognized. - VirtualCallStubManager *pMgr = pAD->GetLoaderAllocator()->GetVirtualCallStubManager(); - CONSISTENCY_CHECK(CheckPointer(pMgr)); - - pSDFrame->SetFunction(pRepresentativeMD); - pSDFrame->Push(CURRENT_THREAD); - INSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE; - - // If we didn't properly create a token above, it's because we needed to wait until - // the helper frame was created (GetTypeID is a throwing operation). - if (!tok.IsValid()) { - tok = pAD->GetLoaderAllocator()->GetDispatchToken(pRepresentativeMD->GetMethodTable()->GetTypeID(), - pRepresentativeMD->GetSlot()); - } - CONSISTENCY_CHECK(tok.IsValid()); - - pRet = pMgr->GetTarget(tok.To_SIZE_T(), pMT); - CONSISTENCY_CHECK(pRet != NULL); - - UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE; - pSDFrame->Pop(CURRENT_THREAD); - - END_SO_INTOLERANT_CODE; - - return pRet; -} -#endif // FEATURE_REMOTING //---------------------------------------------------------------------------- /* static */ @@ -2702,17 +2506,6 @@ VirtualCallStubManager::TraceResolver( MethodTable *pMT = pObj->GetMethodTable(); CONSISTENCY_CHECK(CheckPointer(pMT)); -#ifdef FEATURE_REMOTING - if (pMT->IsTransparentProxy()) - { -#ifdef DACCESS_COMPILE - DacNotImpl(); -#else - trace->InitForFramePush(GetEEFuncEntryPoint(TransparentProxyStubPatchLabel)); -#endif - return TRUE; - } -#endif DispatchSlot slot(pMT->FindDispatchSlot(token)); diff --git a/src/vm/virtualcallstub.h b/src/vm/virtualcallstub.h index b3f736fcae..4bdc1da916 100644 --- a/src/vm/virtualcallstub.h +++ b/src/vm/virtualcallstub.h @@ -56,13 +56,6 @@ extern "C" PCODE STDCALL VSD_ResolveWorker(TransitionBlock * pTransitionBlock, #endif ); -#ifdef FEATURE_REMOTING -// This is used by TransparentProxyWorkerStub to take a stub address (token), and -// MethodTable and return the target. It will look in the cache first, and if not found -// will call the resolver and then put the result into the cache. -extern "C" PCODE STDCALL VSD_GetTargetForTPWorkerQuick(TransparentProxyObject * orTP, size_t token); -extern "C" PCODE STDCALL VSD_GetTargetForTPWorker(TransitionBlock * pTransitionBlock, size_t token); -#endif ///////////////////////////////////////////////////////////////////////////////////// #if defined(_TARGET_X86_) || defined(_TARGET_AMD64_) |