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

Roman Kennke rkennke at openjdk.org
Fri Jan 12 12:14:19 UTC 2024


On Fri, 12 Jan 2024 09:52:08 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> 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.
>
> My previous msg was probably unclear... I meant sth like:
> 
> 
> if (!object->is_forwarded) {
>   preserved_stack()->push_if_necessary...
> }
> 
> 
> (The newly added assert here is incorrect -- fails in GHA.)

Oh I see! This makes more sense, yes. I made that change and cleaned up non G1 code.

BTW: I am working on new/alternative full-GCs for Serial, G1 and Shenandoah that don't store forwarding pointers in the mark-word at all, and thus avoid all that preserved-headers stuff (and together with the OM-world work that some Oracle engineers are working on, get rid of header displacement altogether). The SerialGC version is almost ready in Lilliput: https://github.com/openjdk/lilliput/pull/122

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

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


More information about the hotspot-gc-dev mailing list