RFR: JDK-8076267 - Remove n_gens()

Kim Barrett kim.barrett at oracle.com
Tue Mar 31 17:48:27 UTC 2015

On Mar 31, 2015, at 9:14 AM, Jesper Wilhelmsson <jesper.wilhelmsson at oracle.com> wrote:
> Hi,
> Please review this next cleanup in the backwaters of the generation array removal. This change removes the n_gens() method and the max_gens variable from GenCollectedHeap.
> Next in line in the cleanup queue is a change to remove the levels concept. Mostly all places where we today pass a "level" in the GC code can be removed, or be made more explicit by introducing two constants, YOUNG and OLD. Removing n_gens() and the levels touches upon the same code in many places and we could skip one, in some places somewhat ugly, intermediate version by doing both changes at the same time. The levels removal is a much larger and trickier change though, so to make it easier to review I choose to split these into two changes. Please keep this in mind when reviewing the current change.
> Bug: https://bugs.openjdk.java.net/browse/JDK-8076267
> Webrev: http://cr.openjdk.java.net/~jwilhelm/8076267/webrev.00/

I think YOUNG and OLD might be a little overly generic.  And I’m not sure there’s a need to make them especially short either.

  47   int max_gens = 2;
  53   for (int i = 0; i < max_gens + 1; i++) {

These should be unsigned int or size_t types, rather than (signed)

 433     bool complete = full && (max_level == 1);

I'd really like to have a name for that literal "1".  Or at least a
comment or something, if this code will be changing further with the
cleanup of the level concept.

Similarly here:
 505     complete = complete || (max_level_collected == 1);

Actually, there's a whole bunch of literal "1"s.  I'm worried that in
the future level cleanup it will be very easy to miss some of these.
So I think it would be better to introduce the level constants now,
even if the rest of the level cleanup isn't happening until later.


More information about the hotspot-gc-dev mailing list