< prev index next >

src/hotspot/share/cds/aotMappedHeapLoader.cpp

Print this page
@@ -358,11 +358,11 @@
  
    return true;
  }
  
  objArrayOop AOTMappedHeapLoader::root_segment(int segment_idx) {
-   if (CDSConfig::is_dumping_heap()) {
+   if (CDSConfig::is_dumping_heap() && !CDSConfig::is_dumping_final_static_archive()) {
      assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
    } else {
      assert(CDSConfig::is_using_archive(), "must be");
    }
  

@@ -508,10 +508,25 @@
      HeapWord* top = (HeapWord*)_loaded_heap_top;
      Universe::heap()->fill_with_objects(bottom, top - bottom);
    }
  }
  
+ oop AOTMappedHeapLoader::oop_from_offset(int offset) {
+   // Once GC starts, the offsets saved in CachedCodeDirectoryInternal::_permanent_oop_offsets
+   // will become invalid. I don't know what function can check if GCs are allowed, but surely
+   // GCs can't happen before the Object class is loaded.
+   assert(CDSConfig::is_using_archive(), "sanity");
+   assert(vmClasses::Object_klass()->class_loader_data() == nullptr,
+          "can be called only very early during VM start-up");
+   if (is_loaded()) {
+     return cast_to_oop(_loaded_heap_bottom + offset);
+   } else {
+     assert(is_mapped(), "must be");
+     return cast_to_oop(_mapped_heap_bottom + offset);
+   }
+ }
+ 
  class PatchNativePointers: public BitMapClosure {
    Metadata** _start;
  
   public:
    PatchNativePointers(Metadata** start) : _start(start) {}
< prev index next >