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

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


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

>> src/hotspot/share/runtime/synchronizer.cpp line 1655:
>> 
>>> 1653:     case inflate_cause_hash_code:      return "Monitor Hash Code";
>>> 1654:     case inflate_cause_jni_enter:      return "JNI Monitor Enter";
>>> 1655:     case inflate_cause_jni_exit:       return "JNI Monitor Exit";
>> 
>> Just to be clear, this is the "delete monitor" call that is happening
>> while the calling JavaThread is in blocked state. If we did the release
>> of the oop in the ObjectMonitor in the ObjectMonitor's destructor, then
>> we would be calling release from blocked and not from thread-in-vm.
>
> This comment doesn't make sense to me. We are calling release whilst blocked IIUC.

No we are not calling release while blocked. This function (`delete_monitors()`) is
passed an array of ObjectMonitors to delete (`delete_list`). All of the ObjectMonitors
on `delete_list` have been deflated which means that `release_object()` has already
been called for all of these ObjectMonitors.

Since `release_object()` has already been called, the `_obj` field in the WeakHandle
has been cleared AND `_object.is_null()` will be true so the destructor will skip the
call to `release_object()`.

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

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


More information about the hotspot-runtime-dev mailing list