Pre-review discussion of fix for JDK-8139930 "Rename G1 state variable to be meaningful"

Derek White derek.white at oracle.com
Mon Oct 19 20:50:45 UTC 2015


I talked to a few people about this issue during the offsite, but I 
wanted to broadcast this before renaming in earnest. Usually everyone 
has opinions about names :-)

JDK-8139930 Rename G1 state variable to be meaningful 
<https://bugs.openjdk.java.net/browse/JDK-8139930>

    Some of the core G1 state variables in G1CollectorState are
    ambiguously named:

    gcs_are_young, last_young_gc, last_gc_was_young

    Problems:

      * All gcs include the young gen, so taken literally "young"
        doesn't add any information.
      * "young" is shorthand for one of:
          o "fully young" (which confusing with "full gc")
          o "young only", but the "only" is both silent and invisible.
      * "last" is used in one variable to mean "previous", and in
        another to mean "ultimate, maybe".
          o "last_gc_was_young" vs. "last_young_gc".

This issue is a general cleanup on its own, but is also a prerequisite 
for JDK-8080226 <https://bugs.openjdk.java.net/browse/JDK-8080226> 
(Replace collector state booleans with explicit state variable(s)?)

I'm working on two options:
*Simple version:*

    gcs_are_young       => mixed_mode
    last_young_gc        => consider_mixed_mode
    last_gc_was_young => was_mixed_mode

There is some indication that "last_gc_was_young" != 
(!"was_mixed_mode"). After a full GC, "last_gc_was_young" is set to 
false. So it might make more sense to use an enum (Normal, Mixed, Full) 
for "g1_mode" and "prev_g1_mode" variables.

*Enum version:*

    gcs_are_young        => (g1_mode == NormalGC)     // can add helper
    predicate functions
    last_young_gc         => consider_mixed_mode
    last_gc_was_young  => (prev_g1_mode == NormalGC)
    full_collection          => (g1_mode == FullGC)

Any opinions on this before I spin up jprt runs and webrevs?

Thanks!

  - Derek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20151019/61cee3cf/attachment.htm>


More information about the hotspot-gc-dev mailing list