[15] RFR 8242602: Shenandoah: allow earlier recycle of trashed regions during concurrent root processing

Aleksey Shipilev shade at redhat.com
Tue Apr 14 16:28:08 UTC 2020


On 4/14/20 5:11 PM, Zhengyu Gu wrote:
> Please review this patch that allows early recycling of trashed regions 
> during concurrent root processing.
> 
> We need to preserve immediate garbage regions during weak root 
> processing, since they may contain those dead oops and we need to be 
> able to identify them via is_alive closure. After that, we can safely 
> recycle them.
> 
> 
> Bug: https://bugs.openjdk.java.net/browse/JDK-8242602
> Webrev: http://cr.openjdk.java.net/~zgu/JDK-8242602/webrev.00/

I don't understand the interaction between flags and should_do* in op_roots.

 void ShenandoahHeap::op_roots() {
   if (is_concurrent_root_in_progress()) {
     if (ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
       ...weak roots...
       set_concurrent_weak_root_in_progress(false);
     }

     if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
       ...all roots...
     }
     set_concurrent_weak_root_in_progress(false);
     set_concurrent_root_in_progress(false);
   }
 }

Can't we just follow the flags in op_roots?

 void ShenandoahHeap::op_roots() {
   if (is_concurrent_root_in_progress()) {
     if (is_concurrent_weak_root_in_progress()) {
       ...
       set_concurrent_weak_root_in_progress(false);
     }

     ...all roots...
     set_concurrent_root_in_progress(false);
   }
 }

...and then make prepare_concurrent_roots() do:

 void ShenandoahHeap::prepare_concurrent_roots() {
   assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
   if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
     set_concurrent_root_in_progress(true);
     if (ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
       set_concurrent_weak_root_in_progress(true);
     }
   }
 }

This carries what needs to be done in flags, and flags get down as soon as the relevant block is
finished.

-- 
Thanks,
-Aleksey



More information about the shenandoah-dev mailing list