Repository navigation
Reduce WebAssembly managed method prologs - #135440
Draft
davidwrighton wants to merge 3 commits into
Draft
davidwrighton wants to merge 3 commits into
davidwrighton wants to merge 3 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging @dotnet/jit-contrib for JIT-EE GUID update |
|
Azure Pipelines: Successfully started running 7 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: @dotnet/crossgen-contrib |
davidwrighton
commented
Oct 9, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Description
Reduce CoreCLR WebAssembly R2R managed method prologs by replacing per-method function-table-index materialization with compact frame identities:
Stack processing resolves these identities to the method's virtual IP. The interpreter is unchanged.
The frame-identity relocation carries its target method explicitly so the JIT interface does not assume it always refers to the method being compiled. This also supports future use by direct inter-method calls.
Size impact
Measured on
System.Private.CoreLib.wasmusing Release browser builds after merging the body-deduplication change from #134623 intomain:mainbaselineThe embedded WebCIL data remained unchanged at 7,897,194 bytes. The remaining saving comes primarily from fewer physical Wasm bodies and the smaller associated function-name data.
Call performance
Measured with R2R-compiled Wasm under Node.js. The hot
Leafcallee calls a separate non-inlined method, forcingLeafto use an unwindable frame and execute the changed PEP-saving prolog on every entry. Disassembly confirms that the baseline materializes its table index while the changed body stores its incoming PEP.Each sample performs 40,000,000 entries into
Leaf, arranged as 1, 2, 4, or 8 sequential calls per loop iteration. Each result is the median of nine independent processes; each process reports the median of nine samples. Baseline and changed processes were alternated.The one-call loop exhibits a distinct V8 optimization effect and does not agree with the converged repeated-call cases. The 2/4/8-call cases consistently show a 1.26% to 1.68% Wasm call-performance regression, approximately 1.5%.
Validation
./build.sh -os browser -c Release -subset clr+libs— passed for both merged-mainbaseline and changed builds./build.sh -os browser -c Release -subset clr.r2rtests -test— passed: 169 total, 130 passed, 39 skippedpython3 src/coreclr/scripts/jitformat.py -r . -o linux -a x64— passedlocalloc, and compiled reverse P/InvokeNote
This pull request description was generated with GitHub Copilot.