RFR: 8318757: VM_ThreadDump asserts in interleaved ObjectMonitor::deflate_monitor calls [v5]
Stefan Karlsson
stefank at openjdk.org
Thu Nov 9 06:46:58 UTC 2023
On Thu, 9 Nov 2023 01:14:12 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> src/hotspot/share/runtime/synchronizer.cpp line 1094:
>>
>>> 1092: // Iterate owned ObjectMonitors.
>>> 1093: void ObjectSynchronizer::owned_monitors_iterate(MonitorClosure* closure) {
>>> 1094: auto all_filter = [&](void* owner) { return true; };
>>
>> I don't grok how this filter only iterates owned ObjectMonitors.
>> It always returns `true` and does not check for a non-null owner.
>> I'm probably missing some sort of lambda magic here...
>
> I think in this case we already know that all the monitors in the closure are owned by the expected owner. But I wonder if we should/can assert that?
The filter accepts all monitors. The filtering that only returns owned monitors is done inside the called `owned_monitors_iterate_filtered`:
void ObjectSynchronizer::owned_monitors_iterate_filtered(MonitorClosure* closure, OwnerFilter filter) {
...
if (mid->has_owner() && filter(mid->owner_raw())) {
...
closure->do_monitor(mid);
}
The closure is only applied to monitors that "have an owner". Maybe "owned monitors" sounds too much as if the function only visit all monitors owned by the current thread?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16519#discussion_r1387552877
More information about the hotspot-dev
mailing list