diff --git a/src/hotspot/share/ci/ciField.cpp b/src/hotspot/share/ci/ciField.cpp index d47c4c508d775..8f33c17d0e691 100644 --- a/src/hotspot/share/ci/ciField.cpp +++ b/src/hotspot/share/ci/ciField.cpp @@ -216,9 +216,6 @@ ciField::ciField(fieldDescriptor *fd) : static bool trust_final_non_static_fields(ciInstanceKlass* holder) { if (holder == nullptr) return false; - if (holder->name() == ciSymbols::java_lang_System()) - // Never trust strangely unstable finals: System.out, etc. - return false; // 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") || holder->is_in_package("java/lang/reflect") || holder->is_in_package("jdk/internal/reflect") || @@ -230,15 +227,9 @@ static bool trust_final_non_static_fields(ciInstanceKlass* holder) { // can't be serialized, so there is no hacking of finals going on with them. if (holder->is_hidden()) return true; - // Trust final fields in all boxed classes - if (holder->is_box_klass()) - return true; // Trust final fields in records if (holder->is_record()) return true; - // Trust final fields in String - if (holder->name() == ciSymbols::java_lang_String()) - 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() == ciSymbols::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl() ||