Author: zoltan
Date: 2007-05-31 17:44:46 -0400 (Thu, 31 May 2007)
New Revision: 78382

Modified:
   trunk/mono/mono/mini/ChangeLog
   trunk/mono/mono/mini/mini-x86.c
Log:
2007-05-31  Zoltan Varga  <[EMAIL PROTECTED]>

        * mini-x86.c (mono_arch_get_delegate_invoke_impl): Implement support 
for the
        static case as well.


Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog      2007-05-31 21:23:27 UTC (rev 78381)
+++ trunk/mono/mono/mini/ChangeLog      2007-05-31 21:44:46 UTC (rev 78382)
@@ -1,5 +1,8 @@
 2007-05-31  Zoltan Varga  <[EMAIL PROTECTED]>
 
+       * mini-x86.c (mono_arch_get_delegate_invoke_impl): Implement support 
for the
+       static case as well.
+
        * tramp-ia64.c (mono_arch_create_trampoline_code): Fix ia64 build.
 
        * mini-x86.c (mono_arch_get_delegate_invoke_impl): New arch dependent 
function.

Modified: trunk/mono/mono/mini/mini-x86.c
===================================================================
--- trunk/mono/mono/mini/mini-x86.c     2007-05-31 21:23:27 UTC (rev 78381)
+++ trunk/mono/mono/mini/mini-x86.c     2007-05-31 21:44:46 UTC (rev 78382)
@@ -4301,6 +4301,7 @@
 {
        guint8 *code, *start;
        MonoDomain *domain = mono_domain_get ();
+       int i;
 
        /* FIXME: Support more cases */
        if (MONO_TYPE_ISSTRUCT (sig->ret))
@@ -4325,11 +4326,26 @@
 
                g_assert ((code - start) < 64);
        } else {
-               /* 
-                * We would need to shift arguments on the stack which isn't 
much faster than
-                * the generic invoke implementation.
-                */
-               start = NULL;
+               for (i = 0; i < sig->param_count; ++i)
+                       if (!mono_is_regsize_var (sig->params [i]))
+                               return NULL;
+
+               mono_domain_lock (domain);
+               start = code = mono_code_manager_reserve (domain->code_mp, 32 + 
(sig->param_count * 8));
+               mono_domain_unlock (domain);
+
+               /* Load this == delegate */
+               x86_mov_reg_membase (code, X86_EAX, X86_ESP, 4, 4);
+
+               /* Push arguments in opposite order, taking changes in ESP into 
account */
+               for (i = 0; i < sig->param_count; ++i)
+                       x86_push_membase (code, X86_ESP, 4 + (sig->param_count 
* 4));
+
+               /* Call the delegate */
+               x86_call_membase (code, X86_EAX, G_STRUCT_OFFSET (MonoDelegate, 
method_ptr));
+               if (sig->param_count > 0)
+                       x86_alu_reg_imm (code, X86_ADD, X86_ESP, 
sig->param_count * 4);
+               x86_ret (code);
        }
 
        return start;

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

Reply via email to