* il2tests.2.il: New file for generics CIL tests. Add test for #78019.
authorRaja R Harinath <harinath@hurrynot.org>
Wed, 31 May 2006 10:47:15 +0000 (10:47 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Wed, 31 May 2006 10:47:15 +0000 (10:47 -0000)
* Makefile.am: Update.

svn path=/trunk/mono/; revision=61309

mono/mini/ChangeLog
mono/mini/Makefile.am
mono/mini/il2tests.2.il [new file with mode: 0644]

index 8680d00838bd276cb3039a423a5009c7836dbf8b..78f9422b6840c8479e4b317e19ea9d3111746089 100644 (file)
@@ -1,5 +1,9 @@
 2006-05-31  Raja R Harinath  <rharinath@novell.com>
 
+       * il2tests.2.il: New file for generics CIL tests.  Add test for
+       #78019.
+       * Makefile.am: Update.
+
        Fix #78019
        * mini.c (mono_method_to_ir): Don't apply box+brtrue optimization
        to nullable types.
index 36575d4150b9efdb2f06233173a079c09ac99852..124c7332aa39fbdc196336794890107b141af1d1 100644 (file)
@@ -38,7 +38,7 @@ RUNTIME2 = MONO_PATH=$(CLASS2) $(top_builddir)/runtime/mono-wrapper
 MCS = $(RUNTIME) $(CLASS1)/mcs.exe -unsafe -nowarn:0162
 GMCS = $(RUNTIME2) $(CLASS2)/gmcs.exe -unsafe -nowarn:0162
 ILASM = $(RUNTIME) $(CLASS1)/ilasm.exe
-
+ILASM2 = $(RUNTIME2) $(CLASS2)/ilasm.exe
 
 AM_CFLAGS = \
        -I$(top_srcdir)         \
@@ -220,7 +220,7 @@ test_sources =              \
        iltests.il              \
        test.cs
 
-test_sources2 = generics.2.cs
+test_sources2 = generics.2.cs il2tests.2.il
 
 if MONO_DEBUGGER_SUPPORTED
 mono_debugger_sources = debug-debugger.c debug-debugger.h
@@ -229,7 +229,8 @@ mono_debugger_sources =
 endif
 
 regtests=basic.exe arrays.exe basic-float.exe basic-math.exe basic-long.exe objects.exe basic-calls.exe iltests.exe exceptions.exe bench.exe
-regtests2=generics.exe
+regtests2=generics.exe il2tests.exe
+
 common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-float.brg
 
 if X86
@@ -328,6 +329,9 @@ libmono_la_LIBADD = \
 %.exe: %.cs TestDriver.dll
        $(MCS) -out:$@ -unsafe $< -r:TestDriver.dll
 
+%.exe: %.2.il
+       $(ILASM2) -output=$@ $<
+
 %.exe: %.il
        $(ILASM) -output=$@ $<
 
diff --git a/mono/mini/il2tests.2.il b/mono/mini/il2tests.2.il
new file mode 100644 (file)
index 0000000..4212c96
--- /dev/null
@@ -0,0 +1,37 @@
+.assembly il2tests {}
+.assembly extern TestDriver {}
+.assembly extern mscorlib {}
+
+.class public auto ansi sealed beforefieldinit Tests {
+
+       .method static public int32 Main(string[] args) cil managed {
+               .entrypoint
+               
+               ldtoken Tests
+               call       class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+               ldarg.0
+               call       int32 [TestDriver]TestDriver::RunTests(class [mscorlib]System.Type, string[])
+               ret
+       }
+
+       .method private static hidebysig default int32 Foo<T> (!!T n)  cil managed {
+               ldarg.0
+               box !!0
+               brtrue HAS_VALUE
+               ldc.i4.0
+               ret
+HAS_VALUE:     ldc.i4.1
+               ret
+       }
+
+       // bug 78019
+       .method static public int32 test_0_nullable_box_brtrue () cil managed {
+
+               .locals init (valuetype [mscorlib]System.Nullable`1<int32> V_0)
+
+               ldloc.0
+               call int32 class Tests::Foo<valuetype [mscorlib]System.Nullable`1<int32>> (!!0)
+               ret
+       }
+}
+