-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[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
base: main
Are you sure you want to change the base?
[clr-interp] Runtime async support #121862
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.
|
|
||
| // Runtime-async | ||
| RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_RuntimeAsync, W("RuntimeAsync"), 0, "Enables runtime async method support") | ||
| RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_RuntimeAsync, W("RuntimeAsync"), 1, "Enables runtime async method support") |
Copilot
AI
Nov 20, 2025
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.
This change enables RuntimeAsync by default (changing from 0 to 1). The PR description explicitly states "NOTE: THIS PR has a few changes to enable RuntimeAsync by default... those should not be merged". This change should not be included in the final merge.
| RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_RuntimeAsync, W("RuntimeAsync"), 1, "Enables runtime async method support") | |
| RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_RuntimeAsync, W("RuntimeAsync"), 0, "Enables runtime async method support") |
| } | ||
| else | ||
| { | ||
| // pMT is an object reference type, simple report the address directly. |
Copilot
AI
Nov 20, 2025
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.
The comment on line 1475 says "pMT is an object reference type, simple report the address directly" but contains a typo: "simple" should be "simply".
| // pMT is an object reference type, simple report the address directly. | |
| // pMT is an object reference type, simply report the address directly. |
|
Tagging subscribers to this area: @dotnet/interop-contrib |
This PR adds runtime async support to the interpreter
Notable changes:
TODO before merge