< prev index next >
src/hotspot/share/memory/filemap.cpp
Print this page
*** 1175,1191 ****
--- 1175,1198 ----
_crc = crc;
_mapped_from_file = false;
_mapped_base = NULL;
}
+ static const char* region_names[] = {
+ "mc", "rw", "ro", "bm", "ca0", "ca1", "oa0", "oa1"
+ };
+
void FileMapInfo::write_region(int region, char* base, size_t size,
bool read_only, bool allow_exec) {
Arguments::assert_is_dumping_archive();
FileMapRegion* si = space_at(region);
char* target_base;
+ const int num_regions = sizeof(region_names)/sizeof(region_names[0]);
+ assert(0 <= region && region < num_regions, "sanity");
+
if (region == MetaspaceShared::bm) {
target_base = NULL; // always NULL for bm region.
} else {
if (DynamicDumpSharedSpaces) {
assert(!HeapShared::is_heap_region(region), "dynamic archive doesn't support heap regions");
*** 1195,1209 ****
}
}
si->set_file_offset(_file_offset);
char* requested_base = (target_base == NULL) ? NULL : target_base + MetaspaceShared::final_delta();
- log_debug(cds)("Shared file region %d: " SIZE_FORMAT_HEX_W(08)
- " bytes, addr " INTPTR_FORMAT " file offset " SIZE_FORMAT_HEX_W(08),
- region, size, p2i(requested_base), _file_offset);
-
int crc = ClassLoader::crc32(0, base, (jint)size);
si->init(region, target_base, size, read_only, allow_exec, crc);
if (base != NULL) {
write_bytes_aligned(base, size);
}
--- 1202,1218 ----
}
}
si->set_file_offset(_file_offset);
char* requested_base = (target_base == NULL) ? NULL : target_base + MetaspaceShared::final_delta();
int crc = ClassLoader::crc32(0, base, (jint)size);
+ if (size > 0) {
+ log_debug(cds)("Shared file region (%-3s) %d: " SIZE_FORMAT_W(8)
+ " bytes, addr " INTPTR_FORMAT " file offset " SIZE_FORMAT_HEX_W(08)
+ " crc 0x%08x",
+ region_names[region], region, size, p2i(requested_base), _file_offset, crc);
+ }
si->init(region, target_base, size, read_only, allow_exec, crc);
if (base != NULL) {
write_bytes_aligned(base, size);
}
*** 1244,1255 ****
if (closed_oopmaps != NULL && open_oopmaps != NULL) {
size_t curr_offset = write_oopmaps(closed_oopmaps, ptrmap->size_in_bytes(), buffer);
write_oopmaps(open_oopmaps, curr_offset, buffer);
}
- log_debug(cds)("ptrmap = " INTPTR_FORMAT " (" SIZE_FORMAT " bytes)",
- p2i(buffer), size_in_bytes);
write_region(MetaspaceShared::bm, (char*)buffer, size_in_bytes, /*read_only=*/true, /*allow_exec=*/false);
}
// Write out the given archive heap memory regions. GC code combines multiple
// consecutive archive GC regions into one MemRegion whenever possible and
--- 1253,1262 ----
*** 1295,1321 ****
"(current MaxHeapSize is " SIZE_FORMAT ", InitialHeapSize is " SIZE_FORMAT ").",
MaxHeapSize, InitialHeapSize);
}
size_t total_size = 0;
! for (int i = first_region_id, arr_idx = 0;
! i < first_region_id + max_num_regions;
! i++, arr_idx++) {
char* start = NULL;
size_t size = 0;
! if (arr_idx < arr_len) {
! start = (char*)heap_mem->at(arr_idx).start();
! size = heap_mem->at(arr_idx).byte_size();
total_size += size;
}
! log_debug(cds)("Archive heap region %d: " INTPTR_FORMAT " - " INTPTR_FORMAT " = " SIZE_FORMAT_W(8) " bytes",
! i, p2i(start), p2i(start + size), size);
! write_region(i, start, size, false, false);
if (size > 0) {
! space_at(i)->init_oopmap(oopmaps->at(arr_idx)._offset,
! oopmaps->at(arr_idx)._oopmap_size_in_bits);
}
}
return total_size;
}
--- 1302,1325 ----
"(current MaxHeapSize is " SIZE_FORMAT ", InitialHeapSize is " SIZE_FORMAT ").",
MaxHeapSize, InitialHeapSize);
}
size_t total_size = 0;
! for (int i = 0; i < max_num_regions; i++) {
char* start = NULL;
size_t size = 0;
! if (i < arr_len) {
! start = (char*)heap_mem->at(i).start();
! size = heap_mem->at(i).byte_size();
total_size += size;
}
! int region_idx = i + first_region_id;
! write_region(region_idx, start, size, false, false);
if (size > 0) {
! space_at(region_idx)->init_oopmap(oopmaps->at(i)._offset,
! oopmaps->at(i)._oopmap_size_in_bits);
}
}
return total_size;
}
< prev index next >