RFR: 8305898: Alternative self-forwarding mechanism [v19]

Stefan Karlsson stefank at openjdk.org
Fri Aug 18 13:51:36 UTC 2023


On Fri, 11 Aug 2023 18:40:36 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> Currently, the Serial, Parallel and G1 GCs store a pointer to self into object headers, when compaction fails, to indicate that the object has been looked at, but failed compaction into to-space. This is problematic for compact object headers ([JDK-8294992](https://bugs.openjdk.org/browse/JDK-8294992)) because it would (temporarily) over-write the crucial class information, which we need for heap parsing. I would like to propose an alternative: use the bit #3 (previously biased-locking bit) to indicate that an object is 'self-forwarded'. That preserves the crucial class information in the upper bits of the header until the full header gets restored.
>
> Roman Kennke has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 31 commits:
> 
>  - Merge branch 'JDK-8305896' into JDK-8305898
>  - Merge branch 'JDK-8305896' into JDK-8305898
>  - Merge branch 'JDK-8305896' into JDK-8305898
>  - Update comment about mark-word layout
>  - Merge branch 'JDK-8305896' into JDK-8305898
>  - Fix tests on 32bit builds
>  - Merge branch 'JDK-8305896' into JDK-8305898
>  - Merge branch 'JDK-8305896' into JDK-8305898
>  - wqRevert "Rename self-forwarded -> forward-failed"
>    
>    This reverts commit 4d9713ca239da8e294c63887426bfb97240d3130.
>  - Merge branch 'JDK-8305896' into JDK-8305898
>  - ... and 21 more: https://git.openjdk.org/jdk/compare/d2b41e25...cd5f2374

src/hotspot/share/oops/oop.inline.hpp line 292:

> 290:     m = m.set_self_forwarded();
> 291:     assert(forwardee(m) == cast_to_oop(this), "encoding must be reversible");
> 292:     set_mark(m);

Could you explain why we need to restore the displaced mark word here? I wonder why it matters what the old mark word is and why this code can't be changed to something like this:

    markWord m = markWord::prototype().set_self_forwarded();
    set_mark(m);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13779#discussion_r1298475144


More information about the hotspot-gc-dev mailing list