Skip to content

[Wasm RyuJit] more fixes from crossgen2 of spc#124837

Merged
AndyAyersMS merged 1 commit intodotnet:mainfrom
AndyAyersMS:WasmCrossgenFixes3
Feb 25, 2026
Merged

[Wasm RyuJit] more fixes from crossgen2 of spc#124837
AndyAyersMS merged 1 commit intodotnet:mainfrom
AndyAyersMS:WasmCrossgenFixes3

Conversation

@AndyAyersMS
Copy link
Member

  • Wasm codegen does not use jump tables
  • Bail with NYI for now if there are blocks only reachable via EH
  • 8 byte structs can be returned as primitives
  • another vn case where we need to tolerate the final pep arg
  • handle structs passed/returned by-ref in signature gen code

- Wasm codegen does not use jump tables
- Bail with NYI for now if there are blocks only reachable via EH
- 8 byte structs can be returned as primitives
- another vn case where we need to tolerate the final pep arg
- handle structs passed/returned by-ref in signature gen code
Copilot AI review requested due to automatic review settings February 25, 2026 01:02
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 25, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@AndyAyersMS
Copy link
Member Author

@adamperlin PTAL
@dotnet/jit-contrib FYI

This fixes some more issues that came up trying to crossgen a release System.Private.CoreLib for Wasm.

The "successful" processing of SPC was done via

#define NYI_WASM(x) implReadyToRunUnsupported()

so that methods with features we cannot yet handle were cleanly skipped.

Plus some workarounds for small struct issues in lowering and codegen. I will open issues for those.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR contains several fixes for the WASM RyuJit compiler discovered while performing crossgen2 of System.Private.CoreLib (spc). The changes address various issues related to struct handling, value numbering, control flow, and switch optimization for the WASM target.

Changes:

  • Handle structs passed/returned by-ref in WASM signature generation by adding null check for LowerToAbiType
  • Allow WasmPortableEntryPoint argument in value numbering for helper calls with 3+ arguments
  • Enable 8-byte structs to be returned as primitives (TYP_LONG) on WASM, similar to 64-bit platforms
  • Add proper NYI exception for methods with blocks only reachable via EH on WASM
  • Skip jump table removal optimization on WASM since it doesn't use GT_JMPTABLE nodes

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/tools/Common/JitInterface/WasmLowering.cs Adds null check for abiType to handle structs that must be passed by-ref, returning pointer type as fallback
src/coreclr/jit/valuenum.cpp Relaxes assertion to allow WasmPortableEntryPoint as 4th argument in helper calls with 3 value-numbered arguments
src/coreclr/jit/layout.h Extends TYP_LONG return type for 8-byte structs to include TARGET_WASM (previously only TARGET_64BIT)
src/coreclr/jit/fgwasm.cpp Adds NYI_WASM macro to properly report unsupported EH-only reachable blocks instead of silently returning
src/coreclr/jit/fgopt.cpp Guards GT_JMPTABLE removal code with !defined(TARGET_WASM) since WASM doesn't use jump tables

@AndyAyersMS AndyAyersMS merged commit 6e58274 into dotnet:main Feb 25, 2026
132 of 134 checks passed
iremyux pushed a commit to iremyux/dotnet-runtime that referenced this pull request Mar 2, 2026
- Wasm codegen does not use jump tables
- Bail with NYI for now if there are blocks only reachable via EH
- 8 byte structs can be returned as primitives
- another vn case where we need to tolerate the final pep arg
- handle structs passed/returned by-ref in signature gen code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants