RFR: 8256302: releasing oopStorage when deflating allows for faster deleting

Robbin Ehn rehn at openjdk.org
Thu Dec 1 10:11:52 UTC 2022


On Wed, 30 Nov 2022 22:11:18 GMT, David Holmes <dholmes at openjdk.org> wrote:

> I still think we should have been able to keep the release in the destructor guarded by some check:
> 
> ```
> if (! already_released) {
>   assert(!safepoint_safe, "must be");
>   _object.release(_oop_storage);
> }
> ```
> 
> but perhaps there is no way to ask if "already_released"?
> 
> Thanks for the additional comments on the why of all this. The constraints on when you can access oopStorage were not clear before.

You can ask by doing _object().is_null(), if true there is no backing storage in oopStorage.
Since the case above should never ever happen (cross-fingers) I would:

`guarantee(_object().is_null(), "Destructor should never be called if weak handle is not released");`

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

PR: https://git.openjdk.org/jdk/pull/11296


More information about the hotspot-runtime-dev mailing list