3 using System.Reflection;
4 using System.Runtime.InteropServices;
5 using System.Runtime.CompilerServices;
8 * Regression tests for the AOT/FULL-AOT code.
18 static int Main (String[] args) {
19 return TestDriver.RunTests (typeof (Tests), args);
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);
61 static int test_0_arm64_dyncall_double () {
64 var res = (double)typeof (Foo<double>).GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
71 static int test_0_arm64_dyncall_float () {
74 var res = (float)typeof (Foo<float>).GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
81 static int test_0_arm64_dyncall_hfa_double () {
83 // HFA with double members
84 var s = new Struct1 ();
87 var s_res = (Struct1)typeof (Foo<Struct1>).GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
88 if (s_res.a != 1.0f || s_res.b != 2.0f)
94 static int test_0_arm64_dyncall_hfa_float () {
96 var s = new Struct2 ();
99 var s_res = (Struct2)typeof (Foo<Struct2>).GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
100 if (s_res.a != 1.0f || s_res.b != 2.0f)
105 [Category ("GSHAREDVT")]
106 static int test_0_arm64_dyncall_gsharedvt_out_hfa_double () {
107 /* gsharedvt out trampoline with double hfa argument */
110 var s = new Struct1 ();
113 // Call Foo2.Get_T directly, so its gets an instance
114 Foo2<Struct1>.Get_T (arg1, s);
115 Type t = typeof (Foo3<>).MakeGenericType (new Type [] { typeof (Struct1) });
116 // Call Foo3.Get_T, this will call the gsharedvt instance, which will call the non-gsharedvt instance
117 var s_res = (Struct1)t.GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
118 if (s_res.a != 1.0f || s_res.b != 2.0f)
123 [Category ("GSHAREDVT")]
124 static int test_0_arm64_dyncall_gsharedvt_out_hfa_float () {
125 /* gsharedvt out trampoline with double hfa argument */
128 var s = new Struct2 ();
131 // Call Foo2.Get_T directly, so its gets an instance
132 Foo2<Struct2>.Get_T (arg1, s);
133 Type t = typeof (Foo3<>).MakeGenericType (new Type [] { typeof (Struct2) });
134 // Call Foo3.Get_T, this will call the gsharedvt instance, which will call the non-gsharedvt instance
135 var s_res = (Struct2)t.GetMethod ("Get_T").Invoke (null, new object [] { arg1, s });
136 if (s_res.a != 1.0f || s_res.b != 2.0f)
141 interface IFaceFoo4<T> {
142 T Get_T (double d, T t);
145 class Foo4<T> : IFaceFoo4<T> {
146 public T Get_T (double d, T t) {
147 return Foo2<T>.Get_T (d, t);
151 struct VTypeByRefStruct {
152 public long o1, o2, o3;
156 [Category ("GSHAREDVT")]
157 public static int test_0_arm64_gsharedvt_out_vtypebyref () {
158 /* gsharedvt out trampoline with vtypebyref argument */
159 var s = new VTypeByRefStruct () { o1 = 1, o2 = 2, o3 = 3 };
161 // Call Foo2.Get_T directly, so its gets an instance
162 Foo2<VTypeByRefStruct>.Get_T (1.0f, s);
163 var o = (IFaceFoo4<VTypeByRefStruct>)Activator.CreateInstance (typeof (Foo4<>).MakeGenericType (new Type [] { typeof (VTypeByRefStruct) }));
164 // Call Foo4.Get_T, this will call the gsharedvt instance, which will call the non-gsharedvt instance
165 var s_res = o.Get_T (1.0f, s);
166 if (s_res.o1 != 1 || s_res.o2 != 2 || s_res.o3 != 3)
173 public static T Get_T (object o) {
178 [Category ("!AMD64")]
179 static int test_0_arm64_dyncall_vtypebyref_ret () {
180 var s = new VTypeByRefStruct () { o1 = 1, o2 = 2, o3 = 3 };
181 Type t = typeof (Foo5<>).MakeGenericType (new Type [] { typeof (VTypeByRefStruct) });
182 var o = Activator.CreateInstance (t);
184 var s_res = (VTypeByRefStruct)t.GetMethod ("Get_T").Invoke (o, new object [] { s });
185 if (s_res.o1 != 1 || s_res.o2 != 2 || s_res.o3 != 3)
187 } catch (TargetInvocationException) {