8159666: Better CDS support for Event-based tracing

Reviewed-by: jiangli, mgronlun
This commit is contained in:
Ioi Lam 2016-06-20 22:02:20 -07:00
parent a52192d206
commit 79377a1bf1
3 changed files with 11 additions and 1 deletions

View file

@ -1961,6 +1961,11 @@ void InstanceKlass::remove_unshareable_info() {
m->remove_unshareable_info(); m->remove_unshareable_info();
} }
// cached_class_file might be pointing to a malloc'ed buffer allocated by
// event-based tracing code at CDS dump time. It's not usable at runtime
// so let's clear it.
set_cached_class_file(NULL);
// do array classes also. // do array classes also.
array_klasses_do(remove_unshareable_in_class); array_klasses_do(remove_unshareable_in_class);
} }

View file

@ -482,6 +482,7 @@ void Klass::oops_do(OopClosure* cl) {
void Klass::remove_unshareable_info() { void Klass::remove_unshareable_info() {
assert (DumpSharedSpaces, "only called for DumpSharedSpaces"); assert (DumpSharedSpaces, "only called for DumpSharedSpaces");
TRACE_REMOVE_KLASS_ID(this);
set_subklass(NULL); set_subklass(NULL);
set_next_sibling(NULL); set_next_sibling(NULL);
@ -494,7 +495,8 @@ void Klass::remove_unshareable_info() {
} }
void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) { void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
TRACE_INIT_KLASS_ID(this); TRACE_RESTORE_KLASS_ID(this);
// If an exception happened during CDS restore, some of these fields may already be // If an exception happened during CDS restore, some of these fields may already be
// set. We leave the class on the CLD list, even if incomplete so that we don't // set. We leave the class on the CLD list, even if incomplete so that we don't
// modify the CLD list outside a safepoint. // modify the CLD list outside a safepoint.

View file

@ -33,6 +33,9 @@ typedef u8 traceid;
#define TRACE_KLASS_DEFINITION(k, t) #define TRACE_KLASS_DEFINITION(k, t)
#define TRACE_INIT_KLASS_ID(k) #define TRACE_INIT_KLASS_ID(k)
#define TRACE_REMOVE_KLASS_ID(k)
#define TRACE_RESTORE_KLASS_ID(k)
#define TRACE_INIT_MODULE_ID(m) #define TRACE_INIT_MODULE_ID(m)
#define TRACE_INIT_PACKAGE_ID(p) #define TRACE_INIT_PACKAGE_ID(p)
#define TRACE_INIT_THREAD_ID(td) #define TRACE_INIT_THREAD_ID(td)