4670071: loadClassInternal is too restrictive

VM support for deadlock fix. Library fix in 4735126. See API proposal.

Reviewed-by: dholmes, blacklion
This commit is contained in:
Karen Kinnear 2009-01-05 13:44:03 -05:00
parent f05b009ce8
commit 315de68fc0
6 changed files with 138 additions and 66 deletions

View file

@ -441,6 +441,7 @@ oop java_lang_Class::primitive_mirror(BasicType t) {
bool java_lang_Class::offsets_computed = false;
int java_lang_Class::classRedefinedCount_offset = -1;
int java_lang_Class::parallelCapable_offset = -1;
void java_lang_Class::compute_offsets() {
assert(!offsets_computed, "offsets should be initialized only once");
@ -451,6 +452,23 @@ void java_lang_Class::compute_offsets() {
// so don't go fatal.
compute_optional_offset(classRedefinedCount_offset,
k, vmSymbols::classRedefinedCount_name(), vmSymbols::int_signature());
// The field indicating parallelCapable (parallelLockMap) is only present starting in 7,
klassOop k1 = SystemDictionary::classloader_klass();
compute_optional_offset(parallelCapable_offset,
k1, vmSymbols::parallelCapable_name(), vmSymbols::concurrenthashmap_signature());
}
// For class loader classes, parallelCapable defined
// based on non-null field
// Written to by java.lang.ClassLoader, vm only reads this field, doesn't set it
bool java_lang_Class::parallelCapable(oop class_loader) {
if (!JDK_Version::is_gte_jdk17x_version()
|| parallelCapable_offset == -1) {
// Default for backward compatibility is false
return false;
}
return (class_loader->obj_field(parallelCapable_offset) != NULL);
}
int java_lang_Class::classRedefinedCount(oop the_class_mirror) {