patch for presumed typo in boehm-gc/misc.c

Boehm, Hans hans_boehm@hp.com
Thu Apr 5 14:37:00 GMT 2001


Per -

Here's a patch that backs out the problematic piece of the misc.c fix.  It
simultaneously reduces the amount of memory clearing to 1/4 of the old
version by adjusting a constant.  I did some quick testing on it with a
slightly older 3.0 Itanium tree.  That looked fine.  I'm still building the
current 3.0 tree on X86.

Given that the new code was clearly not being tested when I though it was, I
think this is safer, and should have most of the benefit.

Could you try it, and check it in if it works for you?  I believe it needs
to go into both 3.0 and the trunk, since the files should be the same.

Thanks.

Hans

Index: misc.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/misc.c,v
retrieving revision 1.12.4.1
diff -u -r1.12.4.1 misc.c
--- misc.c	2001/04/05 00:13:13	1.12.4.1
+++ misc.c	2001/04/05 21:23:19
@@ -206,10 +206,10 @@
  */
 word GC_stack_last_cleared = 0;	/* GC_no when we last did this */
 # ifdef THREADS
-#   define BIG_CLEAR_SIZE 2048	/* Clear this much now and then.	*/
-#   define SMALL_CLEAR_SIZE 256 /* Clear this much every time.		*/
+#   define CLEAR_SIZE 512
+# else
+#   define CLEAR_SIZE 213
 # endif
-# define CLEAR_SIZE 213  /* Granularity for GC_clear_stack_inner */
 # define DEGRADE_RATE 50
 
 word GC_min_sp;		/* Coolest stack pointer value from which
we've */
@@ -266,12 +266,10 @@
 {
     register word sp = (word)GC_approx_sp();  /* Hotter than actual sp */
 #   ifdef THREADS
-        word dummy[SMALL_CLEAR_SIZE];
-	unsigned random_no = 0;  /* Should be more random than it is ... */
-				 /* Used to occasionally clear a bigger	 */
-				 /* chunk.				 */
+        word dummy[CLEAR_SIZE];
+#   else
+    	register word limit;
 #   endif
-    register word limit;
     
 #   define SLOP 400
 	/* Extra bytes we clear every time.  This clears our own	*/
@@ -289,14 +287,7 @@
 	/* thus more junk remains accessible, thus the heap gets	*/
 	/* larger ...							*/
 # ifdef THREADS
-    if (++random_no % 13 == 0) {
-	limit = sp;
-	MAKE_HOTTER(limit, BIG_CLEAR_SIZE*sizeof(word));
-	return GC_lear_stack_inner(arg, limit);
-    } else {
-	BZERO(dummy, SMALL_CLEAR_SIZE*sizeof(word));
-	return arg;
-    }
+    BZERO(dummy, CLEAR_SIZE*sizeof(word));
 # else
     if (GC_gc_no > GC_stack_last_cleared) {
         /* Start things over, so we clear the entire stack again */



More information about the Java-patches mailing list