< prev index next >

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

Print this page
*** 380,22 ***
  
  void MemAllocator::mem_clear(HeapWord* mem) const {
    assert(mem != nullptr, "cannot initialize null object");
    const size_t hs = oopDesc::header_size();
    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 {
    assert(mem != nullptr, "null object pointer");
-   // May be bootstrapping
-   oopDesc::set_mark(mem, markWord::prototype());
    // 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 cast_to_oop(mem);
  }
  
  oop ObjAllocator::initialize(HeapWord* mem) const {
    mem_clear(mem);
--- 380,27 ---
  
  void MemAllocator::mem_clear(HeapWord* mem) const {
    assert(mem != nullptr, "cannot initialize null object");
    const size_t hs = oopDesc::header_size();
    assert(_word_size >= hs, "unexpected object size");
!   if (!UseCompactObjectHeaders) {
+     oopDesc::set_klass_gap(mem, 0);
+   }
    Copy::fill_to_aligned_words(mem + hs, _word_size - hs);
  }
  
  oop MemAllocator::finish(HeapWord* mem) const {
    assert(mem != nullptr, "null object pointer");
    // 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.
!   if (UseCompactObjectHeaders) {
+     oopDesc::release_set_mark(mem, _klass->prototype_header());
+   } else {
+     oopDesc::set_mark(mem, markWord::prototype());
+     oopDesc::release_set_klass(mem, _klass);
+   }
    return cast_to_oop(mem);
  }
  
  oop ObjAllocator::initialize(HeapWord* mem) const {
    mem_clear(mem);
< prev index next >