Skip to content

Reuse handle-based unwind lookup for WebAssembly - #136168

Merged
rcj1 merged 1 commit into
mainfrom
refactor/wasm-unwind-lookup
Oct 20, 2026
Merged

rcj1 merged 1 commit into
mainfrom
refactor/wasm-unwind-lookup

Conversation

@rcj1

@rcj1 rcj1 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Route WASM R2R unwind-data lookup through the existing ExecutionManager APIs instead of maintaining a separate control-PC-only lookup path.

WasmR2RInfo.TryGetUnwindData now resolves the virtual IP with GetCodeBlockHandle, then obtains the runtime-function entry and image base through GetUnwindInfo and GetUnwindInfoBaseAddress. This aligns WASM cDAC unwinding with the lookup pattern used on other architectures and removes IExecutionManager.TryGetUnwindInfo and its implementation.

Changes

  • Replace the dedicated unwind lookup with the existing code-block-based APIs, preserving failure behavior when the code block or unwind information is unavailable.
  • Add focused coverage for root-method and funclet unwind-data resolution through the real ExecutionManager.
  • Update stack-walk test doubles and data-contract documentation.

Validation

Validated with nesm against a CI runtime and crossgen2 matching the tagged-frame ABI, using snapshots captured during real exception processing at six stops: exception dispatch, native virtual unwind, a first-pass filter, second-pass dispatch, second-pass invocation, and a finally funclet.

The branch and baseline produced identical complete public IStackWalk results across all six snapshots: 135 stack-walk entries, including 98 managed frames, per reader. Validation also checked 94 production WasmContext.Unwind steps per reader, including caller SP/IP/FP, and cold MethodDesc/unwind-data resolution for 33 frame instances per reader. Filter/finally funclets and managed/interpreter/native transitions were exercised, and the fixture completed with the expected result.

Target artifacts: runtime CI build 1641014. These results cover cDAC unwinding against that target, not a native runtime rebuilt from this branch.

Note

This PR description was generated with GitHub Copilot.

Remove the redundant direct-PC unwind API and use the existing ExecutionManager code-block lookup in the Wasm unwinder. Update related tests and contract documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

@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, one non-blocking comment about tests

@rcj1

rcj1 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

/ba-g unrelated diagnostic fails

@rcj1
rcj1 merged commit 46aac6f into main Oct 20, 2026
78 of 87 checks passed
@rcj1
rcj1 deleted the refactor/wasm-unwind-lookup branch October 20, 2026 21:39
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants