[mono/mono] [3 commits] 0a2c38df: [corlib] Improve the exception message in Delegate::Remove.

"Rodrigo Kumpera ([email protected])" <[email protected]> Tue, 12 Nov 2013 19:12:35 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <000001424dbac83e-21f7b7ee-ce6b-4f67-bed3-5971adc0ddd9-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/cff65d2ae524...06ba83bfb7e5

   Commit: 0a2c38df5e4c905354f3f4ff1d4493a81cf1ab03
   Author: Rodrigo Kumpera <[email protected]> (kumpera)
     Date: 2013-11-12 19:01:25 GMT
      URL: https://github.com/mono/mono/commit/0a2c38df5e4c905354f3f4ff1d4493a81cf1ab03

[corlib] Improve the exception message in Delegate::Remove.

Changed paths:
  M mcs/class/corlib/System/Delegate.cs

Modified: mcs/class/corlib/System/Delegate.cs
===================================================================
@@ -527,7 +527,7 @@ public static Delegate Remove (Delegate source, Delegate value)
 				return source;
 
 			if (source.GetType () != value.GetType ())
-				throw new ArgumentException ("Delegate type mismatch");
+				throw new ArgumentException (Locale.GetText ("Incompatible Delegate Types. First is {0} second is {1}.", a.GetType ().FullName, b.GetType ().FullName));
 
 			return source.RemoveImpl (value);
 		}

   Commit: ef3524b2673aaf332ac83f9d552f8d1164cedc8d
   Author: Rodrigo Kumpera <[email protected]> (kumpera)
     Date: 2013-11-12 19:01:25 GMT
      URL: https://github.com/mono/mono/commit/ef3524b2673aaf332ac83f9d552f8d1164cedc8d

[jit] Improve arm IMT debugging.

Changed paths:
  M mono/mini/mini-arm.c

Modified: mono/mini/mini-arm.c
===================================================================
@@ -5929,7 +5929,7 @@ enum {
 #define CMP_SIZE (3 * 4)
 #define BRANCH_SIZE (1 * 4)
 #define CALL_SIZE (2 * 4)
-#define WMC_SIZE (5 * 4)
+#define WMC_SIZE (8 * 4)
 #define DISTANCE(A, B) (((gint32)(B)) - ((gint32)(A)))
 
 #ifdef USE_JUMP_TABLES
@@ -5965,6 +5965,15 @@ enum {
 }
 #endif
 
+#ifdef ENABLE_WRONG_METHOD_CHECK
+void
+mini_dump_bad_imt (int input_imt, int compared_imt, int pc)
+{
+	g_print ("BAD IMT comparing %x with expected %x at ip %x", input_imt, compared_imt, pc);
+	g_assert (0);
+}
+#endif
+
 gpointer
 mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count,
 	gpointer fail_tramp)
@@ -5979,6 +5988,9 @@ enum {
 	arminstr_t *vtable_target = NULL;
 	int extra_space = 0;
 #endif
+#ifdef ENABLE_WRONG_METHOD_CHECK
+	char * cond;
+#endif
 
 	size = BASE_SIZE;
 #ifdef USE_JUMP_TABLES
@@ -6033,11 +6045,11 @@ enum {
 		code = mono_domain_code_reserve (domain, size);
 	start = code;
 
-#if DEBUG_IMT
-	printf ("building IMT thunk for class %s %s entries %d code size %d code at %p end %p vtable %p\n", vtable->klass->name_space, vtable->klass->name, count, size, start, ((guint8*)start) + size, vtable);
+#ifdef DEBUG_IMT
+	g_print ("Building IMT thunk for class %s %s entries %d code size %d code at %p end %p vtable %p fail_tramp %p\n", vtable->klass->name_space, vtable->klass->name, count, size, start, ((guint8*)start) + size, vtable, fail_tramp);
 	for (i = 0; i < count; ++i) {
 		MonoIMTCheckItem *item = imt_entries [i];
-		printf ("method %d (%p) %s vtable slot %p is_equals %d chunk size %d\n", i, item->key, item->key->name, &vtable->vtable [item->value.vtable_slot], item->is_equals, item->chunk_size);
+		g_print ("method %d (%p) %s vtable slot %p is_equals %d chunk size %d\n", i, item->key, ((MonoMethod*)item->key)->name, &vtable->vtable [item->value.vtable_slot], item->is_equals, item->chunk_size);
 	}
 #endif
 
@@ -6121,10 +6133,19 @@ enum {
 				ARM_LDR_IMM (code, ARMREG_R1, ARMREG_PC, 0);
 #endif
 				ARM_CMP_REG_REG (code, ARMREG_R0, ARMREG_R1);
-				ARM_B_COND (code, ARMCOND_NE, 1);
-
+				cond = code;
+				ARM_B_COND (code, ARMCOND_EQ, 0);
+
+/* Define this if your system is so bad that gdb is failing. */
+#ifdef BROKEN_DEV_ENV
+				ARM_MOV_REG_REG (code, ARMREG_R2, ARMREG_PC);
+				ARM_BL (code, 0);
+				arm_patch (code - 1, mini_dump_bad_imt);
+#else
 				ARM_DBRK (code);
 #endif
+				arm_patch (cond, code);
+#endif
 			}
 
 			if (item->has_target_code) {
@@ -6281,7 +6302,7 @@ enum {
 		}
 	}
 
-#if DEBUG_IMT
+#ifdef DEBUG_IMT
 	{
 		char *buff = g_strdup_printf ("thunk_for_class_%s_%s_entries_%d", vtable->klass->name_space, vtable->klass->name, count);
 		mono_disassemble_code (NULL, (guint8*)start, size, buff);

   Commit: 06ba83bfb7e51f3e280d0254af76daa05d9d9805
   Author: Rodrigo Kumpera <[email protected]> (kumpera)
     Date: 2013-11-12 19:01:26 GMT
      URL: https://github.com/mono/mono/commit/06ba83bfb7e51f3e280d0254af76daa05d9d9805

[jit] Use unsigned comparisons with the IMT thunks as they can live in high memory addresses.

Changed paths:
  M mono/mini/mini-arm.c

Modified: mono/mini/mini-arm.c
===================================================================
@@ -6264,15 +6264,15 @@ enum {
 #ifdef USE_JUMP_TABLES
 			code = load_element_with_regbase_cond (code, ARMREG_R1, ARMREG_R2, IMT_METHOD_JTI (i), ARMCOND_AL);
 			ARM_CMP_REG_REG (code, ARMREG_R0, ARMREG_R1);
-			code = load_element_with_regbase_cond (code, ARMREG_R1, ARMREG_R2, JUMP_CODE_JTI (i), ARMCOND_GE);
-			ARM_BX_COND (code, ARMCOND_GE, ARMREG_R1);
+			code = load_element_with_regbase_cond (code, ARMREG_R1, ARMREG_R2, JUMP_CODE_JTI (i), ARMCOND_HS);
+			ARM_BX_COND (code, ARMCOND_HS, ARMREG_R1);
 			item->jmp_code = GUINT_TO_POINTER (JUMP_CODE_JTI (i));
 #else
 			ARM_LDR_IMM (code, ARMREG_R1, ARMREG_PC, 0);
 			ARM_CMP_REG_REG (code, ARMREG_R0, ARMREG_R1);
 
 			item->jmp_code = (guint8*)code;
-			ARM_B_COND (code, ARMCOND_GE, 0);
+			ARM_B_COND (code, ARMCOND_HS, 0);
 			++extra_space;
 #endif
 		}


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