JDK-7088680 : G1: Cleanup in the G1CollectorPolicy class
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs22
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-09-09
  • Updated: 2013-09-18
  • Resolved: 2012-01-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 Other
8Fixed hs23Fixed
Description
There is some cleanup that can be done in the G1CollectorPolicy class.

- Fields _n_marks and _n_marks_since_last_pause seem to be updated but never used and can be safely removed.
- The work done in record_concurrent_mark_cleanup_end() is split into record_concurrent_mark_cleanup_end_work1() and record_concurrent_mark_cleanup_end_workd2() and those two methods are also re-used in G1CollectorPolicy_BestRegionsFirst::record_concurrent_mark_cleanup_end(). It'd be nice to somehow unify them.
- In fact, we should probably fold the functionality from the G1CollectorPolicy_BestRegionsFirst class into the G1CollectorPolicy class and get rid of the former. I don't think we'll be needing this separation in the short term.

Comments
EVALUATION See main CR
28-10-2011

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/074f0252cc13
14-10-2011

PUBLIC COMMENTS This turned out to be not that much work. I'll target it to hs23 to get it out of the way.
26-09-2011

PUBLIC COMMENTS Regarding the G1CollectorPolicy_BestRegionsFirst class, I just removed it and put all its functionality into G1CollectorPolicy. If we ever want to have separate policies for G1 we can rethink the way we do it. Currently, we only have one and the way the "general" vs. "specific" separation was done was somewhat arbitrary. At least in the short- to medium- term we're better off not having the separation. As part of the G1CollectorPolicy_BestRegionsFirst class removal, I made all the protected members private given that G1CollectorPolicy has no subclasses any more. I also devirtualized a bunch of methods (a lot of record_*-type methods) which do not need to be virtual (and never needed to be in the first place).
26-09-2011

PUBLIC COMMENTS There are also some more fields that are maintained but apparently not used: _n_pauses_at_mark_end _num_markings _mark_thread_startup_sec as well as the following method: note_start_of_mark_thread() (it was just setting _mark_thread_startup_sec) note_change_in_marked_bytes() (it is a nop) default_init_heap_size() (never called) I'll remove those too.
26-09-2011