< prev index next >

src/hotspot/share/prims/jvmtiEnvBase.cpp

Print this page
rev 57232 : v2.00 -> v2.08 (CR8/v2.08/11-for-jdk14) patches combined into one; merge with jdk-14+25 snapshot; merge with jdk-14+26 snapshot.
rev 57233 : See CR8-to-CR9-changes; merge with 8230876.patch (2019.11.15); merge with jdk-14+25 snapshot; fuzzy merge with jdk-14+26 snapshot.

@@ -649,14 +649,21 @@
 jvmtiError
 JvmtiEnvBase::get_current_contended_monitor(JavaThread *calling_thread, JavaThread *java_thread, jobject *monitor_ptr) {
 #ifdef ASSERT
   uint32_t debug_bits = 0;
 #endif
+  // Note: The is_thread_fully_suspended() part of the assert() is
+  // from an older implementation that recognized suspension as
+  // being safe. However, that was racy in the face of rogue resumes.
+  // Should be replaced with "calling_thread == java_thread".
   assert((SafepointSynchronize::is_at_safepoint() ||
           java_thread->is_thread_fully_suspended(false, &debug_bits)),
          "at safepoint or target thread is suspended");
   oop obj = NULL;
+  // For all of the get_current_contended_monitor() call sites, we
+  // are either at a safepoint or the calling thread is operating
+  // on itself so this ObjectMonitorHandle is not strictly necessary.
   ObjectMonitorHandle omh;
   ObjectMonitor *mon = java_thread->current_waiting_monitor(&omh);
   if (mon == NULL) {
     // thread is not doing an Object.wait() call
     mon = java_thread->current_pending_monitor(&omh);

@@ -733,19 +740,25 @@
   }
 
   HandleMark hm;
   oop wait_obj = NULL;
   {
+    // For all of the get_locked_objects_in_frame() call sites, we
+    // are either at a safepoint or the calling thread is operating
+    // on itself so this ObjectMonitorHandle is not strictly necessary.
     ObjectMonitorHandle omh;
     // save object of current wait() call (if any) for later comparison
     ObjectMonitor *mon = java_thread->current_waiting_monitor(&omh);
     if (mon != NULL) {
       wait_obj = (oop)mon->object();
     }
   }
   oop pending_obj = NULL;
   {
+    // For all of the get_locked_objects_in_frame() call sites, we
+    // are either at a safepoint or the calling thread is operating
+    // on itself so this ObjectMonitorHandle is not strictly necessary.
     ObjectMonitorHandle omh;
     // save object of current enter() call (if any) for later comparison
     ObjectMonitor *mon = java_thread->current_pending_monitor(&omh);
     if (mon != NULL) {
       pending_obj = (oop)mon->object();
< prev index next >