src/hotspot/share/oops/klass.cpp
changeset 50532 a18c60527166
parent 50429 83aec1d357d4
child 50569 60d66a249db6
--- a/src/hotspot/share/oops/klass.cpp	Tue Jun 12 14:08:24 2018 -0700
+++ b/src/hotspot/share/oops/klass.cpp	Tue Jun 12 18:12:59 2018 -0400
@@ -529,20 +529,19 @@
   Handle module_handle(THREAD, ((module_entry != NULL) ? module_entry->module() : (oop)NULL));
 
   if (this->has_raw_archived_mirror()) {
+    ResourceMark rm;
     log_debug(cds, mirror)("%s has raw archived mirror", external_name());
     if (MetaspaceShared::open_archive_heap_region_mapped()) {
-      oop m = archived_java_mirror();
-      log_debug(cds, mirror)("Archived mirror is: " PTR_FORMAT, p2i(m));
-      if (m != NULL) {
-        // mirror is archived, restore
-        assert(MetaspaceShared::is_archive_object(m), "must be archived mirror object");
-        Handle m_h(THREAD, m);
-        java_lang_Class::restore_archived_mirror(this, m_h, loader, module_handle, protection_domain, CHECK);
+      bool present = java_lang_Class::restore_archived_mirror(this, loader, module_handle,
+                                                              protection_domain,
+                                                              CHECK);
+      if (present) {
         return;
       }
     }
 
     // No archived mirror data
+    log_debug(cds, mirror)("No archived mirror data for %s", external_name());
     _java_mirror = NULL;
     this->clear_has_raw_archived_mirror();
   }
@@ -558,18 +557,10 @@
 #if INCLUDE_CDS_JAVA_HEAP
 // Used at CDS dump time to access the archived mirror. No GC barrier.
 oop Klass::archived_java_mirror_raw() {
-  assert(DumpSharedSpaces, "called only during runtime");
   assert(has_raw_archived_mirror(), "must have raw archived mirror");
   return CompressedOops::decode(_archived_mirror);
 }
 
-// Used at CDS runtime to get the archived mirror from shared class. Uses GC barrier.
-oop Klass::archived_java_mirror() {
-  assert(UseSharedSpaces, "UseSharedSpaces expected.");
-  assert(has_raw_archived_mirror(), "must have raw archived mirror");
-  return RootAccess<IN_ARCHIVE_ROOT>::oop_load(&_archived_mirror);
-}
-
 // No GC barrier
 void Klass::set_archived_java_mirror_raw(oop m) {
   assert(DumpSharedSpaces, "called only during runtime");