Author: zoltan
Date: 2005-05-26 08:43:17 -0400 (Thu, 26 May 2005)
New Revision: 45041

Modified:
   trunk/mono/mono/mini/ChangeLog
   trunk/mono/mono/mini/iltests.il
   trunk/mono/mono/mini/mini.c
Log:
2005-05-26  Zoltan Varga  <[EMAIL PROTECTED]>

        * iltests.il: Add a new test.

        * mini.c (mono_method_to_ir): Initialize valuetypes when created using
        newobj. Fixes #75042.


Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog      2005-05-26 12:40:19 UTC (rev 45040)
+++ trunk/mono/mono/mini/ChangeLog      2005-05-26 12:43:17 UTC (rev 45041)
@@ -1,3 +1,10 @@
+2005-05-26  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * iltests.il: Add a new test.
+
+       * mini.c (mono_method_to_ir): Initialize valuetypes when created using
+       newobj. Fixes #75042.
+
 2005-05-22  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * *-ia64.*: Ongoing IA64 work.

Modified: trunk/mono/mono/mini/iltests.il
===================================================================
--- trunk/mono/mono/mini/iltests.il     2005-05-26 12:40:19 UTC (rev 45040)
+++ trunk/mono/mono/mini/iltests.il     2005-05-26 12:43:17 UTC (rev 45041)
@@ -680,24 +680,6 @@
                        ret
        }
 
-       .class nested private auto ansi sealed beforefieldinit FooStruct 
-               extends [mscorlib]System.ValueType {
-
-               .method public hidebysig specialname rtspecialname instance 
void .ctor () cil managed {
-                       .maxstack 8
-                       ret
-               }
-       }
-
-       .method public static int32 test_0_newobj_vtype () {
-               .maxstack 8
-
-               newobj instance void Tests/FooStruct::.ctor()
-               pop
-               ldc.i4.0
-               ret
-       }
-
        .method public static int32 test_7_conv_ovf_u8_un () {
        .maxstack  2
         .locals    init (unsigned int64)
@@ -758,4 +740,35 @@
                ceq
                ret
        }
+
+       .class nested private auto ansi sealed xxx
+       extends [mscorlib]System.ValueType
+   {
+     .field  public   object a
+
+     .method public hidebysig  specialname  rtspecialname 
+            instance default void .ctor ()  cil managed 
+     {
+                .maxstack 8
+                ret 
+     }
+   } // end of class xxx
+
+       .method public static int32 test_0_newobj_vtype () {
+               .maxstack 6
+               .locals init (
+                       valuetype Tests/xxx V_0
+               )
+
+               newobj instance void valuetype Tests/xxx::.ctor ()
+               stloc.0
+               ldloca.s 0
+               ldfld object Tests/xxx::a
+               brfalse OK
+               ldc.i4.s 1
+               ret
+       OK:
+               ldc.i4.s 0
+               ret
+       }
 }

Modified: trunk/mono/mono/mini/mini.c
===================================================================
--- trunk/mono/mono/mini/mini.c 2005-05-26 12:40:19 UTC (rev 45040)
+++ trunk/mono/mono/mini/mini.c 2005-05-26 12:43:17 UTC (rev 45041)
@@ -4691,8 +4691,13 @@
                                if (cmethod->klass->valuetype) {
                                        iargs [0] = mono_compile_create_var 
(cfg, &cmethod->klass->byval_arg, OP_LOCAL);
                                        temp = iargs [0]->inst_c0;
+
                                        NEW_TEMPLOADA (cfg, *sp, temp);
 
+                                       handle_initobj (cfg, bblock, *sp, NULL, 
cmethod->klass, stack_start, sp);
+
+                                       NEW_TEMPLOADA (cfg, *sp, temp);
+
                                        /* 
                                         * The code generated by 
mini_emit_virtual_call () expects
                                         * iargs [0] to be a boxed instance, 
but luckily the vcall

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to