This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch: FYI: java.lang.ref.*
- To: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- Subject: Re: Patch: FYI: java.lang.ref.*
- From: Tom Tromey <tromey at redhat dot com>
- Date: 03 Oct 2001 10:59:16 -0600
- Cc: Java Patch List <java-patches at gcc dot gnu dot org>
- References: <878zeudrw7.fsf@creche.redhat.com> <3BBAEEFE.2000106@waitaki.otago.ac.nz>
- Reply-To: tromey at redhat dot com
>>>>> "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