< prev index next >

src/hotspot/share/services/threadService.cpp

Print this page
@@ -43,10 +43,11 @@
  #include "runtime/atomic.hpp"
  #include "runtime/handles.inline.hpp"
  #include "runtime/init.hpp"
  #include "runtime/javaThread.inline.hpp"
  #include "runtime/objectMonitor.inline.hpp"
+ #include "runtime/synchronizer.hpp"
  #include "runtime/thread.inline.hpp"
  #include "runtime/threads.hpp"
  #include "runtime/threadSMR.inline.hpp"
  #include "runtime/vframe.hpp"
  #include "runtime/vmThread.hpp"

@@ -685,11 +686,11 @@
      }
      delete _jni_locked_monitors;
    }
  }
  
- void ThreadStackTrace::dump_stack_at_safepoint(int maxDepth, ObjectMonitorsHashtable* table, bool full) {
+ void ThreadStackTrace::dump_stack_at_safepoint(int maxDepth, ObjectMonitorsView* monitors, bool full) {
    assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped");
  
    if (_thread->has_last_Java_frame()) {
      RegisterMap reg_map(_thread,
                          RegisterMap::UpdateMap::include,

@@ -721,21 +722,11 @@
  
    if (_with_locked_monitors) {
      // Iterate inflated monitors and find monitors locked by this thread
      // that are not found in the stack, e.g. JNI locked monitors:
      InflatedMonitorsClosure imc(this);
-     if (table != nullptr) {
-       // Get the ObjectMonitors locked by the target thread, if any,
-       // and does not include any where owner is set to a stack lock
-       // address in the target thread:
-       ObjectMonitorsHashtable::PtrList* list = table->get_entry(_thread);
-       if (list != nullptr) {
-         ObjectSynchronizer::monitors_iterate(&imc, list, _thread);
-       }
-     } else {
-       ObjectSynchronizer::monitors_iterate(&imc, _thread);
-     }
+     monitors->visit(&imc, _thread);
    }
  }
  
  
  bool ThreadStackTrace::is_owned_monitor_on_stack(oop object) {

@@ -986,13 +977,13 @@
    delete _stack_trace;
    delete _concurrent_locks;
  }
  
  void ThreadSnapshot::dump_stack_at_safepoint(int max_depth, bool with_locked_monitors,
-                                              ObjectMonitorsHashtable* table, bool full) {
+                                              ObjectMonitorsView* monitors, bool full) {
    _stack_trace = new ThreadStackTrace(_thread, with_locked_monitors);
-   _stack_trace->dump_stack_at_safepoint(max_depth, table, full);
+   _stack_trace->dump_stack_at_safepoint(max_depth, monitors, full);
  }
  
  
  void ThreadSnapshot::metadata_do(void f(Metadata*)) {
    if (_stack_trace != nullptr) {
< prev index next >