< prev index next >

src/hotspot/share/ci/ciField.cpp

Print this page
rev 57242 : imported patch 8234049.patch


 202   if (is_reference_type(field_type)) {
 203     _type = NULL;  // must call compute_type on first access
 204   } else {
 205     _type = ciType::make(field_type);
 206   }
 207 
 208   initialize_from(fd);
 209 
 210   // Either (a) it is marked shared, or else (b) we are done bootstrapping.
 211   assert(is_shared() || ciObjectFactory::is_initialized(),
 212          "bootstrap classes must not create & cache unshared fields");
 213 }
 214 
 215 static bool trust_final_non_static_fields(ciInstanceKlass* holder) {
 216   if (holder == NULL)
 217     return false;
 218   if (holder->name() == ciSymbol::java_lang_System())
 219     // Never trust strangely unstable finals:  System.out, etc.
 220     return false;
 221   // Even if general trusting is disabled, trust system-built closures in these packages.
 222   if (holder->is_in_package("java/lang/invoke") || holder->is_in_package("sun/invoke"))


 223     return true;
 224   // Trust VM unsafe anonymous classes. They are private API (jdk.internal.misc.Unsafe)
 225   // and can't be serialized, so there is no hacking of finals going on with them.
 226   if (holder->is_unsafe_anonymous())
 227     return true;
 228   // Trust final fields in all boxed classes
 229   if (holder->is_box_klass())
 230     return true;
 231   // Trust final fields in String
 232   if (holder->name() == ciSymbol::java_lang_String())
 233     return true;
 234   // Trust Atomic*FieldUpdaters: they are very important for performance, and make up one
 235   // more reason not to use Unsafe, if their final fields are trusted. See more in JDK-8140483.
 236   if (holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl() ||
 237       holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_CASUpdater() ||
 238       holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_LockedUpdater() ||
 239       holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicReferenceFieldUpdater_Impl()) {
 240     return true;
 241   }
 242   return TrustFinalNonStaticFields;




 202   if (is_reference_type(field_type)) {
 203     _type = NULL;  // must call compute_type on first access
 204   } else {
 205     _type = ciType::make(field_type);
 206   }
 207 
 208   initialize_from(fd);
 209 
 210   // Either (a) it is marked shared, or else (b) we are done bootstrapping.
 211   assert(is_shared() || ciObjectFactory::is_initialized(),
 212          "bootstrap classes must not create & cache unshared fields");
 213 }
 214 
 215 static bool trust_final_non_static_fields(ciInstanceKlass* holder) {
 216   if (holder == NULL)
 217     return false;
 218   if (holder->name() == ciSymbol::java_lang_System())
 219     // Never trust strangely unstable finals:  System.out, etc.
 220     return false;
 221   // Even if general trusting is disabled, trust system-built closures in these packages.
 222   if (holder->is_in_package("java/lang/invoke") || holder->is_in_package("sun/invoke") ||
 223       holder->is_in_package("jdk/internal/foreign") || holder->is_in_package("jdk/incubator/foreign") ||
 224       holder->is_in_package("java/lang"))
 225     return true;
 226   // Trust VM unsafe anonymous classes. They are private API (jdk.internal.misc.Unsafe)
 227   // and can't be serialized, so there is no hacking of finals going on with them.
 228   if (holder->is_unsafe_anonymous())
 229     return true;
 230   // Trust final fields in all boxed classes
 231   if (holder->is_box_klass())
 232     return true;
 233   // Trust final fields in String
 234   if (holder->name() == ciSymbol::java_lang_String())
 235     return true;
 236   // Trust Atomic*FieldUpdaters: they are very important for performance, and make up one
 237   // more reason not to use Unsafe, if their final fields are trusted. See more in JDK-8140483.
 238   if (holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl() ||
 239       holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_CASUpdater() ||
 240       holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_LockedUpdater() ||
 241       holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicReferenceFieldUpdater_Impl()) {
 242     return true;
 243   }
 244   return TrustFinalNonStaticFields;


< prev index next >