[Gc] Patches resubmission 7

Boehm, Hans hans.boehm at hp.com
Fri Jul 10 18:04:31 PDT 2009


Thanks.

You're right, and this looks like this gets messier than what is really warranted by such a broken feature.  I checked in another patch consisting of your original code plus a comment.

Hans

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Ivan Maidanski
> Sent: Saturday, June 13, 2009 6:49 AM
> To: gc at napali.hpl.hp.com
> Subject: Re[2]: [Gc] Patches resubmission 7
> 
> Hi!
> 
> "Boehm, Hans" <hans.boehm at hp.com> wrote:
> > Thanks.
> > 
> > I'm committing this, with a change to your GC_finalize_all() fix.
> > 
> > I expect that JVMs using this will not expect finalizers to 
> be run in this thread.  It's unclear to me whether this will 
> break things, but I'd rather keep the semantics roughly what 
> they were, especially since this is all part of a hopelessly 
> broken interface anyway, and we aren't really going to fix 
> it.  It should only be used to implement JVM functionality 
> that Java deprecated ten years ago, for excellent reasons.
> > 
> > I fixed the corresponding comment in javaxfc.h.  (I agree with all 
> > your reasons that it was broken.)
> > 
> > Hans
> 
> You've added your code but forget to remove my 
> GC_invoke_finalizers() call in GC_finalize_all() (and to 
> remove the entry from ChangeLog).
> 
> Your code is a bit better than before although it looks like:
> 
>   while (have_finalizers) {
>      enqueue_if_any(); // typically a NOP
>      notify();
>   }
> 
> So, this thread just does busy waiting.
> 
> The better (and compliant with the JVMs) code could be:
> 
>   while (have_finalizers) {
>      enqueue_if_any();
>      notify();
>      if (!have_finalizers) wait_for_invoke_finalizers_completed();
>   }
> 
> Or, better, I think, let this be the responsibility of 
> GC_finalize_all() users to have 
> wait_for_invoke_finalizers_completed() in their client notify() procs.
> 
> PS. Tip for JVM implementers: the best way of dealing with 
> GC_finalize_all() (according to java.lang.ref.Finalizer code) 
> is to fork a thread which executes 
> GC_set_finalize_on_demand(0) and GC_finalize_all().
> 
> Bye.
> 
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> 


More information about the Gc mailing list