8281941: Change CDS warning messages to use Unified Logging

Reviewed-by: dholmes, ccheung
This commit is contained in:
Matias Saavedra Silva 2023-03-10 17:11:48 +00:00 committed by Calvin Cheung
parent 9dd7b87997
commit 206661d45f
7 changed files with 17 additions and 17 deletions

View file

@ -55,7 +55,7 @@ void ClassListWriter::write(const InstanceKlass* k, const ClassFileStream* cfs)
assert(is_enabled(), "must be");
if (!ClassLoader::has_jrt_entry()) {
warning("DumpLoadedClassList and CDS are not supported in exploded build");
log_warning(cds)("DumpLoadedClassList and CDS are not supported in exploded build");
DumpLoadedClassList = nullptr;
return;
}

View file

@ -345,7 +345,7 @@ public:
void doit() {
ResourceMark rm;
if (AllowArchivingWithJavaAgent) {
warning("This archive was created with AllowArchivingWithJavaAgent. It should be used "
log_warning(cds)("This archive was created with AllowArchivingWithJavaAgent. It should be used "
"for testing purposes only and should not be used in a production environment");
}
FileMapInfo::check_nonempty_dir_in_shared_path_table();
@ -370,7 +370,7 @@ void DynamicArchive::check_for_dynamic_dump() {
vm_exit_during_initialization("-XX:+RecordDynamicDumpInfo" __THEMSG, nullptr);
} else {
assert(ArchiveClassesAtExit != nullptr, "sanity");
warning("-XX:ArchiveClassesAtExit" __THEMSG);
log_warning(cds)("-XX:ArchiveClassesAtExit" __THEMSG);
}
#undef __THEMSG
DynamicDumpSharedSpaces = false;

View file

@ -1043,13 +1043,13 @@ bool FileMapInfo::validate_shared_path_table() {
assert(shared_path(0)->is_modules_image(), "first shared_path must be the modules image");
if (header()->app_class_paths_start_index() > 1) {
DynamicDumpSharedSpaces = false;
warning(
log_warning(cds)(
"Dynamic archiving is disabled because base layer archive has appended boot classpath");
}
if (header()->num_module_paths() > 0) {
if (!check_module_paths()) {
DynamicDumpSharedSpaces = false;
warning(
log_warning(cds)(
"Dynamic archiving is disabled because base layer archive has a different module path");
}
}
@ -1134,7 +1134,7 @@ void FileMapInfo::validate_non_existent_class_paths() {
i++) {
SharedClassPathEntry* ent = shared_path(i);
if (!ent->check_non_existent()) {
warning("Archived non-system classes are disabled because the "
log_warning(cds)("Archived non-system classes are disabled because the "
"file %s exists", ent->name());
header()->set_has_platform_or_app_classes(false);
}
@ -2385,14 +2385,14 @@ bool FileMapInfo::map_heap_regions(int first, int max, bool is_open_archive,
// Check that regions are within the java heap
if (!G1CollectedHeap::heap()->check_archive_addresses(regions, num_regions)) {
log_info(cds)("UseSharedSpaces: Unable to allocate region, range is not within java heap.");
log_info(cds)("Unable to allocate region, range is not within java heap.");
return false;
}
// allocate from java heap
if (!G1CollectedHeap::heap()->alloc_archive_regions(
regions, num_regions, is_open_archive)) {
log_info(cds)("UseSharedSpaces: Unable to allocate region, java heap range is already in use.");
log_info(cds)("Unable to allocate region, java heap range is already in use.");
return false;
}
@ -2408,7 +2408,7 @@ bool FileMapInfo::map_heap_regions(int first, int max, bool is_open_archive,
if (base == nullptr || base != addr) {
// dealloc the regions from java heap
dealloc_heap_regions(regions, num_regions);
log_info(cds)("UseSharedSpaces: Unable to map at required address in java heap. "
log_info(cds)("Unable to map at required address in java heap. "
INTPTR_FORMAT ", size = " SIZE_FORMAT " bytes",
p2i(addr), regions[i].byte_size());
return false;
@ -2418,7 +2418,7 @@ bool FileMapInfo::map_heap_regions(int first, int max, bool is_open_archive,
if (VerifySharedSpaces && !r->check_region_crc()) {
// dealloc the regions from java heap
dealloc_heap_regions(regions, num_regions);
log_info(cds)("UseSharedSpaces: mapped heap regions are corrupt");
log_info(cds)("mapped heap regions are corrupt");
return false;
}
}
@ -2644,7 +2644,7 @@ bool FileMapHeader::validate() {
// header data
const char* prop = Arguments::get_property("java.system.class.loader");
if (prop != nullptr) {
warning("Archived non-system classes are disabled because the "
log_warning(cds)("Archived non-system classes are disabled because the "
"java.system.class.loader property is specified (value = \"%s\"). "
"To use archived non-system classes, this property must not be set", prop);
_has_platform_or_app_classes = false;
@ -2683,7 +2683,7 @@ bool FileMapHeader::validate() {
}
if (_allow_archiving_with_java_agent) {
warning("This archive was created with AllowArchivingWithJavaAgent. It should be used "
log_warning(cds)("This archive was created with AllowArchivingWithJavaAgent. It should be used "
"for testing purposes only and should not be used in a production environment");
}

View file

@ -560,7 +560,7 @@ void VM_PopulateDumpSharedSpace::doit() {
}
if (AllowArchivingWithJavaAgent) {
warning("This archive was created with AllowArchivingWithJavaAgent. It should be used "
log_warning(cds)("This archive was created with AllowArchivingWithJavaAgent. It should be used "
"for testing purposes only and should not be used in a production environment");
}
@ -941,7 +941,7 @@ void MetaspaceShared::initialize_runtime_shared_and_meta_spaces() {
} else {
set_shared_metaspace_range(nullptr, nullptr, nullptr);
if (DynamicDumpSharedSpaces) {
warning("-XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info.");
log_warning(cds)("-XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info.");
}
UseSharedSpaces = false;
// The base archive cannot be mapped. We cannot dump the dynamic shared archive.

View file

@ -44,7 +44,7 @@ public class SpecifySysLoaderProp {
String jarFileName = "sysloader.jar";
String appJar = TestCommon.getTestJar(jarFileName);
TestCommon.testDump(appJar, TestCommon.list("ReportMyLoader"));
String warning = "VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified";
String warning = "Archived non-system classes are disabled because the java.system.class.loader property is specified";
// (0) Baseline. Do not specify -Djava.system.class.loader

View file

@ -242,7 +242,7 @@ public class ArchiveConsistency extends DynamicArchiveTestBase {
"-cp",
appJar, mainClass)
.assertNormalExit(output -> {
output.shouldContain("VM warning: -XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded");
output.shouldContain("-XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded");
});
}
}

View file

@ -44,7 +44,7 @@ import jtreg.SkippedException;
// This class contains common test utilities for testing CDS
public class CDSTestUtils {
public static final String MSG_RANGE_NOT_WITHIN_HEAP =
"UseSharedSpaces: Unable to allocate region, range is not within java heap.";
"Unable to allocate region, range is not within java heap.";
public static final String MSG_RANGE_ALREADT_IN_USE =
"Unable to allocate region, java heap range is already in use.";
public static final String MSG_DYNAMIC_NOT_SUPPORTED =