< prev index next >
src/share/vm/memory/metaspaceShared.cpp
Print this page
*** 200,211 ****
bool contains(char* p) {
return base() <= p && p < top();
}
};
DumpRegion _mc_region("mc"), _ro_region("ro"), _rw_region("rw"), _md_region("md"), _od_region("od");
! DumpRegion _s0_region("s0"), _s1_region("s1"), _oa0_region("oa0"), _oa1_region("oa1");
char* MetaspaceShared::misc_code_space_alloc(size_t num_bytes) {
return _mc_region.allocate(num_bytes);
}
--- 200,212 ----
bool contains(char* p) {
return base() <= p && p < top();
}
};
+
DumpRegion _mc_region("mc"), _ro_region("ro"), _rw_region("rw"), _md_region("md"), _od_region("od");
! size_t _total_string_region_size = 0, _total_open_archive_region_size = 0;
char* MetaspaceShared::misc_code_space_alloc(size_t num_bytes) {
return _mc_region.allocate(num_bytes);
}
*** 868,877 ****
--- 869,880 ----
void dump_java_heap_objects() NOT_CDS_JAVA_HEAP_RETURN;
void dump_symbols();
char* dump_read_only_tables();
void print_region_stats();
+ void print_heap_region_stats(GrowableArray<MemRegion> *heap_mem,
+ const char *name, const size_t total_size);
public:
VMOp_Type type() const { return VMOp_PopulateDumpSharedSpace; }
void doit(); // outline because gdb sucks
static void write_region(FileMapInfo* mapinfo, int region, DumpRegion* space, bool read_only, bool allow_exec);
*** 1265,1279 ****
mapinfo->set_misc_data_patching_start(vtbl_list);
mapinfo->set_cds_i2i_entry_code_buffers(MetaspaceShared::cds_i2i_entry_code_buffers());
mapinfo->set_cds_i2i_entry_code_buffers_size(MetaspaceShared::cds_i2i_entry_code_buffers_size());
mapinfo->set_core_spaces_size(core_spaces_size);
- char* s0_start, *s0_top;
- char* s1_start, *s1_top;
- char* oa0_start, *oa0_top;
- char* oa1_start, *oa1_top;
-
for (int pass=1; pass<=2; pass++) {
if (pass == 1) {
// The first pass doesn't actually write the data to disk. All it
// does is to update the fields in the mapinfo->_header.
} else {
--- 1268,1277 ----
*** 1291,1321 ****
write_region(mapinfo, MetaspaceShared::rw, &_rw_region, /*read_only=*/false,/*allow_exec=*/false);
write_region(mapinfo, MetaspaceShared::ro, &_ro_region, /*read_only=*/true, /*allow_exec=*/false);
write_region(mapinfo, MetaspaceShared::md, &_md_region, /*read_only=*/false,/*allow_exec=*/false);
write_region(mapinfo, MetaspaceShared::od, &_od_region, /*read_only=*/true, /*allow_exec=*/false);
! mapinfo->write_archive_heap_regions(_string_regions,
MetaspaceShared::first_string,
! MetaspaceShared::max_strings,
! &s0_start, &s0_top,
! &s1_start, &s1_top);
! mapinfo->write_archive_heap_regions(_open_archive_heap_regions,
MetaspaceShared::first_open_archive_heap_region,
! MetaspaceShared::max_open_archive_heap_region,
! &oa0_start, &oa0_top,
! &oa1_start, &oa1_top);
}
mapinfo->close();
// Restore the vtable in case we invoke any virtual methods.
MetaspaceShared::clone_cpp_vtables((intptr_t*)vtbl_list);
- _s0_region.init(s0_start, s0_top, s0_top);
- _s1_region.init(s1_start, s1_top, s1_top);
- _oa0_region.init(oa0_start, oa0_top, oa0_top);
- _oa1_region.init(oa1_start, oa1_top, oa1_top);
print_region_stats();
if (log_is_enabled(Info, cds)) {
ArchiveCompactor::alloc_stats()->print_stats(int(_ro_region.used()), int(_rw_region.used()),
int(_mc_region.used()), int(_md_region.used()));
--- 1289,1313 ----
write_region(mapinfo, MetaspaceShared::rw, &_rw_region, /*read_only=*/false,/*allow_exec=*/false);
write_region(mapinfo, MetaspaceShared::ro, &_ro_region, /*read_only=*/true, /*allow_exec=*/false);
write_region(mapinfo, MetaspaceShared::md, &_md_region, /*read_only=*/false,/*allow_exec=*/false);
write_region(mapinfo, MetaspaceShared::od, &_od_region, /*read_only=*/true, /*allow_exec=*/false);
! _total_string_region_size = mapinfo->write_archive_heap_regions(
! _string_regions,
MetaspaceShared::first_string,
! MetaspaceShared::max_strings);
! _total_open_archive_region_size = mapinfo->write_archive_heap_regions(
! _open_archive_heap_regions,
MetaspaceShared::first_open_archive_heap_region,
! MetaspaceShared::max_open_archive_heap_region);
}
mapinfo->close();
// Restore the vtable in case we invoke any virtual methods.
MetaspaceShared::clone_cpp_vtables((intptr_t*)vtbl_list);
print_region_stats();
if (log_is_enabled(Info, cds)) {
ArchiveCompactor::alloc_stats()->print_stats(int(_ro_region.used()), int(_rw_region.used()),
int(_mc_region.used()), int(_md_region.used()));
*** 1325,1357 ****
void VM_PopulateDumpSharedSpace::print_region_stats() {
// Print statistics of all the regions
const size_t total_reserved = _ro_region.reserved() + _rw_region.reserved() +
_mc_region.reserved() + _md_region.reserved() +
_od_region.reserved() +
! _s0_region.reserved() + _s1_region.reserved() +
! _oa0_region.reserved() + _oa1_region.reserved();
const size_t total_bytes = _ro_region.used() + _rw_region.used() +
_mc_region.used() + _md_region.used() +
_od_region.used() +
! _s0_region.used() + _s1_region.used() +
! _oa0_region.used() + _oa1_region.used();
const double total_u_perc = total_bytes / double(total_reserved) * 100.0;
_mc_region.print(total_reserved);
_rw_region.print(total_reserved);
_ro_region.print(total_reserved);
_md_region.print(total_reserved);
_od_region.print(total_reserved);
! _s0_region.print(total_reserved);
! _s1_region.print(total_reserved);
! _oa0_region.print(total_reserved);
! _oa1_region.print(total_reserved);
tty->print_cr("total : " SIZE_FORMAT_W(9) " [100.0%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used]",
total_bytes, total_reserved, total_u_perc);
}
// Update a Java object to point its Klass* to the new location after
// shared archive has been compacted.
void MetaspaceShared::relocate_klass_ptr(oop o) {
assert(DumpSharedSpaces, "sanity");
--- 1317,1359 ----
void VM_PopulateDumpSharedSpace::print_region_stats() {
// Print statistics of all the regions
const size_t total_reserved = _ro_region.reserved() + _rw_region.reserved() +
_mc_region.reserved() + _md_region.reserved() +
_od_region.reserved() +
! _total_string_region_size +
! _total_open_archive_region_size;
const size_t total_bytes = _ro_region.used() + _rw_region.used() +
_mc_region.used() + _md_region.used() +
_od_region.used() +
! _total_string_region_size +
! _total_open_archive_region_size;
const double total_u_perc = total_bytes / double(total_reserved) * 100.0;
_mc_region.print(total_reserved);
_rw_region.print(total_reserved);
_ro_region.print(total_reserved);
_md_region.print(total_reserved);
_od_region.print(total_reserved);
! print_heap_region_stats(_string_regions, "st", total_reserved);
! print_heap_region_stats(_open_archive_heap_regions, "oa", total_reserved);
tty->print_cr("total : " SIZE_FORMAT_W(9) " [100.0%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used]",
total_bytes, total_reserved, total_u_perc);
}
+ void VM_PopulateDumpSharedSpace::print_heap_region_stats(GrowableArray<MemRegion> *heap_mem,
+ const char *name, const size_t total_size) {
+ int arr_len = heap_mem == NULL ? 0 : heap_mem->length();
+ for (int i = 0; i < arr_len; i++) {
+ char* start = (char*)heap_mem->at(i).start();
+ size_t size = heap_mem->at(i).byte_size();
+ char* top = start + size;
+ tty->print_cr("%s%d space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [100%% used] at " INTPTR_FORMAT,
+ name, i, size, size/double(total_size)*100.0, size, p2i(start));
+
+ }
+ }
// Update a Java object to point its Klass* to the new location after
// shared archive has been compacted.
void MetaspaceShared::relocate_klass_ptr(oop o) {
assert(DumpSharedSpaces, "sanity");
*** 1582,1592 ****
}
}
#if INCLUDE_CDS_JAVA_HEAP
void VM_PopulateDumpSharedSpace::dump_java_heap_objects() {
! if (!MetaspaceShared::allow_archive_heap_object()) {
if (log_is_enabled(Info, cds)) {
log_info(cds)(
"Archived java heap is not supported as UseG1GC, "
"UseCompressedOops and UseCompressedClassPointers are required."
"Current settings: UseG1GC=%s, UseCompressedOops=%s, UseCompressedClassPointers=%s.",
--- 1584,1594 ----
}
}
#if INCLUDE_CDS_JAVA_HEAP
void VM_PopulateDumpSharedSpace::dump_java_heap_objects() {
! if (!MetaspaceShared::is_heap_object_archiving_allowed()) {
if (log_is_enabled(Info, cds)) {
log_info(cds)(
"Archived java heap is not supported as UseG1GC, "
"UseCompressedOops and UseCompressedClassPointers are required."
"Current settings: UseG1GC=%s, UseCompressedOops=%s, UseCompressedClassPointers=%s.",
*** 1594,1609 ****
BOOL_TO_STR(UseCompressedClassPointers));
}
return;
}
// Cache for recording where the archived objects are copied to
MetaspaceShared::create_archive_object_cache();
tty->print_cr("Dumping String objects to closed archive heap region ...");
NOT_PRODUCT(StringTable::verify());
! // The string space has maximum two regions. See FileMapInfo::write_string_regions() for details.
_string_regions = new GrowableArray<MemRegion>(2);
StringTable::write_to_archive(_string_regions);
tty->print_cr("Dumping objects to open archive heap region ...");
_open_archive_heap_regions = new GrowableArray<MemRegion>(2);
--- 1596,1613 ----
BOOL_TO_STR(UseCompressedClassPointers));
}
return;
}
+ NoSafepointVerifier nsv;
+
// Cache for recording where the archived objects are copied to
MetaspaceShared::create_archive_object_cache();
tty->print_cr("Dumping String objects to closed archive heap region ...");
NOT_PRODUCT(StringTable::verify());
! // The string space has maximum two regions. See FileMapInfo::write_archive_heap_regions() for details.
_string_regions = new GrowableArray<MemRegion>(2);
StringTable::write_to_archive(_string_regions);
tty->print_cr("Dumping objects to open archive heap region ...");
_open_archive_heap_regions = new GrowableArray<MemRegion>(2);
*** 1627,1638 ****
MetaspaceShared::ArchivedObjectCache* MetaspaceShared::_archive_object_cache = NULL;
oop MetaspaceShared::archive_heap_object(oop obj, Thread* THREAD) {
assert(DumpSharedSpaces, "dump-time only");
- NoSafepointVerifier nsv;
-
ArchivedObjectCache* cache = MetaspaceShared::archive_object_cache();
oop* p = cache->get(obj);
if (p != NULL) {
// already archived
return *p;
--- 1631,1640 ----
< prev index next >