8003421: NPG: Move oops out of InstanceKlass into mirror

Inject protection_domain, signers, init_lock into java_lang_Class

Reviewed-by: stefank, dholmes, sla
This commit is contained in:
Coleen Phillimore 2013-05-22 14:37:49 -04:00
parent a1b903879f
commit 6ed8c8fcea
18 changed files with 130 additions and 136 deletions

View file

@ -268,8 +268,6 @@ InstanceKlass::InstanceKlass(int vtable_len,
set_fields(NULL, 0);
set_constants(NULL);
set_class_loader_data(NULL);
set_protection_domain(NULL);
set_signers(NULL);
set_source_file_name(NULL);
set_source_debug_extension(NULL, 0);
set_array_name(NULL);
@ -279,7 +277,6 @@ InstanceKlass::InstanceKlass(int vtable_len,
set_is_marked_dependent(false);
set_init_state(InstanceKlass::allocated);
set_init_thread(NULL);
set_init_lock(NULL);
set_reference_type(rt);
set_oop_map_cache(NULL);
set_jni_ids(NULL);
@ -408,12 +405,6 @@ void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) {
}
set_inner_classes(NULL);
// Null out Java heap objects, although these won't be walked to keep
// alive once this InstanceKlass is deallocated.
set_protection_domain(NULL);
set_signers(NULL);
set_init_lock(NULL);
// We should deallocate the Annotations instance
MetadataFactory::free_metadata(loader_data, annotations());
set_annotations(NULL);
@ -451,6 +442,24 @@ void InstanceKlass::eager_initialize(Thread *thread) {
}
}
// JVMTI spec thinks there are signers and protection domain in the
// instanceKlass. These accessors pretend these fields are there.
// The hprof specification also thinks these fields are in InstanceKlass.
oop InstanceKlass::protection_domain() const {
// return the protection_domain from the mirror
return java_lang_Class::protection_domain(java_mirror());
}
// To remove these from requires an incompatible change and CCC request.
objArrayOop InstanceKlass::signers() const {
// return the signers from the mirror
return java_lang_Class::signers(java_mirror());
}
volatile oop InstanceKlass::init_lock() const {
// return the init lock from the mirror
return java_lang_Class::init_lock(java_mirror());
}
void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_oop) {
EXCEPTION_MARK;
@ -1883,16 +1892,6 @@ bool InstanceKlass::is_dependent_nmethod(nmethod* nm) {
// Garbage collection
void InstanceKlass::oops_do(OopClosure* cl) {
Klass::oops_do(cl);
cl->do_oop(adr_protection_domain());
cl->do_oop(adr_signers());
cl->do_oop(adr_init_lock());
// Don't walk the arrays since they are walked from the ClassLoaderData objects.
}
#ifdef ASSERT
template <class T> void assert_is_in(T *p) {
T heap_oop = oopDesc::load_heap_oop(p);
@ -2241,9 +2240,6 @@ void InstanceKlass::remove_unshareable_info() {
m->remove_unshareable_info();
}
// Need to reinstate when reading back the class.
set_init_lock(NULL);
// do array classes also.
array_klasses_do(remove_unshareable_in_class);
}
@ -2275,13 +2271,6 @@ void InstanceKlass::restore_unshareable_info(TRAPS) {
ik->itable()->initialize_itable(false, CHECK);
}
// Allocate a simple java object for a lock.
// This needs to be a java object because during class initialization
// it can be held across a java call.
typeArrayOop r = oopFactory::new_typeArray(T_INT, 0, CHECK);
Handle h(THREAD, (oop)r);
ik->set_init_lock(h());
// restore constant pool resolved references
ik->constants()->restore_unshareable_info(CHECK);
@ -2836,10 +2825,7 @@ void InstanceKlass::print_on(outputStream* st) const {
class_loader_data()->print_value_on(st);
st->cr();
}
st->print(BULLET"protection domain: "); ((InstanceKlass*)this)->protection_domain()->print_value_on(st); st->cr();
st->print(BULLET"host class: "); host_klass()->print_value_on_maybe_null(st); st->cr();
st->print(BULLET"signers: "); signers()->print_value_on(st); st->cr();
st->print(BULLET"init_lock: "); ((oop)_init_lock)->print_value_on(st); st->cr();
if (source_file_name() != NULL) {
st->print(BULLET"source file: ");
source_file_name()->print_value_on(st);
@ -3040,7 +3026,6 @@ void InstanceKlass::collect_statistics(KlassSizeStats *sz) const {
n += (sz->_method_ordering_bytes = sz->count_array(method_ordering()));
n += (sz->_local_interfaces_bytes = sz->count_array(local_interfaces()));
n += (sz->_transitive_interfaces_bytes = sz->count_array(transitive_interfaces()));
n += (sz->_signers_bytes = sz->count_array(signers()));
n += (sz->_fields_bytes = sz->count_array(fields()));
n += (sz->_inner_classes_bytes = sz->count_array(inner_classes()));
sz->_ro_bytes += n;
@ -3206,17 +3191,11 @@ void InstanceKlass::verify_on(outputStream* st) {
guarantee(constants()->is_metadata(), "should be in metaspace");
guarantee(constants()->is_constantPool(), "should be constant pool");
}
if (protection_domain() != NULL) {
guarantee(protection_domain()->is_oop(), "should be oop");
}
const Klass* host = host_klass();
if (host != NULL) {
guarantee(host->is_metadata(), "should be in metaspace");
guarantee(host->is_klass(), "should be klass");
}
if (signers() != NULL) {
guarantee(signers()->is_objArray(), "should be obj array");
}
}
void InstanceKlass::oop_verify_on(oop obj, outputStream* st) {