diff 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
line wrap: on
line diff
--- a/src/share/vm/ci/ciField.cpp	Fri Oct 30 08:29:19 2015 -0700
+++ b/src/share/vm/ci/ciField.cpp	Thu Oct 29 14:08:19 2015 +0300
@@ -187,6 +187,14 @@
   // Even if general trusting is disabled, trust system-built closures in these packages.
   if (holder->is_in_package("java/lang/invoke") || holder->is_in_package("sun/invoke"))
     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;
 }