changeset 10334:5c91d4315495

8149789: SIGSEGV in CompileTask::print Summary: Print tasks from active compile threads requires safepoint Reviewed-by: kvn
author neliasso
date Thu, 25 Feb 2016 10:44:19 +0100
parents 8f0e2c77a6da
children f4915777c32c
files src/share/vm/compiler/compileBroker.cpp src/share/vm/runtime/vm_operations.cpp src/share/vm/runtime/vm_operations.hpp src/share/vm/services/diagnosticCommand.cpp
diffstat 4 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/compiler/compileBroker.cpp	Thu Feb 25 10:42:42 2016 +0100
+++ b/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/src/share/vm/runtime/vm_operations.cpp	Thu Feb 25 10:42:42 2016 +0100
+++ b/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/src/share/vm/runtime/vm_operations.hpp	Thu Feb 25 10:42:42 2016 +0100
+++ b/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/src/share/vm/services/diagnosticCommand.cpp	Thu Feb 25 10:42:42 2016 +0100
+++ b/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) {