src/hotspot/share/memory/metaspaceShared.cpp
changeset 58278 e47b459b315c
parent 58277 00a98f0aa1b3
child 58447 319173c62caa
equal deleted inserted replaced
58277:00a98f0aa1b3 58278:e47b459b315c
  1425   remove_java_mirror_in_classes();
  1425   remove_java_mirror_in_classes();
  1426   tty->print_cr("done. ");
  1426   tty->print_cr("done. ");
  1427 
  1427 
  1428   SystemDictionaryShared::write_to_archive();
  1428   SystemDictionaryShared::write_to_archive();
  1429 
  1429 
  1430   char* start = _ro_region.top();
       
  1431 
       
  1432   size_t vtptrs_bytes = _num_cloned_vtable_kinds * sizeof(intptr_t*);
  1430   size_t vtptrs_bytes = _num_cloned_vtable_kinds * sizeof(intptr_t*);
  1433   _cloned_cpp_vtptrs = (intptr_t**)_ro_region.allocate(vtptrs_bytes, sizeof(intptr_t*));
  1431   _cloned_cpp_vtptrs = (intptr_t**)_ro_region.allocate(vtptrs_bytes, sizeof(intptr_t*));
  1434 
  1432 
  1435   // Write the other data to the output array.
  1433   // Write the other data to the output array.
       
  1434   char* start = _ro_region.top();
  1436   WriteClosure wc(&_ro_region);
  1435   WriteClosure wc(&_ro_region);
  1437   MetaspaceShared::serialize(&wc);
  1436   MetaspaceShared::serialize(&wc);
  1438 
  1437 
  1439   // Write the bitmaps for patching the archive heap regions
  1438   // Write the bitmaps for patching the archive heap regions
  1440   dump_archive_heap_oopmaps();
  1439   dump_archive_heap_oopmaps();
  1513   _open_archive_heap_regions = NULL;
  1512   _open_archive_heap_regions = NULL;
  1514   dump_java_heap_objects();
  1513   dump_java_heap_objects();
  1515 
  1514 
  1516   ArchiveCompactor::relocate_well_known_klasses();
  1515   ArchiveCompactor::relocate_well_known_klasses();
  1517 
  1516 
  1518   char* read_only_tables_start = dump_read_only_tables();
  1517   char* serialized_data_start = dump_read_only_tables();
  1519   _ro_region.pack(&_md_region);
  1518   _ro_region.pack(&_md_region);
  1520 
  1519 
  1521   char* vtbl_list = _md_region.top();
  1520   char* vtbl_list = _md_region.top();
  1522   MetaspaceShared::allocate_cpp_vtable_clones();
  1521   MetaspaceShared::allocate_cpp_vtable_clones();
  1523   _md_region.pack();
  1522   _md_region.pack();
  1538 
  1537 
  1539   // Create and write the archive file that maps the shared spaces.
  1538   // Create and write the archive file that maps the shared spaces.
  1540 
  1539 
  1541   FileMapInfo* mapinfo = new FileMapInfo(true);
  1540   FileMapInfo* mapinfo = new FileMapInfo(true);
  1542   mapinfo->populate_header(os::vm_allocation_granularity());
  1541   mapinfo->populate_header(os::vm_allocation_granularity());
  1543   mapinfo->set_read_only_tables_start(read_only_tables_start);
  1542   mapinfo->set_serialized_data_start(serialized_data_start);
  1544   mapinfo->set_misc_data_patching_start(vtbl_list);
  1543   mapinfo->set_misc_data_patching_start(vtbl_list);
  1545   mapinfo->set_i2i_entry_code_buffers(MetaspaceShared::i2i_entry_code_buffers(),
  1544   mapinfo->set_i2i_entry_code_buffers(MetaspaceShared::i2i_entry_code_buffers(),
  1546                                       MetaspaceShared::i2i_entry_code_buffers_size());
  1545                                       MetaspaceShared::i2i_entry_code_buffers_size());
  1547   mapinfo->set_core_spaces_size(core_spaces_size);
  1546   mapinfo->set_core_spaces_size(core_spaces_size);
  1548   mapinfo->open_for_write();
  1547   mapinfo->open_for_write();
  2031   // _core_spaces_size is loaded from the shared archive immediatelly after mapping
  2030   // _core_spaces_size is loaded from the shared archive immediatelly after mapping
  2032   assert(_core_spaces_size == mapinfo->core_spaces_size(), "sanity");
  2031   assert(_core_spaces_size == mapinfo->core_spaces_size(), "sanity");
  2033   char* buffer = mapinfo->misc_data_patching_start();
  2032   char* buffer = mapinfo->misc_data_patching_start();
  2034   clone_cpp_vtables((intptr_t*)buffer);
  2033   clone_cpp_vtables((intptr_t*)buffer);
  2035 
  2034 
  2036   // The rest of the data is now stored in the RW region
       
  2037   buffer = mapinfo->read_only_tables_start();
       
  2038 
       
  2039   // Skip over _cloned_cpp_vtptrs;
       
  2040   buffer += _num_cloned_vtable_kinds * sizeof(intptr_t*);
       
  2041 
       
  2042   // Verify various attributes of the archive, plus initialize the
  2035   // Verify various attributes of the archive, plus initialize the
  2043   // shared string/symbol tables
  2036   // shared string/symbol tables
       
  2037   buffer = mapinfo->serialized_data_start();
  2044   intptr_t* array = (intptr_t*)buffer;
  2038   intptr_t* array = (intptr_t*)buffer;
  2045   ReadClosure rc(&array);
  2039   ReadClosure rc(&array);
  2046   serialize(&rc);
  2040   serialize(&rc);
  2047 
  2041 
  2048   // Initialize the run-time symbol table.
  2042   // Initialize the run-time symbol table.