Add support for JVMTI monitor events.

Adds support for the JVMTI can_generate_monitor_events capability and
all associated events. This adds support for the
JVMTI_EVENT_MONITOR_WAIT, JVMTI_EVENT_MONITOR_WAITED,
JVMTI_EVENT_MONITOR_CONTENDED_ENTER, and
JVMTI_EVENT_MONITOR_CONTENDED_ENTERED events.

Bug: 65558434
Bug: 62821960
Bug: 34415266

Test: ./test.py --host -j50

Change-Id: I0fe8038e6c4249e77d37a67e5056b5d2a94b6f48
diff --git a/openjdkjvmti/events.h b/openjdkjvmti/events.h
index b49e80c..0d36c46 100644
--- a/openjdkjvmti/events.h
+++ b/openjdkjvmti/events.h
@@ -30,6 +30,7 @@
 class JvmtiAllocationListener;
 class JvmtiGcPauseListener;
 class JvmtiMethodTraceListener;
+class JvmtiMonitorListener;
 
 // an enum for ArtEvents. This differs from the JVMTI events only in that we distinguish between
 // retransformation capable and incapable loading
@@ -212,6 +213,8 @@
   void HandleEventType(ArtJvmtiEvent event, bool enable);
   void HandleLocalAccessCapabilityAdded();
 
+  bool OtherMonitorEventsEnabledAnywhere(ArtJvmtiEvent event);
+
   // List of all JvmTiEnv objects that have been created, in their creation order.
   // NB Some elements might be null representing envs that have been deleted. They should be skipped
   // anytime this list is used.
@@ -223,6 +226,7 @@
   std::unique_ptr<JvmtiAllocationListener> alloc_listener_;
   std::unique_ptr<JvmtiGcPauseListener> gc_pause_listener_;
   std::unique_ptr<JvmtiMethodTraceListener> method_trace_listener_;
+  std::unique_ptr<JvmtiMonitorListener> monitor_listener_;
 
   // True if frame pop has ever been enabled. Since we store pointers to stack frames we need to
   // continue to listen to this event even if it has been disabled.