< prev index next >

src/hotspot/share/cds/archiveBuilder.cpp

Print this page
*** 37,10 ***
--- 37,11 ---
  #include "logging/logStream.hpp"
  #include "memory/allStatic.hpp"
  #include "memory/memRegion.hpp"
  #include "memory/resourceArea.hpp"
  #include "oops/instanceKlass.hpp"
+ #include "oops/klass.inline.hpp"
  #include "oops/objArrayKlass.hpp"
  #include "oops/oopHandle.inline.hpp"
  #include "runtime/arguments.hpp"
  #include "runtime/globals_extension.hpp"
  #include "runtime/sharedRuntime.hpp"

*** 729,10 ***
--- 730,17 ---
  
  void ArchiveBuilder::make_klasses_shareable() {
    for (int i = 0; i < klasses()->length(); i++) {
      Klass* k = klasses()->at(i);
      k->remove_java_mirror();
+ #ifdef _LP64
+     if (UseCompactObjectHeaders) {
+       Klass* requested_k = to_requested(k);
+       narrowKlass nk = CompressedKlassPointers::encode_not_null(requested_k, _requested_static_archive_bottom);
+       k->set_prototype_header(markWord::prototype().set_narrow_klass(nk));
+     }
+ #endif //_LP64
      if (k->is_objArray_klass()) {
        // InstanceKlass and TypeArrayKlass will in turn call remove_unshareable_info
        // on their array classes.
      } else if (k->is_typeArray_klass()) {
        k->remove_unshareable_info();

*** 770,15 ***
  }
  
  // Update a Java object to point its Klass* to the new location after
  // shared archive has been compacted.
  void ArchiveBuilder::relocate_klass_ptr(oop o) {
    assert(DumpSharedSpaces, "sanity");
    Klass* k = get_relocated_klass(o->klass());
    Klass* requested_k = to_requested(k);
    narrowKlass nk = CompressedKlassPointers::encode_not_null(requested_k, _requested_static_archive_bottom);
!   o->set_narrow_klass(nk);
  }
  
  // RelocateBufferToRequested --- Relocate all the pointers in rw/ro,
  // so that the archive can be mapped to the "requested" location without runtime relocation.
  //
--- 778,21 ---
  }
  
  // Update a Java object to point its Klass* to the new location after
  // shared archive has been compacted.
  void ArchiveBuilder::relocate_klass_ptr(oop o) {
+ #ifdef _LP64
    assert(DumpSharedSpaces, "sanity");
    Klass* k = get_relocated_klass(o->klass());
    Klass* requested_k = to_requested(k);
    narrowKlass nk = CompressedKlassPointers::encode_not_null(requested_k, _requested_static_archive_bottom);
!   if (UseCompactObjectHeaders) {
+     o->set_mark(o->mark().set_narrow_klass(nk));
+   } else {
+     o->set_narrow_klass(nk);
+   }
+ #endif // _LP64
  }
  
  // RelocateBufferToRequested --- Relocate all the pointers in rw/ro,
  // so that the archive can be mapped to the "requested" location without runtime relocation.
  //
< prev index next >