X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fgenerics.cs;h=e9b41a64e08ab33fe63924edf89aeec83d2b0b52;hb=4f187040c6f09094b6d53a3926931bcc73bcfd15;hp=1284cb292ae733f3f58dc8b78c5a07d72d31e488;hpb=fb197673ce77081b0e28cbf6056e9bee44e0430c;p=mono.git diff --git a/mono/mini/generics.cs b/mono/mini/generics.cs index 1284cb292ae..e9b41a64e08 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 ()); } @@ -1272,6 +1309,67 @@ class Tests return 0; } + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static bool is_ref_or_contains_refs () { + 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; + } + + 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; + + return 0; + } } #if !__MOBILE__