Author: lupus
Date: 2007-10-10 13:29:35 -0400 (Wed, 10 Oct 2007)
New Revision: 87282

Modified:
   trunk/mono/mono/mini/ChangeLog
   trunk/mono/mono/mini/mini-arm.c
Log:


Wed Oct 10 19:44:42 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>

        * mini-arm.c: unify the call emission to emit_code_seq().



Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog      2007-10-10 17:22:43 UTC (rev 87281)
+++ trunk/mono/mono/mini/ChangeLog      2007-10-10 17:29:35 UTC (rev 87282)
@@ -1,4 +1,8 @@
 
+Wed Oct 10 19:44:42 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
+
+       * mini-arm.c: unify the call emission to emit_code_seq().
+
 Wed Oct 10 13:05:46 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
 
        * tramp-arm.c: reduced the trampoline size.

Modified: trunk/mono/mono/mini/mini-arm.c
===================================================================
--- trunk/mono/mono/mini/mini-arm.c     2007-10-10 17:22:43 UTC (rev 87281)
+++ trunk/mono/mono/mini/mini-arm.c     2007-10-10 17:29:35 UTC (rev 87282)
@@ -154,6 +154,21 @@
        return code;
 }
 
+static guint8*
+emit_call_seq (MonoCompile *cfg, guint8 *code)
+{
+       if (cfg->method->dynamic) {
+               ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
+               ARM_B (code, 0);
+               *(gpointer*)code = NULL;
+               code += 4;
+               code = emit_call_reg (code, ARMREG_IP);
+       } else {
+               ARM_BL (code, 0);
+       }
+       return code;
+}
+
 /*
  * mono_arch_get_argument_info:
  * @csig:  a method signature
@@ -1734,6 +1749,9 @@
                                return 1;
                        } else if ((thunks [0] == 0) && (thunks [1] == 0) && 
(thunks [2] == 0)) {
                                /* found a free slot instead: emit thunk */
+                               /* ARMREG_IP is fine to use since this can't be 
an IMT call
+                                * which is indirect
+                                */
                                code = (guchar*)thunks;
                                ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
                                if (thumb_supported)
@@ -2388,15 +2406,7 @@
                                mono_add_patch_info (cfg, offset, 
MONO_PATCH_INFO_METHOD, call->method);
                        else
                                mono_add_patch_info (cfg, offset, 
MONO_PATCH_INFO_ABS, call->fptr);
-                       if (cfg->method->dynamic) {
-                               ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
-                               ARM_B (code, 0);
-                               *(gpointer*)code = NULL;
-                               code += 4;
-                               code = emit_call_reg (code, ARMREG_IP);
-                       } else {
-                               ARM_BL (code, 0);
-                       }
+                       code = emit_call_seq (cfg, code);
                        break;
                case OP_FCALL_REG:
                case OP_LCALL_REG:
@@ -2454,15 +2464,7 @@
                                ARM_MOV_REG_REG (code, ARMREG_R0, ins->sreg1);
                        mono_add_patch_info (cfg, code - cfg->native_code, 
MONO_PATCH_INFO_INTERNAL_METHOD, 
                                             
(gpointer)"mono_arch_throw_exception");
-                       if (cfg->method->dynamic) {
-                               ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
-                               ARM_B (code, 0);
-                               *(gpointer*)code = NULL;
-                               code += 4;
-                               code = emit_call_reg (code, ARMREG_IP);
-                       } else {
-                               ARM_BL (code, 0);
-                       }
+                       code = emit_call_seq (cfg, code);
                        break;
                }
                case OP_RETHROW: {
@@ -2470,15 +2472,7 @@
                                ARM_MOV_REG_REG (code, ARMREG_R0, ins->sreg1);
                        mono_add_patch_info (cfg, code - cfg->native_code, 
MONO_PATCH_INFO_INTERNAL_METHOD, 
                                             
(gpointer)"mono_arch_rethrow_exception");
-                       if (cfg->method->dynamic) {
-                               ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
-                               ARM_B (code, 0);
-                               *(gpointer*)code = NULL;
-                               code += 4;
-                               code = emit_call_reg (code, ARMREG_IP);
-                       } else {
-                               ARM_BL (code, 0);
-                       }
+                       code = emit_call_seq (cfg, code);
                        break;
                }
                case OP_START_HANDLER:
@@ -3300,15 +3294,7 @@
 
                mono_add_patch_info (cfg, code - cfg->native_code, 
MONO_PATCH_INFO_INTERNAL_METHOD, 
                             (gpointer)"mono_get_lmf_addr");
-               if (cfg->method->dynamic) {
-                       ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
-                       ARM_B (code, 0);
-                       *(gpointer*)code = NULL;
-                       code += 4;
-                       code = emit_call_reg (code, ARMREG_IP);
-               } else {
-                       ARM_BL (code, 0);
-               }
+               code = emit_code_seq (cfg, code);
                /* we build the MonoLMF structure on the stack - see mini-arm.h 
*/
                /* lmf_offset is the offset from the previous stack pointer,
                 * alloc_size is the total stack space allocated, so the offset

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

Reply via email to