Add a test for JIT temporaries.
authorZoltan Varga <vargaz@gmail.com>
Thu, 9 Sep 2010 03:38:27 +0000 (05:38 +0200)
committerZoltan Varga <vargaz@gmail.com>
Mon, 3 Jan 2011 14:42:16 +0000 (15:42 +0100)
mono/mini/gc-test.cs

index 84ccc5bd1b92e21811e1c9ee761d49d473086417..0e3130cc234f29564a671d66d8fdb0f003a1f9ed 100644 (file)
@@ -451,4 +451,31 @@ class Tests {
                o.GetHashCode ();
                return 0;
        }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       static object alloc_string () {
+               return "A";
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       static object alloc_obj_and_gc () {
+               GC.Collect (1);
+               return new object ();
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       static void liveness_9_call1 (object o1, object o2, object o3) {
+               o1.GetHashCode ();
+               o2.GetHashCode ();
+               o3.GetHashCode ();
+       }
+
+       // Liveness + JIT temporaries
+       public static int test_0_liveness_9 () {
+               // the result of alloc_obj () goes into a vreg, which gets converted to the
+               // JIT temporary because of the branching introduced by the cast
+               // FIXME: This doesn't crash if MONO_TYPE_I is not treated as a GC ref
+               liveness_9_call1 (alloc_obj (), (string)alloc_string (), alloc_obj_and_gc ());
+               return 0;
+       }
 }
\ No newline at end of file