8176132: -XX:+PrintSharedSpaces should be converted to use Unified Logging

Converted -XX:+PrintSharedSpaces to -Xlog:cds=info

Reviewed-by: iklam, jiangli, mseledtsov
This commit is contained in:
Rachel Protacio 2017-06-05 13:13:38 -04:00
parent 3312fc717b
commit 451b8b5d32
12 changed files with 87 additions and 75 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@
#include "precompiled.hpp" #include "precompiled.hpp"
#include "classfile/compactHashtable.inline.hpp" #include "classfile/compactHashtable.inline.hpp"
#include "classfile/javaClasses.hpp" #include "classfile/javaClasses.hpp"
#include "logging/logMessage.hpp"
#include "memory/metadataFactory.hpp" #include "memory/metadataFactory.hpp"
#include "memory/metaspaceShared.hpp" #include "memory/metaspaceShared.hpp"
#include "prims/jvm.h" #include "prims/jvm.h"
@ -146,22 +147,27 @@ void CompactHashtableWriter::dump(SimpleCompactHashtable *cht, const char* table
cht->init(base_address, _num_entries, _num_buckets, cht->init(base_address, _num_entries, _num_buckets,
_compact_buckets->data(), _compact_entries->data()); _compact_buckets->data(), _compact_entries->data());
if (PrintSharedSpaces) { if (log_is_enabled(Info, cds, hashtables)) {
ResourceMark rm;
LogMessage(cds, hashtables) msg;
stringStream info_stream;
double avg_cost = 0.0; double avg_cost = 0.0;
if (_num_entries > 0) { if (_num_entries > 0) {
avg_cost = double(table_bytes)/double(_num_entries); avg_cost = double(table_bytes)/double(_num_entries);
} }
tty->print_cr("Shared %s table stats -------- base: " PTR_FORMAT, info_stream.print_cr("Shared %s table stats -------- base: " PTR_FORMAT,
table_name, (intptr_t)base_address); table_name, (intptr_t)base_address);
tty->print_cr("Number of entries : %9d", _num_entries); info_stream.print_cr("Number of entries : %9d", _num_entries);
tty->print_cr("Total bytes used : %9d", table_bytes); info_stream.print_cr("Total bytes used : %9d", table_bytes);
tty->print_cr("Average bytes per entry : %9.3f", avg_cost); info_stream.print_cr("Average bytes per entry : %9.3f", avg_cost);
tty->print_cr("Average bucket size : %9.3f", summary.avg()); info_stream.print_cr("Average bucket size : %9.3f", summary.avg());
tty->print_cr("Variance of bucket size : %9.3f", summary.variance()); info_stream.print_cr("Variance of bucket size : %9.3f", summary.variance());
tty->print_cr("Std. dev. of bucket size: %9.3f", summary.sd()); info_stream.print_cr("Std. dev. of bucket size: %9.3f", summary.sd());
tty->print_cr("Empty buckets : %9d", _num_empty_buckets); info_stream.print_cr("Empty buckets : %9d", _num_empty_buckets);
tty->print_cr("Value_Only buckets : %9d", _num_value_only_buckets); info_stream.print_cr("Value_Only buckets : %9d", _num_value_only_buckets);
tty->print_cr("Other buckets : %9d", _num_other_buckets); info_stream.print_cr("Other buckets : %9d", _num_other_buckets);
msg.info("%s", info_stream.as_string());
} }
} }

View file

