Skip to content

[Wasm RyuJIT] Move genHomeRegisterParams' output out of the prolog#125398

Merged
kg merged 3 commits intodotnet:mainfrom
kg:issue125200
Mar 10, 2026
Merged

[Wasm RyuJIT] Move genHomeRegisterParams' output out of the prolog#125398
kg merged 3 commits intodotnet:mainfrom
kg:issue125200

Conversation

@kg
Copy link
Copy Markdown
Member

@kg kg commented Mar 10, 2026

Addresses #125200

Also fixes an uninitialized insGroup member I found while debugging.

EDIT: genHomeRegisterParams normally emits into the prolog, which is limited to one insn group. On wasm we can need to generate a nearly unbounded amount of code for this, so I've moved the codegen to the first basic block instead, like swift structs.

Copilot AI review requested due to automatic review settings March 10, 2026 19:02
@kg kg added arch-wasm WebAssembly architecture area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Mar 10, 2026
@kg kg changed the title Enlarge the instruction group buffer on Wasm to make space for long prologs [Wasm RyuJIT] Enlarge the instruction group buffer on Wasm to make space for long prologs Mar 10, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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 increases the instruction-group (IG) buffer sizing for the Wasm JIT to avoid prolog IG overflows in methods with very large parameter lists (e.g., Vector256.Create), aligning Wasm behavior with other architectures that already use larger prolog IG buffers.

Changes:

  • Adds a Wasm-specific SC_IG_BUFFER_NUM_* configuration to allocate a larger IG buffer for prolog generation.
  • Moves EMIT_MAX_IG_INS_COUNT earlier in emit.h and reuses it to size the Wasm large-descriptor buffer.

Comment thread src/coreclr/jit/emit.h Outdated
Comment thread src/coreclr/jit/emit.h Outdated
Copy link
Copy Markdown
Contributor

@SingleAccretion SingleAccretion left a comment

Choose a reason for hiding this comment

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

I've looked a bit into relaxing the IG restriction, and it is very possible, just slightly tricky since we don't generate prologs/epilogs "in order" (the prolog IG is physically first, but generated after the 'main code' groups).

Comment thread src/coreclr/jit/emit.h Outdated
Comment thread src/coreclr/jit/emit.h Outdated
Copilot AI review requested due to automatic review settings March 10, 2026 19:52
@kg kg changed the title [Wasm RyuJIT] Enlarge the instruction group buffer on Wasm to make space for long prologs [Wasm RyuJIT] Move genHomeRegisterParams' output out of the prolog Mar 10, 2026
@kg kg requested a review from SingleAccretion March 10, 2026 19:54
Copy link
Copy Markdown
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread src/coreclr/jit/codegenlinear.cpp
Comment thread src/coreclr/jit/codegenlinear.cpp
Comment thread src/coreclr/jit/codegenwasm.cpp
@kg kg marked this pull request as ready for review March 10, 2026 20:20
Copilot AI review requested due to automatic review settings March 10, 2026 20:20
@kg
Copy link
Copy Markdown
Member Author

kg commented Mar 10, 2026

cc @dotnet/jit-contrib

Copy link
Copy Markdown
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@kg kg enabled auto-merge (squash) March 10, 2026 22:59
@kg kg merged commit 338e288 into dotnet:main Mar 10, 2026
135 checks passed
Copilot AI pushed a commit that referenced this pull request Mar 13, 2026
…125398)

Addresses #125200
genHomeRegisterParams normally emits into the prolog, which is limited to one insn group. On wasm we can need to generate a nearly unbounded amount of code for this, so I've moved the codegen to the first basic block instead, like swift structs.
Also fixes an uninitialized insGroup member I found while debugging.
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 10, 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