Skip to content

Commit 40dac00

Browse files
AndyAyersMSCopilot
andauthored
Crossgen2: pass the hidden type arg for wasm array Address thunks (#133624)
Array address methods need a hidden instantiation argument. Fixes #133307 > [!NOTE] > This PR description was generated with the assistance of GitHub Copilot. --------- Co-authored-by: Copilot <[email protected]> Copilot-Session: 69d6e452-03d7-4aee-aa05-fbe185a200b0
1 parent 217339b commit 40dac00

3 files changed

Lines changed: 3 additions & 14 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ public static unsafe WasmSignature GetSignature(MethodSignature signature, CORIN
589589
public static LoweringFlags GetLoweringFlags(MethodDesc method)
590590
{
591591
LoweringFlags flags = 0;
592-
if (method.RequiresInstMethodDescArg() || method.RequiresInstMethodTableArg())
592+
if (method.RequiresInstMethodDescArg() || method.RequiresInstMethodTableArg() || method.IsArrayAddressMethod())
593593
{
594594
flags |= LoweringFlags.HasGenericContextArg;
595595
}

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,7 @@ internal static (ArgIterator<TypeHandle>, TransitionBlock) BuildArgIterator(Meth
9292
parameterTypes[parameterIndex] = new TypeHandle(signature[parameterIndex]);
9393
}
9494
CallingConventions callingConventions = (hasThis ? CallingConventions.ManagedInstance : CallingConventions.ManagedStatic);
95-
bool hasParamType = methodRequiresInstArg && !isUnboxingStub;
96-
97-
// On X86 the Array address method doesn't use IL stubs, and instead has a custom calling convention
98-
if ((context.Target.Architecture == TargetArchitecture.X86) &&
99-
methodIsArrayAddressMethod)
100-
{
101-
hasParamType = true;
102-
}
95+
bool hasParamType = (methodRequiresInstArg && !isUnboxingStub) || methodIsArrayAddressMethod;
10396

10497
bool hasAsyncContinuation = methodIsAsyncCall;
10598
// We shouldn't be compiling unboxing stubs for async methods yet.

‎src/tests/readytorun/crossgen2/Program.cs‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,11 +2272,7 @@ public static int Main()
22722272
RunTest("ExplicitlySizedClassTest", ExplicitlySizedClassTest());
22732273
RunTest("GenericLdtokenTest", GenericLdtokenTest());
22742274
RunTest("ArrayLdtokenTests", ArrayLdtokenTests());
2275-
// ActiveIssue https://github.com/dotnet/runtime/issues/133307
2276-
if (!PlatformDetection.IsWasm || !PlatformDetection.IsReadyToRunCompiled)
2277-
{
2278-
RunTest("TestGenericMDArrayBehavior", TestGenericMDArrayBehavior());
2279-
}
2275+
RunTest("TestGenericMDArrayBehavior", TestGenericMDArrayBehavior());
22802276
RunTest("TestWithStructureNonBlittableFieldDueToGenerics", TestWithStructureNonBlittableFieldDueToGenerics());
22812277
RunTest("TestSingleElementStructABI", TestSingleElementStructABI());
22822278
RunTest("TestEnumLayoutAlignments", TestEnumLayoutAlignments());

0 commit comments

Comments
 (0)