Permalink
Browse files

2008-04-10 Mark Probst <mark.probst@gmail.com>

	* generic-box.2.cs, generic-boxing.2.il, generic-delegate.2.cs,
	generic-ldobj.2.il, generic-ldtoken.2.il,
	generic-ldtoken-field.2.il, generic-ldtoken-method.2.il,
	generic-mkrefany.2.il, generic-sizeof.2.cs, generic-tailcall.2.il,
	generic-unbox.2.cs, generic-unboxing.2.il, generic-virtual.2.cs,
	generics-sharing.2.cs: New test cases for generic sharing.

	* Makefile.am: Added tests.

svn path=/trunk/mono/; revision=100326
  • Loading branch information...
1 parent c0fb294 commit 72cfa85a6021ce9747ca8759a0cf8825857be591 @schani schani committed Apr 10, 2008
View
@@ -1,3 +1,14 @@
+2008-04-10 Mark Probst <mark.probst@gmail.com>
+
+ * generic-box.2.cs, generic-boxing.2.il, generic-delegate.2.cs,
+ generic-ldobj.2.il, generic-ldtoken.2.il,
+ generic-ldtoken-field.2.il, generic-ldtoken-method.2.il,
+ generic-mkrefany.2.il, generic-sizeof.2.cs, generic-tailcall.2.il,
+ generic-unbox.2.cs, generic-unboxing.2.il, generic-virtual.2.cs,
+ generics-sharing.2.cs: New test cases for generic sharing.
+
+ * Makefile.am: Added tests.
+
2008-03-31 Mark Probst <mark.probst@gmail.com>
* Makefile.am: Re-enabled CoreCLR security tests. Fixes #362626.
View
@@ -257,7 +257,9 @@ BASE_TEST_CS_SRC= \
shared-generic-synchronized.2.cs \
generic-inlining.2.cs \
generic-initobj.2.cs \
- generic-box.2.cs \
+ generic-delegate.2.cs \
+ generic-sizeof.2.cs \
+ generic-virtual.2.cs \
recursive-generics.2.cs \
bug-80392.2.cs \
dynamic-method-access.2.cs \
@@ -348,7 +350,14 @@ TEST_IL_SRC= \
resolve_method_bug.2.il \
resolve_field_bug.2.il \
resolve_type_bug.2.il \
- generics-sharing-other-exc.2.il
+ generics-sharing-other-exc.2.il \
+ generic-sizeof.2.il \
+ generic-ldobj.2.il \
+ generic-mkrefany.2.il \
+ generic-ldtoken.2.il \
+ generic-ldtoken-method.2.il \
+ generic-ldtoken-field.2.il \
+ generic-tailcall.2.il
# bug-318677.il
@@ -640,15 +649,42 @@ test-coreclr-security : coreclr-security.exe
$(RUNTIME21) --security=core-clr-test coreclr-security.exe
endif
+generic-unboxing.2.dll : generic-unboxing.2.il
+ $(ILASM) /dll /output:generic-unboxing.2.dll $(srcdir)/generic-unboxing.2.il
+
+generic-boxing.2.dll : generic-boxing.2.il generic-unboxing.2.dll
+ $(ILASM) /dll /output:generic-boxing.2.dll $(srcdir)/generic-boxing.2.il
+
+generic-unbox.2.exe : generic-unbox.2.cs generic-unboxing.2.dll
+ $(MCS) -r:generic-unboxing.2.dll $(srcdir)/generic-unbox.2.cs
+
+generic-box.2.exe : generic-box.2.cs generic-unboxing.2.dll generic-boxing.2.dll
+ $(MCS) -r:generic-unboxing.2.dll,generic-boxing.2.dll $(srcdir)/generic-box.2.cs
+
test-generic-sharing : generics-sharing.2.exe shared-generic-methods.2.exe \
shared-generic-synchronized.2.exe generic-initobj.2.exe \
- generics-sharing-other-exc.2.exe generic-box.2.exe
- $(RUNTIME) -O=gshared generics-sharing.2.exe
- $(RUNTIME) -O=gshared,-inline shared-generic-methods.2.exe
- $(RUNTIME) -O=gshared shared-generic-synchronized.2.exe
- $(RUNTIME) -O=gshared,-inline generic-initobj.2.exe
- $(RUNTIME) -O=gshared,-inline generic-box.2.exe
- $(RUNTIME) -O=gshared,-inline generics-sharing-other-exc.2.exe
+ generics-sharing-other-exc.2.exe generic-box.2.exe \
+ generic-unbox.2.exe generic-delegate.2.exe generic-sizeof.2.exe \
+ generic-ldobj.2.exe generic-mkrefany.2.exe \
+ generic-ldtoken.2.exe \
+ generic-ldtoken-method.2.exe generic-ldtoken-field.2.exe \
+ generic-virtual.2.exe generic-tailcall.2.exe
+ $(RUNTIME) -O=gshared,-inline generics-sharing.2.exe
+ $(RUNTIME) -O=gshared,-inline shared-generic-methods.2.exe
+ $(RUNTIME) -O=gshared,-inline shared-generic-synchronized.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-initobj.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-box.2.exe
+ $(RUNTIME) -O=gshared,-inline generics-sharing-other-exc.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-unbox.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-delegate.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-sizeof.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-ldobj.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-mkrefany.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-ldtoken.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-ldtoken-method.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-ldtoken-field.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-virtual.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-tailcall.2.exe
EXTRA_DIST += async-exceptions.cs
async-exceptions.exe : async-exceptions.cs
@@ -1,4 +1,6 @@
using System.Collections.Generic;
+using UnboxTest;
+using BoxTest;
public class ClassA {}
@@ -56,6 +58,16 @@ public class main {
return 1;
*/
+ UnboxerStruct<ClassA> us;
+ Boxer<ClassA> b = new Boxer<ClassA> ();
+
+ us.field = 123;
+
+ if (((UnboxerStruct<ClassA>?)b.boxNullable (us)).Value.field != 123)
+ return 1;
+ if (b.boxNullable (null) != null)
+ return 1;
+
return 0;
}
}
@@ -0,0 +1,55 @@
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly extern 'generic-unboxing.2'
+{
+ .ver 0:0:0:0
+}
+.assembly 'generic-boxing.2'
+{
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
+ 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'generic-boxing.2.dll' // GUID = {9C29868F-7AD1-40CC-BBDC-DF985AB656FC}
+
+
+.namespace BoxTest
+{
+ .class public auto ansi beforefieldinit Boxer`1<T>
+ extends [mscorlib]System.Object
+ {
+
+ // method line 1
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20ec
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method Boxer`1::.ctor
+
+ // method line 2
+ .method public hidebysig
+ instance default object boxNullable (valuetype [mscorlib]System.Nullable`1<valuetype ['generic-unboxing.2']UnboxTest.UnboxerStruct`1<!T>> us) cil managed
+ {
+ // Method begins at RVA 0x20f4
+ // Code size 15 (0xf)
+ .maxstack 8
+ IL_0000: ldarg.1
+ // IL_0004: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ['generic-unboxing.2']UnboxTest.UnboxerStruct`1<!T>>::get_Value()
+ IL_0009: box valuetype [mscorlib]System.Nullable`1<valuetype ['generic-unboxing.2']UnboxTest.UnboxerStruct`1<!T>>
+ IL_000e: ret
+ } // end of method Boxer`1::boxNullable
+
+ } // end of class BoxTest.Boxer`1
+}
+
@@ -0,0 +1,58 @@
+public class ClassA {}
+
+public delegate int IntDelegate (int x);
+public delegate T[] TDelegate<T> ();
+
+public class Gen<T> {
+ public int intFunction (int x) {
+ return x + 1;
+ }
+
+ public IntDelegate getIntDelegate () {
+ return intFunction;
+ }
+
+ public virtual int virtIntFunction (int x) {
+ return x + 2;
+ }
+
+ public IntDelegate getVirtIntDelegate () {
+ return virtIntFunction;
+ }
+
+ public T[] tFunction () {
+ return new T[3];
+ }
+
+ public TDelegate<T> getTDelegate () {
+ return tFunction;
+ }
+
+ public static T[] staticTFunction () {
+ return new T[3];
+ }
+
+ public TDelegate<T> getStaticTDelegate () {
+ return staticTFunction;
+ }
+}
+
+public class main {
+ public static int Main () {
+ Gen<ClassA> ga = new Gen<ClassA> ();
+ IntDelegate id = ga.getIntDelegate ();
+ TDelegate<ClassA> tda = ga.getTDelegate ();
+ IntDelegate vid = ga.getVirtIntDelegate ();
+ TDelegate<ClassA> stda = ga.getStaticTDelegate ();
+
+ if (id (123) != 124)
+ return 1;
+ if (tda ().GetType () != typeof (ClassA[]))
+ return 1;
+ if (vid (123) != 125)
+ return 1;
+ if (stda ().GetType () != typeof (ClassA[]))
+ return 1;
+ return 0;
+ }
+}
@@ -0,0 +1,164 @@
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'generic-mkrefany.2'
+{
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
+ 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'generic-mkrefany.2.exe' // GUID = {51FFBB77-6AFB-435E-B206-16DB5C8A3730}
+
+
+ .class public auto ansi beforefieldinit ClassA
+ extends [mscorlib]System.Object
+ {
+
+ // method line 1
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20ec
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method ClassA::.ctor
+
+ } // end of class ClassA
+
+ .class public sequential ansi sealed beforefieldinit GenStruct`1<T>
+ extends [mscorlib]System.ValueType
+ {
+ .field public int32 field1
+ .field public !0 field2
+
+ } // end of class GenStruct`1
+
+ .class public auto ansi beforefieldinit Gen`1<T>
+ extends [mscorlib]System.Object
+ {
+
+ // method line 2
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20f4
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method Gen`1::.ctor
+
+ // method line 3
+ .method public hidebysig
+ instance default !T ident (!T t) cil managed
+ {
+ // Method begins at RVA 0x20fc
+ // Code size 4 (0x4)
+ .maxstack 1
+ .locals init (
+ !T V_0)
+ IL_0000: ldarg.1
+ IL_0001: stloc.0
+ ldloca 0
+ ldobj !0
+ IL_0003: ret
+ } // end of method Gen`1::ident
+
+ // method line 4
+ .method public hidebysig
+ instance default valuetype GenStruct`1<!T> structIdent (valuetype GenStruct`1<!T> gst) cil managed
+ {
+ // Method begins at RVA 0x210c
+ // Code size 4 (0x4)
+ .maxstack 1
+ .locals init (
+ valuetype GenStruct`1<!T> V_0)
+ IL_0000: ldarg.1
+ IL_0001: stloc.0
+ ldloca 0
+ ldobj valuetype GenStruct`1<!0>
+ IL_0003: ret
+ } // end of method Gen`1::structIdent
+
+ } // end of class Gen`1
+
+ .class public auto ansi beforefieldinit main
+ extends [mscorlib]System.Object
+ {
+
+ // method line 5
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x211c
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method main::.ctor
+
+ // method line 6
+ .method public static hidebysig
+ default int32 Main () cil managed
+ {
+ // Method begins at RVA 0x2124
+ .entrypoint
+ // Code size 94 (0x5e)
+ .maxstack 8
+ .locals init (
+ class ClassA V_0,
+ valuetype GenStruct`1<class ClassA> V_1,
+ class Gen`1<class ClassA> V_2,
+ valuetype GenStruct`1<class ClassA> V_3)
+ IL_0000: newobj instance void class ClassA::'.ctor'()
+ IL_0005: stloc.0
+ IL_0006: ldloca.s 1
+ IL_0008: ldc.i4.s 0x7b
+ IL_000a: stfld int32 valuetype GenStruct`1<class ClassA>::field1
+ IL_000f: ldloca.s 1
+ IL_0011: ldloc.0
+ IL_0012: stfld !0 valuetype GenStruct`1<class ClassA>::field2
+ IL_0017: newobj instance void class Gen`1<class ClassA>::'.ctor'()
+ IL_001c: stloc.2
+ IL_001d: ldloc.2
+ IL_001e: ldloc.0
+ IL_001f: callvirt instance !0 class Gen`1<class ClassA>::ident(!0)
+ IL_0024: ldloc.0
+ IL_0025: beq IL_002c
+
+ IL_002a: ldc.i4.1
+ IL_002b: ret
+ IL_002c: ldloc.2
+ IL_002d: ldloc.1
+ IL_002e: callvirt instance valuetype GenStruct`1<!0> class Gen`1<class ClassA>::structIdent(valuetype GenStruct`1<!0>)
+ IL_0033: stloc.3
+ IL_0034: ldloca.s 3
+ IL_0036: ldfld int32 valuetype GenStruct`1<class ClassA>::field1
+ IL_003b: ldloca.s 1
+ IL_003d: ldfld int32 valuetype GenStruct`1<class ClassA>::field1
+ IL_0042: bne.un IL_005a
+
+ IL_0047: ldloca.s 3
+ IL_0049: ldfld !0 valuetype GenStruct`1<class ClassA>::field2
+ IL_004e: ldloca.s 1
+ IL_0050: ldfld !0 valuetype GenStruct`1<class ClassA>::field2
+ IL_0055: beq IL_005c
+
+ IL_005a: ldc.i4.1
+ IL_005b: ret
+ IL_005c: ldc.i4.0
+ IL_005d: ret
+ } // end of method main::Main
+
+ } // end of class main
+
Oops, something went wrong.

0 comments on commit 72cfa85

Please sign in to comment.