Fix VSD cache publication and resolve stub size - #134226
davidwrighton with Copilot wants to merge 1 commit into
Conversation
Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
@copilot , give the PR a good description. |
|
Tagging subscribers to this area: @agocke |
Updated the PR description with the two root causes, the fixes, scope separation for the counter work, and validation performed. |
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The changes touch low-level VM concurrency and stub code size accounting where subtle memory-ordering or codegen interactions merit final human validation.
Review effort: Lite
Findings: None
What changed in this PR
This PR makes two targeted correctness fixes in CoreCLR’s Virtual Stub Dispatch (VSD) implementation: it strengthens the publication semantics for dispatch cache entries to support concurrent readers, and it corrects the reported size of the AMD64 resolve stub to match the actual stub type.
Changes:
- Publish
DispatchCacheentries withVolatileStore(paired with existingVolatileLoadreads) to ensure initialized cache entries become safely visible to concurrent lookups. - Fix
ResolveStub::size()on AMD64 to returnsizeof(ResolveStub)(matching other architectures and ensuring instruction-cache flush / logging uses the correct byte size).
| File | Description |
|---|---|
| src/coreclr/vm/virtualcallstub.h | Uses VolatileStore(&cache[idx], elem) for cache entry publication to match VolatileLoad readers. |
| src/coreclr/vm/amd64/virtualcallstubcpu.hpp | Corrects ResolveStub::size() to return sizeof(ResolveStub) instead of sizeof(LookupStub). |
|
Is this a fix for a crash or is this just based on codereview? |
Summary
VolatileStoreso initialized entries are safely visible to concurrent readers.ResolveStub::size()to returnsizeof(ResolveStub)instead ofsizeof(LookupStub).