From: Jan Kotas Date: Mon, 2 Dec 2019 16:12:29 +0000 (-0800) Subject: Delete CLSID_ComCallUnmarshal and related code (#426) X-Git-Tag: submit/tizen/20210909.063632~10850 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cf57a64845f2727d6d4850bb30b266c1b4a4c48c;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Delete CLSID_ComCallUnmarshal and related code (#426) Not used in CoreCLR --- diff --git a/src/coreclr/src/inc/MSCOREE.IDL b/src/coreclr/src/inc/MSCOREE.IDL index 5323a7c..b19544f 100644 --- a/src/coreclr/src/inc/MSCOREE.IDL +++ b/src/coreclr/src/inc/MSCOREE.IDL @@ -29,9 +29,6 @@ interface IHostControl; cpp_quote("struct ICLRControl;") interface ICLRControl; -// CLSID ComCallUnmarshal2 -cpp_quote("EXTERN_GUID(CLSID_ComCallUnmarshalV4, 0x45fb4600,0xe6e8,0x4928,0xb2,0x5e,0x50,0x47,0x6f,0xf7,0x94,0x25);") - // IID ICLRRuntimeHost: uuid(90F1A06C-7712-4762-86B5-7A5EBA6BDB02) cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost, 0x90F1A06C, 0x7712, 0x4762, 0x86, 0xB5, 0x7A, 0x5E, 0xBA, 0x6B, 0xDB, 0x02);") diff --git a/src/coreclr/src/pal/prebuilt/inc/mscoree.h b/src/coreclr/src/pal/prebuilt/inc/mscoree.h index ab7bbb0..79b436b 100644 --- a/src/coreclr/src/pal/prebuilt/inc/mscoree.h +++ b/src/coreclr/src/pal/prebuilt/inc/mscoree.h @@ -79,7 +79,6 @@ struct IHostControl; struct ICLRControl; -EXTERN_GUID(CLSID_ComCallUnmarshalV4, 0x45fb4600,0xe6e8,0x4928,0xb2,0x5e,0x50,0x47,0x6f,0xf7,0x94,0x25); EXTERN_GUID(IID_ICLRRuntimeHost, 0x90F1A06C, 0x7712, 0x4762, 0x86, 0xB5, 0x7A, 0x5E, 0xBA, 0x6B, 0xDB, 0x02); EXTERN_GUID(IID_ICLRRuntimeHost2, 0x712AB73F, 0x2C22, 0x4807, 0xAD, 0x7E, 0xF5, 0x01, 0xD7, 0xb7, 0x2C, 0x2D); EXTERN_GUID(IID_ICLRRuntimeHost4, 0x64F6D366, 0xD7C2, 0x4F1F, 0xB4, 0xB2, 0xE8, 0x16, 0x0C, 0xAC, 0x43, 0xAF); diff --git a/src/coreclr/src/vm/reflectioninvocation.cpp b/src/coreclr/src/vm/reflectioninvocation.cpp index 4b91d14..f220e76e 100644 --- a/src/coreclr/src/vm/reflectioninvocation.cpp +++ b/src/coreclr/src/vm/reflectioninvocation.cpp @@ -994,9 +994,6 @@ FCIMPL5(Object*, RuntimeMethodHandle::InvokeMethod, } #endif - // Skip the activation optimization for remoting because of remoting proxy is not always activated. - // It would be nice to clean this up and get remoting to always activate methodtable behind the proxy. - BOOL fForceActivationForRemoting = FALSE; BOOL fCtorOfVariableSizedObject = FALSE; if (fConstructor) @@ -1020,14 +1017,11 @@ FCIMPL5(Object*, RuntimeMethodHandle::InvokeMethod, gc.retVal = pMT->Allocate(); } } - else - { - } { ArgIteratorForMethodInvoke argit(&gc.pSig); - if (argit.IsActivationNeeded() || fForceActivationForRemoting) + if (argit.IsActivationNeeded()) pMeth->EnsureActive(); CONSISTENCY_CHECK(pMeth->CheckActivated()); @@ -1322,11 +1316,7 @@ FCIMPL5(Object*, RuntimeMethodHandle::InvokeMethod, if (fConstructor) { // We have a special case for Strings...The object is returned... - if (ownerType == TypeHandle(g_pStringClass) -#ifdef FEATURE_UTF8STRING - || ownerType == TypeHandle(g_pUtf8StringClass) -#endif // FEATURE_UTF8STRING - ) { + if (fCtorOfVariableSizedObject) { PVOID pReturnValue = &callDescrData.returnValue; gc.retVal = *(OBJECTREF *)pReturnValue; } diff --git a/src/coreclr/src/vm/runtimehandles.h b/src/coreclr/src/vm/runtimehandles.h index 6d08aad..10dd4fd 100644 --- a/src/coreclr/src/vm/runtimehandles.h +++ b/src/coreclr/src/vm/runtimehandles.h @@ -448,7 +448,6 @@ public: ReflectClassBaseObject *pDeclaringType); static FCDECL3(Object *, GetCustomModifiers, SignatureNative* pSig, INT32 parameter, CLR_BOOL fRequired); static FCDECL2(FC_BOOL_RET, CompareSig, SignatureNative* pLhs, SignatureNative* pRhs); - static FCDECL4(FC_BOOL_RET, CompareSigForAppCompat, SignatureNative* pLhs, ReflectClassBaseObject * pTypeLhs, SignatureNative* pRhs, ReflectClassBaseObject * pTypeRhs); BOOL HasThis() { LIMITED_METHOD_CONTRACT; return (m_managedCallingConvention & CALLCONV_HasThis); } diff --git a/src/coreclr/src/vm/stdinterfaces.cpp b/src/coreclr/src/vm/stdinterfaces.cpp index e39a8ad..7ca4975 100644 --- a/src/coreclr/src/vm/stdinterfaces.cpp +++ b/src/coreclr/src/vm/stdinterfaces.cpp @@ -102,37 +102,6 @@ const IID IID_ICustomPropertyProvider = {0x7C925755,0x3E48,0x42B4,{0x86, 0x77, 0 const IID IID_IStringable = {0x96369f54,0x8eb6,0x48f0, {0xab,0xce,0xc1,0xb2,0x11,0xe6,0x27,0xc3}}; -// For free-threaded marshaling, we must not be spoofed by out-of-process or cross-runtime marshal data. -// Only unmarshal data that comes from our own runtime. -BYTE g_UnmarshalSecret[sizeof(GUID)]; -bool g_fInitedUnmarshalSecret = false; - - -static HRESULT InitUnmarshalSecret() -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - MODE_PREEMPTIVE; - } - CONTRACTL_END; - - HRESULT hr = S_OK; - - if (!g_fInitedUnmarshalSecret) - { - ComCall::LockHolder lh; - - if (!g_fInitedUnmarshalSecret) - { - hr = ::CoCreateGuid((GUID *) g_UnmarshalSecret); - if (SUCCEEDED(hr)) - g_fInitedUnmarshalSecret = true; - } - } - return hr; -} //------------------------------------------------------------------------------------------ // IUnknown methods for CLR objects @@ -2441,10 +2410,7 @@ HRESULT GetSpecialMarshaler(IMarshal* pMarsh, SimpleComCallWrapper* pSimpleWrap, HRESULT hr = S_OK; - - // In case of APPX process we always use the standard marshaller. - // In Non-APPX process use standard marshalling for everything except in-proc servers. - // In case of CoreCLR, we always use the standard marshaller as well. + // In case of CoreCLR, we always use the standard marshaller. SafeComHolderPreemp pMarshalerObj = NULL; IfFailRet(CoCreateFreeThreadedMarshaler(NULL, &pMarshalerObj)); @@ -2496,16 +2462,7 @@ HRESULT __stdcall Marshal_GetUnmarshalClass ( if (FAILED(hr)) return hr; - if (pMsh != NULL) - { - hr = pMsh->GetUnmarshalClass (riid, pv, dwDestContext, pvDestContext, mshlflags, pclsid); - return hr; - } - - // Use a statically allocated singleton class to do all unmarshalling. - *pclsid = CLSID_ComCallUnmarshalV4; - - return S_OK; + return pMsh->GetUnmarshalClass (riid, pv, dwDestContext, pvDestContext, mshlflags, pclsid); } HRESULT __stdcall Marshal_GetMarshalSizeMax ( @@ -2534,15 +2491,7 @@ HRESULT __stdcall Marshal_GetMarshalSizeMax ( if (FAILED(hr)) return hr; - if (pMsh != NULL) - { - HRESULT hr = pMsh->GetMarshalSizeMax (riid, pv, dwDestContext, pvDestContext, mshlflags, pSize); - return hr; - } - - *pSize = sizeof (IUnknown *) + sizeof (ULONG) + sizeof(GUID); - - return S_OK; + return pMsh->GetMarshalSizeMax (riid, pv, dwDestContext, pvDestContext, mshlflags, pSize); } HRESULT __stdcall Marshal_MarshalInterface ( @@ -2563,7 +2512,6 @@ HRESULT __stdcall Marshal_MarshalInterface ( } CONTRACTL_END; - ULONG cbRef; HRESULT hr = S_OK; SimpleComCallWrapper *pSimpleWrap = SimpleComCallWrapper::GetWrapperFromIP(pMarsh); @@ -2584,38 +2532,7 @@ HRESULT __stdcall Marshal_MarshalInterface ( if (FAILED(hr)) return hr; - if (pMsh != NULL) - { - hr = pMsh->MarshalInterface (pStm, riid, pv, dwDestContext, pvDestContext, mshlflags); - return hr; - } - - // Write the raw IP into the marshalling stream. - hr = pStm->Write (&pv, sizeof (pv), 0); - if (FAILED (hr)) - return hr; - - // Followed by the marshalling flags (we need these on the remote end to - // manage refcounting the IP). - hr = pStm->Write (&mshlflags, sizeof (mshlflags), 0); - if (FAILED (hr)) - return hr; - - // Followed by the secret, which confirms that the pointer above can be trusted - // because it originated from our runtime. - hr = InitUnmarshalSecret(); - if (FAILED(hr)) - return hr; - - hr = pStm->Write(g_UnmarshalSecret, sizeof(g_UnmarshalSecret), 0); - if (FAILED(hr)) - return hr; - - // We have now created an additional reference to the object. - cbRef = SafeAddRefPreemp((IUnknown *)pv); - LogInteropAddRef((IUnknown *)pv, cbRef, "MarshalInterface"); - - return S_OK; + return pMsh->MarshalInterface (pStm, riid, pv, dwDestContext, pvDestContext, mshlflags); } HRESULT __stdcall Marshal_UnmarshalInterface ( diff --git a/src/coreclr/src/vm/stdinterfaces.h b/src/coreclr/src/vm/stdinterfaces.h index de2f5f4..9ff3289 100644 --- a/src/coreclr/src/vm/stdinterfaces.h +++ b/src/coreclr/src/vm/stdinterfaces.h @@ -56,11 +56,6 @@ typedef HRESULT (__stdcall* PCOMFN)(void); #define S_USEIUNKNOWN (HRESULT)2 #define S_USEIDISPATCH (HRESULT)3 -// For free-threaded marshaling, we must not be spoofed by out-of-process or cross-runtime marshal data. -// Only unmarshal data that comes from our own runtime. -extern BYTE g_UnmarshalSecret[sizeof(GUID)]; -extern bool g_fInitedUnmarshalSecret; - // make sure to keep the following enum and the g_stdVtables array in sync enum Enum_StdInterfaces {