During the code review for JDK-8007036, one of the reviewers made a good point:
-----
One question. You added a note to the _length field in CollectionSetChooser:
// The number of candidate old regions added to the CSet chooser.
// Note: this is not updated when removing a region using
// remove_and_move_to_next() below.
uint _length;
As far as I can tell we should really decrement the _length field in remove_and_move_to_next(). Would it maybe be better to fix this (as a separate change of course) than to add the note? I guess the code works since we don't use the length information after finlalize_cset() but it feels a bit fragile.
-----
This is a valid point. The routine remove_and_move_to_next() should actually decrement the _length field.
Ideally the internals of the CollectionSetChooser should be rewritten to use the RegionList abstraction. Using a RegionList should provide most of the infrastructure needed for this class.
There is an explicit ordering of elements in the CollectionSetChooser from higher GC efficiency to lower GC efficiency which must be preserved.
-----
One question. You added a note to the _length field in CollectionSetChooser:
// The number of candidate old regions added to the CSet chooser.
// Note: this is not updated when removing a region using
// remove_and_move_to_next() below.
uint _length;
As far as I can tell we should really decrement the _length field in remove_and_move_to_next(). Would it maybe be better to fix this (as a separate change of course) than to add the note? I guess the code works since we don't use the length information after finlalize_cset() but it feels a bit fragile.
-----
This is a valid point. The routine remove_and_move_to_next() should actually decrement the _length field.
Ideally the internals of the CollectionSetChooser should be rewritten to use the RegionList abstraction. Using a RegionList should provide most of the infrastructure needed for this class.
There is an explicit ordering of elements in the CollectionSetChooser from higher GC efficiency to lower GC efficiency which must be preserved.