8149789: SIGSEGV in CompileTask::print
authorneliasso
Thu, 25 Feb 2016 10:44:19 +0100
changeset 36322 218528915a61
parent 36321 d3618f1ff1bb
child 36323 f7d5ddfbb5ce
8149789: SIGSEGV in CompileTask::print Summary: Print tasks from active compile threads requires safepoint Reviewed-by: kvn
hotspot/src/share/vm/compiler/compileBroker.cpp
hotspot/src/share/vm/runtime/vm_operations.cpp
hotspot/src/share/vm/runtime/vm_operations.hpp
hotspot/src/share/vm/services/diagnosticCommand.cpp
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Thu Feb 25 10:42:42 2016 +0100
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Thu Feb 25 10:44:19 2016 +0100
@@ -469,7 +469,6 @@
 void CompileBroker::print_compile_queues(outputStream* st) {
   st->print_cr("Current compiles: ");
   MutexLocker locker(MethodCompileQueue_lock);
-  MutexLocker locker2(Threads_lock);
 
   char buf[2000];
   int buflen = sizeof(buf);
--- a/hotspot/src/share/vm/runtime/vm_operations.cpp	Thu Feb 25 10:42:42 2016 +0100
+++ b/hotspot/src/share/vm/runtime/vm_operations.cpp	Thu Feb 25 10:44:19 2016 +0100
@@ -485,6 +485,10 @@
   }
 }
 
+void VM_PrintCompileQueue::doit() {
+  CompileBroker::print_compile_queues(_out);
+}
+
 #if INCLUDE_SERVICES
 void VM_PrintClassHierarchy::doit() {
   KlassHierarchy::print_class_hierarchy(_out, _print_interfaces, _print_subclasses, _classname);
--- a/hotspot/src/share/vm/runtime/vm_operations.hpp	Thu Feb 25 10:42:42 2016 +0100
+++ b/hotspot/src/share/vm/runtime/vm_operations.hpp	Thu Feb 25 10:44:19 2016 +0100
@@ -105,6 +105,7 @@
   template(DumpHashtable)                         \
   template(DumpTouchedMethods)                    \
   template(MarkActiveNMethods)                    \
+  template(PrintCompileQueue)                     \
   template(PrintClassHierarchy)                   \
 
 class VM_Operation: public CHeapObj<mtInternal> {
@@ -421,6 +422,17 @@
   void doit();
 };
 
+class VM_PrintCompileQueue: public VM_Operation {
+ private:
+  outputStream* _out;
+
+ public:
+  VM_PrintCompileQueue(outputStream* st) : _out(st) {}
+  VMOp_Type type() const { return VMOp_PrintCompileQueue; }
+  Mode evaluation_mode() const { return _safepoint; }
+  void doit();
+};
+
 #if INCLUDE_SERVICES
 class VM_PrintClassHierarchy: public VM_Operation {
  private:
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp	Thu Feb 25 10:42:42 2016 +0100
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp	Thu Feb 25 10:44:19 2016 +0100
@@ -832,7 +832,8 @@
 }
 
 void CompileQueueDCmd::execute(DCmdSource source, TRAPS) {
-  CompileBroker::print_compile_queues(output());
+  VM_PrintCompileQueue printCompileQueueOp(output());
+  VMThread::execute(&printCompileQueueOp);
 }
 
 void CodeListDCmd::execute(DCmdSource source, TRAPS) {