[lilliput-jdk17u:lilliput] RFR: 8308956: [Lilliput/JDK17] Fix some object initialization paths
Aleksey Shipilev
shade at openjdk.org
Sat May 27 10:06:51 UTC 2023
On Fri, 26 May 2023 14:43:24 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> src/hotspot/share/gc/shared/memAllocator.cpp line 388:
>>
>>> 386: assert(mem != NULL, "NULL object pointer");
>>> 387: if (UseBiasedLocking) {
>>> 388: oopDesc::set_mark(mem, _klass->prototype_header());
>>
>> Not enough, I think, because there is a `oopDesc::set_mark` in the block below that would overwrite it.
>
> I think this one would be cleaner:
>
>
> if (UseCompactObjectHeaders) {
> oopDesc::release_set_mark(mem, _klass->prototype_header());
> } else {
> if (UseBiasedLocking) {
> oopDesc::set_mark(mem, _klass->prototype_header());
> } else {
> // May be bootstrapping
> oopDesc::set_mark(mem, markWord::prototype());
> }
> // Need a release store to ensure array/class length, mark word, and
> // object zeroing are visible before setting the klass non-NULL, for
> // concurrent collectors.
> if (!UseCompactObjectHeaders) {
> oopDesc::release_set_klass(mem, _klass);
> }
> }
Copy this to `HeapShared::copy_roots` too.
-------------
PR Review Comment: https://git.openjdk.org/lilliput-jdk17u/pull/28#discussion_r1206897247
More information about the lilliput-dev
mailing list