src/share/vm/ci/ciField.cpp

Print this page

        

*** 175,185 **** // Either (a) it is marked shared, or else (b) we are done bootstrapping. assert(is_shared() || ciObjectFactory::is_initialized(), "bootstrap classes must not create & cache unshared fields"); } ! static bool trust_final_non_static_fields(ciInstanceKlass* holder) { if (holder == NULL) return false; if (holder->name() == ciSymbol::java_lang_System()) // Never trust strangely unstable finals: System.out, etc. return false; --- 175,185 ---- // Either (a) it is marked shared, or else (b) we are done bootstrapping. assert(is_shared() || ciObjectFactory::is_initialized(), "bootstrap classes must not create & cache unshared fields"); } ! bool trust_final_non_static_fields(ciInstanceKlass* holder) { if (holder == NULL) return false; if (holder->name() == ciSymbol::java_lang_System()) // Never trust strangely unstable finals: System.out, etc. return false;
*** 188,197 **** --- 188,203 ---- 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 the non-serializable classes in java/util/concurrent/atomic. This benefits, + // most notably, Atomic*FieldUpdaters. We bail on serializable classes in case there is + // any special treatment for final fields done by deserializers. + if (holder->is_in_package("java/util/concurrent/atomic")) { + return !holder->is_subtype_of(CURRENT_ENV->Serializable_klass()); + } return TrustFinalNonStaticFields; } void ciField::initialize_from(fieldDescriptor* fd) { // Get the flags, offset, and canonical holder of the field.