Implement getFunctionEntryPoint for runtime-async R2R compilation#7
Open
jtschuster wants to merge 1 commit intoruntime16from
Open
Implement getFunctionEntryPoint for runtime-async R2R compilation#7jtschuster wants to merge 1 commit intoruntime16from
jtschuster wants to merge 1 commit intoruntime16from
Conversation
Runtime-async methods call into AsyncHelpers (CaptureContexts, RestoreContexts, etc.) via method handles returned by getAsyncInfo. Previously, crossgen2's getFunctionEntrypoint created a jumpable delay-load import for these calls, but only updateEntryPointForTailCall (PR dotnet#56669) actually had jumpable thunk support, so these calls failed. This change removes the unused CORINFO_HELP_ASYNC_* JIT helper infrastructure and instead routes all async helper calls through getFunctionEntrypoint with standard (non-jumpable) delay-load imports. JIT changes (async.cpp): - Replace gtNewHelperCallNode(CORINFO_HELP_ASYNC_*) with gtNewCallNode(CT_USER_FUNC, methHnd) for all 7 async helper call sites (CaptureContexts, RestoreContexts, CaptureContinuationContext, CaptureExecutionContext, RestoreContextsOnSuspension, RestoreExecutionContext) - Call getFunctionEntrypoint + setEntryPoint on each call node under FEATURE_READYTORUN so fgMorphArgs adds the R2R indirection cell arg (x11 on ARM64, found from return address on x64) JIT changes (codegenxarch.cpp): - In GT_JMP epilog, call updateEntryPointForTailCall to upgrade the import to a jumpable thunk, then always load rax with the cell address. This is required because jmp has no return address for the standard thunk to decode. Crossgen2 changes (CorInfoImpl.ReadyToRun.cs): - Set isJumpableImportRequired to false in getFunctionEntrypoint. The JIT's GT_JMP codegen calls updateEntryPointForTailCall when needed. - Remove CORINFO_HELP_ASYNC_* cases from GetHelperFtnUncached. NativeAOT scanner fix (ILImporter.Scanner.cs): - Fix incorrect method names (AsyncCaptureExecutionContext -> CaptureExecutionContext, etc.) in dependency tracking. R2RDump fix (CoreDisTools.cs): - Handle ARM64 BL instructions targeting async resumption stubs, which are separate RuntimeFunctions not listed in the target method's collection. Replace Debug.Fail with graceful fallthrough. Removed CORINFO_HELP_ASYNC_* infrastructure from corinfo.h, jithelpers.h, readytorun.h, readytorunhelpers.h, utils.cpp, ReadyToRunConstants.cs, CorInfoHelpFunc.cs, JitHelper.cs, ReadyToRunSignature.cs, and CorInfoImpl.RyuJit.cs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Runtime-async methods call into AsyncHelpers (CaptureContexts, RestoreContexts, etc.) via method handles returned by getAsyncInfo. Previously, crossgen2's getFunctionEntrypoint created a delay-load import for these calls, but only updateEntryPointForTailCall (PR dotnet#56669) actually had jumpable thunk support, so when the JIT called this getFunctionEntryPoint for jmp instructions, those calls failed (see callconv3_d jit test).
This change removes the CORINFO_HELP_ASYNC_* JIT helper infrastructure and instead routes all async helper calls through getFunctionEntrypoint with standard (non-jumpable) delay-load imports.
JIT changes (async.cpp):
JIT changes (codegenxarch.cpp):
Crossgen2 changes (CorInfoImpl.ReadyToRun.cs):
NativeAOT scanner fix (ILImporter.Scanner.cs):
R2RDump fix (CoreDisTools.cs):
Removed CORINFO_HELP_ASYNC_* helpers from corinfo.h, jithelpers.h, readytorun.h, readytorunhelpers.h, utils.cpp, ReadyToRunConstants.cs, CorInfoHelpFunc.cs, JitHelper.cs, ReadyToRunSignature.cs, and CorInfoImpl.RyuJit.cs.