Uh oh!
There was an error while loading. Please reload this page.
crossgen2: Extract funclets in WasmObjectWriter - #128736
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the Wasm object writer path so compiled methods with funclets can contribute additional contiguous Wasm functions/table entries, enabling funclet pointer/index relocation scenarios for Wasm EH work.
Changes:
- Adds
INodeWithFuncletsto expose frame/EH metadata from method nodes. - Records Wasm function/table entries and signatures for method funclets.
- Updates Wasm relocation addend handling for table-index relocations and funclet constants.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/coreclr/tools/Common/Compiler/ObjectWriter/WasmObjectWriter.cs | Adds funclet discovery, signature registration, and symbol/table indexing logic. |
src/coreclr/tools/Common/Compiler/DependencyAnalysis/Relocation.cs | Reads addends for Wasm table-index relocations. |
src/coreclr/tools/Common/Compiler/DependencyAnalysis/INodeWithFunclets.cs | Introduces the shared funclet metadata interface. |
src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/DependencyAnalysis/MethodCodeNode.cs | Marks NativeAOT method code nodes as funclet-capable. |
src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj | Links the new interface into the ReadyToRun compiler project. |
src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodWithGCInfo.cs | Marks ReadyToRun method nodes as funclet-capable. |
src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj | Links the new interface into the NativeAOT compiler project. |
src/coreclr/jit/emitwasm.cpp | Avoids overwriting funclet relocation addends already written through relocation recording. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I've validated that we can invoke a finally funclet with this change, so a simple test like the following: voidMain(){try{
...}finally{Console.WriteLine("in finally funclet");}}should execute properly. |
…bstract over EH info differences in R2R vs. NAOT
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
adamperlin
commented
Jun 2, 2026
/ba-g infrastructure issues |
Uh oh!
There was an error while loading. Please reload this page.
Now that #128736 is merged, flip JitWasmFunclets default from 0 to 1 so methods with funclets are compiled without the late bailout. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Note
This PR was created with assistance from Github Copilot
This PR adds handling to the Wasm Object Writer to extract funclets attached to a compiled method as separate Wasm functions.
To do this, an
INodeWithFuncletsinterface was added for ReadyToRun and NativeAOT so that we can generically access EHInfo and FrameInfo fields attached to nodes which represent managed method definitions.We lay funclets out sequentially in the object file and they are added to the Wasm table contiguously. This is required by #128222 and lets us grab the funclet index using an offset from the index of the method it is attached to, i.e., funclet
ifor method M is attable_index(M) + i.Follow up on #127773 and other Wasm EH work.