From 9abc5a95be8e2b1193ed71cd041763b62a93654d Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Fri, 5 May 2023 18:21:37 +0200 Subject: [PATCH] Remove [AO] in SpanHelpers methods (#85819) --- .../System.Private.CoreLib/src/System/SpanHelpers.Byte.cs | 2 -- .../System.Private.CoreLib/src/System/SpanHelpers.Char.cs | 2 -- .../System.Private.CoreLib/src/System/SpanHelpers.T.cs | 11 ----------- 3 files changed, 15 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Byte.cs b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Byte.cs index c3d7cd2..39e9daa 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Byte.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Byte.cs @@ -342,7 +342,6 @@ namespace System // IndexOfNullByte processes memory in aligned chunks, and thus it won't crash even if it accesses memory beyond the null terminator. // This behavior is an implementation detail of the runtime and callers outside System.Private.CoreLib must not depend on it. - [MethodImpl(MethodImplOptions.AggressiveOptimization)] internal static unsafe int IndexOfNullByte(byte* searchSpace) { const int Length = int.MaxValue; @@ -789,7 +788,6 @@ namespace System return i * 8 + LocateFirstFoundByte(candidate); } - [MethodImpl(MethodImplOptions.AggressiveOptimization)] public static unsafe int SequenceCompareTo(ref byte first, int firstLength, ref byte second, int secondLength) { Debug.Assert(firstLength >= 0); diff --git a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Char.cs b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Char.cs index f486595..967ec6d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Char.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.Char.cs @@ -355,7 +355,6 @@ namespace System } } - [MethodImpl(MethodImplOptions.AggressiveOptimization)] public static unsafe int SequenceCompareTo(ref char first, int firstLength, ref char second, int secondLength) { Debug.Assert(firstLength >= 0); @@ -422,7 +421,6 @@ namespace System // IndexOfNullCharacter processes memory in aligned chunks, and thus it won't crash even if it accesses memory beyond the null terminator. // This behavior is an implementation detail of the runtime and callers outside System.Private.CoreLib must not depend on it. - [MethodImpl(MethodImplOptions.AggressiveOptimization)] public static unsafe int IndexOfNullCharacter(char* searchSpace) { const char value = '\0'; diff --git a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs index 54d044c..93d15de 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs @@ -1315,7 +1315,6 @@ namespace System return NonPackedContainsValueType(ref searchSpace, value, length); } - [MethodImpl(MethodImplOptions.AggressiveOptimization)] internal static bool NonPackedContainsValueType(ref T searchSpace, T value, int length) where T : struct, INumber { Debug.Assert(length >= 0, "Expected non-negative length"); @@ -1463,7 +1462,6 @@ namespace System return NonPackedIndexOfValueType(ref searchSpace, value, length); } - [MethodImpl(MethodImplOptions.AggressiveOptimization)] internal static int NonPackedIndexOfValueType(ref TValue searchSpace, TValue value, int length) where TValue : struct, INumber where TNegator : struct, INegator @@ -1621,7 +1619,6 @@ namespace System } // having INumber constraint here allows to use == operator and get better perf compared to .Equals - [MethodImpl(MethodImplOptions.AggressiveOptimization)] internal static int NonPackedIndexOfAnyValueType(ref TValue searchSpace, TValue value0, TValue value1, int length) where TValue : struct, INumber where TNegator : struct, INegator @@ -1797,7 +1794,6 @@ namespace System return NonPackedIndexOfAnyValueType(ref searchSpace, value0, value1, value2, length); } - [MethodImpl(MethodImplOptions.AggressiveOptimization)] internal static int NonPackedIndexOfAnyValueType(ref TValue searchSpace, TValue value0, TValue value1, TValue value2, int length) where TValue : struct, INumber where TNegator : struct, INegator @@ -1958,7 +1954,6 @@ namespace System internal static int IndexOfAnyExceptValueType(ref T searchSpace, T value0, T value1, T value2, T value3, int length) where T : struct, INumber => IndexOfAnyValueType>(ref searchSpace, value0, value1, value2, value3, length); - [MethodImpl(MethodImplOptions.AggressiveOptimization)] private static int IndexOfAnyValueType(ref TValue searchSpace, TValue value0, TValue value1, TValue value2, TValue value3, int length) where TValue : struct, INumber where TNegator : struct, INegator @@ -2087,7 +2082,6 @@ namespace System internal static int IndexOfAnyExceptValueType(ref T searchSpace, T value0, T value1, T value2, T value3, T value4, int length) where T : struct, INumber => IndexOfAnyValueType>(ref searchSpace, value0, value1, value2, value3, value4, length); - [MethodImpl(MethodImplOptions.AggressiveOptimization)] private static int IndexOfAnyValueType(ref TValue searchSpace, TValue value0, TValue value1, TValue value2, TValue value3, TValue value4, int length) where TValue : struct, INumber where TNegator : struct, INegator @@ -2219,7 +2213,6 @@ namespace System internal static int LastIndexOfAnyExceptValueType(ref T searchSpace, T value, int length) where T : struct, INumber => LastIndexOfValueType>(ref searchSpace, value, length); - [MethodImpl(MethodImplOptions.AggressiveOptimization)] private static int LastIndexOfValueType(ref TValue searchSpace, TValue value, int length) where TValue : struct, INumber where TNegator : struct, INegator @@ -2354,7 +2347,6 @@ namespace System internal static int LastIndexOfAnyExceptValueType(ref T searchSpace, T value0, T value1, int length) where T : struct, INumber => LastIndexOfAnyValueType>(ref searchSpace, value0, value1, length); - [MethodImpl(MethodImplOptions.AggressiveOptimization)] private static int LastIndexOfAnyValueType(ref TValue searchSpace, TValue value0, TValue value1, int length) where TValue : struct, INumber where TNegator : struct, INegator @@ -2510,7 +2502,6 @@ namespace System internal static int LastIndexOfAnyExceptValueType(ref T searchSpace, T value0, T value1, T value2, int length) where T : struct, INumber => LastIndexOfAnyValueType>(ref searchSpace, value0, value1, value2, length); - [MethodImpl(MethodImplOptions.AggressiveOptimization)] private static int LastIndexOfAnyValueType(ref TValue searchSpace, TValue value0, TValue value1, TValue value2, int length) where TValue : struct, INumber where TNegator : struct, INegator @@ -2667,7 +2658,6 @@ namespace System internal static int LastIndexOfAnyExceptValueType(ref T searchSpace, T value0, T value1, T value2, T value3, int length) where T : struct, INumber => LastIndexOfAnyValueType>(ref searchSpace, value0, value1, value2, value3, length); - [MethodImpl(MethodImplOptions.AggressiveOptimization)] private static int LastIndexOfAnyValueType(ref TValue searchSpace, TValue value0, TValue value1, TValue value2, TValue value3, int length) where TValue : struct, INumber where TNegator : struct, INegator @@ -2882,7 +2872,6 @@ namespace System internal static int LastIndexOfAnyExceptValueType(ref T searchSpace, T value0, T value1, T value2, T value3, T value4, int length) where T : struct, INumber => LastIndexOfAnyValueType>(ref searchSpace, value0, value1, value2, value3, value4, length); - [MethodImpl(MethodImplOptions.AggressiveOptimization)] private static int LastIndexOfAnyValueType(ref TValue searchSpace, TValue value0, TValue value1, TValue value2, TValue value3, TValue value4, int length) where TValue : struct, INumber where TNegator : struct, INegator -- 2.7.4