RFR: 8138975: G1CollectorPolicy::calculate_young_list_target_length should be const

Erik Helin erik.helin at oracle.com
Tue Oct 6 15:28:59 UTC 2015


Hi all,

this patch splits G1CollectorPolicy::update_young_list_target_length into
two methods:
- void G1CollectorPolicy::update_young_list_target_length()
- size_t
  G1CollectorPolicy::bounded_young_list_target_length(bool is_young, size_t rs_lenghts) const

This enables bounded_young_list_target_length to be const and then
update_young_list_target_length can just set the field
_young_list_target_length to the newly calculated value. Making
bounded_young_list_target_length const revaled some strange
side effects of update_young_list_target_length:
- update_young_list_target_length also called
  update_max_gc_locker_expansion. I moved the call to
  update_max_gc_locker_expansion to all callsites of
  update_young_list_target_length.
- update_young_list_target_length sometimes updated the field
  _rs_lenghts_prediction. This is only needed when
  update_young_list_target_length is called from the
  ConcurrentG1RefinementThread that is scanning the rembered sets sizes
  of the YoungList, because _rs_lenghts_prediction is state that belongs
  to that thread but for some reason ended up in G1CollectorPolicy.
  Anyways, I moved the update of the field to only place where it is
  needed. This move will actually cause the "// Add 10% to avoid having to
  recalculate too often" comment to become correct since previously the
  field was only set via some code paths in
  update_young_list_target_length.

Enhancement:
https://bugs.openjdk.java.net/browse/JDK-8138975

Webrev:
http://cr.openjdk.java.net/~ehelin/8138975/webrev/

Testing:
JPRT

Thanks,
Erik



More information about the hotspot-gc-dev mailing list