diff options
author | Luqun Lou <luqunl@microsoft.com> | 2017-10-17 23:33:39 +0300 |
---|---|---|
committer | Luqun Lou <luqunl@microsoft.com> | 2017-10-17 23:33:39 +0300 |
commit | 431c48978a66f31a904757a394de47bdc80c2a41 (patch) | |
tree | cb89fdc492bd3dd6edbefc63f72fc555593d1ba8 /src/System.Private.Interop | |
parent | 990f55966aa7daef1e312c12e73c624ed02c789e (diff) |
Replace generic StdCall intristics with non-generic StdCall
the reason for replacing StdCall<T> with StdCall__int is that
1. CoreCLR doesn't support generic Calli, see voidSigPointer::ConvertToInternalExactlyOne(Module* pSigModule, SigTypeContext *pTypeContext, SigBuilder * pSigBuilder, BOOL bSkipCustomModifier) for more info
2. StdCall<T> doesn't buy us much, since we always use StdCall<int>
[tfs-changeset: 1678326]
Diffstat (limited to 'src/System.Private.Interop')
7 files changed, 57 insertions, 61 deletions
diff --git a/src/System.Private.Interop/src/Shared/McgComHelpers.cs b/src/System.Private.Interop/src/Shared/McgComHelpers.cs index 603543449..123358a86 100644 --- a/src/System.Private.Interop/src/Shared/McgComHelpers.cs +++ b/src/System.Private.Interop/src/Shared/McgComHelpers.cs @@ -93,7 +93,7 @@ namespace System.Runtime.InteropServices Interop.COM.__IStream* pStreamNativePtr = (Interop.COM.__IStream*)(void*)pStream; UInt64 newPosition; - int hr = CalliIntrinsics.StdCall<int>( + int hr = CalliIntrinsics.StdCall__int( pStreamNativePtr->vtbl->pfnSeek, pStreamNativePtr, 0UL, @@ -110,7 +110,7 @@ namespace System.Runtime.InteropServices Interop.COM.__IStream* pStreamNativePtr = (Interop.COM.__IStream*)(void*)pStream; UInt64 newPosition; - int hr = CalliIntrinsics.StdCall<int>( + int hr = CalliIntrinsics.StdCall__int( pStreamNativePtr->vtbl->pfnSetSize, pStreamNativePtr, lSize, diff --git a/src/System.Private.Interop/src/Shared/McgIntrinsics.cs b/src/System.Private.Interop/src/Shared/McgIntrinsics.cs index cf87beacc..1162dca06 100644 --- a/src/System.Private.Interop/src/Shared/McgIntrinsics.cs +++ b/src/System.Private.Interop/src/Shared/McgIntrinsics.cs @@ -187,10 +187,10 @@ namespace System.Runtime.InteropServices void * arg7) { // This method is implemented elsewhere in the toolchain - return 0; + return default(int); } - internal static T StdCall<T>( + internal static int StdCall__int( System.IntPtr pfn, void* pComThis, ulong arg0, @@ -198,9 +198,9 @@ namespace System.Runtime.InteropServices void* arg2) { // This method is implemented elsewhere in the toolchain - return default(T); + return 0; } - internal static T StdCall<T>( + internal static int StdCall__int( System.IntPtr pfn, void* pComThis, IntPtr arg0, @@ -210,50 +210,44 @@ namespace System.Runtime.InteropServices IntPtr arg4) { // This method is implemented elsewhere in the toolchain - return default(T); + return 0; } - internal static T StdCall<T>( + internal static int StdCall__int( System.IntPtr pfn, uint arg0) { // This method is implemented elsewhere in the toolchain - return default(T); + return default(int); } - internal static T StdCall<T>( + internal static int StdCall__int( System.IntPtr pfn, void* arg0) { // This method is implemented elsewhere in the toolchain - return default(T); - } - internal static T StdCall<T>( - System.IntPtr pfn, - void* arg0, - void* arg1) - { - // This method is implemented elsewhere in the toolchain - return default(T); + return default(int); } - internal static T StdCall<T>( + + internal static int StdCall__int( System.IntPtr pfn, void* arg0, uint arg1, void* arg2) { // This method is implemented elsewhere in the toolchain - return default(T); + return default(int); } - internal static T StdCall<T>( + internal static int StdCall__int( System.IntPtr pfn, void* arg0, void* arg1, void* arg2) { // This method is implemented elsewhere in the toolchain - return default(T); + return default(int); } - internal static T StdCall<T>( + + internal static int StdCall__int( System.IntPtr pfn, void* arg0, uint arg1, @@ -261,18 +255,19 @@ namespace System.Runtime.InteropServices void* arg3) { // This method is implemented elsewhere in the toolchain - return default(T); + return default(int); } - internal static T StdCall<T>( + internal static int StdCall__int( System.IntPtr pfn, int hr, void* errorMsg, System.IntPtr pUnk) { // This method is implemented elsewhere in the toolchain - return default(T); + return default(int); } - internal static T StdCall<T>( + + internal static int StdCall__int( System.IntPtr pfn, System.IntPtr pComThis, out System.IntPtr arg1, @@ -285,18 +280,19 @@ namespace System.Runtime.InteropServices arg3 = default(IntPtr); arg4 = default(IntPtr); arg2 = 0; - return default(T); + return default(int); } - internal static T StdCall<T>( + internal static int StdCall__int( System.IntPtr pfn, System.IntPtr pComThis, out System.IntPtr arg) { // This method is implemented elsewhere in the toolchain arg = default(IntPtr); - return default(T); + return default(int); } - internal static T StdCall<T>( + + internal static int StdCall__int( System.IntPtr pfn, System.IntPtr pComThis, System.Guid arg1, @@ -304,10 +300,10 @@ namespace System.Runtime.InteropServices { // This method is implemented elsewhere in the toolchain arg2 = default(IntPtr); - return default(T); + return default(int); } - internal static T StdCall<T>( + internal static int StdCall__int( IntPtr pfn, void* pComThis, IntPtr piid, @@ -318,10 +314,10 @@ namespace System.Runtime.InteropServices IntPtr pclsid) { // This method is implemented elsewhere in the toolchain - return default(T); + return default(int); } - internal static T StdCall<T>( + internal static int StdCall__int( IntPtr pfn, void* pComThis, IntPtr pStm, @@ -332,10 +328,10 @@ namespace System.Runtime.InteropServices int mshlflags) { // This method is implemented elsewhere in the toolchain - return default(T); + return default(int); } - internal static T StdCall<T>( + internal static int StdCall__int( IntPtr pfn, void* pComThis, IntPtr pStm, @@ -343,25 +339,25 @@ namespace System.Runtime.InteropServices IntPtr ppvObj) { // This method is implemented elsewhere in the toolchain - return default(T); + return default(int); } - internal static T StdCall<T>( + internal static int StdCall__int( IntPtr pfn, void* pComThis, IntPtr pStm) { // This method is implemented elsewhere in the toolchain - return default(T); + return default(int); } - internal static T StdCall<T>( + internal static int StdCall__int( IntPtr pfn, void* pComThis, int dwReserved) { // This method is implemented elsewhere in the toolchain - return default(T); + return default(int); } private const MethodImplOptions InternalCall = (MethodImplOptions)0x1000; diff --git a/src/System.Private.Interop/src/Shared/RCWWalker.cs b/src/System.Private.Interop/src/Shared/RCWWalker.cs index 9f1507b3e..b6a6d75d8 100644 --- a/src/System.Private.Interop/src/Shared/RCWWalker.cs +++ b/src/System.Private.Interop/src/Shared/RCWWalker.cs @@ -571,7 +571,7 @@ namespace System.Runtime.InteropServices private static unsafe void Initialize(__com_IJupiterObject* pJupiterObject) { IntPtr pGCManager; - int hr = CalliIntrinsics.StdCall<int>(pJupiterObject->pVtable->pfnGetJupiterGCManager, pJupiterObject, &pGCManager); + int hr = CalliIntrinsics.StdCall__int(pJupiterObject->pVtable->pfnGetJupiterGCManager, pJupiterObject, &pGCManager); if (hr >= 0) { // disable warning for ref volatile @@ -599,7 +599,7 @@ namespace System.Runtime.InteropServices // AddRef on IGCManager // __com_IUnknown* pGCManagerUnk = (__com_IUnknown*)pGCManager; - CalliIntrinsics.StdCall<int>(pGCManagerUnk->pVtable->pfnAddRef, pGCManager); + CalliIntrinsics.StdCall__int(pGCManagerUnk->pVtable->pfnAddRef, pGCManager); s_clrServices.pVtable = __vtable_ICLRServices.GetVtable(); @@ -609,7 +609,7 @@ namespace System.Runtime.InteropServices // Tell Jupiter that we are ready for tracking life time of objects and provide Jupiter with // our life time realted services through ICLRServices // - CalliIntrinsics.StdCall<int>( + CalliIntrinsics.StdCall__int( pGCManager->pVTable->pfnSetCLRServices, pGCManager, pCLRServices @@ -656,7 +656,7 @@ namespace System.Runtime.InteropServices // Notify Jupiter that we've created a new RCW for this Jupiter object // To avoid surprises, we should notify them before we fire the first AfterAddRef // - CalliIntrinsics.StdCall<int>(pJupiterObject->pVtable->pfnConnect, pJupiterObject); + CalliIntrinsics.StdCall__int(pJupiterObject->pVtable->pfnConnect, pJupiterObject); // // Tell Jupiter that we've done AddRef for IJupiterObject* and IUnknown* @@ -687,7 +687,7 @@ namespace System.Runtime.InteropServices // We should do this *after* we made a AddRef because we should never // be in a state where report refs > actual refs // - CalliIntrinsics.StdCall<int>(pJupiterObject->pVtable->pfnAfterAddRef, pJupiterObject); + CalliIntrinsics.StdCall__int(pJupiterObject->pVtable->pfnAfterAddRef, pJupiterObject); } /// <summary> @@ -706,7 +706,7 @@ namespace System.Runtime.InteropServices __com_IJupiterObject* pJupiterObject = comObject.GetIJupiterObject_NoAddRef(); - CalliIntrinsics.StdCall<int>(pJupiterObject->pVtable->pfnBeforeRelease, pJupiterObject); + CalliIntrinsics.StdCall__int(pJupiterObject->pVtable->pfnBeforeRelease, pJupiterObject); } /// <summary> diff --git a/src/System.Private.Interop/src/Shared/StandardInterfaces.cs b/src/System.Private.Interop/src/Shared/StandardInterfaces.cs index b480e37d3..0c36184dd 100644 --- a/src/System.Private.Interop/src/Shared/StandardInterfaces.cs +++ b/src/System.Private.Interop/src/Shared/StandardInterfaces.cs @@ -1612,7 +1612,7 @@ namespace System.Runtime.InteropServices int hr = GetIMarshal((void **)&pIMarshal); if (hr < 0) return hr; - return CalliIntrinsics.StdCall<int>( + return CalliIntrinsics.StdCall__int( (*pIMarshal)->pfnGetUnmarshalClass, pIMarshal, piid, @@ -1645,7 +1645,7 @@ namespace System.Runtime.InteropServices int hr = GetIMarshal((void**)&pIMarshal); ; if (hr < 0) return hr; - return CalliIntrinsics.StdCall<int>( + return CalliIntrinsics.StdCall__int( (*pIMarshal)->pfnGetMarshalSizeMax, pIMarshal, piid, @@ -1678,7 +1678,7 @@ namespace System.Runtime.InteropServices int hr = GetIMarshal((void**)&pIMarshal); if (hr < 0) return hr; - return CalliIntrinsics.StdCall<int>( + return CalliIntrinsics.StdCall__int( (*pIMarshal)->pfnMarshalInterface, pIMarshal, pStm, @@ -1708,7 +1708,7 @@ namespace System.Runtime.InteropServices int hr = GetIMarshal((void**)&pIMarshal); if (hr < 0) return hr; - return CalliIntrinsics.StdCall<int>( + return CalliIntrinsics.StdCall__int( (*pIMarshal)->pfnUnmarshalInterface, pIMarshal, pStm, @@ -1733,7 +1733,7 @@ namespace System.Runtime.InteropServices int hr = GetIMarshal((void**)&pIMarshal); if (hr < 0) return hr; - return CalliIntrinsics.StdCall<int>( + return CalliIntrinsics.StdCall__int( (*pIMarshal)->pfnReleaseMarshalData, pIMarshal, pStm); @@ -1756,7 +1756,7 @@ namespace System.Runtime.InteropServices int hr = GetIMarshal((void**)&pIMarshal); if (hr < 0) return hr; - return CalliIntrinsics.StdCall<int>( + return CalliIntrinsics.StdCall__int( (*pIMarshal)->pfnDisconnectObject, pIMarshal, dwReserved); diff --git a/src/System.Private.Interop/src/Shared/__ComObject.cs b/src/System.Private.Interop/src/Shared/__ComObject.cs index 11277cf61..63687f1d8 100644 --- a/src/System.Private.Interop/src/Shared/__ComObject.cs +++ b/src/System.Private.Interop/src/Shared/__ComObject.cs @@ -3067,7 +3067,7 @@ namespace System.Runtime.InteropServices (Interop.COM.__IContextCallback*)(void*)pContextCallback; fixed (Guid* unsafe_iid = &Interop.COM.IID_IEnterActivityWithNoLock) { - int hr = CalliIntrinsics.StdCall<int>( + int hr = CalliIntrinsics.StdCall__int( pContextCallbackNativePtr->vtbl->pfnContextCallback, pContextCallbackNativePtr, // Don't forget 'this pointer AddrOfIntrinsics.AddrOf<AddrOfIntrinsics.AddrOfTarget1>(EnterContextCallbackProc), @@ -3608,7 +3608,7 @@ namespace System.Runtime.InteropServices try { - int hr = CalliIntrinsics.StdCall<int>( + int hr = CalliIntrinsics.StdCall__int( pIStringable->pVtable->pfnToString, pIStringable, &unsafe_hstring diff --git a/src/System.Private.Interop/src/System/Runtime/InteropServices/ComWeakReferenceHelpers.cs b/src/System.Private.Interop/src/System/Runtime/InteropServices/ComWeakReferenceHelpers.cs index a97198082..a3910b67c 100644 --- a/src/System.Private.Interop/src/System/Runtime/InteropServices/ComWeakReferenceHelpers.cs +++ b/src/System.Private.Interop/src/System/Runtime/InteropServices/ComWeakReferenceHelpers.cs @@ -134,7 +134,7 @@ namespace System.Runtime.InteropServices { // Now that we have the IWeakReferenceSource , we need to call the GetWeakReference method to get the corresponding IWeakReference __com_IWeakReferenceSource* pComWeakRefSource = (__com_IWeakReferenceSource*)pWeakRefSource; - int result = CalliIntrinsics.StdCall<int>( + int result = CalliIntrinsics.StdCall__int( pComWeakRefSource->pVtable->pfnGetWeakReference, pWeakRefSource, out pWeakRef); diff --git a/src/System.Private.Interop/src/WinRT/ExceptionHelpers.cs b/src/System.Private.Interop/src/WinRT/ExceptionHelpers.cs index 511f489a2..c023d5c06 100644 --- a/src/System.Private.Interop/src/WinRT/ExceptionHelpers.cs +++ b/src/System.Private.Interop/src/WinRT/ExceptionHelpers.cs @@ -32,7 +32,7 @@ namespace System.Runtime.InteropServices { // Get the errorDetails associated with the restrictedErrorInfo. __com_IRestrictedErrorInfo* pComRestrictedErrorInfo = (__com_IRestrictedErrorInfo*)pRestrictedErrorInfo; - result = CalliIntrinsics.StdCall<int>( + result = CalliIntrinsics.StdCall__int( pComRestrictedErrorInfo->pVtable->pfnGetErrorDetails, pRestrictedErrorInfo, out pErrDes, @@ -75,7 +75,7 @@ namespace System.Runtime.InteropServices try { __com_IRestrictedErrorInfo* pComRestrictedErrorInfo = (__com_IRestrictedErrorInfo*)pRestrictedErrorInfo; - int result = CalliIntrinsics.StdCall<int>(pComRestrictedErrorInfo->pVtable->pfnGetReference, pRestrictedErrorInfo, out pReference); + int result = CalliIntrinsics.StdCall__int(pComRestrictedErrorInfo->pVtable->pfnGetReference, pRestrictedErrorInfo, out pReference); if (result >= 0) { errReference = Interop.COM.ConvertBSTRToString(pReference); @@ -795,7 +795,7 @@ namespace System.Runtime.InteropServices // We have an LanguageExceptionErrorInfo. IntPtr pUnk; __com_ILanguageExceptionErrorInfo* pComLanguageExceptionErrorInfo = (__com_ILanguageExceptionErrorInfo*)pLanguageExceptionErrorInfo; - int result = CalliIntrinsics.StdCall<int>(pComLanguageExceptionErrorInfo->pVtable->pfnGetLanguageException, pLanguageExceptionErrorInfo, out pUnk); + int result = CalliIntrinsics.StdCall__int(pComLanguageExceptionErrorInfo->pVtable->pfnGetLanguageException, pLanguageExceptionErrorInfo, out pUnk); McgMarshal.ComSafeRelease(pLanguageExceptionErrorInfo); if (result >= 0 && pUnk != IntPtr.Zero) |