< prev index next >

src/hotspot/share/prims/jvmtiEnvBase.cpp

Print this page
*** 1471,11 ***
      hobj = Handle(current_thread, mirror);
    }
  
    ThreadsListHandle tlh(current_thread);
    JavaThread *owning_thread = nullptr;
-   ObjectMonitor *mon = nullptr;
    jvmtiMonitorUsage ret = {
        nullptr, 0, 0, nullptr, 0, nullptr
    };
  
    uint32_t debug_bits = 0;
--- 1471,10 ---

*** 1496,12 ***
    jint nWant = 0, nWait = 0;
    markWord mark = hobj->mark();
    ResourceMark rm(current_thread);
    GrowableArray<JavaThread*>* wantList = nullptr;
  
!   if (mark.has_monitor()) {
!     mon = mark.monitor();
      assert(mon != nullptr, "must have monitor");
      // this object has a heavyweight monitor
      nWant = mon->contentions(); // # of threads contending for monitor entry, but not re-entry
      nWait = mon->waiters();     // # of threads waiting for notification,
                                  // or to re-enter monitor, in Object.wait()
--- 1495,15 ---
    jint nWant = 0, nWait = 0;
    markWord mark = hobj->mark();
    ResourceMark rm(current_thread);
    GrowableArray<JavaThread*>* wantList = nullptr;
  
!   ObjectMonitor* mon = mark.has_monitor()
!       ? ObjectSynchronizer::read_monitor(current_thread, hobj(), mark)
+       : nullptr;
+ 
+   if (mon != nullptr) {
      assert(mon != nullptr, "must have monitor");
      // this object has a heavyweight monitor
      nWant = mon->contentions(); // # of threads contending for monitor entry, but not re-entry
      nWait = mon->waiters();     // # of threads waiting for notification,
                                  // or to re-enter monitor, in Object.wait()
< prev index next >