On Fri, 3 Sep 2021 01:26:01 GMT, Daniel D. Daugherty <[email protected]> wrote:
>> monitors_iterate make several checks which often are true before filter
>> monitor by a thread. It might take a lot of time when there are a lot of
>> threads. So it makes sense to first check thread and only then other
>> conditions.
>
> src/hotspot/share/runtime/synchronizer.cpp line 981:
>
>> 979: if (mid->owner() != thread) {
>> 980: return;
>> 981: }
>
> The `iter` is processing the in-use-list and you're bailing the iteration
> when you run into an ObjectMonitor that is not owned by `thread`, but
> that doesn't mean that there's not an ObjectMonitor owned by `thread`
> later on in the in-use-list.
>
> So I could see you doing a `continue` here, but not a `return`.
Thanks for resolving the above comment.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5194