changeset 55684:8d73d95166ec lworld

8224971: [lworld] ObjArrayKlass::storage_properties() should not return "null free" for multidim Reviewed-by: thartmann
author dsimms
date Wed, 29 May 2019 13:11:41 +0200
parents 7ad85c156b27
children 1a80dd639dbd
files src/hotspot/share/gc/shared/memAllocator.cpp src/hotspot/share/oops/objArrayKlass.cpp src/hotspot/share/oops/symbol.cpp src/hotspot/share/oops/symbol.hpp
diffstat 4 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shared/memAllocator.cpp	Wed May 29 11:44:02 2019 +0200
+++ b/src/hotspot/share/gc/shared/memAllocator.cpp	Wed May 29 13:11:41 2019 +0200
@@ -426,6 +426,8 @@
     mem_clear(mem);
   }
   arrayOopDesc::set_length(mem, _length);
+  assert(ArrayKlass::cast(_klass)->storage_properties().is_empty() ||
+      ArrayKlass::cast(_klass)->dimension() == 1, "Multidim should have no storage props");
   return finish_with_properties(mem, ArrayKlass::cast(_klass)->storage_properties());
 }
 
--- a/src/hotspot/share/oops/objArrayKlass.cpp	Wed May 29 11:44:02 2019 +0200
+++ b/src/hotspot/share/oops/objArrayKlass.cpp	Wed May 29 13:11:41 2019 +0200
@@ -163,12 +163,14 @@
 objArrayOop ObjArrayKlass::allocate(int length, TRAPS) {
   check_array_allocation_length(length, arrayOopDesc::max_array_length(T_OBJECT), CHECK_0);
   int size = objArrayOopDesc::object_size(length);
-  bool populate_null_free = storage_properties().is_null_free() && (dimension() == 1);
+  bool populate_null_free = storage_properties().is_null_free();
   objArrayOop array =  (objArrayOop)Universe::heap()->array_allocate(this, size, length,
                                                        /* do_zero */ true, THREAD);
   if (populate_null_free) {
+    assert(dimension() == 1, "Can only populate the final dimension");
     assert(element_klass()->is_value(), "Unexpected");
     assert(!element_klass()->is_array_klass(), "ArrayKlass unexpected here");
+    assert(!ValueKlass::cast(element_klass())->flatten_array(), "Expected valueArrayOop allocation");
     element_klass()->initialize(CHECK_NULL);
     // Populate default values...
     objArrayHandle array_h(THREAD, array);
@@ -217,7 +219,7 @@
 }
 
 ArrayStorageProperties ObjArrayKlass::storage_properties() {
-  return name()->is_Q_array_signature() ? ArrayStorageProperties::null_free : ArrayStorageProperties::empty;
+  return name()->is_Q_singledim_array_signature() ? ArrayStorageProperties::null_free : ArrayStorageProperties::empty;
 }
 
 // Either oop or narrowOop depending on UseCompressedOops.
--- a/src/hotspot/share/oops/symbol.cpp	Wed May 29 11:44:02 2019 +0200
+++ b/src/hotspot/share/oops/symbol.cpp	Wed May 29 13:11:41 2019 +0200
@@ -123,6 +123,10 @@
   return false;
 }
 
+bool Symbol::is_Q_singledim_array_signature() const {
+  return utf8_length() > 3 && char_at(0) == '[' && char_at(1) == 'Q' && ends_with(';');
+}
+
 Symbol* Symbol::fundamental_name(TRAPS) {
   if ((char_at(0) == 'Q' || char_at(0) == 'L') && ends_with(';')) {
     return SymbolTable::lookup(this, 1, utf8_length() - 1, CHECK_NULL);
--- a/src/hotspot/share/oops/symbol.hpp	Wed May 29 11:44:02 2019 +0200
+++ b/src/hotspot/share/oops/symbol.hpp	Wed May 29 13:11:41 2019 +0200
@@ -230,6 +230,7 @@
 
   bool is_Q_signature() const;
   bool is_Q_array_signature() const;
+  bool is_Q_singledim_array_signature() const;
   Symbol* fundamental_name(TRAPS);
   bool is_same_fundamental_type(Symbol*) const;