Avoid boxing allocations for async in Tier0 (dotnet/coreclr#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)
Commit migrated from https://github.com/dotnet/coreclr/commit/dc0d0721aca6c6b1da99346dfb95de78d7c83d6f

src/libraries/System.Private.CoreLib/src/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