[Gc] volatile for GC_clear_stack

Ivan Maidanski ivmai at mail.ru
Fri Nov 21 04:28:03 PST 2008


Hi!

This small patch adds "volatile" qualifier for "dummy" arrays (together with de-volatile casts) in GC_clear_stack[_inner]().

Bye.
-------------- next part --------------
diff -ru bdwgc/misc.c updated/bdwgc/misc.c
--- bdwgc/misc.c	2008-11-20 17:57:14.000000000 +0300
+++ updated/bdwgc/misc.c	2008-11-21 14:52:36.000000000 +0300
@@ -236,9 +236,9 @@
 /*ARGSUSED*/
 void * GC_clear_stack_inner(void *arg, ptr_t limit)
 {
-    word dummy[CLEAR_SIZE];
+    volatile word dummy[CLEAR_SIZE];
     
-    BZERO(dummy, CLEAR_SIZE*sizeof(word));
+    BZERO((word *)dummy, CLEAR_SIZE*sizeof(word));
     if ((ptr_t)(dummy) COOLER_THAN limit) {
         (void) GC_clear_stack_inner(arg, limit);
     }
@@ -256,7 +256,7 @@
 {
     ptr_t sp = GC_approx_sp();  /* Hotter than actual sp */
 #   ifdef THREADS
-        word dummy[SMALL_CLEAR_SIZE];
+        volatile word dummy[SMALL_CLEAR_SIZE];
 	static unsigned random_no = 0;
        			 	 /* Should be more random than it is ... */
 				 /* Used to occasionally clear a bigger	 */
@@ -288,7 +288,7 @@
         		/* implementations of GC_clear_stack_inner.	*/
 	return GC_clear_stack_inner(arg, limit);
     } else {
-	BZERO(dummy, SMALL_CLEAR_SIZE*sizeof(word));
+	BZERO((word *)dummy, SMALL_CLEAR_SIZE*sizeof(word));
 	return arg;
     }
 # else


More information about the Gc mailing list