@ -30,6 +30,7 @@
#include "classfile/systemDictionary.hpp" #include "classfile/systemDictionary.hpp"
#include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/collectedHeap.inline.hpp"
#include "gc/shared/gcLocker.inline.hpp" #include "gc/shared/gcLocker.inline.hpp"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
#include "memory/filemap.hpp" #include "memory/filemap.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
@ -744,14 +745,12 @@ void StringTable::serialize(SerializeClosure* soc, GrowableArray<MemRegion> *str
_shared_table.reset(); _shared_table.reset();
if (soc->writing()) { if (soc->writing()) {
if (!(UseG1GC && UseCompressedOops && UseCompressedClassPointers)) { if (!(UseG1GC && UseCompressedOops && UseCompressedClassPointers)) {
if (PrintSharedSpaces) { log_info(cds)(
tty->print_cr(
"Shared strings are excluded from the archive as UseG1GC, " "Shared strings are excluded from the archive as UseG1GC, "
"UseCompressedOops and UseCompressedClassPointers are required." "UseCompressedOops and UseCompressedClassPointers are required."
"Current settings: UseG1GC=%s, UseCompressedOops=%s, UseCompressedClassPointers=%s.", "Current settings: UseG1GC=%s, UseCompressedOops=%s, UseCompressedClassPointers=%s.",
BOOL_TO_STR(UseG1GC), BOOL_TO_STR(UseCompressedOops), BOOL_TO_STR(UseG1GC), BOOL_TO_STR(UseCompressedOops),
BOOL_TO_STR(UseCompressedClassPointers)); BOOL_TO_STR(UseCompressedClassPointers));
}
} else { } else {
int num_buckets = the_table()->number_of_entries() / int num_buckets = the_table()->number_of_entries() /
SharedSymbolTableBucketSize; SharedSymbolTableBucketSize;

View file

@ -44,6 +44,7 @@
LOG_TAG(blocks) \ LOG_TAG(blocks) \
LOG_TAG(bot) \ LOG_TAG(bot) \
LOG_TAG(breakpoint) \ LOG_TAG(breakpoint) \
LOG_TAG(cds) \
LOG_TAG(census) \ LOG_TAG(census) \
LOG_TAG(class) \ LOG_TAG(class) \
LOG_TAG(classhisto) \ LOG_TAG(classhisto) \

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,8 @@
#if INCLUDE_ALL_GCS #if INCLUDE_ALL_GCS
#include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1CollectedHeap.hpp"
#endif #endif
#include "logging/log.hpp"
#include "logging/logMessage.hpp"
#include "memory/filemap.hpp" #include "memory/filemap.hpp"
#include "memory/metadataFactory.hpp" #include "memory/metadataFactory.hpp"
#include "memory/oopFactory.hpp" #include "memory/oopFactory.hpp"
@ -98,9 +100,11 @@ void FileMapInfo::fail_continue(const char *msg, ...) {
if (RequireSharedSpaces) { if (RequireSharedSpaces) {
fail(msg, ap); fail(msg, ap);
} else { } else {
if (PrintSharedSpaces) { if (log_is_enabled(Info, cds)) {
tty->print("UseSharedSpaces: "); ResourceMark rm;
tty->vprint_cr(msg, ap); outputStream* logstream = Log(cds)::info_stream();
logstream->print("UseSharedSpaces: ");
logstream->vprint_cr(msg, ap);
} }
} }
UseSharedSpaces = false; UseSharedSpaces = false;
@ -418,9 +422,13 @@ bool FileMapInfo::open_for_read() {
void FileMapInfo::open_for_write() { void FileMapInfo::open_for_write() {
_full_path = Arguments::GetSharedArchivePath(); _full_path = Arguments::GetSharedArchivePath();
if (PrintSharedSpaces) { if (log_is_enabled(Info, cds)) {
tty->print_cr("Dumping shared data to file: "); ResourceMark rm;
tty->print_cr(" %s", _full_path); LogMessage(cds) msg;
stringStream info_stream;
info_stream.print_cr("Dumping shared data to file: ");
info_stream.print_cr(" %s", _full_path);
msg.info("%s", info_stream.as_string());
} }
#ifdef _WINDOWS // On Windows, need WRITE permission to remove the file. #ifdef _WINDOWS // On Windows, need WRITE permission to remove the file.
@ -477,10 +485,9 @@ void FileMapInfo::write_region(int region, char* base, size_t size,
if (_file_open) { if (_file_open) {
guarantee(si->_file_offset == _file_offset, "file offset mismatch."); guarantee(si->_file_offset == _file_offset, "file offset mismatch.");
if (PrintSharedSpaces) { log_info(cds)("Shared file region %d: " SIZE_FORMAT_HEX_W(6)
tty->print_cr("Shared file region %d: " SIZE_FORMAT_HEX_W(6) " bytes, addr " INTPTR_FORMAT " bytes, addr " INTPTR_FORMAT " file offset " SIZE_FORMAT_HEX_W(6),
" file offset " SIZE_FORMAT_HEX_W(6), region, size, p2i(base), _file_offset); region, size, p2i(base), _file_offset);
}
} else { } else {
si->_file_offset = _file_offset; si->_file_offset = _file_offset;
} }
@ -691,11 +698,11 @@ bool FileMapInfo::map_string_regions() {
narrow_oop_shift() != Universe::narrow_oop_shift() || narrow_oop_shift() != Universe::narrow_oop_shift() ||
narrow_klass_base() != Universe::narrow_klass_base() || narrow_klass_base() != Universe::narrow_klass_base() ||
narrow_klass_shift() != Universe::narrow_klass_shift()) { narrow_klass_shift() != Universe::narrow_klass_shift()) {
if (PrintSharedSpaces && _header->_space[MetaspaceShared::first_string]._used > 0) { if (log_is_enabled(Info, cds) && _header->_space[MetaspaceShared::first_string]._used > 0) {
tty->print_cr("Shared string data from the CDS archive is being ignored. " log_info(cds)("Shared string data from the CDS archive is being ignored. "
"The current CompressedOops/CompressedClassPointers encoding differs from " "The current CompressedOops/CompressedClassPointers encoding differs from "
"that archived due to heap size change. The archive was dumped using max heap " "that archived due to heap size change. The archive was dumped using max heap "
"size " UINTX_FORMAT "M.", max_heap_size()/M); "size " UINTX_FORMAT "M.", max_heap_size()/M);
} }
} else { } else {
string_ranges = new MemRegion[MetaspaceShared::max_strings]; string_ranges = new MemRegion[MetaspaceShared::max_strings];
@ -761,8 +768,8 @@ bool FileMapInfo::map_string_regions() {
return true; return true;
} }
} else { } else {
if (PrintSharedSpaces && _header->_space[MetaspaceShared::first_string]._used > 0) { if (log_is_enabled(Info, cds) && _header->_space[MetaspaceShared::first_string]._used > 0) {
tty->print_cr("Shared string data from the CDS archive is being ignored. UseG1GC, " log_info(cds)("Shared string data from the CDS archive is being ignored. UseG1GC, "
"UseCompressedOops and UseCompressedClassPointers are required."); "UseCompressedOops and UseCompressedClassPointers are required.");
} }
} }

View file

@ -80,7 +80,7 @@ class MetadataFactory : AllStatic {
template <class T> template <class T>
static void free_metadata(ClassLoaderData* loader_data, T md) { static void free_metadata(ClassLoaderData* loader_data, T md) {
if (DumpSharedSpaces) { if (DumpSharedSpaces) {
// FIXME: the freeing code is buggy, especially when PrintSharedSpaces is enabled. // FIXME: the freeing code is buggy, especially when -Xlog:cds is enabled.
// Disable for now -- this means if you specify bad classes in your classlist you // Disable for now -- this means if you specify bad classes in your classlist you
// may have wasted space inside the archive. // may have wasted space inside the archive.
return; return;

View file

@ -3569,7 +3569,7 @@ void Metaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) {
assert(!SafepointSynchronize::is_at_safepoint() assert(!SafepointSynchronize::is_at_safepoint()
|| Thread::current()->is_VM_thread(), "should be the VM thread"); || Thread::current()->is_VM_thread(), "should be the VM thread");
if (DumpSharedSpaces && PrintSharedSpaces) { if (DumpSharedSpaces && log_is_enabled(Info, cds)) {
record_deallocation(ptr, vsm()->get_allocation_word_size(word_size)); record_deallocation(ptr, vsm()->get_allocation_word_size(word_size));
} }
@ -3603,7 +3603,7 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
if (result == NULL) { if (result == NULL) {
report_out_of_shared_space(read_only ? SharedReadOnly : SharedReadWrite); report_out_of_shared_space(read_only ? SharedReadOnly : SharedReadWrite);
} }
if (PrintSharedSpaces) { if (log_is_enabled(Info, cds)) {
space->record_allocation(result, type, space->vsm()->get_allocation_word_size(word_size)); space->record_allocation(result, type, space->vsm()->get_allocation_word_size(word_size));
} }

View file

@ -36,6 +36,8 @@
#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcLocker.hpp"
#include "interpreter/bytecodeStream.hpp" #include "interpreter/bytecodeStream.hpp"
#include "interpreter/bytecodes.hpp" #include "interpreter/bytecodes.hpp"
#include "logging/log.hpp"
#include "logging/logMessage.hpp"
#include "memory/filemap.hpp" #include "memory/filemap.hpp"
#include "memory/metaspace.hpp" #include "memory/metaspace.hpp"
#include "memory/metaspaceShared.hpp" #include "memory/metaspaceShared.hpp"
@ -330,9 +332,7 @@ intptr_t* CppVtableCloner<T>::clone_vtable(const char* name, CppVtableInfo* info
// We already checked (and, if necessary, adjusted n) when the vtables were allocated, so we are // We already checked (and, if necessary, adjusted n) when the vtables were allocated, so we are
// safe to do memcpy. // safe to do memcpy.
if (PrintSharedSpaces) { log_debug(cds, vtables)("Copying %3d vtable entries for %s", n, name);
tty->print_cr("Copying %3d vtable entries for %s", n, name);
}
memcpy(dstvtable, srcvtable, sizeof(intptr_t) * n); memcpy(dstvtable, srcvtable, sizeof(intptr_t) * n);
return dstvtable + n; return dstvtable + n;
} }
@ -383,9 +383,7 @@ int CppVtableCloner<T>::get_vtable_length(const char* name) {
break; break;
} }
} }
if (PrintSharedSpaces) { log_debug(cds, vtables)("Found %3d vtable entries for %s", vtable_len, name);
tty->print_cr("Found %3d vtable entries for %s", vtable_len, name);
}
return vtable_len; return vtable_len;
} }
@ -628,9 +626,13 @@ void DumpAllocClosure::dump_stats(int ro_all, int rw_all, int md_all, int mc_all
const char *sep = "--------------------+---------------------------+---------------------------+--------------------------"; const char *sep = "--------------------+---------------------------+---------------------------+--------------------------";
const char *hdr = " ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %"; const char *hdr = " ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %";
tty->print_cr("Detailed metadata info (rw includes md and mc):"); ResourceMark rm;
tty->print_cr("%s", hdr); LogMessage(cds) msg;
tty->print_cr("%s", sep); stringStream info_stream;
info_stream.print_cr("Detailed metadata info (rw includes md and mc):");
info_stream.print_cr("%s", hdr);
info_stream.print_cr("%s", sep);
for (int type = 0; type < int(_number_of_types); type ++) { for (int type = 0; type < int(_number_of_types); type ++) {
const char *name = type_name((Type)type); const char *name = type_name((Type)type);
int ro_count = _counts[RO][type]; int ro_count = _counts[RO][type];
@ -644,10 +646,10 @@ void DumpAllocClosure::dump_stats(int ro_all, int rw_all, int md_all, int mc_all
double rw_perc = 100.0 * double(rw_bytes) / double(rw_all); double rw_perc = 100.0 * double(rw_bytes) / double(rw_all);
double perc = 100.0 * double(bytes) / double(ro_all + rw_all); double perc = 100.0 * double(bytes) / double(ro_all + rw_all);
tty->print_cr(fmt_stats, name, info_stream.print_cr(fmt_stats, name,
ro_count, ro_bytes, ro_perc, ro_count, ro_bytes, ro_perc,
rw_count, rw_bytes, rw_perc, rw_count, rw_bytes, rw_perc,
count, bytes, perc); count, bytes, perc);
all_ro_count += ro_count; all_ro_count += ro_count;
all_ro_bytes += ro_bytes; all_ro_bytes += ro_bytes;
@ -662,14 +664,16 @@ void DumpAllocClosure::dump_stats(int ro_all, int rw_all, int md_all, int mc_all
double all_rw_perc = 100.0 * double(all_rw_bytes) / double(rw_all); double all_rw_perc = 100.0 * double(all_rw_bytes) / double(rw_all);
double all_perc = 100.0 * double(all_bytes) / double(ro_all + rw_all); double all_perc = 100.0 * double(all_bytes) / double(ro_all + rw_all);
tty->print_cr("%s", sep); info_stream.print_cr("%s", sep);
tty->print_cr(fmt_stats, "Total", info_stream.print_cr(fmt_stats, "Total",
all_ro_count, all_ro_bytes, all_ro_perc, all_ro_count, all_ro_bytes, all_ro_perc,
all_rw_count, all_rw_bytes, all_rw_perc, all_rw_count, all_rw_bytes, all_rw_perc,
all_count, all_bytes, all_perc); all_count, all_bytes, all_perc);
assert(all_ro_bytes == ro_all, "everything should have been counted"); assert(all_ro_bytes == ro_all, "everything should have been counted");
assert(all_rw_bytes == rw_all, "everything should have been counted"); assert(all_rw_bytes == rw_all, "everything should have been counted");
msg.info("%s", info_stream.as_string());
#undef fmt_stats #undef fmt_stats
} }
@ -897,7 +901,7 @@ void VM_PopulateDumpSharedSpace::doit() {
// Restore the vtable in case we invoke any virtual methods. // Restore the vtable in case we invoke any virtual methods.
MetaspaceShared::clone_cpp_vtables((intptr_t*)vtbl_list); MetaspaceShared::clone_cpp_vtables((intptr_t*)vtbl_list);
if (PrintSharedSpaces) { if (log_is_enabled(Info, cds)) {
DumpAllocClosure dac; DumpAllocClosure dac;
dac.iterate_metaspace(_loader_data->ro_metaspace(), DumpAllocClosure::RO); dac.iterate_metaspace(_loader_data->ro_metaspace(), DumpAllocClosure::RO);
dac.iterate_metaspace(_loader_data->rw_metaspace(), DumpAllocClosure::RW); dac.iterate_metaspace(_loader_data->rw_metaspace(), DumpAllocClosure::RW);
@ -1064,9 +1068,7 @@ void MetaspaceShared::preload_and_dump(TRAPS) {
} }
tty->print_cr("Loading classes to share: done."); tty->print_cr("Loading classes to share: done.");
if (PrintSharedSpaces) { log_info(cds)("Shared spaces: preloaded %d classes", class_count);
tty->print_cr("Shared spaces: preloaded %d classes", class_count);
}
// Rewrite and link classes // Rewrite and link classes
tty->print_cr("Rewriting and linking classes ..."); tty->print_cr("Rewriting and linking classes ...");
@ -1102,9 +1104,9 @@ int MetaspaceShared::preload_and_dump(const char* class_list_path,
CLEAR_PENDING_EXCEPTION; CLEAR_PENDING_EXCEPTION;
if (klass != NULL) { if (klass != NULL) {
if (PrintSharedSpaces && Verbose && WizardMode) { if (log_is_enabled(Trace, cds)) {
ResourceMark rm; ResourceMark rm;
tty->print_cr("Shared spaces preloaded: %s", klass->external_name()); log_trace(cds)("Shared spaces preloaded: %s", klass->external_name());
} }
InstanceKlass* ik = InstanceKlass::cast(klass); InstanceKlass* ik = InstanceKlass::cast(klass);

View file

@ -416,6 +416,7 @@ static AliasedFlag const aliased_jvm_flags[] = {
// NOTE: A compatibility request will be necessary for each alias to be removed. // NOTE: A compatibility request will be necessary for each alias to be removed.
static AliasedLoggingFlag const aliased_logging_flags[] = { static AliasedLoggingFlag const aliased_logging_flags[] = {
{ "PrintCompressedOopsMode", LogLevel::Info, true, LOG_TAGS(gc, heap, coops) }, { "PrintCompressedOopsMode", LogLevel::Info, true, LOG_TAGS(gc, heap, coops) },
{ "PrintSharedSpaces", LogLevel::Info, true, LOG_TAGS(cds) },
{ "TraceBiasedLocking", LogLevel::Info, true, LOG_TAGS(biasedlocking) }, { "TraceBiasedLocking", LogLevel::Info, true, LOG_TAGS(biasedlocking) },
{ "TraceClassLoading", LogLevel::Info, true, LOG_TAGS(class, load) }, { "TraceClassLoading", LogLevel::Info, true, LOG_TAGS(class, load) },
{ "TraceClassLoadingPreorder", LogLevel::Debug, true, LOG_TAGS(class, preorder) }, { "TraceClassLoadingPreorder", LogLevel::Debug, true, LOG_TAGS(class, preorder) },
@ -1298,7 +1299,7 @@ void Arguments::check_unsupported_dumping_properties() {
assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be"); assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be");
// If a vm option is found in the unsupported_options array with index less than the info_idx, // If a vm option is found in the unsupported_options array with index less than the info_idx,
// vm will exit with an error message. Otherwise, it will print an informational message if // vm will exit with an error message. Otherwise, it will print an informational message if
// PrintSharedSpaces is enabled. // -Xlog:cds is enabled.
uint info_idx = 1; uint info_idx = 1;
SystemProperty* sp = system_properties(); SystemProperty* sp = system_properties();
while (sp != NULL) { while (sp != NULL) {
@ -1308,10 +1309,8 @@ void Arguments::check_unsupported_dumping_properties() {
vm_exit_during_initialization( vm_exit_during_initialization(
"Cannot use the following option when dumping the shared archive", unsupported_options[i]); "Cannot use the following option when dumping the shared archive", unsupported_options[i]);
} else { } else {
if (PrintSharedSpaces) { log_info(cds)("Info: the %s option is ignored when dumping the shared archive",
tty->print_cr( unsupported_options[i]);
"Info: the %s option is ignored when dumping the shared archive", unsupported_options[i]);
}
} }
} }
} }
@ -4402,10 +4401,11 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
"Shared spaces are not supported in this VM\n"); "Shared spaces are not supported in this VM\n");
return JNI_ERR; return JNI_ERR;
} }
if ((UseSharedSpaces && FLAG_IS_CMDLINE(UseSharedSpaces)) || PrintSharedSpaces) { if ((UseSharedSpaces && FLAG_IS_CMDLINE(UseSharedSpaces)) ||
log_is_enabled(Info, cds)) {
warning("Shared spaces are not supported in this VM"); warning("Shared spaces are not supported in this VM");
FLAG_SET_DEFAULT(UseSharedSpaces, false); FLAG_SET_DEFAULT(UseSharedSpaces, false);
FLAG_SET_DEFAULT(PrintSharedSpaces, false); LogConfiguration::configure_stdout(LogLevel::Off, true, LOG_TAGS(cds));
} }
no_shared_spaces("CDS Disabled"); no_shared_spaces("CDS Disabled");
#endif // INCLUDE_CDS #endif // INCLUDE_CDS

View file

@ -3874,9 +3874,6 @@ public:
"shared spaces, and dumps the shared spaces to a file to be " \ "shared spaces, and dumps the shared spaces to a file to be " \
"used in future JVM runs") \ "used in future JVM runs") \
\ \
product(bool, PrintSharedSpaces, false, \
"Print usage of shared spaces") \
\
product(bool, PrintSharedArchiveAndExit, false, \ product(bool, PrintSharedArchiveAndExit, false, \
"Print shared archive file contents") \ "Print shared archive file contents") \
\ \

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -62,7 +62,7 @@ public class XShareAuto {
pb = ProcessTools.createJavaProcessBuilder( pb = ProcessTools.createJavaProcessBuilder(
"-server", "-Xshare:auto", "-XX:+UnlockDiagnosticVMOptions", "-server", "-Xshare:auto", "-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=./XShareAuto.jsa", "-XX:+PrintSharedSpaces", "-version"); "-XX:SharedArchiveFile=./XShareAuto.jsa", "-Xlog:cds", "-version");
output = new OutputAnalyzer(pb.start()); output = new OutputAnalyzer(pb.start());
try { try {
output.shouldContain("sharing"); output.shouldContain("sharing");

View file

@ -48,6 +48,6 @@ public class DefaultUseWithClient {
} }
CDSTestUtils.createArchiveAndCheck(); CDSTestUtils.createArchiveAndCheck();
CDSTestUtils.runWithArchiveAndCheck("-client", "-XX:+PrintSharedSpaces"); CDSTestUtils.runWithArchiveAndCheck("-client", "-Xlog:cds");
} }
} }

View file

@ -52,7 +52,7 @@ public class SharedStrings {
"-XX:SharedArchiveFile=./SharedStrings.jsa", "-XX:SharedArchiveFile=./SharedStrings.jsa",
"-XX:+UseG1GC", "-XX:+UseG1GC",
"-XX:+UseCompressedOops", "-XX:+UseCompressedOops",
"-XX:+PrintSharedSpaces", "-Xlog:cds,cds+hashtables",
// Needed for bootclasspath match, for CDS to work with WhiteBox API // Needed for bootclasspath match, for CDS to work with WhiteBox API
"-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"), "-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"),
"-Xshare:dump"); "-Xshare:dump");