< prev index next > src/hotspot/share/cds/archiveHeapWriter.cpp
Print this page
HeapWord* mem = offset_to_buffered_address<HeapWord*>(_buffer_used);
memset(mem, 0, byte_size);
{
// This is copied from MemAllocator::finish
! oopDesc::set_mark(mem, markWord::prototype());
! oopDesc::release_set_klass(mem, k);
}
{
// This is copied from ObjArrayAllocator::initialize
arrayOopDesc::set_length(mem, length);
}
HeapWord* mem = offset_to_buffered_address<HeapWord*>(_buffer_used);
memset(mem, 0, byte_size);
{
// This is copied from MemAllocator::finish
! if (UseCompactObjectHeaders) {
! oopDesc::release_set_mark(mem, k->prototype_header());
+ } else {
+ oopDesc::set_mark(mem, markWord::prototype());
+ oopDesc::release_set_klass(mem, k);
+ }
}
{
// This is copied from ObjArrayAllocator::initialize
arrayOopDesc::set_length(mem, length);
}
void ArchiveHeapWriter::init_filler_array_at_buffer_top(int array_length, size_t fill_bytes) {
assert(UseCompressedClassPointers, "Archived heap only supported for compressed klasses");
Klass* oak = Universe::objectArrayKlassObj(); // already relocated to point to archived klass
HeapWord* mem = offset_to_buffered_address<HeapWord*>(_buffer_used);
memset(mem, 0, fill_bytes);
- oopDesc::set_mark(mem, markWord::prototype());
narrowKlass nk = ArchiveBuilder::current()->get_requested_narrow_klass(oak);
! cast_to_oop(mem)->set_narrow_klass(nk);
arrayOopDesc::set_length(mem, array_length);
}
void ArchiveHeapWriter::maybe_fill_gc_region_gap(size_t required_byte_size) {
// We fill only with arrays (so we don't need to use a single HeapWord filler if the
void ArchiveHeapWriter::init_filler_array_at_buffer_top(int array_length, size_t fill_bytes) {
assert(UseCompressedClassPointers, "Archived heap only supported for compressed klasses");
Klass* oak = Universe::objectArrayKlassObj(); // already relocated to point to archived klass
HeapWord* mem = offset_to_buffered_address<HeapWord*>(_buffer_used);
memset(mem, 0, fill_bytes);
narrowKlass nk = ArchiveBuilder::current()->get_requested_narrow_klass(oak);
! if (UseCompactObjectHeaders) {
+ oopDesc::release_set_mark(mem, markWord::prototype().set_narrow_klass(nk));
+ } else {
+ oopDesc::set_mark(mem, markWord::prototype());
+ cast_to_oop(mem)->set_narrow_klass(nk);
+ }
arrayOopDesc::set_length(mem, array_length);
}
void ArchiveHeapWriter::maybe_fill_gc_region_gap(size_t required_byte_size) {
// We fill only with arrays (so we don't need to use a single HeapWord filler if the
assert(UseCompressedClassPointers, "Archived heap only supported for compressed klasses");
narrowKlass nk = ArchiveBuilder::current()->get_requested_narrow_klass(src_klass);
address buffered_addr = requested_addr_to_buffered_addr(cast_from_oop<address>(requested_obj));
oop fake_oop = cast_to_oop(buffered_addr);
! fake_oop->set_narrow_klass(nk);
// We need to retain the identity_hash, because it may have been used by some hashtables
// in the shared heap.
if (src_obj != nullptr && !src_obj->fast_no_hash_check()) {
int src_hash = src_obj->identity_hash();
! fake_oop->set_mark(markWord::prototype().copy_set_hash(src_hash));
assert(fake_oop->mark().is_unlocked(), "sanity");
DEBUG_ONLY(int archived_hash = fake_oop->identity_hash());
assert(src_hash == archived_hash, "Different hash codes: original %x, archived %x", src_hash, archived_hash);
}
assert(UseCompressedClassPointers, "Archived heap only supported for compressed klasses");
narrowKlass nk = ArchiveBuilder::current()->get_requested_narrow_klass(src_klass);
address buffered_addr = requested_addr_to_buffered_addr(cast_from_oop<address>(requested_obj));
oop fake_oop = cast_to_oop(buffered_addr);
! if (UseCompactObjectHeaders) {
+ fake_oop->set_mark(fake_oop->mark().set_narrow_klass(nk));
+ } else {
+ fake_oop->set_narrow_klass(nk);
+ }
// We need to retain the identity_hash, because it may have been used by some hashtables
// in the shared heap.
if (src_obj != nullptr && !src_obj->fast_no_hash_check()) {
int 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");
DEBUG_ONLY(int archived_hash = fake_oop->identity_hash());
assert(src_hash == archived_hash, "Different hash codes: original %x, archived %x", src_hash, archived_hash);
}
< prev index next >