RFR: 8256302: releasing oopStorage when deflating allows for faster deleting [v5]

Daniel D. Daugherty dcubed at openjdk.org
Mon Jun 5 20:11:15 UTC 2023


On Mon, 5 Jun 2023 01:23:09 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Now we use `!_object.is_null()` as a flag to indicate when it is
>> okay (and safe) to do the release from this location.
>
> This is confusing - why is `is_null` being used as a proxy for checking the current thread's state?

I look at it a little different, I guess. Here in the destructor we check if
the object's oop storage has already been released. If it has not, then
we do the `release_object()` call. This is like seeing if a buffer has
been already freed and taking care of the free if it is still needed. Here
I care about the `_object`'s state (and not the thread's state).

I don't check the current thread's state here nor do I assert it. Based
on my testing, if this destructor is called from an unsafe context and
we need to do the `release_object()` call, the we'll fail a sanity check
down in the `release_object()` call stack.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/11296#discussion_r1218502013


More information about the hotspot-runtime-dev mailing list