The `GetThreadSnapshotHandshakeClosure` was added to support virtual threads in thread dumps. It is very similar to the logic used in the old safepoint-based thread dump. `GetThreadSnapshotHandshakeClosure::detect_locks` using the raw `javaVFrame::monitors()` method rather than using the `locked_monitors()` method which already filters out some monitors including those for which `wait()` has been called. It uses the raw `monitors()` list because it wants to process eliminated compiled monitors itself, and they are already removed from `locked_monitors()`. But that means it should be doing its own filtering of monitors that are being waited-on so they are not reported as locked. This seems to have been an oversight with the original implementation.
I also fixed a pre-existing typo whilst in this code. Testing - tiers 1-3 - updated tests in the PR Thanks --------- - [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). ------------- Commit messages: - fix comment - 8361926: Thread dump has incorrect locking information Changes: https://git.openjdk.org/jdk/pull/32977/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32977&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8361926 Stats: 10 lines in 2 files changed: 7 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/32977.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/32977/head:pull/32977 PR: https://git.openjdk.org/jdk/pull/32977
