Skip to content

Enable NativeAOT data dehydration on WebAssembly - #137074

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

MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:dehyd

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

Use absolute 32-bit dehydration fixups on WebAssembly so function-table indices survive rehydration, and place hydrated data in BSS. Enable dehydration by default, correct inline relocation addends, and cover preinitialized generic delegates.

Use absolute 32-bit dehydration fixups on WebAssembly so function-table indices survive rehydration, and place hydrated data in BSS. Enable dehydration by default, correct inline relocation addends, and cover preinitialized generic delegates.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9bc3dfee-1040-4648-bdad-86922a749613
@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).
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 this area: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

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

Default-on WASM dehydration changes linker layout and startup reconstruction, requiring unavailable linked-image inspection and WASI NativeAOT execution to verify BSS zero-initialization and function-table fixups.

No open issues 🎉

What changed in this PR

This PR enables NativeAOT data dehydration on WebAssembly, coordinating compiler fixup emission with runtime rehydration to preserve function-table indices.

Changes:

  • Use absolute 32-bit dehydration fixups on WebAssembly and place hydration targets in BSS.
  • Enable dehydration by default and correct addend reads for consecutive inline relocations.
  • Extend preinitialization smoke tests with generic delegates.
File Description
src/​tests/​nativeaot/​SmokeTests/​Preinitialization/​Preinitialization.cs Adds preinitialized generic delegate coverage.
src/​coreclr/​tools/​Common/​Compiler/​ObjectWriter/​WasmRelocatableObjectWriter.cs Maps hydrated data to .bss.hydrated.
src/​coreclr/​tools/​aot/​ILCompiler.Compiler/​Compiler/​DependencyAnalysis/​DehydratedDataNode.cs Emits absolute WebAssembly fixups and corrects inline relocation addends.
src/​coreclr/​nativeaot/​Common/​src/​Internal/​Runtime/​CompilerHelpers/​StartupCodeHelpers.cs Reads absolute fixups on WebAssembly while retaining relative fixups elsewhere.
src/​coreclr/​nativeaot/​BuildIntegration/​Microsoft.NETCore.Native.Wasm.targets Removes the error rejecting WebAssembly dehydration.
src/​coreclr/​nativeaot/​BuildIntegration/​Microsoft.NETCore.Native.targets Removes the WebAssembly-specific dehydration opt-out.

Review effort: Balanced

@MichalStrehovsky
MichalStrehovsky merged commit a2dd4f7 into dotnet:main Nov 7, 2026
126 checks passed
@MichalStrehovsky
MichalStrehovsky deleted the dehyd branch November 7, 2026 01:13
@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