8063112: Compiler diagnostic commands should have locking instead of safepoint

Remove unnecessary vm-ops and add locking instead, improve output

Reviewed-by: kvn
This commit is contained in:
Nils Eliasson 2016-01-22 15:25:40 +01:00
parent 56c2dccccf
commit ae0867c9f8
8 changed files with 48 additions and 69 deletions

View file

@ -31,6 +31,7 @@
#include "code/codeCacheExtensions.hpp"
#include "code/scopeDesc.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/compileTask.hpp"
#include "gc/shared/gcId.hpp"
#include "gc/shared/gcLocker.inline.hpp"
#include "gc/shared/workgroup.hpp"
@ -2884,6 +2885,20 @@ void JavaThread::print_on(outputStream *st) const {
print_thread_state_on(st);
_safepoint_state->print_on(st);
#endif // PRODUCT
if (is_Compiler_thread()) {
CompilerThread* ct = (CompilerThread*)this;
if (ct->task() != NULL) {
st->print(" Compiling: ");
ct->task()->print(st, NULL, true, false);
} else {
st->print(" No compile task");
}
st->cr();
}
}
void JavaThread::print_name_on_error(outputStream* st, char *buf, int buflen) const {
st->print("%s", get_thread_name_string(buf, buflen));
}
// Called by fatal error handler. The difference between this and
@ -4386,7 +4401,6 @@ void Threads::print_on(outputStream* st, bool print_stacks,
wt->print_on(st);
st->cr();
}
CompileBroker::print_compiler_threads_on(st);
st->flush();
}
@ -4439,8 +4453,24 @@ void Threads::print_on_error(outputStream* st, Thread* current, char* buf,
current->print_on_error(st, buf, buflen);
st->cr();
}
st->cr();
st->print_cr("Threads with active compile tasks:");
print_threads_compiling(st, buf, buflen);
}
void Threads::print_threads_compiling(outputStream* st, char* buf, int buflen) {
ALL_JAVA_THREADS(thread) {
if (thread->is_Compiler_thread()) {
CompilerThread* ct = (CompilerThread*) thread;
if (ct->task() != NULL) {
thread->print_name_on_error(st, buf, buflen);
ct->task()->print(st, NULL, true, true);
}
}
}
}
// Internal SpinLock and Mutex
// Based on ParkEvent

View file

@ -1660,6 +1660,7 @@ class JavaThread: public Thread {
void print_thread_state_on(outputStream*) const PRODUCT_RETURN;
void print_thread_state() const PRODUCT_RETURN;
void print_on_error(outputStream* st, char* buf, int buflen) const;
void print_name_on_error(outputStream* st, char* buf, int buflen) const;
void verify();
const char* get_thread_name() const;
private:
@ -2158,6 +2159,7 @@ class Threads: AllStatic {
print_on(tty, print_stacks, internal_format, false /* no concurrent lock printed */);
}
static void print_on_error(outputStream* st, Thread* current, char* buf, int buflen);
static void print_threads_compiling(outputStream* st, char* buf, int buflen);
// Get Java threads that are waiting to enter a monitor. If doLock
// is true, then Threads_lock is grabbed as needed. Otherwise, the

View file

@ -485,18 +485,6 @@ void VM_Exit::wait_if_vm_exited() {
}
}
void VM_PrintCompileQueue::doit() {
CompileBroker::print_compile_queues(_out);
}
void VM_PrintCodeList::doit() {
CodeCache::print_codelist(_out);
}
void VM_PrintCodeCache::doit() {
CodeCache::print_layout(_out);
}
#if INCLUDE_SERVICES
void VM_PrintClassHierarchy::doit() {
KlassHierarchy::print_class_hierarchy(_out, _print_interfaces, _print_subclasses, _classname);

View file

@ -105,9 +105,6 @@
template(DumpHashtable) \
template(DumpTouchedMethods) \
template(MarkActiveNMethods) \
template(PrintCompileQueue) \
template(PrintCodeList) \
template(PrintCodeCache) \
template(PrintClassHierarchy) \
class VM_Operation: public CHeapObj<mtInternal> {
@ -424,37 +421,6 @@ class VM_Exit: public VM_Operation {
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 _no_safepoint; }
void doit();
};
class VM_PrintCodeList: public VM_Operation {
private:
outputStream* _out;
public:
VM_PrintCodeList(outputStream* st) : _out(st) {}
VMOp_Type type() const { return VMOp_PrintCodeList; }
void doit();
};
class VM_PrintCodeCache: public VM_Operation {
private:
outputStream* _out;
public:
VM_PrintCodeCache(outputStream* st) : _out(st) {}
VMOp_Type type() const { return VMOp_PrintCodeCache; }
void doit();
};
#if INCLUDE_SERVICES
class VM_PrintClassHierarchy: public VM_Operation {
private: