Skip to content
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

Implement a change in IL API to use RuntimeHelpers.Await<T>(Task<T>) and similar helpers. #2951

Open
wants to merge 9 commits into
base: feature/async2-experiment
Choose a base branch
from

Conversation

VSadov
Copy link
Member

@VSadov VSadov commented Jan 22, 2025

This is actual implementation of what is proposed in dotnet/runtime#110420
and prototyped in #2941

NOTE: This PR has only the VM/runtime parts.
The JIT optimization to optimize Await(RuntimeAsyncMethod), which is probably the harder part of the proposal, is not included here.

The code works and passes tests, but the optimization is important to avoid redundant thunking when one runtime-async method awaits another as such scenario could be common and can be lowered into a more efficient direct call.

@VSadov VSadov requested a review from jakobbotsch January 22, 2025 16:12
AssertEqual("B", strings.B);
AssertEqual("C", strings.C);
AssertEqual("D", strings.D);
// TODO: need to fix this
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakobbotsch the change stresses calling via thunks and possibly introduced some scenarios that tests did not cover before. Remarkably, nearly everything works fine!! However, here I saw an assert and turned off one scenario.
Not sure if this is something wrong with IL or something on the JIT side.
(the other case is with thunks for async methods in structs).

@jakobbotsch
Copy link
Member

The JIT optimization to optimize Await(RuntimeAsyncMethod), which is probably the harder part of the proposal, is not included here.

It would be nice to start on this work to see how it would look before we make the switch. Note that most of the work will be VM work -- teaching getCallInfo implementations to deal with the fact that it now may need to describe a call to the async variant of a call described by a token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants