84 // rw - read-write metadata |
84 // rw - read-write metadata |
85 // ro - read-only metadata and read-only tables |
85 // ro - read-only metadata and read-only tables |
86 // md - misc data (the c++ vtables) |
86 // md - misc data (the c++ vtables) |
87 // od - optional data (original class files) |
87 // od - optional data (original class files) |
88 // |
88 // |
89 // s0 - shared strings(closed archive heap space) #0 |
89 // ca0 - closed archive heap space #0 |
90 // s1 - shared strings(closed archive heap space) #1 (may be empty) |
90 // ca1 - closed archive heap space #1 (may be empty) |
91 // oa0 - open archive heap space #0 |
91 // oa0 - open archive heap space #0 |
92 // oa1 - open archive heap space #1 (may be empty) |
92 // oa1 - open archive heap space #1 (may be empty) |
93 // |
93 // |
94 // The mc, rw, ro, md and od regions are linearly allocated, starting from |
94 // The mc, rw, ro, md and od regions are linearly allocated, starting from |
95 // SharedBaseAddress, in the order of mc->rw->ro->md->od. The size of these 5 regions |
95 // SharedBaseAddress, in the order of mc->rw->ro->md->od. The size of these 5 regions |
196 } |
196 } |
197 }; |
197 }; |
198 |
198 |
199 |
199 |
200 DumpRegion _mc_region("mc"), _ro_region("ro"), _rw_region("rw"), _md_region("md"), _od_region("od"); |
200 DumpRegion _mc_region("mc"), _ro_region("ro"), _rw_region("rw"), _md_region("md"), _od_region("od"); |
201 size_t _total_string_region_size = 0, _total_open_archive_region_size = 0; |
201 size_t _total_closed_archive_region_size = 0, _total_open_archive_region_size = 0; |
202 |
202 |
203 char* MetaspaceShared::misc_code_space_alloc(size_t num_bytes) { |
203 char* MetaspaceShared::misc_code_space_alloc(size_t num_bytes) { |
204 return _mc_region.allocate(num_bytes); |
204 return _mc_region.allocate(num_bytes); |
205 } |
205 } |
206 |
206 |
1272 SystemDictionary::well_known_klasses_do(&ext_reloc); |
1272 SystemDictionary::well_known_klasses_do(&ext_reloc); |
1273 } |
1273 } |
1274 // NOTE: after this point, we shouldn't have any globals that can reach the old |
1274 // NOTE: after this point, we shouldn't have any globals that can reach the old |
1275 // objects. |
1275 // objects. |
1276 |
1276 |
1277 // We cannot use any of the objects in the heap anymore (except for the objects |
1277 // We cannot use any of the objects in the heap anymore (except for the |
1278 // in the CDS shared string regions) because their headers no longer point to |
1278 // shared strings) because their headers no longer point to valid Klasses. |
1279 // valid Klasses. |
|
1280 } |
1279 } |
1281 |
1280 |
1282 static void iterate_roots(MetaspaceClosure* it) { |
1281 static void iterate_roots(MetaspaceClosure* it) { |
1283 GrowableArray<Symbol*>* symbols = _ssc->get_sorted_symbols(); |
1282 GrowableArray<Symbol*>* symbols = _ssc->get_sorted_symbols(); |
1284 for (int i=0; i<symbols->length(); i++) { |
1283 for (int i=0; i<symbols->length(); i++) { |
1489 write_region(mapinfo, MetaspaceShared::rw, &_rw_region, /*read_only=*/false,/*allow_exec=*/false); |
1488 write_region(mapinfo, MetaspaceShared::rw, &_rw_region, /*read_only=*/false,/*allow_exec=*/false); |
1490 write_region(mapinfo, MetaspaceShared::ro, &_ro_region, /*read_only=*/true, /*allow_exec=*/false); |
1489 write_region(mapinfo, MetaspaceShared::ro, &_ro_region, /*read_only=*/true, /*allow_exec=*/false); |
1491 write_region(mapinfo, MetaspaceShared::md, &_md_region, /*read_only=*/false,/*allow_exec=*/false); |
1490 write_region(mapinfo, MetaspaceShared::md, &_md_region, /*read_only=*/false,/*allow_exec=*/false); |
1492 write_region(mapinfo, MetaspaceShared::od, &_od_region, /*read_only=*/true, /*allow_exec=*/false); |
1491 write_region(mapinfo, MetaspaceShared::od, &_od_region, /*read_only=*/true, /*allow_exec=*/false); |
1493 |
1492 |
1494 _total_string_region_size = mapinfo->write_archive_heap_regions( |
1493 _total_closed_archive_region_size = mapinfo->write_archive_heap_regions( |
1495 _closed_archive_heap_regions, |
1494 _closed_archive_heap_regions, |
1496 _closed_archive_heap_oopmaps, |
1495 _closed_archive_heap_oopmaps, |
1497 MetaspaceShared::first_string, |
1496 MetaspaceShared::first_closed_archive_heap_region, |
1498 MetaspaceShared::max_strings); |
1497 MetaspaceShared::max_closed_archive_heap_region); |
1499 _total_open_archive_region_size = mapinfo->write_archive_heap_regions( |
1498 _total_open_archive_region_size = mapinfo->write_archive_heap_regions( |
1500 _open_archive_heap_regions, |
1499 _open_archive_heap_regions, |
1501 _open_archive_heap_oopmaps, |
1500 _open_archive_heap_oopmaps, |
1502 MetaspaceShared::first_open_archive_heap_region, |
1501 MetaspaceShared::first_open_archive_heap_region, |
1503 MetaspaceShared::max_open_archive_heap_region); |
1502 MetaspaceShared::max_open_archive_heap_region); |
1527 void VM_PopulateDumpSharedSpace::print_region_stats() { |
1526 void VM_PopulateDumpSharedSpace::print_region_stats() { |
1528 // Print statistics of all the regions |
1527 // Print statistics of all the regions |
1529 const size_t total_reserved = _ro_region.reserved() + _rw_region.reserved() + |
1528 const size_t total_reserved = _ro_region.reserved() + _rw_region.reserved() + |
1530 _mc_region.reserved() + _md_region.reserved() + |
1529 _mc_region.reserved() + _md_region.reserved() + |
1531 _od_region.reserved() + |
1530 _od_region.reserved() + |
1532 _total_string_region_size + |
1531 _total_closed_archive_region_size + |
1533 _total_open_archive_region_size; |
1532 _total_open_archive_region_size; |
1534 const size_t total_bytes = _ro_region.used() + _rw_region.used() + |
1533 const size_t total_bytes = _ro_region.used() + _rw_region.used() + |
1535 _mc_region.used() + _md_region.used() + |
1534 _mc_region.used() + _md_region.used() + |
1536 _od_region.used() + |
1535 _od_region.used() + |
1537 _total_string_region_size + |
1536 _total_closed_archive_region_size + |
1538 _total_open_archive_region_size; |
1537 _total_open_archive_region_size; |
1539 const double total_u_perc = percent_of(total_bytes, total_reserved); |
1538 const double total_u_perc = percent_of(total_bytes, total_reserved); |
1540 |
1539 |
1541 _mc_region.print(total_reserved); |
1540 _mc_region.print(total_reserved); |
1542 _rw_region.print(total_reserved); |
1541 _rw_region.print(total_reserved); |
1543 _ro_region.print(total_reserved); |
1542 _ro_region.print(total_reserved); |
1544 _md_region.print(total_reserved); |
1543 _md_region.print(total_reserved); |
1545 _od_region.print(total_reserved); |
1544 _od_region.print(total_reserved); |
1546 print_heap_region_stats(_closed_archive_heap_regions, "st", total_reserved); |
1545 print_heap_region_stats(_closed_archive_heap_regions, "ca", total_reserved); |
1547 print_heap_region_stats(_open_archive_heap_regions, "oa", total_reserved); |
1546 print_heap_region_stats(_open_archive_heap_regions, "oa", total_reserved); |
1548 |
1547 |
1549 tty->print_cr("total : " SIZE_FORMAT_W(9) " [100.0%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used]", |
1548 tty->print_cr("total : " SIZE_FORMAT_W(9) " [100.0%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used]", |
1550 total_bytes, total_reserved, total_u_perc); |
1549 total_bytes, total_reserved, total_u_perc); |
1551 } |
1550 } |
1713 // are implemented by K are not verified. |
1712 // are implemented by K are not verified. |
1714 link_and_cleanup_shared_classes(CATCH); |
1713 link_and_cleanup_shared_classes(CATCH); |
1715 tty->print_cr("Rewriting and linking classes: done"); |
1714 tty->print_cr("Rewriting and linking classes: done"); |
1716 |
1715 |
1717 SystemDictionary::clear_invoke_method_table(); |
1716 SystemDictionary::clear_invoke_method_table(); |
1718 HeapShared::init_archivable_static_fields(THREAD); |
1717 HeapShared::init_subgraph_entry_fields(THREAD); |
1719 |
1718 |
1720 VM_PopulateDumpSharedSpace op; |
1719 VM_PopulateDumpSharedSpace op; |
1721 VMThread::execute(&op); |
1720 VMThread::execute(&op); |
1722 } |
1721 } |
1723 } |
1722 } |