Skip to content

JIT: fold wasm helper addresses into load offsets - #137510

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wasm-helper-address-folding
Nov 14, 2026
Merged

AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wasm-helper-address-folding

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

Fold module-relative helper-cell addresses into i32.load offsets in late-emitted helper calls, removing a const/add per load. Keep NativeAOT and non-relocating compilation unchanged. Add codegen coverage for reference stores and two-reference struct copies.

Size

Measured against 68b16fb0273, independently of the GC-local change:

Change CoreLib Havit composite
Code -26,975 B (-0.335%) -242,252 B (-0.999%)
Total module -27,168 B (-0.138%) -242,256 B (-0.791%)
Brotli +3,891 B (+0.090%) -2,920 B (-0.072%)
gzip -1,140 B (-0.019%) -10,249 B (-0.144%)

CoreLib is non-composite, compressed with Brotli quality 11 / 4 MiB window and gzip level 9. Havit uses the published module and its SDK-generated compressed assets. The Havit publishes use matching SDK/runtime packages, but the rebuilt application DLL hash differs; very small compressed deltas should not be overinterpreted.

CoreLib's whole-file Brotli regression is a compression interaction: independently compressed code and non-code sections shrink by 55 and 768 bytes, respectively.

Instruction-aware decoding confirms 8,969 CoreLib and 60,511 Havit folds. The only opcode-count changes are the removed i32.const/i32.add pairs.

Validation

  • Checked Wasm cross-JIT build passed.
  • All 169 Wasm compiler tests passed; both new codegen cases fail on baseline.
  • Both official SPMI collections passed: 430,890 contexts, 132,991 smaller, no missing/failing contexts or code-size regressions.
  • Reference-suite execution passed normally and with DOTNET_GCStress=3; changed R2R activation confirmed.
  • Changed Havit cold/warm startup and desktop walkthrough passed in Edge.
  • Targeted jit-format --untidy, C# whitespace verification, and git diff --check passed.

NativeAOT execution and runtime throughput were not measured.

Contributes to #135985.

Note

This PR description was generated with GitHub Copilot.

Remove a const/add per helper-cell load; leave NativeAOT unchanged.

Contributes to dotnet#135985.

Co-authored-by: Copilot <[email protected]>
@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

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/crossgen-contrib
See info in area-owners.md if you want to be subscribed.

@AndyAyersMS AndyAyersMS added the arch-wasm WebAssembly architecture label Nov 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.

@AndyAyersMS

Copy link
Copy Markdown
Member Author

Sample diff

image

@lewing lewing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@AndyAyersMS
AndyAyersMS merged commit d68a109 into dotnet:main Nov 14, 2026
135 of 137 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-ReadyToRun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants