Repository navigation
[Wasm] Elide singleton virtual IP stores - #137465
Merged
davidwrighton merged 2 commits intoNov 13, 2026
Merged
Conversation
Co-authored-by: Copilot <[email protected]>
|
Azure Pipelines: Successfully started running 8 pipeline(s). 7 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: @steveisok, @tommcdon, @dotnet/dotnet-diag |
davidwrighton
marked this pull request as ready for review
November 12, 2026 23:04
davidwrighton
requested review from
AndyAyersMS
and
a balanced review from Copilot
November 12, 2026 23:04
AndyAyersMS
approved these changes
Nov 12, 2026
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The cross-layer stack-walking contract change needs maintainer assessment because browser-Wasm validation could not be independently executed and timing results were mixed.
No open issues 🎉
What changed in this PR
This PR removes virtual instruction-pointer stores from CoreCLR WebAssembly methods without exception handling. The VM and cDAC recover the single observable IP from existing unwind metadata, preserving the shadow-frame layout and leaving NativeAOT code generation unchanged.
Changes:
- Skip singleton virtual-IP stores in the JIT.
- Extend VM and cDAC lookups to support metadata-based IP recovery.
- Add code-generation, unwinding, and exception-stack tests, and update the stack-walk contract documentation.
| File | Description |
|---|---|
src/tests/JIT/Directed/WasmGCLiveness/WasmGCLiveness.cs |
Tests exception attribution for methods without exception handling. |
src/native/managed/cdac/tests/UnitTests/WasmUnwinderTests.cs |
Tests singleton IP recovery with uninitialized slots; updates unwind fixtures. |
src/native/managed/cdac/tests/UnitTests/WasmR2RInfoTests.cs |
Tests unwind metadata lookup across frame identity forms. |
src/native/managed/cdac/tests/UnitTests/StackWalkTests.cs |
Adds virtual-IP extents to mock unwind records. |
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/Wasm/WasmUnwinder.cs |
Infers singleton IPs without reading the frame’s IP slot. |
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/Wasm/WasmR2RInfo.cs |
Returns unwind addresses alongside identity-derived IP bases. |
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/ExecutionManager/Helpers/WasmFunctionTableIndexLookup.cs |
Supplies unwind addresses from runtime-function lookups. |
src/coreclr/vm/wasm/helpers.cpp |
Uses the inferred body IP for singleton frames. |
src/coreclr/vm/codeman.h |
Adds optional singleton-IP outputs to VM lookup declarations. |
src/coreclr/vm/codeman.cpp |
Detects singleton IPs from runtime-function extents. |
src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCases/R2RTestSuites.cs |
Checks store elision and retention with optimization enabled and disabled. |
src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCases/ManagedHelpers/HelperCalls.cs |
Adds a finally-block fixture for code-generation comparisons. |
src/coreclr/jit/fgwasm.cpp |
Omits eligible IP stores while retaining frame-slot reservation. |
docs/design/datacontracts/StackWalk.md |
Documents metadata-based singleton IP recovery. |
Review effort: Balanced
Co-authored-by: Copilot <[email protected]>
AndyAyersMS
approved these changes
Nov 13, 2026
This was referenced Nov 13, 2026
Member
Author
|
/ba-g unrelated failures.
|
davidwrighton
added a commit
to davidwrighton/runtime
that referenced
this pull request
Nov 17, 2026
Resolve conflicts with singleton virtual IP elision (dotnet#137465) by reading Wasm unwind data relative to GCInfoBase in the grouped runtime function format. Co-authored-by: Copilot <[email protected]>
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.
Avoid writing the virtual-IP slot for CoreCLR WebAssembly methods without EH. Such methods have one observable body IP; the VM and cDAC infer it from the existing unwind extent. The shadow-frame layout is unchanged, and NativeAOT codegen is unaffected.
This addresses one part of #134450, without closing the broader issue.
Havit measurements
Release CoreCLR browser-wasm composite, baseline at
68b16fb02735b0002495191823371f9e494ce489. Both variants used the same SDK and Wasm SDK pack. Chromium desktop and emulated mobile measurements were run in baseline/changed/changed/baseline order.Each variant has 20 cold and 10 warm loads per profile and 10 desktop walkthroughs. Timing results are mixed and noisy on the shared host; these measurements do not establish a performance improvement. One changed desktop cold-download snapshot included an extra 134,366 bytes relative to its repeat; the table uses the consistent mobile measurements.
In the compiled Havit
StaticsHelpers.GetGCStaticBase, this removes the seven-bytelocal.get 0; i32.const 1; i32.store offset=4sequence while preserving the frame identity store.Validation
./build.sh clr+libs+host -os browser -arch wasm -c Release /p:RuntimeFlavor=CoreCLR— passed for baseline and changed builds../dotnet.sh build src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/ILCompiler.ReadyToRun.Tests.csproj -c Debug -p:TargetOS=browser -p:TargetArchitecture=wasm -p:CoreCLRConfiguration=Release -p:LibrariesConfiguration=Release— passed../dotnet.sh test artifacts/bin/ILCompiler.ReadyToRun.Tests/Debug/Release_CLR/browser-wasm/ILCompiler.ReadyToRun.Tests.dll --filter 'FullyQualifiedName~Wasm'— passed, 169 tests. The two new codegen cases failed against the baseline JIT and passed with the prototype../dotnet.sh build src/native/managed/cdac/tests/UnitTests/Microsoft.Diagnostics.DataContractReader.Tests.csproj -c Debug— passed../dotnet.sh test artifacts/bin/Microsoft.Diagnostics.DataContractReader.Tests/Debug/Microsoft.Diagnostics.DataContractReader.Tests.dll --filter 'FullyQualifiedName~Wasm|FullyQualifiedName~StackWalkTests'— passed, 359 tests.src/tests/build.sh browser wasm Release -Test JIT/Directed/WasmGCLiveness/WasmGCLiveness.csproj -priority1— passed; one test project built.CORE_ROOTset to the browser-wasm Release test layout, Node and the repository SDK onPATH, andRunCrossGen2=1:bash artifacts/tests/coreclr/browser.wasm.Release/JIT/Directed/WasmGCLiveness/WasmGCLiveness/WasmGCLiveness.sh— passed (expected exit code 100). The emitted R2R Wasm image also passed R2RDump validation.artifacts/tools/clang-format --dry-run --Werror src/coreclr/jit/fgwasm.cppandgit diff --check— passed.Note
This pull request description was generated with GitHub Copilot.