Repository navigation
JIT: Improve modelling of AsyncResumedDef store in value numbering #132423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
29a964c
JIT: Improve modelling of AsyncResumedDef store in value numbering
jakobbotsch 8381fcf
Address feedback: handle VN pairs for the AsyncResumedDef store
jakobbotsch 3a7e7ee
Merge branch 'main' into fix-131576
jakobbotsch 1b68cc3
Fold based on known indicators in async transformation
jakobbotsch 4484e26
Merge branch 'main' into fix-131576
jakobbotsch 75a3e71
Add JIT dumps for always resumed state propagation
jakobbotsch f968437
Merge branch 'main' into fix-131576
jakobbotsch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Runtime.CompilerServices; | ||
| using System.Threading.Tasks; | ||
| using Xunit; | ||
|
|
||
| // Shapes where the JIT can prove that the "resumed" indicator is 1 at a | ||
| // suspension point: an await that always suspends dominates a later await, with | ||
| // no merge in between. The helpers emitted on the later await's suspension path | ||
| // (RestoreContextsOnSuspension, the inlined frame transition captures) no-op | ||
| // when the indicator is set, so they could be folded away entirely. | ||
| public class Async2ResumedKnownTrue | ||
| { | ||
| [Fact] | ||
| public static void TestTwoYields() | ||
| { | ||
| TwoYields().GetAwaiter().GetResult(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public static void TestYieldThenAwaitTask() | ||
| { | ||
| YieldThenAwaitTask().GetAwaiter().GetResult(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public static void TestYieldThenAwaitInlinedFrame() | ||
| { | ||
| YieldThenAwaitInlinedFrame().GetAwaiter().GetResult(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public static void TestYieldThenAwaitResumedInlinedFrame() | ||
| { | ||
| YieldThenAwaitResumedInlinedFrame().GetAwaiter().GetResult(); | ||
| } | ||
|
|
||
| // The second Yield's suspension path sees the indicator defined by the | ||
| // first, which always suspends. | ||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| private static async Task TwoYields() | ||
| { | ||
| await Task.Yield(); | ||
| await Task.Yield(); | ||
| } | ||
|
|
||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| private static async Task YieldThenAwaitTask() | ||
| { | ||
| await Task.Yield(); | ||
| await Task.Delay(1); | ||
| } | ||
|
|
||
| // Same, but the later await sits in an inlined async frame, so its | ||
| // suspension tail runs the enclosing frames' transition captures too. | ||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| private static async Task YieldThenAwaitInlinedFrame() | ||
| { | ||
| await Task.Yield(); | ||
| await Inner(); | ||
| } | ||
|
|
||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| private static async Task Inner() | ||
| { | ||
| await Task.Delay(1); | ||
| } | ||
|
|
||
| // Here the inlined frame's own indicator is set as well by the time it suspends, so | ||
| // none of the frame transition handling is needed. | ||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| private static async Task YieldThenAwaitResumedInlinedFrame() | ||
| { | ||
| await Task.Yield(); | ||
| await InnerYieldThenAwait(); | ||
| } | ||
|
|
||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| private static async Task InnerYieldThenAwait() | ||
| { | ||
| await Task.Yield(); | ||
| await Task.Delay(1); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <ItemGroup> | ||
| <Compile Include="$(MSBuildProjectName).cs" /> | ||
| </ItemGroup> | ||
| </Project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.