comparison src/share/vm/ci/ciField.cpp @ 23454:714096aec397

8140483: Atomic*FieldUpdaters final fields should be trusted Summary: Add exceptions for A*FU subclasses that do the actual work. Reviewed-by: jrose, vlivanov
author shade
date Thu, 29 Oct 2015 14:08:19 +0300
parents 00cf2b6f51b9
children b5f3a471e646
comparison
equal deleted inserted replaced
23453:6fff3d627d0a 23454:714096aec397
185 // Never trust strangely unstable finals: System.out, etc. 185 // Never trust strangely unstable finals: System.out, etc.
186 return false; 186 return false;
187 // Even if general trusting is disabled, trust system-built closures in these packages. 187 // Even if general trusting is disabled, trust system-built closures in these packages.
188 if (holder->is_in_package("java/lang/invoke") || holder->is_in_package("sun/invoke")) 188 if (holder->is_in_package("java/lang/invoke") || holder->is_in_package("sun/invoke"))
189 return true; 189 return true;
190 // Trust Atomic*FieldUpdaters: they are very important for performance, and make up one
191 // more reason not to use Unsafe, if their final fields are trusted. See more in JDK-8140483.
192 if (holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl() ||
193 holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_CASUpdater() ||
194 holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_LockedUpdater() ||
195 holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicReferenceFieldUpdater_Impl()) {
196 return true;
197 }
190 return TrustFinalNonStaticFields; 198 return TrustFinalNonStaticFields;
191 } 199 }
192 200
193 void ciField::initialize_from(fieldDescriptor* fd) { 201 void ciField::initialize_from(fieldDescriptor* fd) {
194 // Get the flags, offset, and canonical holder of the field. 202 // Get the flags, offset, and canonical holder of the field.