[Gc] Minor fix for Darwin

Ivan Maidanski ivmai at mail.ru
Wed Nov 5 05:16:43 PST 2008


Hi!

The patch replaces GC_abort() calls with ABORT() for Darwin target (affects only SMALL_CONFIG).

Also, some changes to "test.c" file:
- AO_t is used (instead of "unsigned") for "n_tests" counter if THREADS;
- djgpp-specific code for setting stack bottom is removed (to allow automatic stack bottom setting in GC_init_inner()).

PS. Multi-threaded GC for Mac OS X 10.4.1 i386 doesn't work (aborts with "thread_get_state() failed" (code 4)). May be, it works for newer OS builds.

Bye.

-------------- next part --------------
diff -ru bdwgc/dyn_load.c updated/bdwgc/dyn_load.c
--- bdwgc/dyn_load.c	2008-10-25 17:19:26.000000000 +0400
+++ updated/bdwgc/dyn_load.c	2008-11-05 11:11:11.252480300 +0300
@@ -1151,7 +1151,7 @@
 #   endif
       
       if(!_dyld_bind_fully_image_containing_address((unsigned long*)GC_malloc))
-        GC_abort("_dyld_bind_fully_image_containing_address failed");
+        ABORT("_dyld_bind_fully_image_containing_address failed");
     }
 
 }
diff -ru bdwgc/include/private/darwin_semaphore.h updated/bdwgc/include/private/darwin_semaphore.h
--- bdwgc/include/private/darwin_semaphore.h	2005-10-11 03:33:34.000000000 +0400
+++ updated/bdwgc/include/private/darwin_semaphore.h	2008-11-05 11:17:58.236855300 +0300
@@ -21,7 +21,7 @@
 static int sem_init(sem_t *sem, int pshared, int value) {
     int ret;
     if(pshared)
-        GC_abort("sem_init with pshared set");
+        ABORT("sem_init with pshared set");
     sem->value = value;
     
     ret = pthread_mutex_init(&sem->mutex,NULL);
diff -ru bdwgc/misc.c updated/bdwgc/misc.c
--- bdwgc/misc.c	2008-10-31 22:16:14.000000000 +0300
+++ updated/bdwgc/misc.c	2008-11-05 11:10:35.299355300 +0300
@@ -1061,7 +1061,7 @@
     return old;
 }
 
-#if !defined(PCR) && (!defined(SMALL_CONFIG) || defined(DARWIN))
+#if !defined(PCR) && !defined(SMALL_CONFIG)
 void GC_abort(const char *msg)
 {
 #   if defined(MSWIN32) && !defined(DONT_USE_USER32_DLL)
diff -ru bdwgc/tests/test.c updated/bdwgc/tests/test.c
--- bdwgc/tests/test.c	2008-10-31 21:26:18.000000000 +0300
+++ updated/bdwgc/tests/test.c	2008-11-05 14:22:15.672000600 +0300
@@ -868,7 +868,11 @@
 #   endif
 }
 
-unsigned n_tests = 0;
+#ifdef THREADS
+  AO_t n_tests = 0;
+#else
+  unsigned n_tests = 0;
+#endif
 
 GC_word bm_huge[10] = {
     0xffffffff,
@@ -1233,7 +1237,7 @@
 #   endif
 		GC_invoke_finalizers();
       }
-    (void)GC_printf("Completed %u tests\n", n_tests);
+    (void)GC_printf("Completed %u tests\n", (unsigned)n_tests);
     (void)GC_printf("Allocated %d collectable objects\n", collectable_count);
     (void)GC_printf("Allocated %d uncollectable objects\n",
 		    uncollectable_count);
@@ -1326,16 +1330,7 @@
   int main()
 #endif
 {
-#   if defined(DJGPP)
-	int dummy;
-#   endif
     n_tests = 0;
-    
-#   if defined(DJGPP)
-	/* No good way to determine stack base from library; do it */
-	/* manually on this platform.				   */
-    	GC_stackbottom = (void *)(&dummy);
-#   endif
 #   if defined(MACOS)
 	/* Make sure we have lots and lots of stack space. 	*/
 	SetMinimumStack(cMinStackSpace);


More information about the Gc mailing list