RFR: 8272147: Consolidate preserved marks handling with other STW collectors [v2]
Albert Mingkun Yang
ayang at openjdk.org
Wed Jun 7 11:49:59 UTC 2023
On Tue, 6 Jun 2023 17:02:32 GMT, Guoxiong Li <gli at openjdk.org> wrote:
>> Hi all,
>>
>> This patch removes the class `markSweep.hpp::PreservedMark` and uses the shared `PreservedMarksSet` instead.
>>
>> In order to keep the meaning of the field `_preserved_marks` in `markSweep`,
>> I need to use `OopAndMarkWord` explicitly. So I move `OopAndMarkWord` out of `PreservedMarks`.
>>
>> Tests:
>> `hotspot:tier1` passed locally (x86 & linux).
>>
>> Thanks for the review.
>>
>> Best Regards,
>> -- Guoxiong
>
> Guoxiong Li has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>
> - Use the method 'adjust_during_full_gc' and polish the included header.
> - Merge branch 'master' into JDK-8272147
> - JDK-8272147
src/hotspot/share/gc/serial/markSweep.cpp line 156:
> 154: _preserved_marks[_preserved_count++] = OopAndMarkWord(obj, mark);
> 155: } else {
> 156: _preserved_overflow_stack_set.get()->push_if_necessary(obj, mark);
Why not `push_always`? I'd expect this mark must be preserved.
src/hotspot/share/gc/serial/markSweep.cpp line 200:
> 198: // adjust the oops we saved earlier
> 199: for (size_t i = 0; i < _preserved_count; i++) {
> 200: MarkSweep::adjust_pointer(_preserved_marks[i].get_oop_pointer());
There are still some unnecessary null-checks.
I wonder if one can add new API in `PreservedMarks` to adjust oops.
void adjust_preserved_mark(OopAndMarkWord* elem) {
oop obj = elem->get_oop();
if (obj->is_forwarded()) {
elem->set_oop(obj->forwardee());
}
}
Then `_preserved_marks[]` serves just as a buffer to the overflow array -- how their contents are processed is decided at one place and outside Serial.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14274#discussion_r1221407347
PR Review Comment: https://git.openjdk.org/jdk/pull/14274#discussion_r1221410875
More information about the hotspot-gc-dev
mailing list