RFR: 8310311: Serial: move Generation::contribute_scratch to DefNewGeneration

Thomas Schatzl tschatzl at openjdk.org
Tue Jun 20 09:44:04 UTC 2023


On Mon, 19 Jun 2023 12:08:46 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Simple cleanup to move a method from base-class to  sub-class.
> 
> Test: hotspot_gc

I think this cleanup should go further than this.

We know that:
* only young gen can provide scratch
* it is a single scratch space
* the code only ever uses a single scratch space  (see comment in `GenMarkSweep::allocate_stacks`)
* there are only DefNewGeneration and TenuredGeneration anyway (and the framework wouldn't work with an additional intermediate generation too).

So `GenMarkSweep::allocate_stacks` should ask the young gen directly for scratch space (if `GenCollectedHeap::young_gen()` returned a `DefNewGeneration` right away; all callers of that method immediately cast it to `DefNewGeneration` anyway).
This also removes the need for some helpers for the scratch space, like sorting the list (which is always very degenerate anyway).

Kind of useless assertions and comments (in `DefNewGeneration::contribute_scratch`) should be removed.

This change should imho also remove obsolete comments (with "$$$") in the vicinity.

-------------

PR Review: https://git.openjdk.org/jdk/pull/14540#pullrequestreview-1487741747


More information about the hotspot-gc-dev mailing list