Repository navigation
JIT: fix Wasm local declaration counts - #136956
Open
AndyAyersMS wants to merge 1 commit into
Open
AndyAyersMS wants to merge 1 commit into
AndyAyersMS wants to merge 1 commit into
Conversation
Match local counts with type-based ABI register reuse. CoreLib tuple deconstruction drops 3 unused locals (137 -> 135 bytes). Libraries SPMI: 8,427 bytes saved, 4,074 methods smaller, none larger. Fixes dotnet#136727 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
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. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Member
Author
|
@adamperlin PTAL |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change aligning WebAssembly local counting with allocation.
No open issues 🎉
What changed in this PR
This PR corrects WebAssembly local declaration counts in the JIT by aligning ABI register reuse checks with local allocation, avoiding unused locals while preserving the type-mismatch fallback.
Changes:
- Share a validity-and-type check between local counting and allocation instead of requiring identical register indices.
- Add an assertion that allocated locals do not exceed the declared count.
| File | Description |
|---|---|
src/coreclr/jit/regallocwasm.cpp |
Aligns ABI register reuse checks and adds a local-count bounds assertion. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Count ABI register reuse by Wasm type rather than register index, using the same check for counting and allocating locals. Preserve the existing type-mismatch fallback.
CoreLib examples:
TupleExtensions.Deconstruct<T1,T2>drops three unused locals: 137 -> 135 bytes.Number.ConvertDecimalIeee754ToInteger<Decimal128,UInt128,ulong>drops one unused local: 331 bytes unchanged.Code size
Libraries Wasm SuperPMI, 87,080 successful contexts on both JITs:
4,074 methods shrink, none grow; 22,099 contexts have codegen differences. No compilation failures or missing contexts.
Validation
Runtime_133502ABI type-mismatch regression passed in Node/ReadyToRun.git diff --checkpassed. Full jit-format/clang-tidy checks were blocked by local cross-target toolchain configuration.Resolves #136727
Note
This PR description was generated with GitHub Copilot.