Skip to content

Commit bca175c

Browse files
Handle Generic Context Arg in runtime implementation of signature key computation (#128171)
> [!NOTE] > PR description generated with AI assistance. Fixes issue where methods with generic instantiation arguments cannot be called from managed code if they are called from R2R code. The WASM signature key computation in `helpers.cpp` was not accounting for `HasGenericContextArg()`, which meant that methods requiring a generic instantiation context (hidden argument) would produce an incorrect signature key. This caused call mismatches when managed code invoked R2R-compiled methods with generic context. The fix adds a check for `HasGenericContextArg()` and appends the appropriate `'i'` (integer/pointer) parameter to the signature key buffer, matching the actual calling convention.
1 parent a4e4aee commit bca175c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/coreclr/vm/wasm/helpers.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,13 @@ namespace
947947
pos++;
948948
}
949949

950+
if (sig.HasGenericContextArg())
951+
{
952+
if (pos < maxSize)
953+
keyBuffer[pos] = 'i';
954+
pos++;
955+
}
956+
950957
for (CorElementType argType = sig.NextArg();
951958
argType != ELEMENT_TYPE_END;
952959
argType = sig.NextArg())

0 commit comments

Comments
 (0)