Skip to content

Allow NativeAOT WASM method folding with frame identity relocations - #137073

Merged
MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:fold
Nov 7, 2026
Merged

MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:fold

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

Normalize self-targeting WASM frame identity relocations consistently in method-body hashing and equality. Preserve all signature, GC, unwind, and exception-handling comparisons.

Normalize self-targeting WASM frame identity relocations consistently in method-body hashing and equality. Preserve all signature, GC, unwind, and exception-handling comparisons.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9bc3dfee-1040-4648-bdad-86922a749613
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 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 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@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.

@jkotas jkotas 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.

I assume that we did not take any wasm shortcuts elsewhere and the function pointer to method info mapping still works fine with this change.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Changes to WASM shadow-frame identity require NativeAOT WASM runtime validation of GC, exception handling, and stack walking, which was unavailable in this static review.

No open issues 🎉

What changed in this PR

Enables NativeAOT WebAssembly method-body folding when otherwise identical methods differ only in self-targeting frame identity relocations.

Changes:

  • Adds shared detection of self-targeting frame identity relocations for consistent hashing and equality.
  • Passes method owners into body comparison while leaving signature, GC, unwind, and exception-handling comparisons unchanged.
File Description
src/​coreclr/​tools/​aot/​ILCompiler.Compiler/​Compiler/​MethodBodyDeduplicator.cs Normalizes self-targeting WASM frame identity relocations during method-body hashing and equality checks.

Review effort: Balanced

@MichalStrehovsky

Copy link
Copy Markdown
Member Author

I assume that we did not take any wasm shortcuts elsewhere and the function pointer to method info mapping still works fine with this change.

I'm not aware of taking shortcuts, this should work same as other architectures and I think I ran the tests on this locally. Either way, will find out soon.

@MichalStrehovsky
MichalStrehovsky merged commit 7066044 into dotnet:main Nov 7, 2026
120 checks passed
@MichalStrehovsky
MichalStrehovsky deleted the fold branch November 7, 2026 01:17
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 7, 2026
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.

3 participants