Skip to content

[wasm] JIT: Add WasmLocals JIT Metric - #138560

Open
adamperlin wants to merge 1 commit into
dotnet:mainfrom
adamperlin:adamperlin/wasm-local-count-metric
Open

adamperlin wants to merge 1 commit into
dotnet:mainfrom
adamperlin:adamperlin/wasm-local-count-metric

Conversation

@adamperlin

Copy link
Copy Markdown
Contributor

On Wasm targets, this counts the total number of declared Wasm locals at codegen time across all funclets. The metric allows us to use superpmi metricdiff to evaluate diffs in the number of locals which makes evaluating changes like those in #138249 much easier.

On non-wasm targets, the metric is always 0.

Validation

Ran superpmi metricdiff on identical copies of the wasm JIT to ensure that WasmLocals were being counted and diffed to zero across identical JITs. Additionally, ran metricdiff on an x64 collection to ensure non-wasm targets report the metric as 0.

@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 30, 2026
@adamperlin

Copy link
Copy Markdown
Contributor Author

@AndyAyersMS PTAL, cc @dotnet/wasm-contrib

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

@adamperlin

Copy link
Copy Markdown
Contributor Author

The jit-format errors seem to be from a blob storage account permissions issue.

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

The change adding the WasmLocals metric has no active review issues.

No open issues 🎉

What changed in this PR

Adds a WasmLocals JIT metric so SuperPMI can compare declared WebAssembly local counts, helping evaluate local-reuse optimizations such as #138249.

Changes:

  • Registers WasmLocals as a lower-is-better metric.
  • Accumulates declared locals during method and funclet prolog generation on WebAssembly; non-WebAssembly targets retain zero.
File Description
src/​coreclr/​jit/​jitmetadatalist.h Defines the WasmLocals metric and its comparison direction.
src/​coreclr/​jit/​codegenwasm.cpp Counts declared locals in method and funclet prologs.

Review effort: Balanced

@adamperlin
adamperlin force-pushed the adamperlin/wasm-local-count-metric branch from 35beb19 to ab9d26d Compare December 1, 2026 17:04
@adamperlin
adamperlin requested review from a team and AndyAyersMS December 2, 2026 18:29

This branch has not been deployed

No deployments
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.

2 participants