From 215e71a2165c3bb7292aa800c9f47832c3eba6e0 Mon Sep 17 00:00:00 2001 From: Zihao Lin Date: Fri, 7 Nov 2025 18:56:53 +0800 Subject: [PATCH 1/2] fix --- src/hotspot/share/ci/ciField.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/hotspot/share/ci/ciField.cpp b/src/hotspot/share/ci/ciField.cpp index d47c4c508d775..502568c18e541 100644 --- a/src/hotspot/share/ci/ciField.cpp +++ b/src/hotspot/share/ci/ciField.cpp @@ -236,9 +236,6 @@ static bool trust_final_non_static_fields(ciInstanceKlass* holder) { // 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() || From 36f8bce16c2ed50f0f0012a95955f78336456c75 Mon Sep 17 00:00:00 2001 From: Zihao Lin Date: Wed, 12 Nov 2025 13:09:17 +0800 Subject: [PATCH 2/2] remove --- src/hotspot/share/ci/ciField.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/hotspot/share/ci/ciField.cpp b/src/hotspot/share/ci/ciField.cpp index 502568c18e541..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,9 +227,6 @@ 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;