< prev index next >

src/hotspot/share/cds/archiveBuilder.hpp

Print this page
@@ -143,10 +143,14 @@
          _buffered_addr = ref->obj();
        } else {
          _buffered_addr = nullptr;
        }
      }
+     SourceObjInfo(address src, address buf) {
+       _source_addr = src;
+       _buffered_addr = buf;
+     }
  
      // This constructor is only used for regenerated objects (created by LambdaFormInvokers, etc).
      //   src = address of a Method or InstanceKlass that has been regenerated.
      //   renegerated_obj_info = info for the regenerated version of src.
      SourceObjInfo(address src, SourceObjInfo* renegerated_obj_info) :

@@ -209,18 +213,20 @@
    ReservedSpace _shared_rs;
    VirtualSpace _shared_vs;
  
    DumpRegion _rw_region;
    DumpRegion _ro_region;
+   DumpRegion _cc_region;
  
    // Combined bitmap to track pointers in both RW and RO regions. This is updated
    // as objects are copied into RW and RO.
    CHeapBitMap _ptrmap;
  
    // _ptrmap is split into these two bitmaps which are written into the archive.
    CHeapBitMap _rw_ptrmap;   // marks pointers in the RW region
    CHeapBitMap _ro_ptrmap;   // marks pointers in the RO region
+   CHeapBitMap _cc_ptrmap;   // marks pointers in the CC region
  
    SourceObjList _rw_src_objs;                 // objs to put in rw region
    SourceObjList _ro_src_objs;                 // objs to put in ro region
    ResizeableResourceHashtable<address, SourceObjInfo, AnyObj::C_HEAP, mtClassShared> _src_obj_table;
    ResizeableResourceHashtable<address, address, AnyObj::C_HEAP, mtClassShared> _buffered_to_src_table;

@@ -256,10 +262,11 @@
  
    void iterate_sorted_roots(MetaspaceClosure* it);
    void sort_klasses();
    static int compare_symbols_by_address(Symbol** a, Symbol** b);
    static int compare_klass_by_name(Klass** a, Klass** b);
+   void update_hidden_class_loader_type(InstanceKlass* ik) NOT_CDS_JAVA_HEAP_RETURN;
  
    void make_shallow_copies(DumpRegion *dump_region, const SourceObjList* src_objs);
    void make_shallow_copy(DumpRegion *dump_region, SourceObjInfo* src_info);
  
    void relocate_embedded_pointers(SourceObjList* src_objs);

@@ -289,10 +296,13 @@
    address requested_static_archive_bottom()  const { return  _requested_static_archive_bottom;     }
    address mapped_static_archive_bottom()     const { return  _mapped_static_archive_bottom;        }
    intx buffer_to_requested_delta()           const { return _buffer_to_requested_delta;            }
  
    bool is_in_buffer_space(address p) const {
+     if (current_dump_region() == nullptr) {
+       return false;
+     }
      return (buffer_bottom() <= p && p < buffer_top());
    }
  
    template <typename T> bool is_in_requested_static_archive(T p) const {
      return _requested_static_archive_bottom <= (address)p && (address)p < _requested_static_archive_top;

@@ -341,12 +351,10 @@
    u4 any_to_offset_u4(T p) const {
      uintx offset = any_to_offset((address)p);
      return to_offset_u4(offset);
    }
  
-   static void assert_is_vm_thread() PRODUCT_RETURN;
- 
  public:
    ArchiveBuilder();
    ~ArchiveBuilder();
  
    int entropy();

@@ -357,17 +365,24 @@
    void remember_embedded_pointer_in_enclosing_obj(MetaspaceClosure::Ref* ref);
    static void serialize_dynamic_archivable_items(SerializeClosure* soc);
  
    DumpRegion* rw_region() { return &_rw_region; }
    DumpRegion* ro_region() { return &_ro_region; }
+   DumpRegion* cc_region() { return &_cc_region; }
+ 
+   void start_cc_region();
+   void end_cc_region();
  
    static char* rw_region_alloc(size_t num_bytes) {
      return current()->rw_region()->allocate(num_bytes);
    }
    static char* ro_region_alloc(size_t num_bytes) {
      return current()->ro_region()->allocate(num_bytes);
    }
+   static char* cc_region_alloc(size_t num_bytes) {
+     return current()->cc_region()->allocate(num_bytes);
+   }
  
    template <typename T>
    static Array<T>* new_ro_array(int length) {
      size_t byte_size = Array<T>::byte_sizeof(length, sizeof(T));
      Array<T>* array = (Array<T>*)ro_region_alloc(byte_size);

@@ -396,20 +411,27 @@
    void dump_rw_metadata();
    void dump_ro_metadata();
    void relocate_metaspaceobj_embedded_pointers();
    void record_regenerated_object(address orig_src_obj, address regen_src_obj);
    void make_klasses_shareable();
+   void make_training_data_shareable();
    void relocate_to_requested();
    void write_archive(FileMapInfo* mapinfo, ArchiveHeapInfo* heap_info);
    void write_region(FileMapInfo* mapinfo, int region_idx, DumpRegion* dump_region,
                      bool read_only,  bool allow_exec);
  
    void write_pointer_in_buffer(address* ptr_location, address src_addr);
    template <typename T> void write_pointer_in_buffer(T* ptr_location, T src_addr) {
      write_pointer_in_buffer((address*)ptr_location, (address)src_addr);
    }
  
+   void mark_and_relocate_to_buffered_addr(address* ptr_location);
+   template <typename T> void mark_and_relocate_to_buffered_addr(T ptr_location) {
+     mark_and_relocate_to_buffered_addr((address*)ptr_location);
+   }
+ 
+   bool has_been_archived(address src_addr) const;
    address get_buffered_addr(address src_addr) const;
    template <typename T> T get_buffered_addr(T src_addr) const {
      return (T)get_buffered_addr((address)src_addr);
    }
  

@@ -421,15 +443,15 @@
    // All klasses and symbols that will be copied into the archive
    GrowableArray<Klass*>*  klasses() const { return _klasses; }
    GrowableArray<Symbol*>* symbols() const { return _symbols; }
  
    static bool is_active() {
-     return (_current != nullptr);
+     CDS_ONLY(return (_current != nullptr));
+     NOT_CDS(return false;)
    }
  
    static ArchiveBuilder* current() {
-     assert_is_vm_thread();
      assert(_current != nullptr, "ArchiveBuilder must be active");
      return _current;
    }
  
    static DumpAllocStats* alloc_stats() {
< prev index next >