RFR: 8308881: Strong CLD oop handle roots are demoted to non-roots concurrently

Erik Österlund eosterlund at openjdk.org
Fri May 26 10:15:57 UTC 2023


On Fri, 26 May 2023 07:20:27 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

>> It is illegal to remove strong roots concurrently without clearing them first. A SATB collector with concurrent root scanning assumes that when strong roots disappear from the object graph, they are cleared first, which makes SATB notice the root. All global strong roots do this. Except CLD strong roots, which are turned into non-roots by decrementing the keep_alive counter to 0, when bootstrapping weak hidden class CLDs. This is not valid behaviour. This patch tries to treat these oops like we do any other global strong handles that are unlinked from the system: clear them when they stop being strong roots.
>
> src/hotspot/share/classfile/classLoaderData.cpp line 317:
> 
>> 315:       // No-op free handle
>> 316:       // No-op allocate new handle using the same address
>> 317:       NativeAccess<>::oop_store(p, obj); // Store the strong non-root
> 
> Is there an issue if someone with an `OopHandle(p)` racingly reads null while a root is transitioning?

Shouldn't be, but I'll remove the null store and write some more comments, to be on the safe side.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14154#discussion_r1206543643


More information about the hotspot-gc-dev mailing list