From dc74cd6302ca26964290f8045947ca21fdf3a2b0 Mon Sep 17 00:00:00 2001 From: Koundinya Veluri Date: Mon, 10 Sep 2018 14:26:30 -0700 Subject: [PATCH] Expose MethodImplOptions.AggressiveOptimization Part of fix for https://github.com/dotnet/corefx/issues/32235 --- src/System.Runtime/ref/System.Runtime.cs | 1 + .../MethodImplAttributeTests.cs | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/System.Runtime/tests/System/Runtime/CompilerServices/MethodImplAttributeTests.cs diff --git a/src/System.Runtime/ref/System.Runtime.cs b/src/System.Runtime/ref/System.Runtime.cs index 747cce29089d..734a09673bbe 100644 --- a/src/System.Runtime/ref/System.Runtime.cs +++ b/src/System.Runtime/ref/System.Runtime.cs @@ -6660,6 +6660,7 @@ public MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions met public enum MethodImplOptions { AggressiveInlining = 256, + AggressiveOptimization = 512, ForwardRef = 16, InternalCall = 4096, NoInlining = 8, diff --git a/src/System.Runtime/tests/System/Runtime/CompilerServices/MethodImplAttributeTests.cs b/src/System.Runtime/tests/System/Runtime/CompilerServices/MethodImplAttributeTests.cs new file mode 100644 index 000000000000..1cca47ec35b4 --- /dev/null +++ b/src/System.Runtime/tests/System/Runtime/CompilerServices/MethodImplAttributeTests.cs @@ -0,0 +1,21 @@ +// 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. + +using System.Reflection; +using Xunit; + +namespace System.Runtime.CompilerServices.Tests +{ + public static class MethodImplAttributeTests + { + [Fact] + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + public static void AggressiveOptimizationTest() + { + Assert.Equal( + MethodImplOptions.AggressiveOptimization, + MethodBase.GetCurrentMethod().GetCustomAttribute().Value); + } + } +}