-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add R2R helpers for AllocContinuation, AllocContinuationMethod, and AllocContinuationClass. #123975
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?
Add R2R helpers for AllocContinuation, AllocContinuationMethod, and AllocContinuationClass. #123975
Conversation
Implements change #3 from async methods R2R breakdown. Adds helpers 0x113-0x115 for allocating continuation objects.
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 Ready-to-Run (R2R) helpers for three new continuation allocation helpers: AllocContinuation, AllocContinuationMethod, and AllocContinuationClass. These helpers are part of the infrastructure for async method support in R2R compiled code.
Changes:
- Added three new R2R helper enum values (0x113-0x115) across C++ and C# codebases
- Added JIT helper mappings to mark these as allocators and heap mutators
- Added entry point resolution to System.Runtime.CompilerServices.AsyncHelpers class
- Minor trailing whitespace cleanup in CorInfoImpl.ReadyToRun.cs
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/inc/readytorun.h | Added C++ enum values for the three new R2R helpers |
| src/coreclr/inc/readytorunhelpers.h | Added helper macro mappings from R2R helpers to CORINFO helpers |
| src/coreclr/jit/utils.cpp | Configured new helpers as allocators that mutate heap |
| src/coreclr/tools/Common/Internal/Runtime/ReadyToRunConstants.cs | Added C# enum values for the three new R2R helpers |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/JitHelper.cs | Added entry point resolution to AsyncHelpers methods |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs | Added JIT interface mappings and whitespace cleanup |
| src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunSignature.cs | Added signature parsing for the new helpers |
| AllocContinuationMethod = 0x114, | ||
| AllocContinuationClass = 0x115, |
Copilot
AI
Feb 3, 2026
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 ordering of AllocContinuationMethod and AllocContinuationClass is inconsistent between ReadyToRunConstants.cs and readytorun.h. In ReadyToRunConstants.cs, AllocContinuationMethod has value 0x114 and AllocContinuationClass has value 0x115, but in readytorun.h (lines 470-471), these values are swapped. The enum values must match exactly across both files to ensure correct helper resolution.
| AllocContinuationMethod = 0x114, | |
| AllocContinuationClass = 0x115, | |
| AllocContinuationMethod = 0x115, | |
| AllocContinuationClass = 0x114, |
| case ReadyToRunHelper.AllocContinuationMethod: | ||
| methodDesc = context.GetCoreLibEntryPoint("System.Runtime.CompilerServices"u8, "AsyncHelpers"u8, "AllocContinuationMethod"u8, null); | ||
| break; | ||
| case ReadyToRunHelper.AllocContinuationClass: | ||
| methodDesc = context.GetCoreLibEntryPoint("System.Runtime.CompilerServices"u8, "AsyncHelpers"u8, "AllocContinuationClass"u8, null); | ||
| break; |
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.
| case ReadyToRunHelper.AllocContinuationMethod: | |
| methodDesc = context.GetCoreLibEntryPoint("System.Runtime.CompilerServices"u8, "AsyncHelpers"u8, "AllocContinuationMethod"u8, null); | |
| break; | |
| case ReadyToRunHelper.AllocContinuationClass: | |
| methodDesc = context.GetCoreLibEntryPoint("System.Runtime.CompilerServices"u8, "AsyncHelpers"u8, "AllocContinuationClass"u8, null); | |
| break; |
This file is for NativeAOT. These variants do not exist for NativeAOT so no need to list them here.
| break; | ||
|
|
||
| case ReadyToRunHelper.AllocContinuation: | ||
| methodDesc = context.GetCoreLibEntryPoint("System.Runtime.CompilerServices"u8, "AsyncHelpers"u8, "AllocContinuation"u8, null); |
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 existing places should be updated to reference ReadyToRunHelper.AllocContinuation instead of the method now that we have ReadyToRunHelper id for it.
src\coreclr\tools\aot\ILCompiler.Compiler\IL\ILImporter.Scanner.cs(470):_dependencies.Add(_factory.MethodEntrypoint(asyncHelpers.GetKnownMethod("AllocContinuation"u8, null)), asyncReason);
src\coreclr\tools\aot\ILCompiler.RyuJit\JitInterface\CorInfoImpl.RyuJit.cs(765):"AsyncHelpers"u8, "AllocContinuation"u8, null));
ilc doesn't need AllocContinuationMethod/Class Update places that reference the method to use the R2RHelper
Add R2R helpers for AllocContinuation, AllocContinuationMethod, and AllocContinuationClass.