From 1b7edcbc68c663afa0856a178e14c491928fc8f3 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 27 Jun 2020 06:55:35 -0700 Subject: [PATCH] Move System.Runtime.CompilerServices.CallConv* types to System.Private.CoreLib and expose via System.Runtime. (#38473) * Move the calling convention types used in the new calling convention modopt-based encoding down to System.Private.CoreLib/System.Runtime. * Make S.R.CS.VisualC a partial facade so the tooling will generate the type forwards in the src assembly. --- .../System.Private.CoreLib.Shared.projitems | 1 + .../CompilerServices/CallingConventions.cs | 23 +++++++++++++++++++ ...e.CompilerServices.VisualC.TypeForwards.cs | 11 +++++++++ ...System.Runtime.CompilerServices.VisualC.cs | 16 ------------- ...em.Runtime.CompilerServices.VisualC.csproj | 3 ++- ...em.Runtime.CompilerServices.VisualC.csproj | 3 ++- .../Runtime/CompilerServices/Attributes.cs | 17 -------------- .../System.Runtime/ref/System.Runtime.cs | 16 +++++++++++++ 8 files changed, 55 insertions(+), 35 deletions(-) create mode 100644 src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/CallingConventions.cs create mode 100644 src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.TypeForwards.cs diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 6971e3798f1d5b..712fca16c64036 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -621,6 +621,7 @@ + diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/CallingConventions.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/CallingConventions.cs new file mode 100644 index 00000000000000..f96a6e2328730b --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/CallingConventions.cs @@ -0,0 +1,23 @@ +// 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. + +namespace System.Runtime.CompilerServices +{ + public class CallConvCdecl + { + public CallConvCdecl() { } + } + public class CallConvFastcall + { + public CallConvFastcall() { } + } + public class CallConvStdcall + { + public CallConvStdcall() { } + } + public class CallConvThiscall + { + public CallConvThiscall() { } + } +} diff --git a/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.TypeForwards.cs b/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.TypeForwards.cs new file mode 100644 index 00000000000000..de61f8f49a9de0 --- /dev/null +++ b/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.TypeForwards.cs @@ -0,0 +1,11 @@ +// 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. +// ------------------------------------------------------------------------------ +// Changes to this file must follow the https://aka.ms/api-review process. +// ------------------------------------------------------------------------------ + +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.CallConvCdecl))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.CallConvStdcall))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.CallConvThiscall))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.CallConvFastcall))] diff --git a/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.cs b/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.cs index 3078e97d586ef0..4bf569a860e029 100644 --- a/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.cs +++ b/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.cs @@ -7,22 +7,6 @@ namespace System.Runtime.CompilerServices { - public partial class CallConvCdecl - { - public CallConvCdecl() { } - } - public partial class CallConvFastcall - { - public CallConvFastcall() { } - } - public partial class CallConvStdcall - { - public CallConvStdcall() { } - } - public partial class CallConvThiscall - { - public CallConvThiscall() { } - } public static partial class CompilerMarshalOverride { } diff --git a/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.csproj b/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.csproj index 4aa813260324c5..c63584df9a6fa0 100644 --- a/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.csproj +++ b/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.csproj @@ -6,8 +6,9 @@ + - \ No newline at end of file + diff --git a/src/libraries/System.Runtime.CompilerServices.VisualC/src/System.Runtime.CompilerServices.VisualC.csproj b/src/libraries/System.Runtime.CompilerServices.VisualC/src/System.Runtime.CompilerServices.VisualC.csproj index 25098cd0de4a55..2b8596cf8d9062 100644 --- a/src/libraries/System.Runtime.CompilerServices.VisualC/src/System.Runtime.CompilerServices.VisualC.csproj +++ b/src/libraries/System.Runtime.CompilerServices.VisualC/src/System.Runtime.CompilerServices.VisualC.csproj @@ -2,6 +2,7 @@ System.Runtime.CompilerServices.VisualC enable + true $(NetCoreAppCurrent) @@ -11,4 +12,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs b/src/libraries/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs index 18dad6f87f40bb..6ea1a578e606f9 100644 --- a/src/libraries/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs +++ b/src/libraries/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs @@ -39,23 +39,6 @@ internal AssemblyAttributesGoHereSM() } } - // Types used in Custom Modifier to specify calling conventions. - public class CallConvCdecl - { - } - - public class CallConvStdcall - { - } - - public class CallConvThiscall - { - } - - public class CallConvFastcall - { - } - [AttributeUsage(AttributeTargets.All)] internal sealed class DecoratedNameAttribute : Attribute { diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index 9610e9f0e59413..ea6fcdb33d32e1 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -8993,6 +8993,22 @@ public void SetResult() { } public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { } public void Start(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { } } + public partial class CallConvCdecl + { + public CallConvCdecl() { } + } + public partial class CallConvFastcall + { + public CallConvFastcall() { } + } + public partial class CallConvStdcall + { + public CallConvStdcall() { } + } + public partial class CallConvThiscall + { + public CallConvThiscall() { } + } [System.AttributeUsageAttribute(System.AttributeTargets.Parameter, AllowMultiple=false, Inherited=false)] public sealed partial class CallerArgumentExpressionAttribute : System.Attribute {