From 48fe63793040eaee87bdb26ee7d19636527efa3b Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Mon, 22 Nov 2021 16:17:59 -0700 Subject: [PATCH] Fix regression in IsPrefix / IsSuffix benchmarks (#61935) Mark EndsWith and StartsWith as NoInlining --- src/libraries/Common/src/Interop/Interop.Collation.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/Common/src/Interop/Interop.Collation.cs b/src/libraries/Common/src/Interop/Interop.Collation.cs index 41b7f890ada89..5b210bafb0de5 100644 --- a/src/libraries/Common/src/Interop/Interop.Collation.cs +++ b/src/libraries/Common/src/Interop/Interop.Collation.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; internal static partial class Interop @@ -25,10 +26,12 @@ internal static partial class Globalization internal static unsafe partial int LastIndexOf(IntPtr sortHandle, char* target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options, int* matchLengthPtr); [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_StartsWith", CharSet = CharSet.Unicode)] + [MethodImpl(MethodImplOptions.NoInlining)] [return: MarshalAs(UnmanagedType.Bool)] internal static unsafe partial bool StartsWith(IntPtr sortHandle, char* target, int cwTargetLength, char* source, int cwSourceLength, CompareOptions options, int* matchedLength); [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_EndsWith", CharSet = CharSet.Unicode)] + [MethodImpl(MethodImplOptions.NoInlining)] [return: MarshalAs(UnmanagedType.Bool)] internal static unsafe partial bool EndsWith(IntPtr sortHandle, char* target, int cwTargetLength, char* source, int cwSourceLength, CompareOptions options, int* matchedLength);