提交 25dcc190 编写于 作者: S sla

8027630: SIGSEGV in const char*Klass::external_name()

Reviewed-by: coleenp, sspitsyn, mgronlun
上级 15af8326
......@@ -30,6 +30,7 @@
#include "prims/jvmtiImpl.hpp"
#include "runtime/synchronizer.hpp"
#include "runtime/thread.hpp"
#include "services/threadService.hpp"
#include "utilities/growableArray.hpp"
......@@ -50,6 +51,7 @@ MetadataOnStackMark::MetadataOnStackMark() {
CodeCache::alive_nmethods_do(nmethod::mark_on_stack);
CompileBroker::mark_on_stack();
JvmtiCurrentBreakpoints::metadata_do(Metadata::mark_on_stack);
ThreadService::metadata_do(Metadata::mark_on_stack);
}
MetadataOnStackMark::~MetadataOnStackMark() {
......
......@@ -200,6 +200,12 @@ void ThreadService::oops_do(OopClosure* f) {
}
}
void ThreadService::metadata_do(void f(Metadata*)) {
for (ThreadDumpResult* dump = _threaddump_list; dump != NULL; dump = dump->next()) {
dump->metadata_do(f);
}
}
void ThreadService::add_thread_dump(ThreadDumpResult* dump) {
MutexLocker ml(Management_lock);
if (_threaddump_list == NULL) {
......@@ -451,9 +457,16 @@ void ThreadDumpResult::oops_do(OopClosure* f) {
}
}
void ThreadDumpResult::metadata_do(void f(Metadata*)) {
for (ThreadSnapshot* ts = _snapshots; ts != NULL; ts = ts->next()) {
ts->metadata_do(f);
}
}
StackFrameInfo::StackFrameInfo(javaVFrame* jvf, bool with_lock_info) {
_method = jvf->method();
_bci = jvf->bci();
_class_holder = _method->method_holder()->klass_holder();
_locked_monitors = NULL;
if (with_lock_info) {
ResourceMark rm;
......@@ -477,6 +490,11 @@ void StackFrameInfo::oops_do(OopClosure* f) {
f->do_oop((oop*) _locked_monitors->adr_at(i));
}
}
f->do_oop(&_class_holder);
}
void StackFrameInfo::metadata_do(void f(Metadata*)) {
f(_method);
}
void StackFrameInfo::print_on(outputStream* st) const {
......@@ -620,6 +638,14 @@ void ThreadStackTrace::oops_do(OopClosure* f) {
}
}
void ThreadStackTrace::metadata_do(void f(Metadata*)) {
int length = _frames->length();
for (int i = 0; i < length; i++) {
_frames->at(i)->metadata_do(f);
}
}
ConcurrentLocksDump::~ConcurrentLocksDump() {
if (_retain_map_on_free) {
return;
......@@ -823,6 +849,13 @@ void ThreadSnapshot::oops_do(OopClosure* f) {
}
}
void ThreadSnapshot::metadata_do(void f(Metadata*)) {
if (_stack_trace != NULL) {
_stack_trace->metadata_do(f);
}
}
DeadlockCycle::DeadlockCycle() {
_is_deadlock = false;
_threads = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JavaThread*>(INITIAL_ARRAY_SIZE, true);
......
......@@ -113,6 +113,7 @@ public:
// GC support
static void oops_do(OopClosure* f);
static void metadata_do(void f(Metadata*));
};
// Per-thread Statistics for synchronization
......@@ -242,6 +243,7 @@ public:
void dump_stack_at_safepoint(int max_depth, bool with_locked_monitors);
void set_concurrent_locks(ThreadConcurrentLocks* l) { _concurrent_locks = l; }
void oops_do(OopClosure* f);
void metadata_do(void f(Metadata*));
};
class ThreadStackTrace : public CHeapObj<mtInternal> {
......@@ -265,6 +267,7 @@ class ThreadStackTrace : public CHeapObj<mtInternal> {
void dump_stack_at_safepoint(int max_depth);
Handle allocate_fill_stack_trace_element_array(TRAPS);
void oops_do(OopClosure* f);
void metadata_do(void f(Metadata*));
GrowableArray<oop>* jni_locked_monitors() { return _jni_locked_monitors; }
int num_jni_locked_monitors() { return (_jni_locked_monitors != NULL ? _jni_locked_monitors->length() : 0); }
......@@ -280,6 +283,9 @@ class StackFrameInfo : public CHeapObj<mtInternal> {
Method* _method;
int _bci;
GrowableArray<oop>* _locked_monitors; // list of object monitors locked by this frame
// We need to save the mirrors in the backtrace to keep the class
// from being unloaded while we still have this stack trace.
oop _class_holder;
public:
......@@ -289,9 +295,10 @@ class StackFrameInfo : public CHeapObj<mtInternal> {
delete _locked_monitors;
}
};
Method* method() const { return _method; }
Method* method() const { return _method; }
int bci() const { return _bci; }
void oops_do(OopClosure* f);
void metadata_do(void f(Metadata*));
int num_locked_monitors() { return (_locked_monitors != NULL ? _locked_monitors->length() : 0); }
GrowableArray<oop>* locked_monitors() { return _locked_monitors; }
......@@ -354,6 +361,7 @@ class ThreadDumpResult : public StackObj {
int num_snapshots() { return _num_snapshots; }
ThreadSnapshot* snapshots() { return _snapshots; }
void oops_do(OopClosure* f);
void metadata_do(void f(Metadata*));
};
class DeadlockCycle : public CHeapObj<mtInternal> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册