X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Faot-tests.cs;h=36c7a15a3e8fe91e1c44ebe8d40cf6546c441994;hb=fa7f66c939d6a52b951920d4f2616c898c5a8bc6;hp=79ed12a7e18064a497af6d9f75fa1ecb2291f978;hpb=4e4013721304d8da777f3137a9857e387c7cf548;p=mono.git diff --git a/mono/mini/aot-tests.cs b/mono/mini/aot-tests.cs index 79ed12a7e18..36c7a15a3e8 100644 --- a/mono/mini/aot-tests.cs +++ b/mono/mini/aot-tests.cs @@ -84,6 +84,7 @@ class Tests } [Category ("DYNCALL")] + [Category ("!FULLAOT-AMD64")] static int test_0_arm64_dyncall_hfa_double () { double arg1 = 1.0f; // HFA with double members @@ -97,6 +98,7 @@ class Tests } [Category ("DYNCALL")] + [Category ("!FULLAOT-AMD64")] static int test_0_arm64_dyncall_hfa_float () { double arg1 = 1.0f; var s = new Struct2 (); @@ -110,6 +112,7 @@ class Tests [Category ("DYNCALL")] [Category ("GSHAREDVT")] + [Category ("!FULLAOT-AMD64")] static int test_0_arm64_dyncall_gsharedvt_out_hfa_double () { /* gsharedvt out trampoline with double hfa argument */ double arg1 = 1.0f; @@ -129,6 +132,7 @@ class Tests [Category ("DYNCALL")] [Category ("GSHAREDVT")] + [Category ("!FULLAOT-AMD64")] static int test_0_arm64_dyncall_gsharedvt_out_hfa_float () { /* gsharedvt out trampoline with double hfa argument */ double arg1 = 1.0f; @@ -190,6 +194,8 @@ class Tests } [Category ("DYNCALL")] + [Category ("GSHAREDVT")] + [Category ("!FULLAOT-AMD64")] static int test_0_arm64_dyncall_vtypebyref_ret () { var s = new VTypeByRefStruct () { o1 = 1, o2 = 2, o3 = 3 }; Type t = typeof (Foo5<>).MakeGenericType (new Type [] { typeof (VTypeByRefStruct) }); @@ -210,7 +216,8 @@ class Tests } } - [Category("DYNCALL")] + [Category ("DYNCALL")] + [Category ("GSHAREDVT")] static int test_0_arm_dyncall_reg_stack_split () { var m = typeof (Foo6).GetMethod ("reg_stack_split_inner").MakeGenericMethod (new Type[] { typeof (long) }); var o = new Foo6 (); @@ -238,9 +245,20 @@ class Tests public static T GetValue(Nullable value) where T : struct { return value.Value; } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static Nullable Get(T t) where T : struct { + return t; + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static Nullable GetNull() where T : struct { + return null; + } } [Category ("DYNCALL")] + [Category ("!FULLAOT-AMD64")] public static int test_0_dyncall_nullable () { int? v; @@ -259,6 +277,14 @@ class Tests var res = (int)typeof (NullableMethods).GetMethod ("GetValue").MakeGenericMethod (new Type [] { typeof (int) }).Invoke (null, new object [] { v }); if (res != 42) return 3; + + NullableMethods.Get (42); + var res2 = (int?)typeof (NullableMethods).GetMethod ("Get").MakeGenericMethod (new Type [] { typeof (int) }).Invoke (null, new object [] { 42 }); + if (res2 != 42) + return 4; + res2 = (int?)typeof (NullableMethods).GetMethod ("GetNull").MakeGenericMethod (new Type [] { typeof (int) }).Invoke (null, new object [] { }); + if (res2.HasValue) + return 5; return 0; } @@ -349,6 +375,7 @@ class Tests return 0; } + [Category ("DYNCALL")] public static int test_0_array_accessor_runtime_invoke_ref () { var t = typeof (string[]); var arr = Array.CreateInstance (typeof (string), 1); @@ -363,10 +390,99 @@ class Tests values.Select (x => x).ToArray (); } + [Category ("GSHAREDVT")] public static int test_0_delegate_invoke_wrappers_gsharedvt () { var enums = new LongEnum [] { LongEnum.A }; SetArrayValue_ (enums); return 0; } + struct LargeStruct { + public int a, b, c, d; + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static bool GetHasValue(T? value) where T : struct + { + return value.HasValue; + } + + [Category ("DYNCALL")] + [Category ("!FULLAOT-AMD64")] + public static int test_0_large_nullable_invoke () { + var s = new LargeStruct () { a = 1, b = 2, c = 3, d = 4 }; + + GetHasValue (s); + +#if __MOBILE__ + var m = typeof(AotTests).GetMethod("GetHasValue", BindingFlags.Static | BindingFlags.Public); +#else + var m = typeof(Tests).GetMethod("GetHasValue", BindingFlags.Static | BindingFlags.Public); +#endif + + Type type = typeof (LargeStruct?).GetGenericArguments () [0]; + bool b1 = (bool)m.MakeGenericMethod (new Type[] {type}).Invoke (null, new object[] { s }); + if (!b1) + return 1; + bool b2 = (bool)m.MakeGenericMethod (new Type[] {type}).Invoke (null, new object[] { null }); + if (b2) + return 2; + return 0; + } + + struct FpStruct { + public float a, b, c; + } + + struct LargeStruct2 { + public FpStruct x; + public int a, b, c, d, e, f, g, h; + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + static int pass_hfa_on_stack (FpStruct s1, FpStruct s2, FpStruct s3) { + return (int)s3.c; + } + + public static int test_10_arm64_hfa_on_stack_llvm () { + var arr = new LargeStruct2 [10, 10]; + for (int i = 0; i < 10; ++i) + for (int j = 0; j < 10; ++j) + arr [i, j].x = new FpStruct (); + + var s1 = new FpStruct () { a = 1, b = 1, c = 10 }; + return pass_hfa_on_stack (s1, s1, s1); + } + + public static int test_0_get_current_method () { + var m = MethodBase.GetCurrentMethod (); +#if __MOBILE__ + var m2 = typeof (AotTests).GetMethod ("test_0_get_current_method"); +#else + var m2 = typeof (Tests).GetMethod ("test_0_get_current_method"); +#endif + return m == m2 ? 0 : 1; + } + + class GetCurrentMethodClass { + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public MethodBase get_current () { + return MethodBase.GetCurrentMethod (); + } + } + + public static int test_0_get_current_method_generic () { + var c = new GetCurrentMethodClass (); + var m = c.get_current (); + var m2 = typeof (GetCurrentMethodClass<>).GetMethod ("get_current"); + return m == m2 ? 0 : 1; + } + + public static int test_0_array_wrappers_runtime_invoke () { + string[][] arr = new string [10][]; + IEnumerable iface = arr; + var m = typeof(IEnumerable).GetMethod ("GetEnumerator"); + m.Invoke (arr, null); + return 0; + } }