Skip to content

Avoid tagged shared dynamic-interface vtable entries on WASM - #135957

Merged
MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:nativeaot-wasm-dynamic-interface-vtable
Oct 16, 2026
Merged

MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:nativeaot-wasm-dynamic-interface-vtable

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

Summary

Avoid emitting unsupported tagged shared IDynamicInterfaceCastable method pointers in NativeAOT WASM sealed vtables.

The instantiating-thunk flag is encoded as a function-pointer relocation addend. WASM function pointers are table indices, and the object writer interprets nonzero function addends as funclet ordinals. The flag therefore becomes a reference to a nonexistent funclet and crashes compilation.

Emit null entries for shared dynamic-interface implementations on WASM, with a TODO marking the unsupported scenario. Other sealed-vtable entries and non-WASM targets are unchanged.

This is deliberately a compile-time bringup fix, not runtime support for shared dynamic-interface dispatch. Real support needs a signature-correct way to supply the generic context; changing the pointer encoding alone is insufficient.

Validation

On the combined local NativeAOT WASI bringup tree, including other unmerged enablement:

  • .\build.cmd clr.tools -rc Checked -lc Release -os wasi -arch wasm passed.
  • Determinism no longer failed with the nonexistent funclet reference. Object inspection confirmed zero entries without relocations for the two shared dynamic-interface vtables, while four other inspected vtables retained function relocations.
  • With the separate resolver/linker bringup fixes, freshly rebuilt Determinism and AttributeTrimming returned 100 under Wasmtime.

This branch contains only this cherry-picked commit from main; it was not built independently. Unsupported shared dynamic-interface dispatch itself was not executed.

Note

This PR description was generated by GitHub Copilot.

Emit null sealed-vtable entries for unsupported shared IDynamicInterfaceCastable implementations. WASM function-pointer relocation addends identify funclets and cannot encode the instantiating-thunk flag.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a6f3a617-acae-4f4f-95d3-20b2a0bac43c
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 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: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

@MichalStrehovsky

Copy link
Copy Markdown
Member Author

/ba-g widespread mutex failures; this change is not exercised by CI

@MichalStrehovsky
MichalStrehovsky merged commit 5dd06ec into dotnet:main Oct 16, 2026
114 of 120 checks passed
@MichalStrehovsky
MichalStrehovsky deleted the nativeaot-wasm-dynamic-interface-vtable branch October 16, 2026 22:42

This branch was successfully deployed

1 active deployment
copilot-pat-pool — 15ded2d2 Deployed Oct 16, 2026 by MichalStrehovsky via conclusion #10564
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-NativeAOT-coreclr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants