Author: zoltan
Date: 2008-02-17 11:06:24 -0500 (Sun, 17 Feb 2008)
New Revision: 95978

Modified:
   trunk/mono/mono/mini/ChangeLog
   trunk/mono/mono/mini/mini-x86.c
Log:
2008-02-17  Zoltan Varga  <[EMAIL PROTECTED]>

        * mini-x86.c: Use cfg->vret_addr instead of cfg->ret.


Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog      2008-02-17 15:56:39 UTC (rev 95977)
+++ trunk/mono/mono/mini/ChangeLog      2008-02-17 16:06:24 UTC (rev 95978)
@@ -1,5 +1,7 @@
 2008-02-17  Zoltan Varga  <[EMAIL PROTECTED]>
 
+       * mini-x86.c: Use cfg->vret_addr instead of cfg->ret.
+
        * mini.h (MonoCompile): Add new 'vret_addr' field which represents the 
hidden
        argument holding the vtype return address, to avoid the ambigious use of
        cfg->ret for this purpose.

Modified: trunk/mono/mono/mini/mini-x86.c
===================================================================
--- trunk/mono/mono/mini/mini-x86.c     2008-02-17 15:56:39 UTC (rev 95977)
+++ trunk/mono/mono/mini/mini-x86.c     2008-02-17 16:06:24 UTC (rev 95978)
@@ -863,9 +863,23 @@
 
        switch (cinfo->ret.storage) {
        case ArgOnStack:
-               cfg->ret->opcode = OP_REGOFFSET;
-               cfg->ret->inst_basereg = X86_EBP;
-               cfg->ret->inst_offset = cinfo->ret.offset + ARGS_OFFSET;
+               if (MONO_TYPE_ISSTRUCT (sig->ret)) {
+                       /* 
+                        * In the new IR, the cfg->vret_addr variable 
represents the
+                        * vtype return value.
+                        */
+                       cfg->vret_addr->opcode = OP_REGOFFSET;
+                       cfg->vret_addr->inst_basereg = cfg->frame_reg;
+                       cfg->vret_addr->inst_offset = cinfo->ret.offset + 
ARGS_OFFSET;
+                       if (G_UNLIKELY (cfg->verbose_level > 1)) {
+                               printf ("vret_addr =");
+                               mono_print_ins (cfg->vret_addr);
+                       }
+               } else {
+                       cfg->ret->opcode = OP_REGOFFSET;
+                       cfg->ret->inst_basereg = X86_EBP;
+                       cfg->ret->inst_offset = cinfo->ret.offset + ARGS_OFFSET;
+               }
                break;
        case ArgValuetypeInReg:
                break;
@@ -914,6 +928,9 @@
 
        if (cinfo->ret.storage == ArgValuetypeInReg)
                cfg->ret_var_is_local = TRUE;
+       if ((cinfo->ret.storage != ArgValuetypeInReg) && MONO_TYPE_ISSTRUCT 
(sig->ret)) {
+               cfg->vret_addr = mono_compile_create_var (cfg, 
&mono_defaults.int_class->byval_arg, OP_ARG);
+       }
 }
 
 /* Fixme: we need an alignment solution for enter_method and 
mono_arch_call_opcode,

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

Reply via email to