Summary
-------
The JVMTI `GetObjectMonitorUsage` implementation gives incorrect information about threads waiting to enter or re-enter the ObjectMonitor which does not match the function spec.
Problem
-------
The JVMTI `GetObjectMonitorUsage` returns the following data structure:
```
typedef struct {
jthread owner;
jint entry_count;
jint waiter_count;
jthread* waiters;
jint notify_waiter_count;
jthread* notify_waiters;
} jvmtiMonitorUsage;
```
The following two fields in this structure are specified as:
```
waiter_count [jint] The number of threads waiting to own this monitor
waiters [jthread*] The waiter_count waiting threads
```
The `waiters` field has to include all threads waiting to enter the monitor or to re-enter it in `Object.wait()`.
The implementation also includes the threads waiting to be notified in `Object.wait()` which is wrong.
Solution
-------
The solution is to align the implementation with the spec, so that in the `waiters` field only contains the threads waiting to enter/re-enter the monitor.
The implementation of the JDWP command `ObjectReference.MonitorInfo` has to be adjusted to keep the original behavior.
The bug needs a Release Note.
The following JVMTI vmTestbase tests have to be fixed to adopt the modified behavior:
```
vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/TestDescription.java
vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/TestDescription.java
```
The following JVMTI JCK tests have to be fixed to adopt the modified behavior:
```
vm/jvmti/GetObjectMonitorUsage/gomu001/gomu00101/gomu00101.html
vm/jvmti/GetObjectMonitorUsage/gomu001/gomu00101/gomu00101a.html
vm/jvmti/GetObjectMonitorUsage/gomu001/gomu00102/gomu00102.html
vm/jvmti/GetObjectMonitorUsage/gomu001/gomu00102/gomu00102a.html
```
--------
Specification
-------------
The JVMTI `GetObjectMonitorUsage` spec is not being changed and can be found here:
https://docs.oracle.com/en/java/javase/21/docs/specs/jvmti.html#GetObjectMonitorUsage