diff --git a/src/libraries/System.Private.CoreLib/src/System/Array.cs b/src/libraries/System.Private.CoreLib/src/System/Array.cs index 313b064fc9e676..cecfcf12ccf9aa 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Array.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Array.cs @@ -2207,6 +2207,9 @@ private void IntrospectiveSort(int left, int length) } } + // IntroSort is recursive; block it from being inlined into itself as + // this is currenly not profitable. + [MethodImpl(MethodImplOptions.NoInlining)] private void IntroSort(int lo, int hi, int depthLimit) { Debug.Assert(hi >= lo); @@ -2421,6 +2424,9 @@ private void IntrospectiveSort(int left, int length) } } + // IntroSort is recursive; block it from being inlined into itself as + // this is currenly not profitable. + [MethodImpl(MethodImplOptions.NoInlining)] private void IntroSort(int lo, int hi, int depthLimit) { Debug.Assert(hi >= lo); diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs index cf481d8999649a..1d937f4b853369 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs @@ -128,6 +128,9 @@ internal static void IntrospectiveSort(Span keys, Comparison comparer) } } + // IntroSort is recursive; block it from being inlined into itself as + // this is currenly not profitable. + [MethodImpl(MethodImplOptions.NoInlining)] private static void IntroSort(Span keys, int depthLimit, Comparison comparer) { Debug.Assert(!keys.IsEmpty); @@ -402,6 +405,9 @@ private static void Swap(ref T i, ref T j) j = t; } + // IntroSort is recursive; block it from being inlined into itself as + // this is currenly not profitable. + [MethodImpl(MethodImplOptions.NoInlining)] private static void IntroSort(Span keys, int depthLimit) { Debug.Assert(!keys.IsEmpty);