X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fgenerics.cs;h=eafbd1c0e541c9187885ac412d98cdb863ae173e;hb=50e2ecc773eaa9b288261af85f6f2dafd09f4522;hp=1284cb292ae733f3f58dc8b78c5a07d72d31e488;hpb=62c49f89ad1cc35593a00d909ea57bb41955288b;p=mono.git diff --git a/mono/mini/generics.cs b/mono/mini/generics.cs index 1284cb292ae..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 ()); } @@ -1272,6 +1309,88 @@ class Tests 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__