During review of JDK-8272147, this code has drawn attention:
void PreservedMarks::adjust_preserved_mark(PreservedMark* elem) {
oop obj = elem->get_oop();
if (obj->is_forwarded()) {
elem->set_oop(obj->forwardee());
}
}
The check whether the object is actually forwarded seems superfluous, because why bother storing marks for objects there that are not forwarded.
However this seems to be due to G1 full gc preserving marks during the marking phase when it is not completely clear that the object will actually be moved/forwarded (in G1FullGCMarker::mark_object()). All other collectors seem to only preserve marks for forwarded objects (needs to be verified), and this check a waste of time.
Investigate whether it is possible to move the mark preservation to the point where the object is actually forwarded in G1 too.
void PreservedMarks::adjust_preserved_mark(PreservedMark* elem) {
oop obj = elem->get_oop();
if (obj->is_forwarded()) {
elem->set_oop(obj->forwardee());
}
}
The check whether the object is actually forwarded seems superfluous, because why bother storing marks for objects there that are not forwarded.
However this seems to be due to G1 full gc preserving marks during the marking phase when it is not completely clear that the object will actually be moved/forwarded (in G1FullGCMarker::mark_object()). All other collectors seem to only preserve marks for forwarded objects (needs to be verified), and this check a waste of time.
Investigate whether it is possible to move the mark preservation to the point where the object is actually forwarded in G1 too.
- duplicates
-
JDK-8322383 G1: Only preserve marks on objects that are actually moved
- Resolved
- relates to
-
JDK-8272147 Consolidate preserved marks handling with other STW collectors
- Resolved
-
JDK-8322383 G1: Only preserve marks on objects that are actually moved
- Resolved