Avoid boxing allocations for async in Tier0 (#22984)
authorBen Adams <thundercat@illyriad.co.uk>
Fri, 29 Mar 2019 06:49:08 +0000 (23:49 -0700)
committerJan Kotas <jkotas@microsoft.com>
Fri, 29 Mar 2019 06:49:08 +0000 (23:49 -0700)
src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncMethodBuilder.cs

index 3592fd8..47853b1 100644 (file)
@@ -399,6 +399,8 @@ namespace System.Runtime.CompilerServices
         /// <typeparam name="TStateMachine">Specifies the type of the state machine.</typeparam>
         /// <param name="awaiter">The awaiter.</param>
         /// <param name="stateMachine">The state machine.</param>
+        // AggressiveOptimization to workaround boxing allocations in Tier0 until: https://github.com/dotnet/coreclr/issues/14474
+        [MethodImpl(MethodImplOptions.AggressiveOptimization)]
         public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(
             ref TAwaiter awaiter, ref TStateMachine stateMachine)
             where TAwaiter : ICriticalNotifyCompletion