RFR: 8320318: ObjectMonitor Responsible thread [v3]

Fredrik Bredberg fbredberg at openjdk.org
Fri Sep 20 13:19:43 UTC 2024


On Fri, 20 Sep 2024 05:18:23 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Fredrik Bredberg has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update two, after the review
>
> src/hotspot/share/runtime/javaThread.hpp line 467:
> 
>> 465:   intx _held_monitor_count;  // used by continuations for fast lock detection
>> 466:   intx _jni_monitor_count;
>> 467:   ObjectMonitor* _unlocked_inflated_monitor;
> 
> At the time we store this the OM is in-use but we have unlocked it and so by the time we go to re-lock it later it may no longer be in-use. What prevents it from being deflated and deallocated? Does it require a safepoint that can't happen on that code path? If so we should add a comment to that affect somewhere.

I asked the GC guys @fisk and @xmas92 about this some time ago, and they assured me that it was ok.
Unfortunately I forgot about the details, so I re-asked them today and they said: "Since there is no safepoint polling when calling into the VM, so you can be sure that it hasn't been dealocated." I'll add a comment about it `SharedRuntime::monitor_exit_helper()`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19454#discussion_r1768600977


More information about the hotspot-dev mailing list