changeset 57522:2fbc66ef1a1d

8233826: Change CDS dumping tty->print_cr() to unified logging Reviewed-by: coleenp, dholmes, jiangli
author iklam
date Thu, 19 Dec 2019 23:04:49 -0800
parents 4d90b46f099c
children f93bd058a4ce
files src/hotspot/share/memory/filemap.cpp src/hotspot/share/memory/heapShared.cpp src/hotspot/share/memory/metaspaceShared.cpp test/hotspot/jtreg/gc/g1/TestSharedArchiveWithPreTouch.java test/hotspot/jtreg/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java test/hotspot/jtreg/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java test/hotspot/jtreg/runtime/CDSCompressedKPtrs/XShareAuto.java test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java test/hotspot/jtreg/runtime/NMT/NMTWithCDS.java test/hotspot/jtreg/runtime/cds/SharedArchiveFile.java test/hotspot/jtreg/runtime/cds/SpaceUtilizationCheck.java test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedModuleWithCustomImageTest.java test/hotspot/jtreg/runtime/cds/appcds/cacheObject/OpenArchiveRegion.java test/jdk/com/sun/jdi/cds/CDSJDITest.java
diffstat 15 files changed, 91 insertions(+), 90 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/memory/filemap.cpp	Fri Dec 20 04:47:34 2019 +0100
+++ b/src/hotspot/share/memory/filemap.cpp	Thu Dec 19 23:04:49 2019 -0800
@@ -1164,9 +1164,9 @@
 
   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)
-                " bytes, addr " INTPTR_FORMAT " file offset " SIZE_FORMAT_HEX_W(08),
-                region, size, p2i(requested_base), _file_offset);
+  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);
@@ -1185,8 +1185,8 @@
   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)",
-                p2i(buffer), size_in_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,8 +1247,8 @@
       total_size += size;
     }
 
-    log_info(cds)("Archive heap region %d: " INTPTR_FORMAT " - " INTPTR_FORMAT " = " SIZE_FORMAT_W(8) " bytes",
-                  i, p2i(start), p2i(start + 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) {
       address oopmap = oopmaps->at(arr_idx)._oopmap;
--- a/src/hotspot/share/memory/heapShared.cpp	Fri Dec 20 04:47:34 2019 +0100
+++ b/src/hotspot/share/memory/heapShared.cpp	Thu Dec 19 23:04:49 2019 -0800
@@ -186,14 +186,12 @@
 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));
-    }
+    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 @@
     // 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();
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Fri Dec 20 04:47:34 2019 +0100
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Thu Dec 19 23:04:49 2019 -0800
@@ -160,18 +160,16 @@
 }
 
 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,
-                _name, used(), percent_of(used(), total_bytes), reserved(), percent_of(used(), reserved()),
-                p2i(_base + MetaspaceShared::final_delta()));
+  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",
-             _name, p2i(_base), p2i(_top), int(_end - _base), int(_top - _base));
+  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 @@
 
   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,8 +425,8 @@
                                           need_committed_size));
   }
 
-  log_info(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());
+  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());
 }
 
 void MetaspaceShared::initialize_ptr_marker(CHeapBitMap* ptrmap) {
@@ -1055,9 +1053,9 @@
 
   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 @@
     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 @@
   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 @@
     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 @@
     }
     {
       // 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 @@
       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 @@
 
 #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 @@
   // 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 @@
 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 @@
 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 @@
 }
 
 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 @@
         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 @@
   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,13 +1663,13 @@
   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,
-                size, size/double(total_size)*100.0, size, p2i(NULL));
+  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));
 }
 
 void VM_PopulateDumpSharedSpace::print_heap_region_stats(GrowableArray<MemRegion> *heap_mem,
@@ -1681,8 +1679,8 @@
       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,
-                    name, i, size, size/double(total_size)*100.0, size, p2i(start));
+      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 @@
       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,10 +1945,10 @@
     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 "
-                  INTPTR_FORMAT " (" SIZE_FORMAT_W(8) " bytes)",
-                  p2i(buffer), size_in_bytes,
-                  p2i(regions->at(i).start()), regions->at(i).byte_size());
+    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());
 
     ArchiveHeapOopmapInfo info;
     info._oopmap = (address)buffer;
--- a/test/hotspot/jtreg/gc/g1/TestSharedArchiveWithPreTouch.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/hotspot/jtreg/gc/g1/TestSharedArchiveWithPreTouch.java	Thu Dec 19 23:04:49 2019 -0800
@@ -58,7 +58,7 @@
         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());
--- a/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java	Thu Dec 19 23:04:49 2019 -0800
@@ -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 @@
     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");
--- a/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java	Thu Dec 19 23:04:49 2019 -0800
@@ -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 @@
     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 @@
       // 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");
 
--- a/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/XShareAuto.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/XShareAuto.java	Thu Dec 19 23:04:49 2019 -0800
@@ -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 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);
--- a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java	Thu Dec 19 23:04:49 2019 -0800
@@ -114,7 +114,7 @@
             "-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;
--- a/test/hotspot/jtreg/runtime/NMT/NMTWithCDS.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/hotspot/jtreg/runtime/NMT/NMTWithCDS.java	Thu Dec 19 23:04:49 2019 -0800
@@ -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 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");
--- a/test/hotspot/jtreg/runtime/cds/SharedArchiveFile.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/hotspot/jtreg/runtime/cds/SharedArchiveFile.java	Thu Dec 19 23:04:49 2019 -0800
@@ -43,14 +43,14 @@
     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);
 
--- a/test/hotspot/jtreg/runtime/cds/SpaceUtilizationCheck.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/hotspot/jtreg/runtime/cds/SpaceUtilizationCheck.java	Thu Dec 19 23:04:49 2019 -0800
@@ -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 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);
--- a/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java	Thu Dec 19 23:04:49 2019 -0800
@@ -226,6 +226,7 @@
         } else {
             // static dump
             cmd.add("-Xshare:dump");
+            cmd.add("-Xlog:cds");
             cmd.add("-XX:SharedArchiveFile=" + opts.archiveName);
 
             if (opts.classList != null) {
--- a/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedModuleWithCustomImageTest.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedModuleWithCustomImageTest.java	Thu Dec 19 23:04:49 2019 -0800
@@ -106,7 +106,7 @@
         String[] dumpCmd = {
             customJava.toString(),
             "-XX:SharedArchiveFile=./ArchivedModuleWithCustomImageTest.jsa",
-            "-Xshare:dump"};
+            "-Xshare:dump", "-Xlog:cds"};
         printCommand(dumpCmd);
         ProcessBuilder pbDump = new ProcessBuilder();
         pbDump.command(dumpCmd);
--- a/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/OpenArchiveRegion.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/OpenArchiveRegion.java	Thu Dec 19 23:04:49 2019 -0800
@@ -44,7 +44,7 @@
         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");
--- a/test/jdk/com/sun/jdi/cds/CDSJDITest.java	Fri Dec 20 04:47:34 2019 +0100
+++ b/test/jdk/com/sun/jdi/cds/CDSJDITest.java	Thu Dec 19 23:04:49 2019 -0800
@@ -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 @@
             "-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);