Skip to content

JIT: fill two gaps in wasm codegen - #132259

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wasm-codegen-holes
Aug 17, 2026
Merged

AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wasm-codegen-holes

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

genReturnSuspend pushed a zero of the native return type to keep the epilog's return well typed. A method returning through a buffer lowers to a wasm function with no result, so there is nothing to push, and its compRetNativeType (TYP_STRUCT) fell into the default arm. Vector128 returns by value as a v128 and was missing too.

genEmitHelperCall only had signatures for four of the no-arg managed throw helpers. Add the rest; they are reachable from the unsupported intrinsic and out-of-range immediate paths.

Found crossgenning System.Private.Xml, whose XmlTextReaderImpl.ParseTextAsync returns a ValueTuple`4 by buffer.

genReturnSuspend pushed a zero of the native return type to keep the
epilog's return well typed. A method returning through a buffer lowers
to a wasm function with no result, so there is nothing to push, and its
compRetNativeType (TYP_STRUCT) fell into the default arm. Vector128
returns by value as a v128 and was missing too.

genEmitHelperCall only had signatures for four of the no-arg managed
throw helpers. Add the rest; they are reachable from the unsupported
intrinsic and out-of-range immediate paths.

Neither reaches the product build, which crossgens only CoreLib and
always passes -O. Found crossgenning System.Private.Xml, whose
XmlTextReaderImpl.ParseTextAsync returns a ValueTuple`4 by buffer.

Co-authored-by: Copilot <[email protected]>
Copilot AI lite review requested due to automatic review settings August 13, 2026 02:13
@AndyAyersMS

Copy link
Copy Markdown
Member Author

@adamperlin PTAL
fyi @dotnet/wasm-contrib

@AndyAyersMS
AndyAyersMS requested a review from adamperlin August 13, 2026 02:14
@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 Aug 13, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 6 pipeline(s).
10 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 AI left a comment

Copy link
Copy Markdown
Contributor

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 addresses two missing cases in the WebAssembly JIT backend to prevent invalid wasm codegen in async-suspend paths and to ensure managed throw helpers can always be emitted with a correct wasm signature.

Changes:

  • Update genReturnSuspend to avoid pushing a dummy return value for retbuf returns (wasm functions with no result) and to handle Vector128<T> (v128) returns.
  • Extend genEmitHelperCall’s hard-coded signature table to include additional no-arg managed throw helpers that are reachable from existing JIT paths.

@jkotas jkotas added the arch-wasm WebAssembly architecture label Aug 13, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@adamperlin adamperlin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes look good to me. The NativeAOT failure looks like it could be related to #132030, and the Wasm test failure is the existing GC issue it looks like.

@AndyAyersMS

Copy link
Copy Markdown
Member Author

/ba-g unrelated failures

@AndyAyersMS
AndyAyersMS merged commit 2bb965e into dotnet:main Aug 17, 2026
132 of 139 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Aug 18, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture 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.

4 participants