src/share/vm/ci/ciField.cpp

Print this page

        

@@ -175,11 +175,11 @@
   // 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) {
+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,10 +188,14 @@
     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
+  if (UseNewCode && 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.