Repository navigation
Implement ReadyToRunHelperNode for WASM - #133739
Conversation
|
Azure Pipelines: 16 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @dotnet/crossgen-contrib |
Co-authored-by: jtschuster <[email protected]>
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
Co-authored-by: jtschuster <[email protected]>
Co-authored-by: jtschuster <[email protected]>
Co-authored-by: jtschuster <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
…for HasGenericContextArg
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical and moderate issues include a compile-time regression and incorrect WASM relocation handling.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
src/coreclr/tools/Common/JitInterface/WasmLowering.cs:563
- Removing the MethodDesc overloads here breaks existing READYTORUN callers that still invoke
WasmLowering.GetSignature(MethodDesc)andGetLoweringFlags(MethodDesc)(for example ReadyToRunCodegenNodeFactory.cs:1517, CorInfoImpl.ReadyToRun.cs, and WasmImportThunkPortableEntrypoint.cs). This is a compile-time regression; keep those overloads or update every caller in the same change.
public static WasmSignature GetSignature(INodeWithTypeSignature node)
{
return GetSignature(node.Signature, GetLoweringFlags(node));
}
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_Wasm/WasmReadyToRunHelperNode.cs:160
I32.ConstRVAencodes a linear-memory address, buttarget.GetTargetNode(factory)is a method entry/function pointer for theCanonicalEntrypointandExactCallableAddressdelegate cases. The WASM ABI usesWASM_TABLE_INDEX_SLEBfor function pointers (seeCorInfoTypes.cs:516-519andemitwasm.cpp:1031-1035), so these delegates receive an image/data address rather than a callable table index;target.Thunkon line 165 has the same problem. KeepDispatchCellas a memory address, but emit method/thunk symbols with a table-index relocation.
[!NOTE] This review comment was created by GitHub Copilot.
expressions.Add(I32.ConstRVA(target.GetTargetNode(factory)));
}
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
Critical unresolved overload and duplicate-declaration issues remain.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 2
- Review effort level: Lite
…sMethod for HasGenericContextArg" This reverts commit 38ce590.
There was a problem hiding this comment.
🔵 Needs a closer look
One or more issues must be addressed before approval.
Review details
Suppressed comments (2)
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_Wasm/WasmReadyToRunHelperNode.cs:159
target.GetTargetNode(factory)is a method entrypoint, butI32.ConstRVAemitsWASM_MEMORY_ADDR_REL_SLEB. Function pointers in the Wasm ABI require a table-index relocation (WASM_TABLE_INDEX_SLEB); the JIT uses that relocation forIF_FUNCPTR, and the current value will not identify the delegate target in the function table. Emit a table-index constant for this method pointer (and use the same fix for the thunk below).
expressions.Add(I32.ConstRVA(target.GetTargetNode(factory)));
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_Wasm/WasmReadyToRunHelperNode.cs:50
- The new hand-authored helper bodies have no focused regression coverage for the static-base cctor paths or virtual-function resolution. The existing WASM tests cover signature/argument-layout calculations and interpreter-transition thunks, so a wrong local/stack sequence or helper relocation here could still pass those tests; add a WASM NativeAOT test that exercises these helper paths.
protected override void EmitCode(NodeFactory factory, ref WasmEmitter encoder, bool relocsOnly)
{
Debug.Assert(!encoder.Is64Bit);
List<WasmExpr> expressions = new List<WasmExpr>();
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_Wasm/WasmReadyToRunHelperNode.cs:203
- This adds several independent WASM helper paths, but no test exercises the generated static-base, delegate-constructor, or virtual/interface helper bodies. The existing browser WASM test covers R2R/interpreter transition signatures and does not reach these helpers, so malformed function signatures, tail-call argument lists, and helper relocations can regress without detection. Add focused WASM coverage for at least lazy statics, delegate construction, and interface/non-interface dispatch.
encoder.FunctionBody = new WasmFunctionBody(WasmLowering.GetSignature(this).FuncType, expressions.ToArray());
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
Adds WASM code emission for ReadyToRun static-base, delegate-construction, and virtual-function helpers. - Registers WASM function signatures with dependency analysis. - Emits architecture-equivalent WASM helper bodies. - Preserves shadow-stack and portable-entrypoint arguments across managed tail calls. - Fixes dotnet#133738 --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: jtschuster <[email protected]> Co-authored-by: Michal Strehovský <[email protected]>
Adds WASM code emission for ReadyToRun static-base, delegate-construction, and virtual-function helpers.
Note
This description was generated by GitHub Copilot.