[mono/mono] [2 commits] f2c57662: [runtime] Fix warnings.

"Zoltan Varga ([email protected])" <[email protected]> Tue, 5 Nov 2013 14:46:19 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014228ba7ca2-04c3f3ef-9780-421f-ac40-5a532b80cdee-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/c2dfadefc2d5...1832b006bad3

   Commit: f2c5766230dec03e739bd0ccc05bab0ad3e0f483
   Author: Zoltan Varga <[email protected]> (vargaz)
     Date: 2013-11-05 14:44:24 GMT
      URL: https://github.com/mono/mono/commit/f2c5766230dec03e739bd0ccc05bab0ad3e0f483

[runtime] Fix warnings.

Changed paths:
  M mono/io-layer/processes.c
  M mono/metadata/sgen-debug.c
  M mono/metadata/sgen-los.c
  M mono/metadata/sgen-memory-governor.c

Modified: mono/io-layer/processes.c
===================================================================
@@ -1715,10 +1715,11 @@ static GSList *load_modules (void)
 
 		slide = _dyld_get_image_vmaddr_slide (i);
 		name = _dyld_get_image_name (i);
-		hdr = _dyld_get_image_header (i);
 #if SIZEOF_VOID_P == 8
+		hdr = (const struct mach_header_64*)_dyld_get_image_header (i);
 		sec = getsectbynamefromheader_64 (hdr, SEG_DATA, SECT_DATA);
 #else
+		hdr = _dyld_get_image_header (i);
 		sec = getsectbynamefromheader (hdr, SEG_DATA, SECT_DATA);
 #endif
 
@@ -2119,9 +2120,11 @@ static gchar *get_process_name_from_proc (pid_t pid)
 	size_t size;
 	struct kinfo_proc2 *pi;
 #elif defined(PLATFORM_MACOSX)
+#if !(!defined (__mono_ppc__) && defined (TARGET_OSX))
 	size_t size;
 	struct kinfo_proc *pi;
 	int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid };
+#endif
 #else
 	FILE *fp;
 	gchar *filename = NULL;

Modified: mono/metadata/sgen-debug.c
===================================================================
@@ -133,7 +133,7 @@
 	printf ("Descriptor type: %d (%s)\n", type, descriptor_types [type]);
 
 	size = sgen_safe_object_get_size ((MonoObject*)ptr);
-	printf ("Size: %td\n", size);
+	printf ("Size: %d\n", (int)size);
 }
 
 void

