Skip to content

Commit 4e66ef0

Browse files
committed
Trim thunk layout comments to match the surrounding style
Replace the multi-line remarks on BuildWasmThunkArgIterator and HasGenericContextBeforeAsync with one-line summaries and a short inline comment where the code isn't self-explanatory; the ABI ordering is already documented in clr-abi.md. Co-authored-by: Copilot App <[email protected]>
1 parent 90e3506 commit 4e66ef0

2 files changed

Lines changed: 4 additions & 18 deletions

File tree

‎src/coreclr/tools/Common/JitInterface/WasmLowering.cs‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -457,21 +457,15 @@ private static int ParseStructSize(string sig, ref int pos)
457457
}
458458

459459
/// <summary>
460-
/// Returns true when the Wasm signature has both a hidden generic context and an async continuation.
460+
/// Returns true when the Wasm signature has a hidden generic context followed by an async continuation.
461461
/// </summary>
462-
/// <remarks>
463-
/// The generic context is encoded like any pointer-sized argument, so it can only be recognized by its position:
464-
/// it is always passed immediately before the async continuation (see "Passing Continuation argument" in
465-
/// docs/design/coreclr/botr/clr-abi.md). Without an async continuation, it occupies the first argument slot either way.
466-
/// </remarks>
467462
public static bool HasGenericContextBeforeAsync(WasmSignature wasmSignature, TypeSystemContext context)
468463
{
469464
string sig = wasmSignature.SignatureString;
470465
int asyncIndex = sig.IndexOf('a');
471466
char hiddenParamChar = (context.Target.PointerSize == 4) ? 'i' : 'l';
472467

473-
// Apart from the generic context, only the return type (a single char at index 0, or ending in a digit) or
474-
// 'T' can precede the async continuation.
468+
// Index 0 is the return type, not a generic context.
475469
return (asyncIndex > 1) && (sig[asyncIndex - 1] == hiddenParamChar);
476470
}
477471

‎src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapBuilder.cs‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,23 +126,15 @@ internal static (ArgIterator<TypeHandle>, TransitionBlock) BuildArgIterator(Meth
126126
/// <summary>
127127
/// Builds the argument layout for a Wasm thunk from its Wasm signature.
128128
/// </summary>
129-
/// <remarks>
130-
/// <see cref="WasmLowering.RaiseSignature"/> has no way to mark a parameter as the hidden generic context, so it
131-
/// returns it as the first entry of the <see cref="MethodSignature"/> parameter list, with <c>this</c> and the
132-
/// return buffer implied by the signature flags and return type. <see cref="ArgIterator{TTypeHandle}"/> would then
133-
/// lay it out as the first user argument, after the async continuation. Here it is removed from the parameter list
134-
/// and modeled as the hidden instantiation argument, giving the <c>[this] [generic context] [async continuation]
135-
/// [user args]</c> order from docs/design/coreclr/botr/clr-abi.md, which the interpreter and the method's GC ref
136-
/// map also use. On Wasm, the return buffer is not part of the argument area. When the generic context is present,
137-
/// the returned signature omits it, and <see cref="ArgIterator{TTypeHandle}.HasParamType"/> is set.
138-
/// </remarks>
139129
internal static (MethodSignature, ArgIterator<TypeHandle>, TransitionBlock) BuildWasmThunkArgIterator(WasmSignature wasmSignature, TypeSystemContext context)
140130
{
141131
MethodSignature signature = WasmLowering.RaiseSignature(wasmSignature, context);
142132
bool isAsyncCall = wasmSignature.SignatureString.Contains('a');
143133
bool hasGenericContext = WasmLowering.HasGenericContextBeforeAsync(wasmSignature, context);
144134
if (hasGenericContext)
145135
{
136+
// RaiseSignature returns the generic context as the first parameter; lay it out as the hidden
137+
// instantiation argument instead, so it precedes the async continuation.
146138
TypeDesc[] parameters = new TypeDesc[signature.Length - 1];
147139
for (int i = 0; i < parameters.Length; i++)
148140
{

0 commit comments

Comments
 (0)