--- old/src/share/vm/ci/ciField.cpp 2015-08-31 16:53:44.670709362 +0300 +++ new/src/share/vm/ci/ciField.cpp 2015-08-31 16:53:44.626709597 +0300 @@ -177,12 +177,16 @@ "bootstrap classes must not create & cache unshared fields"); } -static bool trust_final_non_static_fields(ciInstanceKlass* holder) { +static bool trust_final_non_static_fields(ciInstanceKlass* holder, fieldDescriptor* fd) { if (holder == NULL) return false; if (holder->name() == ciSymbol::java_lang_System()) // Never trust strangely unstable finals: System.out, etc. return false; + if (UseImplicitStableValues && + holder->name() == ciSymbol::java_lang_String() && fd->is_final()) + // All final fields in String are implicitly stable. + return true; // 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; @@ -207,7 +211,7 @@ // A field can be constant if it's a final static field or if // it's a final non-static field of a trusted class (classes in // java.lang.invoke and sun.invoke packages and subpackages). - if (is_stable || trust_final_non_static_fields(_holder)) { + if (is_stable || trust_final_non_static_fields(_holder, fd)) { _is_constant = true; return; } --- old/src/share/vm/opto/c2_globals.hpp 2015-08-31 16:53:44.814708592 +0300 +++ new/src/share/vm/opto/c2_globals.hpp 2015-08-31 16:53:44.770708827 +0300 @@ -483,9 +483,6 @@ product(bool, EliminateAutoBox, true, \ "Control optimizations for autobox elimination") \ \ - diagnostic(bool, UseImplicitStableValues, true, \ - "Mark well-known stable fields as such (e.g. String.value)") \ - \ product(intx, AutoBoxCacheMax, 128, \ "Sets max value cached by the java.lang.Integer autobox cache") \ \ --- old/src/share/vm/runtime/globals.hpp 2015-08-31 16:53:44.962707800 +0300 +++ new/src/share/vm/runtime/globals.hpp 2015-08-31 16:53:44.914708058 +0300 @@ -4126,6 +4126,9 @@ "Use the FP register for holding the frame pointer " \ "and not as a general purpose register.") \ \ + diagnostic(bool, UseImplicitStableValues, true, \ + "Mark well-known stable fields as such (e.g. String.value)") \ + \ diagnostic(bool, CheckIntrinsics, true, \ "When a class C is loaded, check that " \ "(1) all intrinsics defined by the VM for class C are present "\