Modified: mono/metadata/sgen-los.c
===================================================================
@@ -510,10 +510,10 @@ struct _LOSSection {
 		vtable = (MonoVTable*)SGEN_LOAD_VTABLE (obj->data);
 
 		if (obj->data == ptr) {
-			SGEN_LOG (0, "%s (size %td pin %d)\n", los_kind, size, pinned ? 1 : 0);
+			SGEN_LOG (0, "%s (size %d pin %d)\n", los_kind, (int)size, pinned ? 1 : 0);
 		} else {
-			SGEN_LOG (0, "%s (interior-ptr offset %td size %td pin %d)",
-					los_kind, ptr - obj->data, size, pinned ? 1 : 0);
+			SGEN_LOG (0, "%s (interior-ptr offset %td size %d pin %d)",
+					  los_kind, ptr - obj->data, (int)size, pinned ? 1 : 0);
 		}
 
 		return TRUE;

Modified: mono/metadata/sgen-memory-governor.c
===================================================================
@@ -139,11 +139,11 @@
 	if (debug_print_allowance) {
 		mword old_major = last_collection_old_num_major_sections * major_collector.section_size;
 
-		SGEN_LOG (1, "Before collection: %td bytes (%td major, %td LOS)",
-				old_major + last_collection_old_los_memory_usage, old_major, last_collection_old_los_memory_usage);
-		SGEN_LOG (1, "After collection: %td bytes (%td major, %td LOS)",
-				new_heap_size, new_major, last_collection_los_memory_usage);
-		SGEN_LOG (1, "Allowance: %td bytes", minor_collection_allowance);
+		SGEN_LOG (1, "Before collection: %ld bytes (%ld major, %ld LOS)",
+				  (long)(old_major + last_collection_old_los_memory_usage), (long)old_major, (long)last_collection_old_los_memory_usage);
+		SGEN_LOG (1, "After collection: %ld bytes (%ld major, %ld LOS)",
+				  (long)new_heap_size, (long)new_major, (long)last_collection_los_memory_usage);
+		SGEN_LOG (1, "Allowance: %ld bytes", (long)minor_collection_allowance);
 	}
 
 	if (major_collector.have_computed_minor_collection_allowance)

   Commit: 1832b006bad3f3b2a5dc98550dd4af0586be72b3
   Author: Zoltan Varga <[email protected]> (vargaz)
     Date: 2013-11-05 14:44:24 GMT
      URL: https://github.com/mono/mono/commit/1832b006bad3f3b2a5dc98550dd4af0586be72b3

[runtime] Handle unaligned access in all interlocked icalls. Fixes #15925.

Changed paths:
  M mono/metadata/threads.c

Modified: mono/metadata/threads.c
===================================================================
@@ -1790,6 +1790,16 @@ gint32 ves_icall_System_Threading_Interlocked_Increment_Int (gint32 *location)
 
 gint64 ves_icall_System_Threading_Interlocked_Increment_Long (gint64 *location)
 {
+#if SIZEOF_VOID_P == 4
+	if (G_UNLIKELY ((size_t)location & 0x7)) {
+		gint64 ret;
+		mono_interlocked_lock ();
+		(*location)++;
+		ret = *location;
+		mono_interlocked_unlock ();
+		return ret;
+	}
+#endif
 	return InterlockedIncrement64 (location);
 }
 
@@ -1800,6 +1810,16 @@ gint32 ves_icall_System_Threading_Interlocked_Decrement_Int (gint32 *location)
 
 gint64 ves_icall_System_Threading_Interlocked_Decrement_Long (gint64 * location)
 {
+#if SIZEOF_VOID_P == 4
+	if (G_UNLIKELY ((size_t)location & 0x7)) {
+		gint64 ret;
+		mono_interlocked_lock ();
+		(*location)--;
+		ret = *location;
+		mono_interlocked_unlock ();
+		return ret;
+	}
+#endif
 	return InterlockedDecrement64 (location);
 }
 
@@ -1834,6 +1854,16 @@ gfloat ves_icall_System_Threading_Interlocked_Exchange_Single (gfloat *location,
 gint64 
 ves_icall_System_Threading_Interlocked_Exchange_Long (gint64 *location, gint64 value)
 {
+#if SIZEOF_VOID_P == 4
+	if (G_UNLIKELY ((size_t)location & 0x7)) {
+		gint64 ret;
+		mono_interlocked_lock ();
+		ret = *location;
+		*location = value;
+		mono_interlocked_unlock ();
+		return ret;
+	}
+#endif
 	return InterlockedExchange64 (location, value);
 }
 
@@ -1905,7 +1935,7 @@ gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single (gfloat *lo
 ves_icall_System_Threading_Interlocked_CompareExchange_Long (gint64 *location, gint64 value, gint64 comparand)
 {
 #if SIZEOF_VOID_P == 4
-	if ((size_t)location & 0x7) {
+	if (G_UNLIKELY ((size_t)location & 0x7)) {
 		gint64 old;
 		mono_interlocked_lock ();
 		old = *location;
@@ -1945,12 +1975,31 @@ gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single (gfloat *lo
 gint64 
 ves_icall_System_Threading_Interlocked_Add_Long (gint64 *location, gint64 value)
 {
+#if SIZEOF_VOID_P == 4
+	if (G_UNLIKELY ((size_t)location & 0x7)) {
+		gint64 ret;
+		mono_interlocked_lock ();
+		*location += value;
+		ret = *location;
+		mono_interlocked_unlock ();
+		return ret;
+	}
+#endif
 	return InterlockedAdd64 (location, value);
 }
 
 gint64 
 ves_icall_System_Threading_Interlocked_Read_Long (gint64 *location)
 {
+#if SIZEOF_VOID_P == 4
+	if (G_UNLIKELY ((size_t)location & 0x7)) {
+		gint64 ret;
+		mono_interlocked_lock ();
+		ret = *location;
+		mono_interlocked_unlock ();
+		return ret;
+	}
+#endif
 	return InterlockedRead64 (location);
 }
 


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