src/hotspot/share/memory/dynamicArchive.cpp
changeset 58278 e47b459b315c
parent 58277 00a98f0aa1b3
child 58679 9c3209ff7550
child 59056 15936b142f86
equal deleted inserted replaced
58277:00a98f0aa1b3 58278:e47b459b315c
   468   void make_trampolines();
   468   void make_trampolines();
   469   void make_klasses_shareable();
   469   void make_klasses_shareable();
   470   void sort_methods(InstanceKlass* ik) const;
   470   void sort_methods(InstanceKlass* ik) const;
   471   void set_symbols_permanent();
   471   void set_symbols_permanent();
   472   void relocate_buffer_to_target();
   472   void relocate_buffer_to_target();
   473   void write_archive(char* read_only_tables_start);
   473   void write_archive(char* serialized_data_start);
   474   void write_regions(FileMapInfo* dynamic_info);
   474   void write_regions(FileMapInfo* dynamic_info);
   475 
   475 
   476   void init_first_dump_space(address reserved_bottom) {
   476   void init_first_dump_space(address reserved_bottom) {
   477     address first_space_base = reserved_bottom;
   477     address first_space_base = reserved_bottom;
   478     DumpRegion* rw_space = MetaspaceShared::read_write_dump_space();
   478     DumpRegion* rw_space = MetaspaceShared::read_write_dump_space();
   594       iterate_roots(&ext_reloc);
   594       iterate_roots(&ext_reloc);
   595     }
   595     }
   596 
   596 
   597     verify_estimate_size(_estimated_metsapceobj_bytes, "MetaspaceObjs");
   597     verify_estimate_size(_estimated_metsapceobj_bytes, "MetaspaceObjs");
   598 
   598 
   599     char* read_only_tables_start;
   599     char* serialized_data_start;
   600     {
   600     {
   601       set_symbols_permanent();
   601       set_symbols_permanent();
   602 
   602 
   603       // Write the symbol table and system dictionaries to the RO space.
   603       // Write the symbol table and system dictionaries to the RO space.
   604       // Note that these tables still point to the *original* objects
   604       // Note that these tables still point to the *original* objects
   607       // get the correct addresses.
   607       // get the correct addresses.
   608       assert(current_dump_space() == ro_space, "Must be RO space");
   608       assert(current_dump_space() == ro_space, "Must be RO space");
   609       SymbolTable::write_to_archive(false);
   609       SymbolTable::write_to_archive(false);
   610       SystemDictionaryShared::write_to_archive(false);
   610       SystemDictionaryShared::write_to_archive(false);
   611 
   611 
   612       read_only_tables_start = ro_space->top();
   612       serialized_data_start = ro_space->top();
   613       WriteClosure wc(ro_space);
   613       WriteClosure wc(ro_space);
   614       SymbolTable::serialize_shared_table_header(&wc, false);
   614       SymbolTable::serialize_shared_table_header(&wc, false);
   615       SystemDictionaryShared::serialize_dictionary_headers(&wc, false);
   615       SystemDictionaryShared::serialize_dictionary_headers(&wc, false);
   616     }
   616     }
   617 
   617 
   633       PointerMarker marker(this);
   633       PointerMarker marker(this);
   634       iterate_roots(&marker);
   634       iterate_roots(&marker);
   635       relocate_buffer_to_target();
   635       relocate_buffer_to_target();
   636     }
   636     }
   637 
   637 
   638     write_archive(read_only_tables_start);
   638     write_archive(serialized_data_start);
   639 
   639 
   640     assert(_num_dump_regions_used == _total_dump_regions, "must be");
   640     assert(_num_dump_regions_used == _total_dump_regions, "must be");
   641     verify_universe("After CDS dynamic dump");
   641     verify_universe("After CDS dynamic dump");
   642   }
   642   }
   643 
   643 
   925                              MetaspaceShared::misc_code_dump_space()->base(),
   925                              MetaspaceShared::misc_code_dump_space()->base(),
   926                              MetaspaceShared::misc_code_dump_space()->used(),
   926                              MetaspaceShared::misc_code_dump_space()->used(),
   927                              /*read_only=*/false,/*allow_exec=*/true);
   927                              /*read_only=*/false,/*allow_exec=*/true);
   928 }
   928 }
   929 
   929 
   930 void DynamicArchiveBuilder::write_archive(char* read_only_tables_start) {
   930 void DynamicArchiveBuilder::write_archive(char* serialized_data_start) {
   931   int num_klasses = _klasses->length();
   931   int num_klasses = _klasses->length();
   932   int num_symbols = _symbols->length();
   932   int num_symbols = _symbols->length();
   933 
   933 
   934   _header->set_read_only_tables_start(to_target(read_only_tables_start));
   934   _header->set_serialized_data_start(to_target(serialized_data_start));
   935 
   935 
   936   FileMapInfo* dynamic_info = FileMapInfo::dynamic_info();
   936   FileMapInfo* dynamic_info = FileMapInfo::dynamic_info();
   937   assert(dynamic_info != NULL, "Sanity");
   937   assert(dynamic_info != NULL, "Sanity");
   938 
   938 
   939   // Now write the archived data including the file offsets.
   939   // Now write the archived data including the file offsets.
  1100 
  1100 
  1101   if (_dynamic_header == NULL) {
  1101   if (_dynamic_header == NULL) {
  1102     return NULL;
  1102     return NULL;
  1103   }
  1103   }
  1104 
  1104 
  1105   intptr_t* buffer = (intptr_t*)_dynamic_header->read_only_tables_start();
  1105   intptr_t* buffer = (intptr_t*)_dynamic_header->serialized_data_start();
  1106   ReadClosure rc(&buffer);
  1106   ReadClosure rc(&buffer);
  1107   SymbolTable::serialize_shared_table_header(&rc, false);
  1107   SymbolTable::serialize_shared_table_header(&rc, false);
  1108   SystemDictionaryShared::serialize_dictionary_headers(&rc, false);
  1108   SystemDictionaryShared::serialize_dictionary_headers(&rc, false);
  1109 
  1109 
  1110   return (address)top;
  1110   return (address)top;