Skip to content

Enable multi-dim array interpreter test #115916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions src/tests/JIT/interpreter/Interpreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -845,10 +845,11 @@ public static void RunInterpreterTests()
Console.WriteLine("TestLdtoken");
if (!TestLdtoken())
Environment.FailFast(null);
/*

Console.WriteLine("TestMdArray");
if (!TestMdArray())
Environment.FailFast(null);
*/

Console.WriteLine("TestExceptionHandling");
TestExceptionHandling();

Expand Down Expand Up @@ -2246,13 +2247,28 @@ public static bool TestLdtoken()

public static bool TestMdArray()
{
// FIXME: This generates roughly:
// newobj int[,].ctor
// ldtoken int[,]
// call System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray
// The newobj currently fails because int[,].ctor isn't a real method, the interp needs to use getCallInfo to determine how to invoke it
int[,] a = { { 1, 2 }, { 3, 4 } };
return a[0, 1] == 2;
if (a[0, 1] != 2)
return false;

object[,] b = new object[1, 1];
ref object bElt = ref b[0, 0];
bElt = null;

object[,] c = new string[1, 1];

try
{
ref object cElt = ref c[0, 0];
return false;
}
catch (ArrayTypeMismatchException)
{
}

ref readonly object cElt2 = ref c[0, 0];

return true;
}

private static int _fieldA;
Expand Down
Loading