RFR: 8198528: Move GenerationSpecs from GenCollectorPolicy to GenCollectedHeap

Kim Barrett kim.barrett at oracle.com
Thu Feb 22 05:08:05 UTC 2018

> On Feb 21, 2018, at 4:27 PM, Stefan Karlsson <stefan.karlsson at oracle.com> wrote:
> Hi all,
> Please review this patch to move _young_gen_spec and _old_gen_spec out from GenCollectorPolicy into GenCollectedHeap.
>  http://cr.openjdk.java.net/~stefank/8198528/webrev.01/
>  https://bugs.openjdk.java.net/browse/JDK-8198528
> This is a step towards the removal of CollectorPolicy:
>  https://bugs.openjdk.java.net/browse/JDK-8198505
> Thanks,
> StefanK

Generally looks good.  Just a few minor comments.

  66 CMSHeap::CMSHeap(GenCollectorPolicy *policy) :

The new formatting of the initializer list is oddly indented.  I
suppose it's to make the initializer list visually distinct from the
body code.  I prefer accomplishing that by putting the open-brace of
the body on its own line between the initializer list and the body
code, rather than unusual indentation of the initializer list.

Similarly for the SerialHeap constructor.

123 void GenCollectedHeap::initialize_generations(Generation::Name young,

Shouldn't this function just be removed now?

 187 GenerationSpec* GenCollectedHeap::young_gen_spec() const {
 188   assert(_young_gen_spec != NULL, "_young_gen_spec should have been initialized");
 189   return _young_gen_spec;
 190 }
 192 GenerationSpec* GenCollectedHeap::old_gen_spec() const {
 193   assert(_old_gen_spec != NULL, "_old_gen_spec should have been initialized");
 194   return _old_gen_spec;
 195 }

The assertions are no longer useful, and indeed somewhat confusing,
since those members are now initialized in the constructor's
initializer list.


More information about the hotspot-gc-dev mailing list