Author: zoltan
Date: 2006-08-08 11:31:24 -0400 (Tue, 08 Aug 2006)
New Revision: 63489

Modified:
   trunk/mono/mono/mini/ChangeLog
   trunk/mono/mono/mini/mini-sparc.c
Log:
2006-08-08  Zoltan Varga  <[EMAIL PROTECTED]>

        * mini-sparc.c (mono_arch_call_opcode): Fix #79027.


Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog      2006-08-08 15:25:34 UTC (rev 63488)
+++ trunk/mono/mono/mini/ChangeLog      2006-08-08 15:31:24 UTC (rev 63489)
@@ -1,5 +1,7 @@
 2006-08-08  Zoltan Varga  <[EMAIL PROTECTED]>
 
+       * mini-sparc.c (mono_arch_call_opcode): Fix #79027.
+
        * mini-x86.c (mono_arch_call_opcode): Handle the case where there are no
        implicit arguments in a vararg call. Fixes #79027.
 

Modified: trunk/mono/mono/mini/mini-sparc.c
===================================================================
--- trunk/mono/mono/mini/mini-sparc.c   2006-08-08 15:25:34 UTC (rev 63488)
+++ trunk/mono/mono/mini/mini-sparc.c   2006-08-08 15:31:24 UTC (rev 63489)
@@ -1027,6 +1027,38 @@
        return group;
 }
 
+static void
+emit_sig_cookie (MonoCompile *cfg, MonoCallInst *call)
+{
+       MonoInst *arg;
+       MonoMethodSignature *tmp_sig;
+       MonoInst *sig_arg;
+
+       /*
+        * mono_ArgIterator_Setup assumes the signature cookie is 
+        * passed first and all the arguments which were before it are
+        * passed on the stack after the signature. So compensate by 
+        * passing a different signature.
+        */
+       tmp_sig = mono_metadata_signature_dup (call->signature);
+       tmp_sig->param_count -= call->signature->sentinelpos;
+       tmp_sig->sentinelpos = 0;
+       memcpy (tmp_sig->params, call->signature->params + 
call->signature->sentinelpos, tmp_sig->param_count * sizeof (MonoType*));
+
+       /* FIXME: Add support for signature tokens to AOT */
+       cfg->disable_aot = TRUE;
+       /* We allways pass the signature on the stack for simplicity */
+       MONO_INST_NEW (cfg, arg, OP_SPARC_OUTARG_MEM);
+       arg->inst_right = make_group (cfg, (MonoInst*)call, sparc_sp, 
ARGS_OFFSET + cinfo->sig_cookie.offset);
+       MONO_INST_NEW (cfg, sig_arg, OP_ICONST);
+       sig_arg->inst_p0 = tmp_sig;
+       arg->inst_left = sig_arg;
+       arg->type = STACK_PTR;
+       /* prepend, so they get reversed */
+       arg->next = call->out_args;
+       call->out_args = arg;
+}
+
 /* 
  * take the arguments and generate the arch-specific
  * instructions to properly call the function in call.
@@ -1052,32 +1084,7 @@
 
                if ((sig->call_convention == MONO_CALL_VARARG) && (i == 
sig->sentinelpos)) {
                        /* Emit the signature cookie just before the first 
implicit argument */
-                       MonoInst *sig_arg;
-                       MonoMethodSignature *tmp_sig;
-
-                       /*
-                        * mono_ArgIterator_Setup assumes the signature cookie 
is 
-                        * passed first and all the arguments which were before 
it are
-                        * passed on the stack after the signature. So 
compensate by 
-                        * passing a different signature.
-                        */
-                       tmp_sig = mono_metadata_signature_dup (call->signature);
-                       tmp_sig->param_count -= call->signature->sentinelpos;
-                       tmp_sig->sentinelpos = 0;
-                       memcpy (tmp_sig->params, call->signature->params + 
call->signature->sentinelpos, tmp_sig->param_count * sizeof (MonoType*));
-
-                       /* FIXME: Add support for signature tokens to AOT */
-                       cfg->disable_aot = TRUE;
-                       /* We allways pass the signature on the stack for 
simplicity */
-                       MONO_INST_NEW (cfg, arg, OP_SPARC_OUTARG_MEM);
-                       arg->inst_right = make_group (cfg, (MonoInst*)call, 
sparc_sp, ARGS_OFFSET + cinfo->sig_cookie.offset);
-                       MONO_INST_NEW (cfg, sig_arg, OP_ICONST);
-                       sig_arg->inst_p0 = tmp_sig;
-                       arg->inst_left = sig_arg;
-                       arg->type = STACK_PTR;
-                       /* prepend, so they get reversed */
-                       arg->next = call->out_args;
-                       call->out_args = arg;
+                       emit_sig_cookie (cfg, call);
                }
 
                if (is_virtual && i == 0) {
@@ -1196,6 +1203,11 @@
                }
        }
 
+       /* Handle the case where there are no implicit arguments */
+       if (!sig->pinvoke && (sig->call_convention == MONO_CALL_VARARG) && (n 
== sentinelpos)) {
+               emit_sig_cookie (cfg, call);
+       }
+
        /*
         * Reverse the call->out_args list.
         */

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

Reply via email to