< prev index next >

src/hotspot/share/c1/c1_Instruction.cpp

Print this page

@@ -115,16 +115,19 @@
 }
 
 bool Instruction::is_flattened_array() const {
   if (ValueArrayFlatten) {
     ciType* type = declared_type();
-    if (type != NULL &&
-        type->is_value_array_klass() &&
-        type->as_value_array_klass()->element_klass()->as_value_klass()->flatten_array()) {
+    if (type != NULL && type->is_value_array_klass()) {
+      ciValueKlass* element_klass = type->as_value_array_klass()->element_klass()->as_value_klass();
+      if (!element_klass->is_loaded() || element_klass->flatten_array()) {
+        // Assume that all unloaded value arrays are not flattenable. If they
+        // turn out to be flattenable, we deoptimize on aaload/aastore.
     return true;
     }
   }
+  }
 
   return false;
 }
 
 #ifndef PRODUCT
< prev index next >