< prev index next > src/hotspot/share/cds/archiveHeapWriter.cpp
Print this page
_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 {
_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 {
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,
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,
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");
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");
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");
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 >