OpenJDK / amber / amber
changeset 8314:057b1c20fd7e
6354181: nsk.logging.stress.threads.scmhml001 fails assertion in "src/share/vm/oops/instanceKlass.cpp, 111"
Reviewed-by: jrose, acorn
author | never |
---|---|
date | Mon, 31 Jan 2011 17:48:21 -0800 |
parents | 96d498ec7ae1 |
children | 1503f9d7681f |
files | hotspot/src/share/vm/ci/ciEnv.cpp hotspot/src/share/vm/ci/ciInstanceKlass.cpp hotspot/src/share/vm/classfile/loaderConstraints.cpp hotspot/src/share/vm/classfile/systemDictionary.cpp |
diffstat | 4 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hotspot/src/share/vm/ci/ciEnv.cpp Thu Jan 27 16:11:27 2011 -0800 +++ b/hotspot/src/share/vm/ci/ciEnv.cpp Mon Jan 31 17:48:21 2011 -0800 @@ -412,13 +412,16 @@ fail_type = _unloaded_ciinstance_klass; } KlassHandle found_klass; - if (!require_local) { - klassOop kls = SystemDictionary::find_constrained_instance_or_array_klass( - sym, loader, KILL_COMPILE_ON_FATAL_(fail_type)); - found_klass = KlassHandle(THREAD, kls); - } else { - klassOop kls = SystemDictionary::find_instance_or_array_klass( - sym, loader, domain, KILL_COMPILE_ON_FATAL_(fail_type)); + { + MutexLocker ml(Compile_lock); + klassOop kls; + if (!require_local) { + kls = SystemDictionary::find_constrained_instance_or_array_klass(sym, loader, + KILL_COMPILE_ON_FATAL_(fail_type)); + } else { + kls = SystemDictionary::find_instance_or_array_klass(sym, loader, domain, + KILL_COMPILE_ON_FATAL_(fail_type)); + } found_klass = KlassHandle(THREAD, kls); }
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Thu Jan 27 16:11:27 2011 -0800 +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Mon Jan 31 17:48:21 2011 -0800 @@ -46,6 +46,7 @@ ciKlass(h_k), _non_static_fields(NULL) { assert(get_Klass()->oop_is_instance(), "wrong type"); + assert(get_instanceKlass()->is_loaded(), "must be at least loaded"); instanceKlass* ik = get_instanceKlass(); AccessFlags access_flags = ik->access_flags();
--- a/hotspot/src/share/vm/classfile/loaderConstraints.cpp Thu Jan 27 16:11:27 2011 -0800 +++ b/hotspot/src/share/vm/classfile/loaderConstraints.cpp Mon Jan 31 17:48:21 2011 -0800 @@ -322,8 +322,14 @@ klassOop LoaderConstraintTable::find_constrained_klass(Symbol* name, Handle loader) { LoaderConstraintEntry *p = *(find_loader_constraint(name, loader)); - if (p != NULL && p->klass() != NULL) + if (p != NULL && p->klass() != NULL) { + if (Klass::cast(p->klass())->oop_is_instance() && !instanceKlass::cast(p->klass())->is_loaded()) { + // Only return fully loaded classes. Classes found through the + // constraints might still be in the process of loading. + return NULL; + } return p->klass(); + } // No constraints, or else no klass loaded yet. return NULL;
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp Thu Jan 27 16:11:27 2011 -0800 +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp Mon Jan 31 17:48:21 2011 -0800 @@ -1690,6 +1690,8 @@ void SystemDictionary::add_to_hierarchy(instanceKlassHandle k, TRAPS) { assert(k.not_null(), "just checking"); + assert_locked_or_safepoint(Compile_lock); + // Link into hierachy. Make sure the vtables are initialized before linking into k->append_to_sibling_list(); // add to superklass/sibling list k->process_interfaces(THREAD); // handle all "implements" declarations @@ -2152,6 +2154,9 @@ } +// Try to find a class name using the loader constraints. The +// loader constraints might know about a class that isn't fully loaded +// yet and these will be ignored. klassOop SystemDictionary::find_constrained_instance_or_array_klass( Symbol* class_name, Handle class_loader, TRAPS) {