Repository navigation
wasm: fix R2R generic dictionary lookup debug assert - #129947
Merged
AndyAyersMS merged 1 commit intoJun 28, 2026
Merged
Conversation
On wasm, R2R code and data live in separate address spaces, so FindReadyToRunModule can't resolve the dictionary signature's data address. Check the signature lies within pModule's R2R image bounds instead. Co-authored-by: Copilot <[email protected]>
Member
Author
|
@davidwrighton PTAL |
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts a _DEBUG-only invariant check in the CoreCLR generics dictionary lookup helper to account for WASM ReadyToRun (R2R) layout differences (code in function table vs data in linear memory), avoiding a module-lookup assert failure when multiple R2R images are loaded.
Changes:
- Add a
TARGET_WASM-specific debug assert path inGenericHandleWorkerCorethat validates the signature address against the current module’s R2R image bounds. - Keep the existing
ExecutionManager::FindReadyToRunModule/IsNativeImageSharedBydebug assert unchanged for non-WASM targets.
davidwrighton
approved these changes
Jun 28, 2026
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
eiriktsarpalis
pushed a commit
that referenced
this pull request
Jul 15, 2026
On wasm, R2R code lives in the function table and R2R data in linear memory, so the `GenericHandleWorkerCore` debug assert's `ExecutionManager::FindReadyToRunModule` (a code-range lookup) cannot resolve the dictionary signature's data address and returns the wrong module, firing `IsNativeImageSharedBy` spuriously once more than one R2R image is loaded. The signature is taken from `pModule`'s own R2R image (`FindToken` returns the incoming blob), so on wasm the assert instead checks that the signature lies within `pModule`'s R2R image bounds; other targets are unchanged. This is a `_DEBUG`-only assert (`FindReadyToRunModule` has no other callers), so release behavior is unaffected. It was the single most common failure when running the Pri-1 R2R test suite on wasm, accounting for ~half of all observed assert failures and the bulk of the generics tests. Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On wasm, R2R code lives in the function table and R2R data in linear memory, so the
GenericHandleWorkerCoredebug assert'sExecutionManager::FindReadyToRunModule(acode-range lookup) cannot resolve the dictionary signature's data address and returns the
wrong module, firing
IsNativeImageSharedByspuriously once more than one R2R image isloaded. The signature is taken from
pModule's own R2R image (FindTokenreturns theincoming blob), so on wasm the assert instead checks that the signature lies within
pModule's R2R image bounds; other targets are unchanged.This is a
_DEBUG-only assert (FindReadyToRunModulehas no other callers), so releasebehavior is unaffected. It was the single most common failure when running the Pri-1 R2R
test suite on wasm, accounting for ~half of all observed assert failures and the bulk of the
generics tests.