Skip to content

Conversation

@jtschuster
Copy link
Member

@jtschuster jtschuster commented Oct 15, 2025

  • Adds CORJIT_FLAG_ASYNC to be passed to the JIT when compiling runtime-async methods for the aot tools.
  • Adds IsRuntimeAsync property to MethodDesc to indicate when a method has the Async MethodImplAttribute.
  • Replace null return for getAsyncResumptionStub to fail a compilation when it is called.

Previously, a crossgen compilation with a runtime-async method would succeed but fail at runtime. This change at least causes the compilation to fail.

@jtschuster jtschuster added this to the 11.0.0 milestone Oct 15, 2025
@jtschuster jtschuster self-assigned this Oct 15, 2025
Copilot AI review requested due to automatic review settings October 15, 2025 21:54
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

This PR enhances ahead-of-time (AOT) compilation tools to properly handle runtime-async methods. The changes add support for detecting and flagging async methods during compilation, ensuring that AOT tools fail compilation when encountering unsupported async patterns rather than producing invalid code that fails at runtime.

  • Adds IsRuntimeAsync property to MethodDesc to detect methods with the Async MethodImplAttribute
  • Introduces CORJIT_FLAG_ASYNC flag to inform the JIT when compiling async methods
  • Changes getAsyncResumptionStub to throw an exception instead of returning null, causing compilation to fail early

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/coreclr/tools/Common/TypeSystem/Ecma/EcmaMethod.cs Adds async flag detection and IsRuntimeAsync property implementation for ECMA methods
src/coreclr/tools/Common/TypeSystem/Common/MethodDesc.cs Defines virtual IsRuntimeAsync property with default false implementation
src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs Adds CORJIT_FLAG_ASYNC enumeration value
src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs Sets async JIT flag when compiling async methods and throws exception in getAsyncResumptionStub

@MichalStrehovsky
Copy link
Member

I'd name this IsAsync, same as the MethodImpl bit name for consistency with everything else.
We also need an override in MethodDelegator.cs

@jkotas jkotas merged commit c8ca492 into dotnet:main Oct 17, 2025
95 checks passed
@github-project-automation github-project-automation bot moved this to Done in AppModel Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants