Skip to content

Commit 41aa5d5

Browse files
authored
Enable multi-dim array interpreter test (#115916)
Expand and enable the multi-dim array interpreter test
1 parent dc580c1 commit 41aa5d5

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

src/tests/JIT/interpreter/Interpreter.cs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -845,10 +845,11 @@ public static void RunInterpreterTests()
845845
Console.WriteLine("TestLdtoken");
846846
if (!TestLdtoken())
847847
Environment.FailFast(null);
848-
/*
848+
849+
Console.WriteLine("TestMdArray");
849850
if (!TestMdArray())
850851
Environment.FailFast(null);
851-
*/
852+
852853
Console.WriteLine("TestExceptionHandling");
853854
TestExceptionHandling();
854855

@@ -2246,13 +2247,28 @@ public static bool TestLdtoken()
22462247

22472248
public static bool TestMdArray()
22482249
{
2249-
// FIXME: This generates roughly:
2250-
// newobj int[,].ctor
2251-
// ldtoken int[,]
2252-
// call System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray
2253-
// The newobj currently fails because int[,].ctor isn't a real method, the interp needs to use getCallInfo to determine how to invoke it
22542250
int[,] a = { { 1, 2 }, { 3, 4 } };
2255-
return a[0, 1] == 2;
2251+
if (a[0, 1] != 2)
2252+
return false;
2253+
2254+
object[,] b = new object[1, 1];
2255+
ref object bElt = ref b[0, 0];
2256+
bElt = null;
2257+
2258+
object[,] c = new string[1, 1];
2259+
2260+
try
2261+
{
2262+
ref object cElt = ref c[0, 0];
2263+
return false;
2264+
}
2265+
catch (ArrayTypeMismatchException)
2266+
{
2267+
}
2268+
2269+
ref readonly object cElt2 = ref c[0, 0];
2270+
2271+
return true;
22562272
}
22572273

22582274
private static int _fieldA;

0 commit comments

Comments
 (0)