RFR: 8305895: Implementation: JEP 450: Compact Object Headers (Experimental) [v7]
Aleksey Shipilev
shade at openjdk.org
Thu May 11 10:34:49 UTC 2023
On Thu, 11 May 2023 10:00:00 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:
>> Roman Kennke has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 28 commits:
>>
>> - Merge branch 'JDK-8305898' into JDK-8305895
>> - @shipilev review, round 2
>> - Fix build
>> - @shipilev comments, round 1
>> - Allow to resolve mark with LW locking
>> - Use new lightweight locking with compact headers
>> - Merge branch 'JDK-8305898' into JDK-8305895
>> - Imporve GetObjectSizeIntrinsicsTest
>> - Some GC fixes
>> - Add BaseOffsets test
>> - ... and 18 more: https://git.openjdk.org/jdk/compare/39c33727...58046e58
>
> src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp line 250:
>
>> 248: Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(o), cast_from_oop<HeapWord*>(new_obj), new_obj_size);
>> 249:
>> 250: if (!new_obj->mark().is_marked()) {
>
> For this check to work correctly, we are assuming that Copy::aligned_disjoint_words respects word level atomicity, even though we are using one of the non-atomic copying functions. That doesn't feel safe.
True, it is not exactly safe. I wonder if we can plug this particular leak by doing the following:
// Copy obj
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(o), cast_from_oop<HeapWord*>(new_obj), new_obj_size);
if (UseCompactObjectHeaders) {
// The copy above is not atomic. Make sure we have seen the proper mark
// and re-install it into the copy, so that Klass* is guaranteed to be correct.
markWord mark = o->mark_acquire();
if (!mark.is_marked()) {
new_obj->set_mark(mark);
ContinuationGCSupport::transform_stack_chunk(new_obj);
} else {
// If we copied a mark-word that indicates 'forwarded' state, the object
// installation would not succeed. We cannot access Klass* anymore either.
// Skip the transformation.
}
} else {
ContinuationGCSupport::transform_stack_chunk(new_obj);
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13844#discussion_r1190970182
More information about the shenandoah-dev
mailing list