Skip to content

Fix getAsyncOtherVariant JIT-EE implementation in VM#125225

Merged
jakobbotsch merged 1 commit intodotnet:mainfrom
jakobbotsch:fix-spmi-async-variants
Mar 6, 2026
Merged

Fix getAsyncOtherVariant JIT-EE implementation in VM#125225
jakobbotsch merged 1 commit intodotnet:mainfrom
jakobbotsch:fix-spmi-async-variants

Conversation

@jakobbotsch
Copy link
Member

We could end up calling GetAsyncOtherVariant for explicitly-async methods like AsyncHelpers.Await, which do not have other variants.
This was happening under EnableExtraSuperPmiQueries mode that queries both variants proactively. Also simplify SPMI implementation of the recording of this function.

We could end up calling GetAsyncOtherVariant for explicitly-async
methods like AsyncHelpers.Await, which do not have other variants.
Copilot AI review requested due to automatic review settings March 5, 2026 15:41
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 5, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes VM/JIT handling of async “other variant” lookups so explicitly-async (non-variant-paired) methods don’t trigger invalid GetAsyncOtherVariant calls, and streamlines SuperPMI recording for the query.

Changes:

  • Introduce MethodDesc::HasAsyncOtherVariant() and assert GetAsyncOtherVariant() is only used when a paired variant exists.
  • Update VM call sites (method table builder and JIT-EE getAsyncOtherVariant) to gate lookups on HasAsyncOtherVariant().
  • Simplify SuperPMI shim collector recording API for getAsyncOtherVariant.

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/vm/methodtablebuilder.cpp Uses HasAsyncOtherVariant() to avoid requesting non-existent async variants during decl lookup.
src/coreclr/vm/method.hpp Adds HasAsyncOtherVariant() and asserts GetAsyncOtherVariant() precondition.
src/coreclr/vm/jitinterface.cpp Prevents JIT-EE from calling GetAsyncOtherVariant() for explicitly-async methods with no pair.
src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.cpp Simplifies SPMI interception/recording for getAsyncOtherVariant.
src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h Updates recorder signature to take bool instead of bool*.
src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp Records variantIsThunk by value in the SPMI method context.
src/coreclr/inc/corinfo.h Clarifies variantIsThunk meaning in API comment.

@jakobbotsch jakobbotsch marked this pull request as ready for review March 5, 2026 17:54
@jakobbotsch jakobbotsch merged commit c86ebf2 into dotnet:main Mar 6, 2026
113 checks passed
@jakobbotsch jakobbotsch deleted the fix-spmi-async-variants branch March 6, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI runtime-async

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants