JIT: Centralize WellKnownArg definitions#130252
Conversation
Use a single wellknownargs.h that is included multiple times to build various pieces of information we query about arguments. Rewrite users in terms of columns defined in that file.
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
| for (CallArg& arg : call->gtArgs.Args()) | ||
| { | ||
| switch (arg.GetWellKnownArg()) | ||
| if (!arg.IsUserArg() || (arg.GetWellKnownArg() == WellKnownArg::ThisPointer)) | ||
| { | ||
| case WellKnownArg::RetBuffer: | ||
| case WellKnownArg::ThisPointer: | ||
| case WellKnownArg::AsyncContinuation: | ||
| // Not part of signature but we still expect to see it here | ||
| continue; | ||
| case WellKnownArg::None: | ||
| break; | ||
| default: | ||
| assert(!"Unexpected well known arg to method GDV candidate"); | ||
| continue; | ||
| // Not part of the signature | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Actual bug fix is here.
| WELL_KNOWN_ARG(SwiftError, "swift error", true, false) | ||
| WELL_KNOWN_ARG(SwiftSelf, "swift self", true, false) |
There was a problem hiding this comment.
These are defined in IL and also marked well-known, so I made them true for isILArg.
There was a problem hiding this comment.
Pull request overview
This PR centralizes WellKnownArg metadata into a single wellknownargs.h “X-macro” list that is included multiple times to generate the enum and related query helpers, and it adjusts GDV candidate argument handling to avoid asserting on unexpected well-known args.
Changes:
- Introduces
src/coreclr/jit/wellknownargs.has the single source of truth forWellKnownArgentries and their metadata. - Rewrites
WellKnownArg-related helpers (getWellKnownArgName,CallArg::IsUserArg,CallArg::IsArgAddedLate, arg dump short names) to be table-driven fromwellknownargs.h. - Updates GDV compatibility checking to skip non-signature arguments via
CallArg::IsUserArg()instead of asserting on “unexpected” well-known args.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/wellknownargs.h | New centralized table defining well-known args and their metadata. |
| src/coreclr/jit/morph.cpp | Converts getWellKnownArgName to use the centralized table. |
| src/coreclr/jit/importercalls.cpp | Updates GDV arg filtering logic; also includes a small indentation-only change. |
| src/coreclr/jit/importer.cpp | Refactors inline arg init to use IsUserArg/InstParam instead of a well-known switch. |
| src/coreclr/jit/gentree.h | Generates WellKnownArg enum members from the centralized table. |
| src/coreclr/jit/gentree.cpp | Table-driven IsArgAddedLate, IsUserArg, and short-name lookup for arg messages. |
| src/coreclr/jit/fginline.cpp | Refactors inline argument setup logic to use IsUserArg/InstParam. |
| src/coreclr/jit/compiler.hpp | Stops tagging the helper “method handle” arg as a well-known arg. |
| src/coreclr/jit/CMakeLists.txt | Adds wellknownargs.h to the JIT header list. |
Comments suppressed due to low confidence (1)
src/coreclr/jit/importercalls.cpp:7648
- Extra leading spaces were introduced on this loop and its body, making indentation inconsistent with the surrounding block and adding whitespace-only noise.
for (UINT32 i = 0; i < numberOfMethods; i++)
{
CORINFO_CONST_LOOKUP lookup = {};
info.compCompHnd->getFunctionFixedEntryPoint((CORINFO_METHOD_HANDLE)likelyMethods[i].handle, false,
&lookup);
| pParam->inlineInfo->InlineRoot->m_inlineStrategy | ||
| ->NewContext(pParam->inlineInfo->inlineCandidateInfo->inlinersContext, pParam->inlineInfo->iciStmt, | ||
| pParam->inlineInfo->iciCall); | ||
| pParam->inlineInfo->argCnt = pParam->inlineCandidateInfo->methInfo.args.totalILArgs(); |
There was a problem hiding this comment.
Moved this into impInlineInitVars since I added some asserts that needed it, and this would otherwise be initialized after.
Use a single wellknownargs.h that is included multiple times to build various pieces of information we query about arguments. Rewrite users in terms of columns defined in that file.
Fix #130227