JIT: Unify to instParamLookup and improve GVM test coverage#126947
JIT: Unify to instParamLookup and improve GVM test coverage#126947hez2010 wants to merge 9 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
Refactors CoreCLR devirtualization metadata to use a unified instParamLookup and expands JIT test coverage for generic virtual method (GVM) scenarios to support follow-on GVM devirtualization work.
Changes:
- Add a new GVM-focused runtime lookup/delegate test to broaden devirtualization coverage.
- Replace
CORINFO_DEVIRTUALIZATION_INFOad-hoc flags withinstParamLookup, and update JIT devirtualization logic to consume it. - Update SuperPMI and the managed JitInterface type definitions/serialization to match the new
CORINFO_DEVIRTUALIZATION_INFOshape (plus bump the JIT/EE versioning GUID).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/JIT/Generics/VirtualMethods/generic_virtual_methods.cs | Adds additional GVM/runtime-lookup-related test coverage. |
| src/coreclr/vm/jitinterface.cpp | Initializes/produces instParamLookup for devirtualization results (replacing older flags). |
| src/coreclr/jit/importercalls.cpp | Plumbs instParamLookup through devirtualization + guarded devirtualization candidate tracking and inserts instantiation args when required. |
| src/coreclr/jit/morph.cpp | Simplifies lookup-tree helpers to take CORINFO_LOOKUP directly. |
| src/coreclr/jit/compiler.h | Updates declarations for the new lookup-tree helper signatures and GDV candidate plumbing. |
| src/coreclr/inc/corinfo.h | Updates CORINFO_DEVIRTUALIZATION_INFO to carry instParamLookup instead of legacy flags; documents “no lookup needed” sentinel. |
| src/coreclr/inc/jiteeversionguid.h | Bumps the JIT/EE version GUID for the interface change. |
| src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs | Mirrors the CORINFO_DEVIRTUALIZATION_INFO layout change in managed definitions. |
| src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs | Updates managed resolveVirtualMethod implementation to populate instParamLookup and method-context behavior. |
| src/coreclr/tools/superpmi/superpmi-shared/agnostic.h | Updates SuperPMI record structs to include instParamLookup. |
| src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp | Records/restores/dumps instParamLookup in SuperPMI method contexts. |
|
Test failure seems unrelated. |
|
Ping @jakobbotsch This is a refactor only change which is the prerequisites of the upcoming GVM devirt work, please take a look when you get some time. |
75dec5b to
4da609f
Compare
4da609f to
42d5011
Compare
Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
…m:hez2010/runtime into shared-gvm-devirt/1-tests-instparamlookup
2765090 to
5942cb8
Compare
| // If the guarded method is an instantiating stub, find the instantiated method | ||
| // | ||
| if (instantiatingStub) | ||
| if (instantiatingStub != NO_METHOD_HANDLE) | ||
| { | ||
| JITDUMP(" ... method is an instantiating stub, looking for instantiated entry\n"); | ||
| CORINFO_CLASS_HANDLE ignoredClass = NO_CLASS_HANDLE; | ||
| CORINFO_METHOD_HANDLE ignoredMethod = NO_METHOD_HANDLE; | ||
| CORINFO_METHOD_HANDLE instantiatedMethod = | ||
| info.compCompHnd->getInstantiatedEntry(methodHandle, &ignoredMethod, &ignoredClass); | ||
| assert(ignoredClass == NO_CLASS_HANDLE); | ||
|
|
||
| if (instantiatedMethod != NO_METHOD_HANDLE) | ||
| { | ||
| JITDUMP(" ... updating GDV candidate with instantiated entry info\n"); | ||
| pInfo->guardedMethodInstantiatedEntryHandle = instantiatedMethod; | ||
| } | ||
| JITDUMP(" ... updating GDV candidate with instantiated entry info\n"); | ||
| pInfo->guardedMethodHandle = instantiatingStub; | ||
| pInfo->guardedMethodInstantiatedEntryHandle = methodHandle; |
There was a problem hiding this comment.
This comment says "find the instantiated method", but the code no longer calls getInstantiatedEntry (it just rewrites guardedMethodHandle / guardedMethodInstantiatedEntryHandle). Please update the comment to reflect the new semantics (e.g., that instantiatingStub is stored separately as the instantiation parameter / comparison target, while methodHandle remains the actual direct-call target).
Extracted from #123323. This PR is the first step in splitting the shared GVM devirtualization work.
It does two things:
CORINFO_DEVIRTUALIZATION_INFOwith a singleinstParamLookupContributes to #112596
/cc: @jakobbotsch