[kaffe] CVS kaffe (guilhem): GC fixlet.

Kaffe CVS cvs-commits at kaffe.org
Sun Jul 31 08:23:44 PDT 2005


PatchSet 6773 
Date: 2005/07/31 15:18:47
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
GC fixlet.

2005-07-31  Guilhem Lavaux <guilhem at kaffe.org>
        Riccardo Mottola  <multix at gmail.com>

        * kaffe/kaffevm/kaffe-gc/gc-incremental.c
        (finaliserJob): Protect the access to the block structure
        as the heap may grow at the same time.

Members: 
	ChangeLog:1.4298->1.4299 
	kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.31->1.32 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4298 kaffe/ChangeLog:1.4299
--- kaffe/ChangeLog:1.4298	Sun Jul 31 10:44:42 2005
+++ kaffe/ChangeLog	Sun Jul 31 15:18:47 2005
@@ -1,3 +1,10 @@
+2005-07-31  Guilhem Lavaux <guilhem at kaffe.org>
+	Riccardo Mottola  <multix at gmail.com>
+
+	* kaffe/kaffevm/kaffe-gc/gc-incremental.c
+	(finaliserJob): Protect the access to the block structure
+	as the heap may grow at the same time.
+	
 2005-07-31 Ito Kazumitsu  <kaz at maczuka.gcd.org>
 
 	* test/regression/BufferedInputStreamAvailableTest.java:
Index: kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c
diff -u kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.31 kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.32
--- kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.31	Wed Jul 13 13:31:15 2005
+++ kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c	Sun Jul 31 15:18:50 2005
@@ -878,6 +878,7 @@
   gc_block* info = NULL;
   gc_unit* unit = NULL;
   int idx = 0;
+  int func = 0;
 
   /*
    * Loop until the list of objects whose finaliser needs to be run is empty
@@ -904,8 +905,11 @@
    */
   while (gclists[finalise].cnext != &gclists[finalise]) {
     unit = gclists[finalise].cnext;
+    lockStaticMutex(&gc_lock);
     info = gc_mem2block(unit);
     idx = GCMEM2IDX(info, unit);
+    func = KGC_GET_FUNCS(info, idx); 
+    unlockStaticMutex(&gc_lock);
 
     /* Clear weak references to this object. Because according to the Java API spec.
      * "Suppose that the garbage collector determines at a certain point in time 
@@ -918,11 +922,12 @@
 
     /* Call finaliser */
     unlockStaticMutex(&finman);
-    (*gcFunctions[KGC_GET_FUNCS(info,idx)].final)(gcif, UTOMEM(unit));
+    (*gcFunctions[func].final)(gcif, UTOMEM(unit));
     lockStaticMutex(&finman);
     
     /* and remove unit from the finaliser list */
     lockStaticMutex(&gc_lock);
+    info = gc_mem2block(unit);
     UREMOVELIST(unit);
     UAPPENDLIST(gclists[nofin_white], unit);
     



More information about the kaffe mailing list