Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Expose MethodImplOptions.AggressiveOptimization and MethodImplAttribu…
Browse files Browse the repository at this point in the history
…tes.AggressiveOptimization (#32322)

* Expose MethodImplOptions.AggressiveOptimization

Part of fix for https://github.com/dotnet/corefx/issues/32235
Depends on dotnet/coreclr#20009
API review: https://github.com/dotnet/corefx/issues/32235

* Include new test

* Expose MethodImplAttributes.AggressiveOptimization and fix test

API review: https://github.com/dotnet/corefx/issues/32628
  • Loading branch information
kouvel authored and stephentoub committed Oct 25, 2018
1 parent 7a75bbf commit 3f0a1ee
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5896,6 +5896,7 @@ protected MethodBody() { }
public enum MethodImplAttributes
{
AggressiveInlining = 256,
AggressiveOptimization = 512,
CodeTypeMask = 3,
ForwardRef = 16,
IL = 0,
Expand Down Expand Up @@ -6661,6 +6662,7 @@ public MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions met
public enum MethodImplOptions
{
AggressiveInlining = 256,
AggressiveOptimization = 512,
ForwardRef = 16,
InternalCall = 4096,
NoInlining = 8,
Expand Down
1 change: 1 addition & 0 deletions src/System.Runtime/tests/System.Runtime.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
<Compile Include="System\Reflection\TypeDelegatorTests.netcoreapp.cs" />
<Compile Include="System\Runtime\CompilerServices\CallerArgumentExpressionAttributeTests.cs" />
<Compile Include="System\Runtime\CompilerServices\ConditionalWeakTableTests.netcoreapp.cs" />
<Compile Include="System\Runtime\CompilerServices\MethodImplAttributeTests.netcoreapp.cs" />
<Compile Include="System\Runtime\CompilerServices\RuntimeHelpersTests.netcoreapp.cs" />
<Compile Include="System\Runtime\CompilerServices\RuntimeFeatureTests.netcoreapp.cs" />
<Compile Include="System\Runtime\CompilerServices\RuntimeWrappedExceptionTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
{
MethodImplAttributes implAttributes = MethodBase.GetCurrentMethod().MethodImplementationFlags;
Assert.Equal(MethodImplAttributes.AggressiveOptimization, implAttributes);
Assert.Equal(MethodImplOptions.AggressiveOptimization, (MethodImplOptions)implAttributes);
}
}
}

0 comments on commit 3f0a1ee

Please sign in to comment.