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.
------------- Commit messages: - Merge branch 'master' of https://github.com/openjdk/jdk into 8265489 - fixed check - Merge branch 'master' of https://github.com/openjdk/jdk into 8265489 - 8265489: RunThese24H.java times out because of long ObjectSynchronizer::monitors_iterate(...) operation Changes: https://git.openjdk.java.net/jdk/pull/5194/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5194&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8265489 Stats: 55 lines in 5 files changed: 8 ins; 15 del; 32 mod Patch: https://git.openjdk.java.net/jdk/pull/5194.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/5194/head:pull/5194 PR: https://git.openjdk.java.net/jdk/pull/5194