boehm-gc: finalization doesn't work with --enable-gc-debug

Andrew Haley aph@redhat.com
Tue Jun 21 16:11:00 GMT 2005


With gc debugging enabled, a Java reference doesn't point to the start
of a gc object but to somewhere in the middle of the object.  As a
result of this, objects are prematurely finalized.

I expect that this same problem occurs in other places too, but I'm
waiting for feedback as to whether this is the right approach.

Andrew.


2005-06-21  Andrew Haley  <aph@redhat.com>

	* finalize.c (GC_finalize): Use GC_base of a pointer: if gc
	debugging is enabled, pointers don't point to the start of
	objects.

Index: finalize.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/finalize.c,v
retrieving revision 1.14
diff -u -p -r1.14 finalize.c
--- finalize.c	28 Aug 2004 00:41:40 -0000	1.14
+++ finalize.c	21 Jun 2005 13:43:35 -0000
@@ -557,7 +557,7 @@ void GC_finalize()
       while (curr_dl != 0) {
         real_ptr = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_obj);
         real_link = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_link);
-        if (!GC_is_marked(real_ptr)) {
+        if (!GC_is_marked(GC_base(real_ptr))) {
             *(word *)real_link = 0;
             next_dl = dl_next(curr_dl);
             if (prev_dl == 0) {



More information about the Java-patches mailing list