3 using System.Reflection;
4 using System.Runtime.InteropServices;
5 using System.Runtime.CompilerServices;
8 * Regression tests for the AOT/FULL-AOT code.
19 return TestDriver.RunTests (typeof (Tests));
23 public delegate void ArrayDelegate (int[,] arr);
25 static int test_0_array_delegate_full_aot () {
26 ArrayDelegate d = delegate (int[,] arr) {
28 int[,] a = new int[5, 6];
29 d.BeginInvoke (a, null, null);
42 /* The 'd' argument is used to shift the register indexes so 't' doesn't start at the first reg */
43 public static T Get_T (double d, T t) {
49 public static T Get_T (double d, T t) {
55 public static T Get_T (double d, T t) {
56 return Foo2<T>.Get_T (d, t);
60 static int test_0_arm64_dyncall_double () {
63 var res = (double)typeof (Foo<double>).GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
69 static int test_0_arm64_dyncall_float () {
72 var res = (float)typeof (Foo<float>).GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
78 static int test_0_arm64_dyncall_hfa_double () {
80 // HFA with double members
81 var s = new Struct1 ();
84 var s_res = (Struct1)typeof (Foo<Struct1>).GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
85 if (s_res.a != 1.0f || s_res.b != 2.0f)
90 static int test_0_arm64_dyncall_hfa_float () {
92 var s = new Struct2 ();
95 var s_res = (Struct2)typeof (Foo<Struct2>).GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
96 if (s_res.a != 1.0f || s_res.b != 2.0f)
101 static int test_0_arm64_dyncall_gsharedvt_out_hfa_double () {
102 /* gsharedvt out trampoline with double hfa argument */
105 var s = new Struct1 ();
108 // Call Foo2.Get_T directly, so its gets an instance
109 Foo2<Struct1>.Get_T (arg1, s);
110 Type t = typeof (Foo3<>).MakeGenericType (new Type [] { typeof (Struct1) });
111 // Call Foo3.Get_T, this will call the gsharedvt instance, which will call the non-gsharedvt instance
112 var s_res = (Struct1)t.GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
113 if (s_res.a != 1.0f || s_res.b != 2.0f)
118 static int test_0_arm64_dyncall_gsharedvt_out_hfa_float () {
119 /* gsharedvt out trampoline with double hfa argument */
122 var s = new Struct2 ();
125 // Call Foo2.Get_T directly, so its gets an instance
126 Foo2<Struct2>.Get_T (arg1, s);
127 Type t = typeof (Foo3<>).MakeGenericType (new Type [] { typeof (Struct2) });
128 // Call Foo3.Get_T, this will call the gsharedvt instance, which will call the non-gsharedvt instance
129 var s_res = (Struct2)t.GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
130 if (s_res.a != 1.0f || s_res.b != 2.0f)
135 interface IFaceFoo4<T> {
136 T Get_T (double d, T t);
139 class Foo4<T> : IFaceFoo4<T> {
140 public T Get_T (double d, T t) {
141 return Foo2<T>.Get_T (d, t);
145 struct VTypeByRefStruct {
146 public long o1, o2, o3;
149 public static int test_0_arm64_gsharedvt_out_vtypebyref () {
150 /* gsharedvt out trampoline with vtypebyref argument */
151 var s = new VTypeByRefStruct () { o1 = 1, o2 = 2, o3 = 3 };
153 // Call Foo2.Get_T directly, so its gets an instance
154 Foo2<VTypeByRefStruct>.Get_T (1.0f, s);
155 var o = (IFaceFoo4<VTypeByRefStruct>)Activator.CreateInstance (typeof (Foo4<>).MakeGenericType (new Type [] { typeof (VTypeByRefStruct) }));
156 // Call Foo4.Get_T, this will call the gsharedvt instance, which will call the non-gsharedvt instance
157 var s_res = o.Get_T (1.0f, s);
158 if (s_res.o1 != 1 || s_res.o2 != 2 || s_res.o3 != 3)