mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-25 15:20:11 +00:00
8268857: Merge VM_PrintJNI and VM_PrintThreads and remove the unused field 'is_deadlock' of DeadlockCycle
Reviewed-by: dholmes
This commit is contained in:
parent
1a818154cf
commit
1f0ea7c3d6
@ -399,10 +399,8 @@ static void signal_thread_entry(JavaThread* thread, TRAPS) {
|
||||
// Any SIGBREAK operations added here should make sure to flush
|
||||
// the output stream (e.g. tty->flush()) after output. See 4803766.
|
||||
// Each module also prints an extra carriage return after its output.
|
||||
VM_PrintThreads op;
|
||||
VM_PrintThreads op(tty, PrintConcurrentLocks, false /* no extended info */, true /* print JNI handle info */);
|
||||
VMThread::execute(&op);
|
||||
VM_PrintJNI jni_op;
|
||||
VMThread::execute(&jni_op);
|
||||
VM_FindDeadlocks op1(tty);
|
||||
VMThread::execute(&op1);
|
||||
Universe::print_heap_at_SIGBREAK();
|
||||
|
||||
@ -47,7 +47,6 @@
|
||||
template(DeoptimizeAll) \
|
||||
template(ZombieAll) \
|
||||
template(Verify) \
|
||||
template(PrintJNI) \
|
||||
template(HeapDumper) \
|
||||
template(DeoptimizeTheWorld) \
|
||||
template(CollectForMetadataAllocation) \
|
||||
|
||||
@ -168,6 +168,9 @@ bool VM_PrintThreads::doit_prologue() {
|
||||
|
||||
void VM_PrintThreads::doit() {
|
||||
Threads::print_on(_out, true, false, _print_concurrent_locks, _print_extended_info);
|
||||
if (_print_jni_handle_info) {
|
||||
JNIHandles::print_on(_out);
|
||||
}
|
||||
}
|
||||
|
||||
void VM_PrintThreads::doit_epilogue() {
|
||||
@ -177,10 +180,6 @@ void VM_PrintThreads::doit_epilogue() {
|
||||
}
|
||||
}
|
||||
|
||||
void VM_PrintJNI::doit() {
|
||||
JNIHandles::print_on(_out);
|
||||
}
|
||||
|
||||
void VM_PrintMetadata::doit() {
|
||||
metaspace::MetaspaceReporter::print_report(_out, _scale, _flags);
|
||||
}
|
||||
|
||||
@ -143,12 +143,14 @@ class VM_PrintThreads: public VM_Operation {
|
||||
outputStream* _out;
|
||||
bool _print_concurrent_locks;
|
||||
bool _print_extended_info;
|
||||
bool _print_jni_handle_info;
|
||||
public:
|
||||
VM_PrintThreads()
|
||||
: _out(tty), _print_concurrent_locks(PrintConcurrentLocks), _print_extended_info(false)
|
||||
: _out(tty), _print_concurrent_locks(PrintConcurrentLocks), _print_extended_info(false), _print_jni_handle_info(false)
|
||||
{}
|
||||
VM_PrintThreads(outputStream* out, bool print_concurrent_locks, bool print_extended_info)
|
||||
: _out(out), _print_concurrent_locks(print_concurrent_locks), _print_extended_info(print_extended_info)
|
||||
VM_PrintThreads(outputStream* out, bool print_concurrent_locks, bool print_extended_info, bool print_jni_handle_info)
|
||||
: _out(out), _print_concurrent_locks(print_concurrent_locks), _print_extended_info(print_extended_info),
|
||||
_print_jni_handle_info(print_jni_handle_info)
|
||||
{}
|
||||
VMOp_Type type() const {
|
||||
return VMOp_PrintThreads;
|
||||
@ -158,16 +160,6 @@ class VM_PrintThreads: public VM_Operation {
|
||||
void doit_epilogue();
|
||||
};
|
||||
|
||||
class VM_PrintJNI: public VM_Operation {
|
||||
private:
|
||||
outputStream* _out;
|
||||
public:
|
||||
VM_PrintJNI() { _out = tty; }
|
||||
VM_PrintJNI(outputStream* out) { _out = out; }
|
||||
VMOp_Type type() const { return VMOp_PrintJNI; }
|
||||
void doit();
|
||||
};
|
||||
|
||||
class VM_PrintMetadata : public VM_Operation {
|
||||
private:
|
||||
outputStream* const _out;
|
||||
|
||||
@ -183,17 +183,13 @@ static jint thread_dump(AttachOperation* op, outputStream* out) {
|
||||
}
|
||||
}
|
||||
|
||||
// thread stacks
|
||||
VM_PrintThreads op1(out, print_concurrent_locks, print_extended_info);
|
||||
// thread stacks and JNI global handles
|
||||
VM_PrintThreads op1(out, print_concurrent_locks, print_extended_info, true /* print JNI handle info */);
|
||||
VMThread::execute(&op1);
|
||||
|
||||
// JNI global handles
|
||||
VM_PrintJNI op2(out);
|
||||
VMThread::execute(&op2);
|
||||
|
||||
// Deadlock detection
|
||||
VM_FindDeadlocks op3(out);
|
||||
VMThread::execute(&op3);
|
||||
VM_FindDeadlocks op2(out);
|
||||
VMThread::execute(&op2);
|
||||
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
@ -534,17 +534,13 @@ ThreadDumpDCmd::ThreadDumpDCmd(outputStream* output, bool heap) :
|
||||
}
|
||||
|
||||
void ThreadDumpDCmd::execute(DCmdSource source, TRAPS) {
|
||||
// thread stacks
|
||||
VM_PrintThreads op1(output(), _locks.value(), _extended.value());
|
||||
// thread stacks and JNI global handles
|
||||
VM_PrintThreads op1(output(), _locks.value(), _extended.value(), true /* print JNI handle info */);
|
||||
VMThread::execute(&op1);
|
||||
|
||||
// JNI global handles
|
||||
VM_PrintJNI op2(output());
|
||||
VMThread::execute(&op2);
|
||||
|
||||
// Deadlock detection
|
||||
VM_FindDeadlocks op3(output());
|
||||
VMThread::execute(&op3);
|
||||
VM_FindDeadlocks op2(output());
|
||||
VMThread::execute(&op2);
|
||||
}
|
||||
|
||||
// Enhanced JMX Agent support
|
||||
|
||||
@ -441,8 +441,6 @@ DeadlockCycle* ThreadService::find_deadlocks_at_safepoint(ThreadsList * t_list,
|
||||
// blocked permanently. We record this as a deadlock.
|
||||
num_deadlocks++;
|
||||
|
||||
cycle->set_deadlock(true);
|
||||
|
||||
// add this cycle to the deadlocks list
|
||||
if (deadlocks == NULL) {
|
||||
deadlocks = cycle;
|
||||
@ -484,8 +482,6 @@ DeadlockCycle* ThreadService::find_deadlocks_at_safepoint(ThreadsList * t_list,
|
||||
// We have a (new) cycle
|
||||
num_deadlocks++;
|
||||
|
||||
cycle->set_deadlock(true);
|
||||
|
||||
// add this cycle to the deadlocks list
|
||||
if (deadlocks == NULL) {
|
||||
deadlocks = cycle;
|
||||
@ -955,7 +951,6 @@ void ThreadSnapshot::metadata_do(void f(Metadata*)) {
|
||||
|
||||
|
||||
DeadlockCycle::DeadlockCycle() {
|
||||
_is_deadlock = false;
|
||||
_threads = new (ResourceObj::C_HEAP, mtServiceability) GrowableArray<JavaThread*>(INITIAL_ARRAY_SIZE, mtServiceability);
|
||||
_next = NULL;
|
||||
}
|
||||
|
||||
@ -384,7 +384,6 @@ class ThreadDumpResult : public StackObj {
|
||||
|
||||
class DeadlockCycle : public CHeapObj<mtInternal> {
|
||||
private:
|
||||
bool _is_deadlock;
|
||||
GrowableArray<JavaThread*>* _threads;
|
||||
DeadlockCycle* _next;
|
||||
public:
|
||||
@ -394,9 +393,7 @@ class DeadlockCycle : public CHeapObj<mtInternal> {
|
||||
DeadlockCycle* next() { return _next; }
|
||||
void set_next(DeadlockCycle* d) { _next = d; }
|
||||
void add_thread(JavaThread* t) { _threads->append(t); }
|
||||
void reset() { _is_deadlock = false; _threads->clear(); }
|
||||
void set_deadlock(bool value) { _is_deadlock = value; }
|
||||
bool is_deadlock() { return _is_deadlock; }
|
||||
void reset() { _threads->clear(); }
|
||||
int num_threads() { return _threads->length(); }
|
||||
GrowableArray<JavaThread*>* threads() { return _threads; }
|
||||
void print_on_with(ThreadsList * t_list, outputStream* st) const;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user