Skip to content

JIT: fill two gaps in wasm codegen - #132259

Open
AndyAyersMS wants to merge 1 commit into
dotnet:mainfrom
AndyAyersMS:wasm-codegen-holes
Open

JIT: fill two gaps in wasm codegen#132259
AndyAyersMS wants to merge 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 <223556219+Copilot@users.noreply.github.com>
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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