src/share/vm/ci/ciField.cpp
Print this page
@@ -188,10 +188,18 @@
return true;
// Trust VM anonymous classes. They are private API (sun.misc.Unsafe) and can't be serialized,
// so there is no hacking of finals going on with them.
if (holder->is_anonymous())
return true;
+ // Trust Atomic*FieldUpdaters: they are very important for performance, and make up one
+ // more reason not to use Unsafe, if their final fields are trusted. See more in JDK-8140483.
+ if (holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl() ||
+ holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_CASUpdater() ||
+ holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_LockedUpdater() ||
+ holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicReferenceFieldUpdater_Impl()) {
+ return true;
+ }
return TrustFinalNonStaticFields;
}
void ciField::initialize_from(fieldDescriptor* fd) {
// Get the flags, offset, and canonical holder of the field.