< prev index next >

src/hotspot/share/cds/heapShared.cpp

Print this page
*** 305,16 ***
      //
      // 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);
  
      ArchivedObjectCache* cache = archived_object_cache();
      CachedOopInfo info = make_cached_oop_info(archived_oop);
      cache->put(obj, info);
      if (_original_object_table != NULL) {
--- 305,18 ---
      //
      // 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.
!     if (!(EnableValhalla && obj->mark().is_inline_type())) {
!       int hash_original = obj->identity_hash();
!       archived_oop->set_mark(archived_oop->klass()->prototype_header().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);
+     }
  
      ArchivedObjectCache* cache = archived_object_cache();
      CachedOopInfo info = make_cached_oop_info(archived_oop);
      cache->put(obj, info);
      if (_original_object_table != NULL) {

*** 543,11 ***
    HeapWord* mem = G1CollectedHeap::heap()->archive_mem_allocate(size);
  
    memset(mem, 0, size * BytesPerWord);
    {
      // 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);
--- 545,11 ---
    HeapWord* mem = G1CollectedHeap::heap()->archive_mem_allocate(size);
  
    memset(mem, 0, size * BytesPerWord);
    {
      // This is copied from MemAllocator::finish
!     oopDesc::set_mark(mem, k->prototype_header());
      oopDesc::release_set_klass(mem, k);
    }
    {
      // This is copied from ObjArrayAllocator::initialize
      arrayOopDesc::set_length(mem, length);
< prev index next >