X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fgenerics.cs;h=eafbd1c0e541c9187885ac412d98cdb863ae173e;hb=91149fb1e524882128d180a9ba5f4d0f13e31521;hp=04b4e544933452b1f4e56149c235a69c492c0598;hpb=60e1beca4a884cf219670c0822994263a52309e4;p=mono.git diff --git a/mono/mini/generics.cs b/mono/mini/generics.cs index 04b4e544933..eafbd1c0e54 100644 --- a/mono/mini/generics.cs +++ b/mono/mini/generics.cs @@ -233,6 +233,42 @@ class Tests return 0; } + interface NonGenericInterface { + int return_field (); + } + + interface GenericInterface : NonGenericInterface { + T not_used (); + } + + struct ImplementGenericInterface : GenericInterface { + public Object padding1; + public Object padding2; + public Object padding3; + public T[] arr_t; + + public ImplementGenericInterface (T[] arr_t) { + this.padding1 = null; + this.padding2 = null; + this.padding3 = null; + this.arr_t = arr_t; + } + + public T not_used () { + return arr_t [0]; + } + + public int return_field () { + return arr_t.Length; + } + } + + public static int test_8_struct_implements_generic_interface () { + int[] arr = {1, 2, 3, 4}; + NonGenericInterface s = new ImplementGenericInterface (arr); + return s.return_field () + s.return_field (); + } + public static int test_0_generic_get_value_optimization_vtype () { TestStruct[] arr = new TestStruct[] { new TestStruct (100, 200), new TestStruct (300, 400) }; IEnumerator enumerator = GenericClass.Y (arr); @@ -898,6 +934,7 @@ class Tests } [Category ("!FULLAOT")] + [Category ("!BITCODE")] public static int test_0_regress_668095_synchronized_gshared () { return DoSomething (new DefaultRetriever ()); } @@ -990,6 +1027,19 @@ class Tests return 0; } + class AClass { + } + + class BClass : AClass { + } + + public static int test_0_fullaot_variant_iface () { + var arr = new BClass [10]; + var enumerable = (IEnumerable)arr; + enumerable.GetEnumerator (); + return 0; + } + struct Record : Foo2.IRecord { int counter; int Foo2.IRecord.DoSomething () { @@ -1231,6 +1281,116 @@ class Tests test("a", "b", "c", "d", "e", "f", "g", "h"); return delegate_8_args_res == "h" ? 0 : 1; } + + static void throw_catch_t () where T: Exception { + try { + throw new NotSupportedException (); + } catch (T) { + } + } + + public static int test_0_gshared_catch_open_type () { + throw_catch_t (); + return 0; + } + + class ThrowClass where T: Exception { + public void throw_catch_t () { + try { + throw new NotSupportedException (); + } catch (T) { + } + } + } + + public static int test_0_gshared_catch_open_type_instance () { + var c = new ThrowClass (); + c.throw_catch_t (); + return 0; + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static bool is_ref_or_contains_refs () { + return RuntimeHelpers.IsReferenceOrContainsReferences (); + } + + class IsRefClass { + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public bool is_ref () { + return RuntimeHelpers.IsReferenceOrContainsReferences (); + } + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static bool is_ref_or_contains_refs_gen_ref () { + return RuntimeHelpers.IsReferenceOrContainsReferences> (); + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static bool is_ref_or_contains_refs_gen_noref () { + return RuntimeHelpers.IsReferenceOrContainsReferences> (); + } + + struct GenStruct { + T t; + } + + struct NoRefGenStruct { + } + + struct RefStruct { + string s; + } + + struct NestedRefStruct { + RefStruct r; + } + + struct NoRefStruct { + int i; + } + + struct AStruct3 { + T1 t1; + T2 t2; + T3 t3; + } + + public static int test_0_isreference_intrins () { + if (RuntimeHelpers.IsReferenceOrContainsReferences ()) + return 1; + if (!RuntimeHelpers.IsReferenceOrContainsReferences ()) + return 2; + if (!RuntimeHelpers.IsReferenceOrContainsReferences ()) + return 3; + if (!RuntimeHelpers.IsReferenceOrContainsReferences ()) + return 4; + if (RuntimeHelpers.IsReferenceOrContainsReferences ()) + return 5; + // Generic code + if (is_ref_or_contains_refs ()) + return 6; + // Shared code + if (!is_ref_or_contains_refs ()) + return 7; + // Complex type from shared code + if (!is_ref_or_contains_refs_gen_ref ()) + return 8; + if (is_ref_or_contains_refs_gen_ref ()) + return 9; + if (is_ref_or_contains_refs_gen_noref ()) + return 10; + + // Complex type from shared class method + var c1 = new IsRefClass> (); + if (c1.is_ref ()) + return 11; + var c2 = new IsRefClass> (); + if (!c2.is_ref ()) + return 12; + + return 0; + } } #if !__MOBILE__