Skip to content

Report CORINFO_CALLCONV_GENERIC to JIT - #121561

Merged
jkotas merged 4 commits into
dotnet:mainfrom
MichalStrehovsky:genericcallconv
Nov 13, 2025
Merged

Report CORINFO_CALLCONV_GENERIC to JIT#121561
jkotas merged 4 commits into
dotnet:mainfrom
MichalStrehovsky:genericcallconv

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

Outerloops are broken.

Apparently we got away without reporting this until the test in #121130 was added. Not reporting the calling convention results in this not kicking in:

eeGetMethodSig(resolvedToken.hMethod, &sig);
if (sig.numArgs != info.compMethodInfo->args.numArgs ||
sig.retType != info.compMethodInfo->args.retType ||
sig.callConv != info.compMethodInfo->args.callConv)
{
BADCODE("Incompatible target for CEE_JMPs");
}

and failing the test.

Cc @dotnet/ilc-contrib

Apparently we got away without reporting this until the test in dotnet#121130 was added. Not reporting the calling convention results in this not kicking in:
https://github.com/dotnet/runtime/blob/5e97723bdd8eb9eff95c52b7120cec6bfb5a0a19/src/coreclr/jit/importer.cpp#L7291-L7297
And failing the test.
CopilotAI review requested due to automatic review settings November 12, 2025 21:51
@github-actionsgithub-actionsBot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Nov 12, 2025

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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 fixes broken outerloop tests by ensuring that the CORINFO_CALLCONV_GENERIC calling convention flag is properly reported to the JIT compiler. Previously, the AOT compiler was not setting the generic flag in method signatures, which caused the JIT to miss important optimizations/checks when compiling generic method calls.

  • Added Generic flag to MethodSignatureFlags enum
  • Implemented IsGeneric property on MethodSignature to check the flag
  • Set the flag during ECMA signature parsing when the metadata indicates a generic signature
  • Report the flag to JIT through CORINFO_CALLCONV_GENERIC in the calling convention

Reviewed Changes

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

FileDescription
src/coreclr/tools/Common/TypeSystem/Ecma/EcmaSignatureParser.csSet the Generic flag when parsing method signatures with generic parameters from ECMA metadata
src/coreclr/tools/Common/TypeSystem/Common/MethodDesc.csAdd Generic flag enum value and IsGeneric property to MethodSignature class
src/coreclr/tools/Common/JitInterface/CorInfoImpl.csReport CORINFO_CALLCONV_GENERIC to JIT when signature is generic

Comment threadsrc/coreclr/tools/Common/JitInterface/CorInfoImpl.cs Outdated
Comment threadsrc/coreclr/tools/Common/TypeSystem/Common/MethodDesc.cs Outdated
Comment threadsrc/coreclr/tools/Common/TypeSystem/Common/MethodDesc.cs Outdated
Comment threadsrc/coreclr/tools/Common/TypeSystem/Ecma/EcmaSignatureParser.cs Outdated
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@MichalStrehovsky

Copy link
Copy Markdown
MemberAuthor

There was an error trying to commit changes.

Thanks for nothing, Github.

@MichalStrehovsky

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkotasjkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks

@jkotasjkotas added area-NativeAOT-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Nov 12, 2025
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@jkotas

Copy link
Copy Markdown
Member

/ba-g timeouts

@jkotas
jkotas merged commit 228a12c into dotnet:mainNov 13, 2025
109 of 121 checks passed
@MichalStrehovsky
MichalStrehovsky deleted the genericcallconv branch November 13, 2025 11:03
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Dec 14, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@MichalStrehovsky@jkotas