hotspot/src/share/vm/classfile/javaClasses.cpp
changeset 1890 9ce941df84eb
parent 1889 24b003a6fe46
child 2105 347008ce7984
equal deleted inserted replaced
1889:24b003a6fe46 1890:9ce941df84eb
   439   return mirror;
   439   return mirror;
   440 }
   440 }
   441 
   441 
   442 bool java_lang_Class::offsets_computed = false;
   442 bool java_lang_Class::offsets_computed = false;
   443 int  java_lang_Class::classRedefinedCount_offset = -1;
   443 int  java_lang_Class::classRedefinedCount_offset = -1;
       
   444 int  java_lang_Class::parallelCapable_offset = -1;
   444 
   445 
   445 void java_lang_Class::compute_offsets() {
   446 void java_lang_Class::compute_offsets() {
   446   assert(!offsets_computed, "offsets should be initialized only once");
   447   assert(!offsets_computed, "offsets should be initialized only once");
   447   offsets_computed = true;
   448   offsets_computed = true;
   448 
   449 
   449   klassOop k = SystemDictionary::class_klass();
   450   klassOop k = SystemDictionary::class_klass();
   450   // The classRedefinedCount field is only present starting in 1.5,
   451   // The classRedefinedCount field is only present starting in 1.5,
   451   // so don't go fatal.
   452   // so don't go fatal.
   452   compute_optional_offset(classRedefinedCount_offset,
   453   compute_optional_offset(classRedefinedCount_offset,
   453     k, vmSymbols::classRedefinedCount_name(), vmSymbols::int_signature());
   454     k, vmSymbols::classRedefinedCount_name(), vmSymbols::int_signature());
       
   455 
       
   456   // The field indicating parallelCapable (parallelLockMap) is only present starting in 7,
       
   457   klassOop k1 = SystemDictionary::classloader_klass();
       
   458   compute_optional_offset(parallelCapable_offset,
       
   459     k1, vmSymbols::parallelCapable_name(), vmSymbols::concurrenthashmap_signature());
       
   460 }
       
   461 
       
   462 // For class loader classes, parallelCapable defined
       
   463 // based on non-null field
       
   464 // Written to by java.lang.ClassLoader, vm only reads this field, doesn't set it
       
   465 bool java_lang_Class::parallelCapable(oop class_loader) {
       
   466   if (!JDK_Version::is_gte_jdk17x_version()
       
   467      || parallelCapable_offset == -1) {
       
   468      // Default for backward compatibility is false
       
   469      return false;
       
   470   }
       
   471   return (class_loader->obj_field(parallelCapable_offset) != NULL);
   454 }
   472 }
   455 
   473 
   456 int java_lang_Class::classRedefinedCount(oop the_class_mirror) {
   474 int java_lang_Class::classRedefinedCount(oop the_class_mirror) {
   457   if (!JDK_Version::is_gte_jdk15x_version()
   475   if (!JDK_Version::is_gte_jdk15x_version()
   458       || classRedefinedCount_offset == -1) {
   476       || classRedefinedCount_offset == -1) {