[wasm][coreclr] Fix call delegate with IL stubs#125138
Merged
radekdoulik merged 5 commits intodotnet:mainfrom Mar 9, 2026
Merged
[wasm][coreclr] Fix call delegate with IL stubs#125138radekdoulik merged 5 commits intodotnet:mainfrom
radekdoulik merged 5 commits intodotnet:mainfrom
Conversation
Fix open virtual delegate dispatch crash in interpreter (dotnet#124221) When invoking an open virtual delegate over an interface method, the interpreter's shuffle thunk path resolved the target MethodDesc but fell through to the fallback path if the method had no interpreter code yet. The fallback incorrectly passed the shuffle thunk entry point to NonVirtualEntry2MethodDesc, which on FEATURE_PORTABLE_ENTRYPOINTS treated it as a PortableEntryPoint, crashing with an IsValid() assert. Fix: call DoPrestub to compile the resolved method before checking for interpreter code, matching the existing CALL_INTERP_METHOD logic. Extract duplicated EnsureInterpreterCode helper used by both paths. Also remove resolved ActiveIssue attributes for issue 124221 from Runtime_70259, Runtime_79354, and GSDelegate tests.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a WASM/CoreCLR interpreter crash when invoking open virtual delegates over interface methods by ensuring the resolved target MethodDesc is prestubbed (and interpreter code generated) before deciding whether to take the interpreter fast path vs a fallback path. Also re-enables previously skipped regression tests now that the underlying issue is addressed.
Changes:
- Add
EnsureInterpreterCode(...)helper to deduplicate and align prestub/interpreter-code setup logic across call paths. - Update the delegate shuffle-thunk optimization path and the general
CALL_INTERP_METHODpath to use the shared helper. - Remove
ActiveIssueskips for issue#124221from relevant tests (Runtime_70259, Runtime_79354, GSDelegate).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/coreclr/vm/interpexec.cpp |
Ensures target methods are prestubbed before checking for interpreter code; refactors common logic into EnsureInterpreterCode. |
src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.cs |
Removes ActiveIssue skip for #124221 (re-enables test on WASM). |
src/tests/JIT/Regression/JitBlue/Runtime_70259/Runtime_70259.cs |
Removes ActiveIssue skip for #124221. |
src/tests/JIT/Regression/JitBlue/Runtime_70259/Runtime_70259.il |
Removes TestLibrary extern and ActiveIssue metadata tied to #124221. |
src/tests/JIT/Methodical/delegate/GSDelegate.cs |
Removes ActiveIssue skip for #124221 (re-enables test on WASM). |
Contributor
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
This was referenced Mar 3, 2026
BrzVlad
approved these changes
Mar 5, 2026
jkotas
reviewed
Mar 5, 2026
This was referenced Mar 5, 2026
Open
Clarified comment regarding WASM code generation and native relinking.
jkotas
reviewed
Mar 7, 2026
jkotas
reviewed
Mar 7, 2026
jkotas
reviewed
Mar 7, 2026
And remove the comment and use assert
jkotas
approved these changes
Mar 8, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix open virtual delegate dispatch crash in interpreter (#124221)
When invoking an open virtual delegate over an interface method, the interpreter's shuffle thunk path resolved the target MethodDesc but fell through to the fallback path if the method had no interpreter code yet. The fallback incorrectly passed the shuffle thunk entry point to NonVirtualEntry2MethodDesc, which on FEATURE_PORTABLE_ENTRYPOINTS treated it as a PortableEntryPoint, crashing with an IsValid() assert.
Fix: call DoPrestub to compile the resolved method before checking for interpreter code, matching the existing CALL_INTERP_METHOD logic. Extract duplicated EnsureInterpreterCode helper used by both paths.
Also remove resolved ActiveIssue attributes for issue 124221 from Runtime_70259, Runtime_79354, and GSDelegate tests.