Repository navigation
Enable NativeAOT data dehydration on WebAssembly - #137074
Merged
Merged
Conversation
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
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
|
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. |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
jkotas
approved these changes
Nov 6, 2026
Contributor
There was a problem hiding this comment.
🔵 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
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.
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.