Repository navigation
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>
|
Tagging subscribers to this area: @agocke |
There was a problem hiding this comment.
🟡 Changes recommended
On Windows x86, the map-hit path can create a dispatch stub with signature layouts still unloaded, allowing a later null-receiver call to assert instead of throwing NullReferenceException.
1 open issue
What changed in this PR
This PR addresses #136674 by changing CoreCLR’s non-Unix x86 virtual-call stub creation to obtain stack-pop sizes without requiring unloaded value-type layouts.
Changes:
- Adds
gcrefmap.hand reads the stack-pop size from a dispatch-compatible GCRefMap when available. - Preserves the existing signature-based fallback and loader-use restriction when no map is found.
| File | Description |
|---|---|
src/coreclr/vm/virtualcallstub.cpp |
Uses GCRefMap stack-pop metadata during x86 resolve-stub creation. |
Review effort: Balanced
| if (pGCRefMap != NULL) | ||
| { | ||
| GCRefMapDecoder decoder(pGCRefMap); | ||
| stackArgumentsSize = decoder.ReadStackPop() * sizeof(TADDR); |
There was a problem hiding this comment.
Applied in 337d00e: the dispatch-stub branch of AdjustContextForVirtualStub now reads stackArgumentsSize from the resolve stub (via failTarget() and ResolveHolder::FromFailEntry). It no longer walks the signature or needs the loader-forbid scope. I dropped the unused pMgr assignment. I haven't compiled or run it, and I didn't add the null-receiver test.
Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>
Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The Windows x86-only changes adjust ESP during exception recovery, but only Linux x64 validation is reported, leaving ReadyToRun dispatch and null-receiver delegate stack restoration unverified on the target platform.
Review effort: Balanced

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.