[wasm][coreclr] Fix vtable issue and interpreter I4/I8 arithmetic#125376
Open
radekdoulik wants to merge 1 commit intodotnet:mainfrom
Open
[wasm][coreclr] Fix vtable issue and interpreter I4/I8 arithmetic#125376radekdoulik wants to merge 1 commit intodotnet:mainfrom
radekdoulik wants to merge 1 commit intodotnet:mainfrom
Conversation
…32-bit Fix dotnet#124222, there were 2 problems: 1. prestub.cpp: When a stub-based method (delegate invoke, array ops) is prestubbed, use the method's own PortableEntryPoint rather than the stub's. This maintains the 1:1 MethodDesc-to-entrypoint mapping that GetMethodDescForSlot_NoThrow relies on, similar to previous FCall fix. 2. interpreter/compiler.cpp: Enable I4/I8 mixed arithmetic widening on 32-bit targets by removing the TARGET_64BIT guard. On 32-bit WASM, ldloca results are bashed to StackTypeI (= I4), but IL like sin3double uses conv.i8 before arithmetic, producing I4 + I8 which was rejected as invalid. The widening to I8 already existed for 64-bit; now it applies unconditionally.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes two WASM/CoreCLR interpreter issues that surfaced as a vtable/MethodDesc mapping assert (issue #124222) and as invalid mixed-width integer arithmetic handling on 32-bit interpreter targets.
Changes:
- CoreCLR prestub: when prestubbing stub-based methods under portable entrypoints, publish the method’s own
PortableEntryPoint(and attach the stub’s interpreter data to it) to preserve a 1:1MethodDescto entrypoint mapping. - Interpreter: allow implicit I4 to I8 widening for mixed I4/I8 arithmetic on 32-bit targets by removing the
TARGET_64BITguard. - Tests: remove WASM-specific
ActiveIssuesuppression for the affected Methodical tests now that the runtime behavior is fixed.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/vm/prestub.cpp | Ensures stub-based methods use their own portable entrypoint while reusing the stub’s interpreter data, preserving MethodDesc to entrypoint invariants. |
| src/coreclr/interpreter/compiler.cpp | Enables I4/I8 mixed arithmetic widening on 32-bit interpreter targets to match expected IL numeric promotion behavior. |
| src/tests/JIT/Methodical/switch/switch6.il | Removes WASM ActiveIssue gating tied to #124222. |
| src/tests/JIT/Methodical/flowgraph/bug619534/moduleHandleCache.cs | Removes WASM ActiveIssue gating tied to #124222. |
| src/tests/JIT/Methodical/Boxing/morph/sin3double.il | Removes WASM ActiveIssue gating tied to #124222 (keeps unrelated existing gating). |
jkotas
approved these changes
Mar 10, 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 #124222, there were 2 problems:
prestub.cpp: When a stub-based method (delegate invoke, array ops) is prestubbed, use the method's own PortableEntryPoint rather than the stub's. This maintains the 1:1 MethodDesc-to-entrypoint mapping that GetMethodDescForSlot_NoThrow relies on, similar to previous FCall fix.
interpreter/compiler.cpp: Enable I4/I8 mixed arithmetic widening on 32-bit targets by removing the TARGET_64BIT guard. On 32-bit WASM, ldloca results are bashed to StackTypeI (= I4), but IL like sin3double uses conv.i8 before arithmetic, producing I4 + I8 which was rejected as invalid. The widening to I8 already existed for 64-bit; now it applies unconditionally.