Skip to content

JIT: initialize wasm funclet relocation addends - #137278

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wasm-spmi-reloc-fix
Nov 12, 2026
Merged

AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wasm-spmi-reloc-fix

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

Initialize padded Wasm funclet relocation addends before notifying the EE. SuperPMI only records relocations, so these bytes could otherwise remain uninitialized and cause spurious native differences or decoder failures.

The EE remains free to overwrite the addends.

Validation: Release/Checked Wasm JIT builds and Havit AOT publications passed. Unmodified SuperPMI replayed 38,469 contexts with zero self-differences or errors. Frozen-input AOT code sections were byte-identical.

Note

This PR description was generated with GitHub Copilot.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 1da7d7aa-79b4-4ae1-ae4a-9861fdf9681c
@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 Nov 10, 2026
@AndyAyersMS
AndyAyersMS requested review from adamperlin and a balanced review from Copilot and removed request for adamperlin November 10, 2026 21:00
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 6 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@AndyAyersMS

Copy link
Copy Markdown
Member Author

@adamperlin PTAL
fyi @dotnet/wasm-contrib

Fixes some spurious SPMI diffs.

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.

🟢 Approval recommended

No active review issues remain for the change to initialize Wasm funclet relocation addends.

No open issues 🎉

What changed in this PR

This PR initializes Wasm funclet relocation addends in the JIT to prevent uninitialized bytes from causing spurious SuperPMI differences or decoder failures.

Changes:

  • Write the padded funclet index before notifying the execution engine, which can still overwrite it.
  • Assert that the index is nonnegative and fits in a signed 32-bit integer.
File Description
src/​coreclr/​jit/​emitwasm.cpp Initialize padded funclet relocation addends and assert the index range.

Review effort: Balanced

@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.

@AndyAyersMS

Copy link
Copy Markdown
Member Author

/ba-g unrelated build issues, this change can only affect Wasm

@AndyAyersMS
AndyAyersMS merged commit 491df16 into dotnet:main Nov 12, 2026
124 of 134 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 12, 2026
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.

4 participants