-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[clr-interp] Runtime async support #121862
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
Conversation
…ling for CallStub so we fail cleanly where we haven't implemented it yet
…Async_Interpreter
…nerator. Its ... almost there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds runtime async support to the CLR interpreter, enabling async/await functionality in interpreted code. The implementation wraps async method bodies in try/finally blocks for context management, adds specialized opcodes for suspend/resume operations, and introduces a non-traditional calling convention for passing continuation objects via a dedicated InterpreterFrame field.
Key changes:
- Added async continuation handling with specialized interpreter opcodes
- Modified call stubs across multiple architectures to support continuation return values
- Adjusted test workloads to be more suitable for interpreter performance characteristics
Reviewed Changes
Copilot reviewed 54 out of 54 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/async/*.csproj | Added TestLibrary project references for interpreter detection |
| src/tests/async/*.cs | Reduced Fibonacci test parameters when running under interpreter |
| src/tests/async/Directory.Build.targets | SHOULD NOT MERGE: Deleted file enables async tests by default |
| src/coreclr/inc/clrconfigvalues.h | SHOULD NOT MERGE: Changed RuntimeAsync default to 1 |
| src/coreclr/vm//asmhelpers. | Updated assembly helpers to pass continuation return parameter |
| src/coreclr/vm/*/asmconstants.h | Updated CallStubHeader offset for new HasContinuationRet field |
| src/coreclr/vm/callstubgenerator.* | Added HasContinuationRet support and continuation parameter handling |
| src/coreclr/vm/interpexec.* | Added AsyncHelpers_ResumeInterpreterContinuation and continuation opcodes |
| src/coreclr/vm/frames.* | Added continuation field and GC scanning to InterpreterFrame |
| src/coreclr/vm/object.h | Defined ContinuationObject class structure |
| src/coreclr/vm/jitinterface.* | Added getAsyncResumptionStub implementation for interpreter |
| src/coreclr/vm/prestub.cpp | Added continuation return value population logic |
| src/coreclr/interpreter/. | Major compiler changes for async support including interval maps and suspend/resume logic |
| src/coreclr/System.Private.CoreLib/* | Added QCall for ResumeInterpreterContinuation |
Comments suppressed due to low confidence (1)
src/tests/async/Directory.Build.targets:1
- The deletion of this entire file enables async tests to build and run by default. However, the PR description explicitly states "NOTE: THIS PR has a few changes to enable RuntimeAsync by default, and build the async tests... those should not be merged". This file deletion should not be included in the final merge.
|
Tagging subscribers to this area: @dotnet/interop-contrib |
…Async_Interpreter
…dd some tests affected by the changes. The logic is now much simpler.
…ORINFO_AsyncResumeInfo so it can be shared with the interpreter.
|
This looks great to me. |
Update docs based on feedback Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
…ighton/runtime into RuntimeAsync_Interpreter
janvorli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
|
Github bug -- all comments are resolved |
This PR adds runtime async support to the interpreter
Notable changes:
TODO before merge
1. Remove the changes to enable RuntimeAsync by default.2. Add documentation about how the interpreter async abi works3. Add documentation about what a code generator needs to do to make runtime async work4. I'm pretty sure IL peep handling has a bug handling any of the 2 byte opcodes. This needs to be tested.