[Wasm RyuJIT] Start generating relocations for call_indirect#124205
[Wasm RyuJIT] Start generating relocations for call_indirect#124205kg merged 29 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR updates the WASM JIT emitter to begin supporting relocatable immediates for call_indirect, by representing certain immediates as “padded reloc” placeholders and centralizing constant emission logic.
Changes:
- Use
getWasmTypeSymboland store the returned handle in thecall_indirectimmediate as a relocatable constant. - Teach
instrDesc::idCodeSize()to account for padded reloc sizes forcall_indirectimmediates. - Add helper routines to emit either normal (S)LEB128 constants or fixed-size padded relocation placeholders.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/coreclr/jit/emitwasm.h | Declares new helper APIs for emitting padded relocations/constants. |
| src/coreclr/jit/emitwasm.cpp | Implements padded-reloc emission and switches call_indirect immediate handling to use a relocatable constant path. |
|
Current status: |
src/coreclr/tools/Common/Compiler/DependencyAnalysis/Target_Wasm/WasmTypeNode.cs
Outdated
Show resolved
Hide resolved
|
cc @dotnet/jit-contrib
|
I don't see any strong reason to do hacks here. The relocation write support will also likely be used in the object writer to actually resolve the relocations (similar to e. g. https://github.com/dotnet/runtimelab/blob/c1a9777ae47f937d4e1a5484247ce73c86f45030/src/coreclr/tools/aot/ILCompiler.LLVM/CodeGen/WasmObjectWriter.cs#L310-L318). That needs proper [S|U]LEBs. Edit: for that kind of use case, all relocs (not just those with addends) will need |
SingleAccretion
left a comment
There was a problem hiding this comment.
LGTM module a few comments and the proper LEB management in Relocation.cs.
src/coreclr/tools/Common/Compiler/DependencyAnalysis/Relocation.cs
Outdated
Show resolved
Hide resolved
|
It pads the (U|S)LEB values to 5 bytes now using the algorithm from runtimelab. For completeness's sake I'm manually validating them for the whole 32-bit space right now since I can't manually test them inside of crossgen yet (we're not generating that type of reloc anywhere.) |
SingleAccretion
left a comment
There was a problem hiding this comment.
LGTM with minor comments.
Uh oh!
There was an error while loading. Please reload this page.