< prev index next >

src/hotspot/share/classfile/javaClasses.cpp

Print this page
@@ -886,18 +886,18 @@
          }
        }
      }
    }
  
-   if (k->is_shared() && k->has_raw_archived_mirror()) {
+   if (k->is_shared() && k->has_archived_mirror_index()) {
      if (HeapShared::open_archive_heap_region_mapped()) {
        bool present = restore_archived_mirror(k, Handle(), Handle(), Handle(), CHECK);
        assert(present, "Missing archived mirror for %s", k->external_name());
        return;
      } else {
        k->clear_java_mirror_handle();
-       k->clear_has_raw_archived_mirror();
+       k->clear_archived_mirror_index();
      }
    }
    create_mirror(k, Handle(), Handle(), Handle(), Handle(), CHECK);
  }
  

@@ -1159,13 +1159,13 @@
  oop java_lang_Class::archive_mirror(Klass* k, TRAPS) {
    assert(HeapShared::is_heap_object_archiving_allowed(),
           "HeapShared::is_heap_object_archiving_allowed() must be true");
  
    // Mirror is already archived
-   if (k->has_raw_archived_mirror()) {
-     assert(k->archived_java_mirror_raw() != NULL, "no archived mirror");
-     return k->archived_java_mirror_raw();
+   if (k->has_archived_mirror_index()) {
+     assert(k->archived_java_mirror() != NULL, "no archived mirror");
+     return k->archived_java_mirror();
    }
  
    // No mirror
    oop mirror = k->java_mirror();
    if (mirror == NULL) {

@@ -1193,13 +1193,11 @@
    archived_mirror = process_archived_mirror(k, mirror, archived_mirror, THREAD);
    if (archived_mirror == NULL) {
      return NULL;
    }
  
-   k->set_archived_java_mirror_raw(archived_mirror);
- 
-   k->set_has_raw_archived_mirror();
+   k->set_archived_java_mirror(archived_mirror);
  
    ResourceMark rm;
    log_trace(cds, heap, mirror)(
      "Archived %s mirror object from " PTR_FORMAT " ==> " PTR_FORMAT,
      k->external_name(), p2i(mirror), p2i(archived_mirror));

@@ -1311,14 +1309,15 @@
      assert(fixup_mirror_list() != NULL, "fixup_mirror_list not initialized");
      fixup_mirror_list()->push(k);
      return true;
    }
  
-   oop m = HeapShared::materialize_archived_object(k->archived_java_mirror_raw_narrow());
-   if (m == NULL) {
-     return false;
-   }
+   oop m = k->archived_java_mirror();
+   assert(m != NULL, "must have stored non-null archived mirror");
+ 
+   // Sanity: clear it now to prevent re-initialization if any of the following fails
+   k->clear_archived_mirror_index();
  
    // mirror is archived, restore
    log_debug(cds, mirror)("Archived mirror is: " PTR_FORMAT, p2i(m));
    assert(HeapShared::is_archived_object(m), "must be archived mirror object");
    assert(as_Klass(m) == k, "must be");

@@ -1340,11 +1339,10 @@
    if (class_loader.not_null()) {
      set_class_loader(mirror(), class_loader());
    }
  
    k->set_java_mirror(mirror);
-   k->clear_has_raw_archived_mirror();
  
    set_mirror_module_field(k, mirror, module, THREAD);
  
    if (log_is_enabled(Trace, cds, heap, mirror)) {
      ResourceMark rm(THREAD);
< prev index next >