From d1d848c7ad66bd142ca63517f5ad95a156e38d82 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 28 Nov 2023 19:50:07 -0800 Subject: [PATCH] Delete some native AOT S.P.CoreLib compat suppressions --- .../src/CompatibilitySuppressions.xml | 16 ------- .../Runtime/Augments/RuntimeAugments.cs | 6 --- .../InteropServices/InteropExtensions.cs | 8 +--- .../src/System/Runtime/TypeLoaderExports.cs | 44 +------------------ .../src/System/Threading/Condition.cs | 2 +- .../src/System/TypedReference.cs | 3 +- .../System/Diagnostics/Tracing/EventSource.cs | 2 +- 7 files changed, 6 insertions(+), 75 deletions(-) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml b/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml index 6624968f544b6..805f58f68fa95 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml @@ -877,10 +877,6 @@ CP0001 T:System.Runtime.ExceptionIDs - - CP0001 - T:System.Runtime.InteropServices.InteropExtensions - CP0001 T:System.Runtime.InteropServices.NativeFunctionPointerWrapper @@ -897,10 +893,6 @@ CP0001 T:System.Runtime.RuntimeImports - - CP0001 - T:System.Runtime.RuntimeObjectFactory - CP0001 T:System.Runtime.TypeLoaderExports @@ -909,10 +901,6 @@ CP0001 T:System.RuntimeExceptionHelpers - - CP0001 - T:System.Threading.Condition - CP0002 M:System.ModuleHandle.#ctor(System.Reflection.Module) @@ -925,10 +913,6 @@ CP0002 M:System.Reflection.MethodBase.GetParametersAsSpan - - CP0002 - M:System.TypedReference.get_IsNull - CP0015 M:System.Diagnostics.Tracing.EventSource.Write``1(System.String,``0):[T:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute] diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs index 61472759604d6..c9ceab8a2e431 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs @@ -688,12 +688,6 @@ public static IntPtr GetTargetOfUnboxingAndInstantiatingStub(IntPtr functionPoin return RuntimeImports.RhGetTargetOfUnboxingAndInstantiatingStub(functionPointer); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static IntPtr RuntimeCacheLookup(IntPtr context, IntPtr signature, RuntimeObjectFactory factory, object contextObject, out IntPtr auxResult) - { - return TypeLoaderExports.RuntimeCacheLookupInCache(context, signature, factory, contextObject, out auxResult); - } - //============================================================================================== // Internals //============================================================================================== diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/InteropExtensions.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/InteropExtensions.cs index 8fc9c37a9dd1b..a371386010cee 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/InteropExtensions.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/InteropExtensions.cs @@ -13,13 +13,9 @@ namespace System.Runtime.InteropServices { /// - /// Hooks for System.Private.Interop.dll code to access internal functionality in System.Private.CoreLib.dll. - /// - /// Methods added to InteropExtensions should also be added to the System.Private.CoreLib.InteropServices contract - /// in order to be accessible from System.Private.Interop.dll. + /// Hooks for interop code to access internal functionality in System.Private.CoreLib.dll. /// - [CLSCompliant(false)] - public static class InteropExtensions + internal static class InteropExtensions { internal static bool MightBeBlittable(this EETypePtr eeType) { diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/TypeLoaderExports.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/TypeLoaderExports.cs index c7fa5b35d1dbf..fb8db35f2d269 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/TypeLoaderExports.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/TypeLoaderExports.cs @@ -94,36 +94,6 @@ public static IntPtr GenericLookup(IntPtr context, IntPtr signature) return v._result; } - public static void GenericLookupAndCallCtor(object arg, IntPtr context, IntPtr signature) - { - Value v = LookupOrAdd(context, signature); - RawCalliHelper.Call(v._result, arg); - } - - public static object GenericLookupAndAllocObject(IntPtr context, IntPtr signature) - { - Value v = LookupOrAdd(context, signature); - return RawCalliHelper.Call(v._result, v._auxResult); - } - - public static object GenericLookupAndAllocArray(IntPtr context, IntPtr arg, IntPtr signature) - { - Value v = LookupOrAdd(context, signature); - return RawCalliHelper.Call(v._result, v._auxResult, arg); - } - - public static void GenericLookupAndCheckArrayElemType(IntPtr context, object arg, IntPtr signature) - { - Value v = LookupOrAdd(context, signature); - RawCalliHelper.Call(v._result, v._auxResult, arg); - } - - public static object GenericLookupAndCast(object arg, IntPtr context, IntPtr signature) - { - Value v = LookupOrAdd(context, signature); - return RawCalliHelper.Call(v._result, arg, v._auxResult); - } - public static unsafe IntPtr GVMLookupForSlot(object obj, RuntimeMethodHandle slot) { if (TryGetFromCache((IntPtr)obj.GetMethodTable(), RuntimeMethodHandle.ToIntPtr(slot), out var v)) @@ -162,18 +132,6 @@ private static bool TryGetFromCache(IntPtr context, IntPtr signature, out Value return s_cache.TryGet(k, out entry); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static IntPtr RuntimeCacheLookupInCache(IntPtr context, IntPtr signature, RuntimeObjectFactory factory, object contextObject, out IntPtr auxResult) - { - if (!TryGetFromCache(context, signature, out var v)) - { - v = CacheMiss(context, signature, factory, contextObject); - } - - auxResult = v._auxResult; - return v._result; - } - private static Value CacheMiss(IntPtr ctx, IntPtr sig) { return CacheMiss(ctx, sig, @@ -198,7 +156,7 @@ private static unsafe Value CacheMiss(IntPtr context, IntPtr signature, RuntimeO } } - public delegate IntPtr RuntimeObjectFactory(IntPtr context, IntPtr signature, object contextObject, ref IntPtr auxResult); + internal delegate IntPtr RuntimeObjectFactory(IntPtr context, IntPtr signature, object contextObject, ref IntPtr auxResult); internal static unsafe class RawCalliHelper { diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Condition.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Condition.cs index c8fdbb6038434..66636d7f78260 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Condition.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Condition.cs @@ -8,7 +8,7 @@ namespace System.Threading { - public sealed class Condition + internal sealed class Condition { internal class Waiter { diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/TypedReference.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/TypedReference.cs index 6456aacbe9b61..115ab7bdd5994 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/TypedReference.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/TypedReference.cs @@ -73,8 +73,7 @@ public static object ToObject(TypedReference value) public override bool Equals(object? o) { throw new NotSupportedException(SR.NotSupported_NYI); } public override int GetHashCode() => _typeHandle.IsNull ? 0 : _typeHandle.GetHashCode(); - // Not an api - declared public because of CoreLib/Reflection.Core divide. - public bool IsNull => _typeHandle.IsNull; + internal bool IsNull => _typeHandle.IsNull; internal ref byte Value { diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs index a497f35530297..430bab166562f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs @@ -5152,7 +5152,7 @@ public ManifestBuilder(string providerName, Guid providerGuid, string? dllName, } /// - /// Will NOT build a manifest! If the intention is to build a manifest don’t use this constructor. + /// Will NOT build a manifest! If the intention is to build a manifest don't use this constructor. ///'resources, is a resource manager. If specified all messages are localized using that manager. /// internal ManifestBuilder(ResourceManager? resources, EventManifestOptions flags)