This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: FYI: java.lang.ref.*


>>>>> "Bryce" == Bryce McKinlay <bryce@waitaki.otago.ac.nz> writes:

Bryce> Very cool! I actually started to implement java.lang.ref a long
Bryce> time ago, but never got it finished. My attempt was mostly
Bryce> inside boehm-gc, and it ended up looking pretty messy. I
Bryce> definately think this approach looks better.

I'd like to point out that I didn't think this up -- Hans Boehm
recommended it in a private conversation.  So thanks goes to him.

Bryce> Maybe this should be called _Jv_GCShouldReclaimSoftReference?

Either is fine by me.

Bryce> I guess we need a way to ask the GC if it is approaching its
Bryce> max heap size (and a way to set the max heap size from
Bryce> libjava?) to implement this properly.  Wouldn't false actually
Bryce> be a better default for now, since SoftReference is supposed to
Bryce> be "only slightly weaker" than a real reference?

Yeah, probably.

Bryce> Oh... and btw it seems to crash for me ;-)

Thanks.  Patch appended; I'm checking it in.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* java/lang/ref/natReference.cc (add_to_hash): Set n->next before
	setting *link.

Index: java/lang/ref/natReference.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/ref/natReference.cc,v
retrieving revision 1.1
diff -u -r1.1 natReference.cc
--- java/lang/ref/natReference.cc 2001/10/02 14:31:47 1.1
+++ java/lang/ref/natReference.cc 2001/10/03 16:41:49
@@ -197,8 +197,8 @@
       link = &iter->next;
       iter = *link;
     }
-  *link = n;
   n->next = (*link) ? (*link)->next : NULL;
+  *link = n;
 }
 
 // This is called when an object is ready to be finalized.  This


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]