< prev index next > src/hotspot/share/cds/heapShared.cpp
Print this page
#include "runtime/fieldDescriptor.inline.hpp"
#include "runtime/globals_extension.hpp"
#include "runtime/init.hpp"
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
+ #include "runtime/safepoint.hpp"
#include "runtime/safepointVerifiers.hpp"
#include "utilities/bitMap.inline.hpp"
#include "utilities/copy.hpp"
#if INCLUDE_G1GC
#include "gc/g1/g1CollectedHeap.hpp"
// We need to retain the identity_hash, because it may have been used by some hashtables
// in the shared heap. This also has the side effect of pre-initializing the
// identity_hash for all shared objects, so they are less likely to be written
// into during run time, increasing the potential of memory sharing.
int hash_original = obj->identity_hash();
! archived_oop->set_mark(markWord::prototype().copy_set_hash(hash_original));
assert(archived_oop->mark().is_unlocked(), "sanity");
DEBUG_ONLY(int hash_archived = archived_oop->identity_hash());
assert(hash_original == hash_archived, "Different hash codes: original %x, archived %x", hash_original, hash_archived);
// We need to retain the identity_hash, because it may have been used by some hashtables
// in the shared heap. This also has the side effect of pre-initializing the
// identity_hash for all shared objects, so they are less likely to be written
// into during run time, increasing the potential of memory sharing.
int hash_original = obj->identity_hash();
! if (UseCompactObjectHeaders) {
+ markWord mark = obj->mark();
+ if (mark.has_displaced_mark_helper()) {
+ mark = mark.displaced_mark_helper();
+ }
+ narrowKlass nklass = mark.narrow_klass();
+ archived_oop->set_mark(markWord::prototype().copy_set_hash(hash_original) LP64_ONLY(.set_narrow_klass(nklass)));
+ } else {
+ archived_oop->set_mark(markWord::prototype().copy_set_hash(hash_original));
+ }
assert(archived_oop->mark().is_unlocked(), "sanity");
DEBUG_ONLY(int hash_archived = archived_oop->identity_hash());
assert(hash_original == hash_archived, "Different hash codes: original %x, archived %x", hash_original, hash_archived);
memset(mem, 0, size * BytesPerWord);
{
// This is copied from MemAllocator::finish
if (UseBiasedLocking) {
oopDesc::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);
}
memset(mem, 0, size * BytesPerWord);
{
// This is copied from MemAllocator::finish
if (UseBiasedLocking) {
oopDesc::set_mark(mem, k->prototype_header());
+ } else if (UseCompactObjectHeaders) {
+ oopDesc::release_set_mark(mem, k->prototype_header());
} else {
oopDesc::set_mark(mem, markWord::prototype());
}
! if (!UseCompactObjectHeaders) {
+ oopDesc::release_set_klass(mem, k);
+ }
}
{
// This is copied from ObjArrayAllocator::initialize
arrayOopDesc::set_length(mem, length);
}
< prev index next >