RFR: 8304144: G1: Remove unnecessary is_survivor check in G1ClearCardTableTask

Albert Mingkun Yang ayang at openjdk.org
Tue Mar 21 08:14:42 UTC 2023


On Mon, 20 Mar 2023 23:55:31 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:

> But clearing (i.e. marking card clean) today, from my cursory reading of the code, over-writes the `g1_young_gen` value,

That's correct. Nevertheless, lacking further context, it's impossible to determine whether the mentioned overwrite is appropriate or not. For example in this PR, one doesn't know why the current region can or cannot be a survior-region in the local context.

The class in which this occurs goes by the name of "G1ClearCardTableTask", so it's logical to utilize a method named "clear_cardtable", without requiring broader knowledge.

However, having said that, when considering global knowledge, we do know that regions in cset will arrive at this point, and if a freed region later becomes an eden-region, cards are annotated with `g1_young_gen` as allocation grows inside that region -- rendering the clearing in `G1ClearCardTableTask` redundant. Possibly, this redundancy (and potentially other factors) can use some refactoring here, which probably uncovers a more reasonable location for a region-type related assertion.

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

PR Comment: https://git.openjdk.org/jdk/pull/13023#issuecomment-1477422672


More information about the hotspot-gc-dev mailing list