RFR: 8322383: G1: Only preserve marks on objects that are actually moved

Albert Mingkun Yang ayang at openjdk.org
Mon Jan 8 16:44:23 UTC 2024


On Tue, 19 Dec 2023 16:20:07 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> The G1 full-GC preserves marks during marking, for all live objects in compaction region. However, not all live objects do actually move. In particular, the start of a compaction chain may have a sediment of all-live objects which would not move, and thus don't need to have their marks preserved.
> The problem can easily be solved by preserving marks during forwarding. That also seems a more natural place to do that.
> 
> Testing:
>  - [x] hotspot_gc
>  - [x] tier1
>  - [ ] tier2

src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp line 106:

> 104:   // Store a forwarding pointer if the object should be moved.
> 105:   if (cast_from_oop<HeapWord*>(object) != _compaction_top) {
> 106:     preserved_stack()->push_if_necessary(object, object->mark());

Can this be made conditionally on whether the markword is NOT marked/forwarded? (IOW, move the added predicate in `markWord` here.) The rationale is to minimize changes to the shared code for G1 specific usages.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17159#discussion_r1444987070


More information about the hotspot-dev mailing list