mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 10:34:38 +02:00
8233826: Change CDS dumping tty->print_cr() to unified logging
Reviewed-by: coleenp, dholmes, jiangli
This commit is contained in:
parent
4f22b49c85
commit
d1ad0eaf8f
15 changed files with 91 additions and 90 deletions
|
@ -1164,7 +1164,7 @@ void FileMapInfo::write_region(int region, char* base, size_t size,
|
|||
|
||||
si->set_file_offset(_file_offset);
|
||||
char* requested_base = (target_base == NULL) ? NULL : target_base + MetaspaceShared::final_delta();
|
||||
log_info(cds)("Shared file region %d: " SIZE_FORMAT_HEX_W(08)
|
||||
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);
|
||||
|
||||
|
@ -1185,7 +1185,7 @@ void FileMapInfo::write_bitmap_region(const CHeapBitMap* ptrmap) {
|
|||
ptrmap->write_to(buffer, size_in_bytes);
|
||||
header()->set_ptrmap_size_in_bits(size_in_bits);
|
||||
|
||||
log_info(cds)("ptrmap = " INTPTR_FORMAT " (" SIZE_FORMAT " bytes)",
|
||||
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);
|
||||
}
|
||||
|
@ -1247,7 +1247,7 @@ size_t FileMapInfo::write_archive_heap_regions(GrowableArray<MemRegion> *heap_me
|
|||
total_size += size;
|
||||
}
|
||||
|
||||
log_info(cds)("Archive heap region %d: " INTPTR_FORMAT " - " INTPTR_FORMAT " = " SIZE_FORMAT_W(8) " bytes",
|
||||
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) {
|
||||
|
|
|
@ -186,14 +186,12 @@ void HeapShared::archive_klass_objects(Thread* THREAD) {
|
|||
void HeapShared::archive_java_heap_objects(GrowableArray<MemRegion> *closed,
|
||||
GrowableArray<MemRegion> *open) {
|
||||
if (!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.",
|
||||
BOOL_TO_STR(UseG1GC), BOOL_TO_STR(UseCompressedOops),
|
||||
BOOL_TO_STR(UseCompressedClassPointers));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -205,11 +203,11 @@ void HeapShared::archive_java_heap_objects(GrowableArray<MemRegion> *closed,
|
|||
// Cache for recording where the archived objects are copied to
|
||||
create_archived_object_cache();
|
||||
|
||||
tty->print_cr("Dumping objects to closed archive heap region ...");
|
||||
log_info(cds)("Dumping objects to closed archive heap region ...");
|
||||
NOT_PRODUCT(StringTable::verify());
|
||||
copy_closed_archive_heap_objects(closed);
|
||||
|
||||
tty->print_cr("Dumping objects to open archive heap region ...");
|
||||
log_info(cds)("Dumping objects to open archive heap region ...");
|
||||
copy_open_archive_heap_objects(open);
|
||||
|
||||
destroy_archived_object_cache();
|
||||
|
|
|
@ -160,18 +160,16 @@ void DumpRegion::append_intptr_t(intptr_t n, bool need_to_mark) {
|
|||
}
|
||||
|
||||
void DumpRegion::print(size_t total_bytes) const {
|
||||
tty->print_cr("%-3s space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used] at " INTPTR_FORMAT,
|
||||
log_debug(cds)("%-3s space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used] at " INTPTR_FORMAT,
|
||||
_name, used(), percent_of(used(), total_bytes), reserved(), percent_of(used(), reserved()),
|
||||
p2i(_base + MetaspaceShared::final_delta()));
|
||||
}
|
||||
|
||||
void DumpRegion::print_out_of_space_msg(const char* failing_region, size_t needed_bytes) {
|
||||
tty->print("[%-8s] " PTR_FORMAT " - " PTR_FORMAT " capacity =%9d, allocated =%9d",
|
||||
log_error(cds)("[%-8s] " PTR_FORMAT " - " PTR_FORMAT " capacity =%9d, allocated =%9d",
|
||||
_name, p2i(_base), p2i(_top), int(_end - _base), int(_top - _base));
|
||||
if (strcmp(_name, failing_region) == 0) {
|
||||
tty->print_cr(" required = %d", int(needed_bytes));
|
||||
} else {
|
||||
tty->cr();
|
||||
log_error(cds)(" required = %d", int(needed_bytes));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,7 +321,7 @@ void MetaspaceShared::initialize_dumptime_shared_and_meta_spaces() {
|
|||
|
||||
init_shared_dump_space(&_mc_region);
|
||||
SharedBaseAddress = (size_t)_shared_rs.base();
|
||||
tty->print_cr("Allocated shared space: " SIZE_FORMAT " bytes at " PTR_FORMAT,
|
||||
log_info(cds)("Allocated shared space: " SIZE_FORMAT " bytes at " PTR_FORMAT,
|
||||
_shared_rs.size(), p2i(_shared_rs.base()));
|
||||
}
|
||||
|
||||
|
@ -427,7 +425,7 @@ void MetaspaceShared::commit_shared_space_to(char* newtop) {
|
|||
need_committed_size));
|
||||
}
|
||||
|
||||
log_info(cds)("Expanding shared spaces by " SIZE_FORMAT_W(7) " bytes [total " SIZE_FORMAT_W(9) " bytes ending at %p]",
|
||||
log_debug(cds)("Expanding shared spaces by " SIZE_FORMAT_W(7) " bytes [total " SIZE_FORMAT_W(9) " bytes ending at %p]",
|
||||
commit, _shared_vs.actual_committed_size(), _shared_vs.high());
|
||||
}
|
||||
|
||||
|
@ -1055,9 +1053,9 @@ void DumpAllocStats::print_stats(int ro_all, int rw_all, int mc_all, int md_all)
|
|||
|
||||
LogMessage(cds) msg;
|
||||
|
||||
msg.info("Detailed metadata info (excluding st regions; rw stats include md/mc regions):");
|
||||
msg.info("%s", hdr);
|
||||
msg.info("%s", sep);
|
||||
msg.debug("Detailed metadata info (excluding st regions; rw stats include md/mc regions):");
|
||||
msg.debug("%s", hdr);
|
||||
msg.debug("%s", sep);
|
||||
for (int type = 0; type < int(_number_of_types); type ++) {
|
||||
const char *name = type_name((Type)type);
|
||||
int ro_count = _counts[RO][type];
|
||||
|
@ -1071,7 +1069,7 @@ void DumpAllocStats::print_stats(int ro_all, int rw_all, int mc_all, int md_all)
|
|||
double rw_perc = percent_of(rw_bytes, rw_all);
|
||||
double perc = percent_of(bytes, ro_all + rw_all);
|
||||
|
||||
msg.info(fmt_stats, name,
|
||||
msg.debug(fmt_stats, name,
|
||||
ro_count, ro_bytes, ro_perc,
|
||||
rw_count, rw_bytes, rw_perc,
|
||||
count, bytes, perc);
|
||||
|
@ -1089,8 +1087,8 @@ void DumpAllocStats::print_stats(int ro_all, int rw_all, int mc_all, int md_all)
|
|||
double all_rw_perc = percent_of(all_rw_bytes, rw_all);
|
||||
double all_perc = percent_of(all_bytes, ro_all + rw_all);
|
||||
|
||||
msg.info("%s", sep);
|
||||
msg.info(fmt_stats, "Total",
|
||||
msg.debug("%s", sep);
|
||||
msg.debug(fmt_stats, "Total",
|
||||
all_ro_count, all_ro_bytes, all_ro_perc,
|
||||
all_rw_count, all_rw_bytes, all_rw_perc,
|
||||
all_count, all_bytes, all_perc);
|
||||
|
@ -1311,10 +1309,10 @@ public:
|
|||
SortedSymbolClosure the_ssc; // StackObj
|
||||
_ssc = &the_ssc;
|
||||
|
||||
tty->print_cr("Scanning all metaspace objects ... ");
|
||||
log_info(cds)("Scanning all metaspace objects ... ");
|
||||
{
|
||||
// allocate and shallow-copy RW objects, immediately following the MC region
|
||||
tty->print_cr("Allocating RW objects ... ");
|
||||
log_info(cds)("Allocating RW objects ... ");
|
||||
_mc_region.pack(&_rw_region);
|
||||
|
||||
ResourceMark rm;
|
||||
|
@ -1323,7 +1321,7 @@ public:
|
|||
}
|
||||
{
|
||||
// allocate and shallow-copy of RO object, immediately following the RW region
|
||||
tty->print_cr("Allocating RO objects ... ");
|
||||
log_info(cds)("Allocating RO objects ... ");
|
||||
_rw_region.pack(&_ro_region);
|
||||
|
||||
ResourceMark rm;
|
||||
|
@ -1331,13 +1329,13 @@ public:
|
|||
iterate_roots(&ro_copier);
|
||||
}
|
||||
{
|
||||
tty->print_cr("Relocating embedded pointers ... ");
|
||||
log_info(cds)("Relocating embedded pointers ... ");
|
||||
ResourceMark rm;
|
||||
ShallowCopyEmbeddedRefRelocator emb_reloc;
|
||||
iterate_roots(&emb_reloc);
|
||||
}
|
||||
{
|
||||
tty->print_cr("Relocating external roots ... ");
|
||||
log_info(cds)("Relocating external roots ... ");
|
||||
ResourceMark rm;
|
||||
RefRelocator ext_reloc;
|
||||
iterate_roots(&ext_reloc);
|
||||
|
@ -1345,7 +1343,7 @@ public:
|
|||
|
||||
#ifdef ASSERT
|
||||
{
|
||||
tty->print_cr("Verifying external roots ... ");
|
||||
log_info(cds)("Verifying external roots ... ");
|
||||
ResourceMark rm;
|
||||
IsRefInArchiveChecker checker;
|
||||
iterate_roots(&checker);
|
||||
|
@ -1362,7 +1360,7 @@ public:
|
|||
// old objects which assert that their klass is the original klass.
|
||||
static void relocate_well_known_klasses() {
|
||||
{
|
||||
tty->print_cr("Relocating SystemDictionary::_well_known_klasses[] ... ");
|
||||
log_info(cds)("Relocating SystemDictionary::_well_known_klasses[] ... ");
|
||||
ResourceMark rm;
|
||||
RefRelocator ext_reloc;
|
||||
SystemDictionary::well_known_klasses_do(&ext_reloc);
|
||||
|
@ -1410,7 +1408,7 @@ SortedSymbolClosure* ArchiveCompactor::_ssc;
|
|||
ArchiveCompactor::RelocationTable* ArchiveCompactor::_new_loc_table;
|
||||
|
||||
void VM_PopulateDumpSharedSpace::dump_symbols() {
|
||||
tty->print_cr("Dumping symbol table ...");
|
||||
log_info(cds)("Dumping symbol table ...");
|
||||
|
||||
NOT_PRODUCT(SymbolTable::verify());
|
||||
SymbolTable::write_to_archive();
|
||||
|
@ -1419,12 +1417,12 @@ void VM_PopulateDumpSharedSpace::dump_symbols() {
|
|||
char* VM_PopulateDumpSharedSpace::dump_read_only_tables() {
|
||||
ArchiveCompactor::OtherROAllocMark mark;
|
||||
|
||||
tty->print("Removing java_mirror ... ");
|
||||
log_info(cds)("Removing java_mirror ... ");
|
||||
if (!HeapShared::is_heap_object_archiving_allowed()) {
|
||||
clear_basic_type_mirrors();
|
||||
}
|
||||
remove_java_mirror_in_classes();
|
||||
tty->print_cr("done. ");
|
||||
log_info(cds)("done. ");
|
||||
|
||||
SystemDictionaryShared::write_to_archive();
|
||||
|
||||
|
@ -1443,7 +1441,7 @@ char* VM_PopulateDumpSharedSpace::dump_read_only_tables() {
|
|||
}
|
||||
|
||||
void VM_PopulateDumpSharedSpace::print_class_stats() {
|
||||
tty->print_cr("Number of classes %d", _global_klass_objects->length());
|
||||
log_info(cds)("Number of classes %d", _global_klass_objects->length());
|
||||
{
|
||||
int num_type_array = 0, num_obj_array = 0, num_inst = 0;
|
||||
for (int i = 0; i < _global_klass_objects->length(); i++) {
|
||||
|
@ -1457,9 +1455,9 @@ void VM_PopulateDumpSharedSpace::print_class_stats() {
|
|||
num_type_array ++;
|
||||
}
|
||||
}
|
||||
tty->print_cr(" instance classes = %5d", num_inst);
|
||||
tty->print_cr(" obj array classes = %5d", num_obj_array);
|
||||
tty->print_cr(" type array classes = %5d", num_type_array);
|
||||
log_info(cds)(" instance classes = %5d", num_inst);
|
||||
log_info(cds)(" obj array classes = %5d", num_obj_array);
|
||||
log_info(cds)(" type array classes = %5d", num_type_array);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1541,14 +1539,14 @@ void VM_PopulateDumpSharedSpace::doit() {
|
|||
print_class_stats();
|
||||
|
||||
// Ensure the ConstMethods won't be modified at run-time
|
||||
tty->print("Updating ConstMethods ... ");
|
||||
log_info(cds)("Updating ConstMethods ... ");
|
||||
rewrite_nofast_bytecodes_and_calculate_fingerprints(THREAD);
|
||||
tty->print_cr("done. ");
|
||||
log_info(cds)("done. ");
|
||||
|
||||
// Remove all references outside the metadata
|
||||
tty->print("Removing unshareable information ... ");
|
||||
log_info(cds)("Removing unshareable information ... ");
|
||||
remove_unshareable_in_classes();
|
||||
tty->print_cr("done. ");
|
||||
log_info(cds)("done. ");
|
||||
|
||||
ArchiveCompactor::initialize();
|
||||
ArchiveCompactor::copy_and_compact();
|
||||
|
@ -1665,12 +1663,12 @@ void VM_PopulateDumpSharedSpace::print_region_stats() {
|
|||
print_heap_region_stats(_closed_archive_heap_regions, "ca", 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]",
|
||||
log_debug(cds)("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_bitmap_region_stats(size_t size, size_t total_size) {
|
||||
tty->print_cr("bm space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [100.0%% used] at " INTPTR_FORMAT,
|
||||
log_debug(cds)("bm space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [100.0%% used] at " INTPTR_FORMAT,
|
||||
size, size/double(total_size)*100.0, size, p2i(NULL));
|
||||
}
|
||||
|
||||
|
@ -1681,7 +1679,7 @@ void VM_PopulateDumpSharedSpace::print_heap_region_stats(GrowableArray<MemRegion
|
|||
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.0%% used] at " INTPTR_FORMAT,
|
||||
log_debug(cds)("%s%d space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [100.0%% used] at " INTPTR_FORMAT,
|
||||
name, i, size, size/double(total_size)*100.0, size, p2i(start));
|
||||
|
||||
}
|
||||
|
@ -1807,33 +1805,33 @@ void MetaspaceShared::preload_and_dump(TRAPS) {
|
|||
class_list_path = SharedClassListFile;
|
||||
}
|
||||
|
||||
tty->print_cr("Loading classes to share ...");
|
||||
log_info(cds)("Loading classes to share ...");
|
||||
_has_error_classes = false;
|
||||
int class_count = preload_classes(class_list_path, THREAD);
|
||||
if (ExtraSharedClassListFile) {
|
||||
class_count += preload_classes(ExtraSharedClassListFile, THREAD);
|
||||
}
|
||||
tty->print_cr("Loading classes to share: done.");
|
||||
log_info(cds)("Loading classes to share: done.");
|
||||
|
||||
log_info(cds)("Shared spaces: preloaded %d classes", class_count);
|
||||
|
||||
if (SharedArchiveConfigFile) {
|
||||
tty->print_cr("Reading extra data from %s ...", SharedArchiveConfigFile);
|
||||
log_info(cds)("Reading extra data from %s ...", SharedArchiveConfigFile);
|
||||
read_extra_data(SharedArchiveConfigFile, THREAD);
|
||||
}
|
||||
tty->print_cr("Reading extra data: done.");
|
||||
log_info(cds)("Reading extra data: done.");
|
||||
|
||||
HeapShared::init_subgraph_entry_fields(THREAD);
|
||||
|
||||
// Rewrite and link classes
|
||||
tty->print_cr("Rewriting and linking classes ...");
|
||||
log_info(cds)("Rewriting and linking classes ...");
|
||||
|
||||
// Link any classes which got missed. This would happen if we have loaded classes that
|
||||
// were not explicitly specified in the classlist. E.g., if an interface implemented by class K
|
||||
// fails verification, all other interfaces that were not specified in the classlist but
|
||||
// are implemented by K are not verified.
|
||||
link_and_cleanup_shared_classes(CATCH);
|
||||
tty->print_cr("Rewriting and linking classes: done");
|
||||
log_info(cds)("Rewriting and linking classes: done");
|
||||
|
||||
if (HeapShared::is_heap_object_archiving_allowed()) {
|
||||
// Avoid fragmentation while archiving heap objects.
|
||||
|
@ -1947,7 +1945,7 @@ void VM_PopulateDumpSharedSpace::dump_archive_heap_oopmaps(GrowableArray<MemRegi
|
|||
size_t size_in_bytes = oopmap.size_in_bytes();
|
||||
uintptr_t* buffer = (uintptr_t*)_ro_region.allocate(size_in_bytes, sizeof(intptr_t));
|
||||
oopmap.write_to(buffer, size_in_bytes);
|
||||
log_info(cds)("Oopmap = " INTPTR_FORMAT " (" SIZE_FORMAT_W(6) " bytes) for heap region "
|
||||
log_info(cds, heap)("Oopmap = " INTPTR_FORMAT " (" SIZE_FORMAT_W(6) " bytes) for heap region "
|
||||
INTPTR_FORMAT " (" SIZE_FORMAT_W(8) " bytes)",
|
||||
p2i(buffer), size_in_bytes,
|
||||
p2i(regions->at(i).start()), regions->at(i).byte_size());
|
||||
|
|
|
@ -58,7 +58,7 @@ public class TestSharedArchiveWithPreTouch {
|
|||
if (Platform.is64bit()) {
|
||||
dump_args.addAll(0, Arrays.asList(new String[] { "-XX:+UseCompressedClassPointers", "-XX:+UseCompressedOops" }));
|
||||
}
|
||||
dump_args.addAll(Arrays.asList(new String[] { "-Xshare:dump" }));
|
||||
dump_args.addAll(Arrays.asList(new String[] { "-Xshare:dump", "-Xlog:cds" }));
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder(dump_args.toArray(new String[0]));
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -42,7 +42,7 @@ public class CDSCompressedKPtrs {
|
|||
if (Platform.is64bit()) {
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+UseCompressedClassPointers", "-XX:+UseCompressedOops",
|
||||
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./CDSCompressedKPtrs.jsa", "-Xshare:dump");
|
||||
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./CDSCompressedKPtrs.jsa", "-Xshare:dump", "-Xlog:cds");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
try {
|
||||
output.shouldContain("Loading classes to share");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -44,7 +44,7 @@ public class CDSCompressedKPtrsError {
|
|||
if (Platform.is64bit()) {
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+UseCompressedOops", "-XX:+UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:SharedArchiveFile=" + filename, "-Xshare:dump");
|
||||
"-XX:SharedArchiveFile=" + filename, "-Xshare:dump", "-Xlog:cds");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
try {
|
||||
output.shouldContain("Loading classes to share");
|
||||
|
@ -79,19 +79,19 @@ public class CDSCompressedKPtrsError {
|
|||
// Test bad options with -Xshare:dump.
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:-UseCompressedOops", "-XX:+UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:SharedArchiveFile=./CDSCompressedKPtrsErrorBad1.jsa", "-Xshare:dump");
|
||||
"-XX:SharedArchiveFile=./CDSCompressedKPtrsErrorBad1.jsa", "-Xshare:dump", "-Xlog:cds");
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Cannot dump shared archive");
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+UseCompressedOops", "-XX:-UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:SharedArchiveFile=./CDSCompressedKPtrsErrorBad2.jsa", "-Xshare:dump");
|
||||
"-XX:SharedArchiveFile=./CDSCompressedKPtrsErrorBad2.jsa", "-Xshare:dump", "-Xlog:cds");
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Cannot dump shared archive");
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:-UseCompressedOops", "-XX:-UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:SharedArchiveFile=./CDSCompressedKPtrsErrorBad3.jsa", "-Xshare:dump");
|
||||
"-XX:SharedArchiveFile=./CDSCompressedKPtrsErrorBad3.jsa", "-Xshare:dump", "-Xlog:cds");
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Cannot dump shared archive");
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -40,7 +40,7 @@ public class XShareAuto {
|
|||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-server", "-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:SharedArchiveFile=./XShareAuto.jsa", "-Xshare:dump");
|
||||
"-XX:SharedArchiveFile=./XShareAuto.jsa", "-Xshare:dump", "-Xlog:cds");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Loading classes to share");
|
||||
output.shouldHaveExitValue(0);
|
||||
|
|
|
@ -114,7 +114,7 @@ public class CompressedClassPointers {
|
|||
"-XX:SharedBaseAddress=8g",
|
||||
"-XX:+PrintCompressedOopsMode",
|
||||
"-XX:+VerifyBeforeGC",
|
||||
"-Xshare:dump");
|
||||
"-Xshare:dump", "-Xlog:cds");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
if (output.firstMatch("Shared spaces are not supported in this VM") != null) {
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -40,7 +40,7 @@ public class NMTWithCDS {
|
|||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb;
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./NMTWithCDS.jsa", "-Xshare:dump");
|
||||
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./NMTWithCDS.jsa", "-Xshare:dump", "-Xlog:cds");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
try {
|
||||
output.shouldContain("Loading classes to share");
|
||||
|
|
|
@ -43,14 +43,14 @@ public class SharedArchiveFile {
|
|||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
|
||||
"-XX:SharedArchiveFile=./SharedArchiveFile.jsa",
|
||||
"-Xshare:dump");
|
||||
"-Xshare:dump", "-Xlog:cds");
|
||||
OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "SharedArchiveFile");
|
||||
CDSTestUtils.checkDump(out);
|
||||
|
||||
// -XX:+DumpSharedSpaces should behave the same as -Xshare:dump
|
||||
pb = ProcessTools.createJavaProcessBuilder(true,
|
||||
"-XX:SharedArchiveFile=./SharedArchiveFile.jsa",
|
||||
"-XX:+DumpSharedSpaces");
|
||||
"-XX:+DumpSharedSpaces", "-Xlog:cds");
|
||||
out = CDSTestUtils.executeAndLog(pb, "SharedArchiveFile");
|
||||
CDSTestUtils.checkDump(out);
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
*/
|
||||
|
||||
import jdk.test.lib.cds.CDSTestUtils;
|
||||
import jdk.test.lib.cds.CDSOptions;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import sun.hotspot.WhiteBox;
|
||||
|
||||
|
@ -49,19 +50,22 @@ public class SpaceUtilizationCheck {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// (1) Default VM arguments
|
||||
test();
|
||||
test("-Xlog:cds=debug");
|
||||
|
||||
// (2) Use the now deprecated VM arguments. They should have no effect.
|
||||
test("-XX:SharedReadWriteSize=128M",
|
||||
test("-Xlog:cds=debug",
|
||||
"-XX:SharedReadWriteSize=128M",
|
||||
"-XX:SharedReadOnlySize=128M",
|
||||
"-XX:SharedMiscDataSize=128M",
|
||||
"-XX:SharedMiscCodeSize=128M");
|
||||
}
|
||||
|
||||
static void test(String... extra_options) throws Exception {
|
||||
OutputAnalyzer output = CDSTestUtils.createArchive(extra_options);
|
||||
CDSOptions opts = new CDSOptions();
|
||||
opts.addSuffix(extra_options);
|
||||
OutputAnalyzer output = CDSTestUtils.createArchive(opts);
|
||||
CDSTestUtils.checkDump(output);
|
||||
Pattern pattern = Pattern.compile("^(..) *space: *([0-9]+).* out of *([0-9]+) bytes .* at 0x([0-9a0-f]+)");
|
||||
Pattern pattern = Pattern.compile("(..) *space: *([0-9]+).* out of *([0-9]+) bytes .* at 0x([0-9a0-f]+)");
|
||||
WhiteBox wb = WhiteBox.getWhiteBox();
|
||||
long reserve_alignment = wb.metaspaceReserveAlignment();
|
||||
System.out.println("Metaspace::reserve_alignment() = " + reserve_alignment);
|
||||
|
|
|
@ -226,6 +226,7 @@ public class TestCommon extends CDSTestUtils {
|
|||
} else {
|
||||
// static dump
|
||||
cmd.add("-Xshare:dump");
|
||||
cmd.add("-Xlog:cds");
|
||||
cmd.add("-XX:SharedArchiveFile=" + opts.archiveName);
|
||||
|
||||
if (opts.classList != null) {
|
||||
|
|
|
@ -106,7 +106,7 @@ public class ArchivedModuleWithCustomImageTest {
|
|||
String[] dumpCmd = {
|
||||
customJava.toString(),
|
||||
"-XX:SharedArchiveFile=./ArchivedModuleWithCustomImageTest.jsa",
|
||||
"-Xshare:dump"};
|
||||
"-Xshare:dump", "-Xlog:cds"};
|
||||
printCommand(dumpCmd);
|
||||
ProcessBuilder pbDump = new ProcessBuilder();
|
||||
pbDump.command(dumpCmd);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class OpenArchiveRegion {
|
|||
String appClasses[] = TestCommon.list("Hello");
|
||||
|
||||
// Dump with open archive heap region, requires G1 GC
|
||||
OutputAnalyzer output = TestCommon.dump(appJar, appClasses);
|
||||
OutputAnalyzer output = TestCommon.dump(appJar, appClasses, "-Xlog:cds=debug");
|
||||
TestCommon.checkDump(output, "oa0 space:");
|
||||
output.shouldNotContain("oa0 space: 0 [");
|
||||
output = TestCommon.exec(appJar, "Hello");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -72,7 +72,7 @@ public class CDSJDITest {
|
|||
"-Xbootclasspath/a:" + appJar,
|
||||
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./SharedArchiveFile.jsa",
|
||||
"-XX:ExtraSharedClassListFile=" + jarClasslistFile.getPath(),
|
||||
"-Xshare:dump");
|
||||
"-Xshare:dump", "-Xlog:cds");
|
||||
OutputAnalyzer outputDump = executeAndLog(pb, "exec");
|
||||
for (String jarClass : jarClasses) {
|
||||
outputDump.shouldNotContain("Cannot find " + jarClass);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue