< prev index next >

src/hotspot/share/gc/shared/memAllocator.cpp

Print this page

        

@@ -381,25 +381,30 @@
   assert(_word_size >= hs, "unexpected object size");
   oopDesc::set_klass_gap(mem, 0);
   Copy::fill_to_aligned_words(mem + hs, _word_size - hs);
 }
 
-oop MemAllocator::finish(HeapWord* mem) const {
+inline void MemAllocator::finish_mark(HeapWord* mem) const {
   assert(mem != NULL, "NULL object pointer");
-  if (UseBiasedLocking) {
-    oopDesc::set_mark_raw(mem, _klass->prototype_header());
-  } else {
-    // May be bootstrapping
-    oopDesc::set_mark_raw(mem, markOopDesc::prototype());
-  }
+  oopDesc::set_mark_raw(mem, Klass::default_prototype_header(_klass));
+}
+
+oop MemAllocator::finish(HeapWord* mem) const {
+  finish_mark(mem);
   // Need a release store to ensure array/class length, mark word, and
   // object zeroing are visible before setting the klass non-NULL, for
   // concurrent collectors.
   oopDesc::release_set_klass(mem, _klass);
   return oop(mem);
 }
 
+oop MemAllocator::finish_with_properties(HeapWord* mem, ArrayStorageProperties storage_props) const {
+  finish_mark(mem);
+  oopDesc::release_set_metadata(mem, storage_props, _klass);
+  return oop(mem);
+}
+
 oop ObjAllocator::initialize(HeapWord* mem) const {
   mem_clear(mem);
   return finish(mem);
 }
 

@@ -419,11 +424,13 @@
   assert(_length >= 0, "length should be non-negative");
   if (_do_zero) {
     mem_clear(mem);
   }
   arrayOopDesc::set_length(mem, _length);
-  return finish(mem);
+  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());
 }
 
 oop ClassAllocator::initialize(HeapWord* mem) const {
   // Set oop_size field before setting the _klass field because a
   // non-NULL _klass field indicates that the object is parsable by
< prev index next >