< prev index next >

src/hotspot/share/cds/archiveHeapWriter.cpp

Print this page
*** 184,11 ***
    _buffer->at_grow(to_array_index(min_bytes));
  }
  
  objArrayOop ArchiveHeapWriter::allocate_root_segment(size_t offset, int element_count) {
    HeapWord* mem = offset_to_buffered_address<HeapWord *>(offset);
!   memset(mem, 0, objArrayOopDesc::object_size(element_count));
  
    // The initialization code is copied from MemAllocator::finish and ObjArrayAllocator::initialize.
    if (UseCompactObjectHeaders) {
      oopDesc::release_set_mark(mem, Universe::objectArrayKlass()->prototype_header());
    } else {
--- 184,11 ---
    _buffer->at_grow(to_array_index(min_bytes));
  }
  
  objArrayOop ArchiveHeapWriter::allocate_root_segment(size_t offset, int element_count) {
    HeapWord* mem = offset_to_buffered_address<HeapWord *>(offset);
!   memset(mem, 0, refArrayOopDesc::object_size(element_count));
  
    // The initialization code is copied from MemAllocator::finish and ObjArrayAllocator::initialize.
    if (UseCompactObjectHeaders) {
      oopDesc::release_set_mark(mem, Universe::objectArrayKlass()->prototype_header());
    } else {

*** 220,11 ***
  
    assert((_buffer_used % MIN_GC_REGION_ALIGNMENT) == 0,
           "Pre-condition: Roots start at aligned boundary: %zu", _buffer_used);
  
    int max_elem_count = ((MIN_GC_REGION_ALIGNMENT - arrayOopDesc::header_size_in_bytes()) / heapOopSize);
!   assert(objArrayOopDesc::object_size(max_elem_count)*HeapWordSize == MIN_GC_REGION_ALIGNMENT,
           "Should match exactly");
  
    HeapRootSegments segments(_buffer_used,
                              roots->length(),
                              MIN_GC_REGION_ALIGNMENT,
--- 220,11 ---
  
    assert((_buffer_used % MIN_GC_REGION_ALIGNMENT) == 0,
           "Pre-condition: Roots start at aligned boundary: %zu", _buffer_used);
  
    int max_elem_count = ((MIN_GC_REGION_ALIGNMENT - arrayOopDesc::header_size_in_bytes()) / heapOopSize);
!   assert(refArrayOopDesc::object_size(max_elem_count)*HeapWordSize == MIN_GC_REGION_ALIGNMENT,
           "Should match exactly");
  
    HeapRootSegments segments(_buffer_used,
                              roots->length(),
                              MIN_GC_REGION_ALIGNMENT,

*** 334,11 ***
    log_info(aot)("Size of heap region = %zu bytes, %d objects, %d roots, %d native ptrs",
                  _buffer_used, _source_objs->length() + 1, roots->length(), _num_native_ptrs);
  }
  
  size_t ArchiveHeapWriter::filler_array_byte_size(int length) {
!   size_t byte_size = objArrayOopDesc::object_size(length) * HeapWordSize;
    return byte_size;
  }
  
  int ArchiveHeapWriter::filler_array_length(size_t fill_bytes) {
    assert(is_object_aligned(fill_bytes), "must be");
--- 334,11 ---
    log_info(aot)("Size of heap region = %zu bytes, %d objects, %d roots, %d native ptrs",
                  _buffer_used, _source_objs->length() + 1, roots->length(), _num_native_ptrs);
  }
  
  size_t ArchiveHeapWriter::filler_array_byte_size(int length) {
!   size_t byte_size = refArrayOopDesc::object_size(length) * HeapWordSize;
    return byte_size;
  }
  
  int ArchiveHeapWriter::filler_array_length(size_t fill_bytes) {
    assert(is_object_aligned(fill_bytes), "must be");

*** 591,14 ***
    if (src_obj == nullptr) {
      return;
    }
    // We need to retain the identity_hash, because it may have been used by some hashtables
    // in the shared heap.
!   if (!src_obj->fast_no_hash_check()) {
      intptr_t src_hash = src_obj->identity_hash();
      if (UseCompactObjectHeaders) {
        fake_oop->set_mark(markWord::prototype().set_narrow_klass(nk).copy_set_hash(src_hash));
      } else {
        fake_oop->set_mark(markWord::prototype().copy_set_hash(src_hash));
      }
      assert(fake_oop->mark().is_unlocked(), "sanity");
  
--- 591,16 ---
    if (src_obj == nullptr) {
      return;
    }
    // We need to retain the identity_hash, because it may have been used by some hashtables
    // in the shared heap.
!   if (!src_obj->fast_no_hash_check() && (!(EnableValhalla && src_obj->mark().is_inline_type()))) {
      intptr_t src_hash = src_obj->identity_hash();
      if (UseCompactObjectHeaders) {
        fake_oop->set_mark(markWord::prototype().set_narrow_klass(nk).copy_set_hash(src_hash));
+     } else if (EnableValhalla) {
+       fake_oop->set_mark(src_klass->prototype_header().copy_set_hash(src_hash));
      } else {
        fake_oop->set_mark(markWord::prototype().copy_set_hash(src_hash));
      }
      assert(fake_oop->mark().is_unlocked(), "sanity");
  
< prev index next >