RFR: Dynamic worker refactoring

Aleksey Shipilev shade at redhat.com
Thu Sep 21 14:16:47 UTC 2017


On 09/21/2017 04:10 PM, Zhengyu Gu wrote:
> Updated webrev: http://cr.openjdk.java.net/~zgu/shenandoah/dwg_refactor/webrev.01/

I'd call these two "calc_workers_for_(conc|final)_update_refs":

  60   // Calculate workers for concurrent reference update
  61   static uint calc_workers_for_conc_update_ref();
  62
  63   // Calculate workers for parallel reference update
  64   static uint calc_workers_for_par_update_ref();

Also, indenting makes it ragged again :(

 // Calculate workers for parallel fullgc
 uint ShenandoahWorkerPolicy::calc_workers_for_fullgc() {
   uint active_workers = (_prev_fullgc == 0) ?  ParallelGCThreads : _prev_fullgc;
   _prev_fullgc = AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
                                                          active_workers,
                                                          Threads::number_of_non_daemon_threads());
   return _prev_fullgc;
 }

 // Calculate workers for Stop-the-world partial GC
 uint ShenandoahWorkerPolicy::calc_workers_for_stw_partial() {
   uint active_workers = (_prev_stw_partial == 0) ? ParallelGCThreads : _prev_stw_partial;
   _prev_stw_partial = AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
                                                               active_workers,
                                                               Threads::number_of_non_daemon_threads());
   return _prev_stw_partial;
}

Better:

 // Calculate workers for parallel fullgc
 uint ShenandoahWorkerPolicy::calc_workers_for_fullgc() {
   uint active_workers = (_prev_fullgc == 0) ?  ParallelGCThreads : _prev_fullgc;
   _prev_fullgc =
     AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
                                             active_workers,
                                             Threads::number_of_non_daemon_threads());
   return _prev_fullgc;
 }

 // Calculate workers for Stop-the-world partial GC
 uint ShenandoahWorkerPolicy::calc_workers_for_stw_partial() {
   uint active_workers = (_prev_stw_partial == 0) ? ParallelGCThreads : _prev_stw_partial;
   _prev_stw_partial =
     AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
                                             active_workers,
                                             Threads::number_of_non_daemon_threads());
   return _prev_stw_partial;
 }


Otherwise good, no need to re-review if you decide to rename the methods and fix the indenting above.

Thanks,
-Aleksey




More information about the shenandoah-dev mailing list