--- old/src/share/vm/memory/filemap.cpp 2017-05-31 15:52:13.788224937 -0400 +++ new/src/share/vm/memory/filemap.cpp 2017-05-31 15:52:13.336224952 -0400 @@ -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. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ #if INCLUDE_ALL_GCS #include "gc/g1/g1CollectedHeap.hpp" #endif +#include "logging/log.hpp" +#include "logging/logMessage.hpp" #include "memory/filemap.hpp" #include "memory/metadataFactory.hpp" #include "memory/oopFactory.hpp" @@ -98,9 +100,11 @@ if (RequireSharedSpaces) { fail(msg, ap); } else { - if (PrintSharedSpaces) { - tty->print("UseSharedSpaces: "); - tty->vprint_cr(msg, ap); + if (log_is_enabled(Info, cds)) { + ResourceMark rm; + outputStream* logstream = Log(cds)::info_stream(); + logstream->print("UseSharedSpaces: "); + logstream->vprint_cr(msg, ap); } } UseSharedSpaces = false; @@ -418,9 +422,13 @@ void FileMapInfo::open_for_write() { _full_path = Arguments::GetSharedArchivePath(); - if (PrintSharedSpaces) { - tty->print_cr("Dumping shared data to file: "); - tty->print_cr(" %s", _full_path); + if (log_is_enabled(Info, cds)) { + ResourceMark rm; + 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. @@ -477,10 +485,9 @@ if (_file_open) { guarantee(si->_file_offset == _file_offset, "file offset mismatch."); - if (PrintSharedSpaces) { - tty->print_cr("Shared file region %d: " SIZE_FORMAT_HEX_W(6) " bytes, addr " INTPTR_FORMAT - " file offset " SIZE_FORMAT_HEX_W(6), region, size, p2i(base), _file_offset); - } + log_info(cds)("Shared file region %d: " SIZE_FORMAT_HEX_W(6) + " bytes, addr " INTPTR_FORMAT " file offset " SIZE_FORMAT_HEX_W(6), + region, size, p2i(base), _file_offset); } else { si->_file_offset = _file_offset; } @@ -691,11 +698,11 @@ narrow_oop_shift() != Universe::narrow_oop_shift() || narrow_klass_base() != Universe::narrow_klass_base() || narrow_klass_shift() != Universe::narrow_klass_shift()) { - if (PrintSharedSpaces && _header->_space[MetaspaceShared::first_string]._used > 0) { - tty->print_cr("Shared string data from the CDS archive is being ignored. " - "The current CompressedOops/CompressedClassPointers encoding differs from " - "that archived due to heap size change. The archive was dumped using max heap " - "size " UINTX_FORMAT "M.", max_heap_size()/M); + if (log_is_enabled(Info, cds) && _header->_space[MetaspaceShared::first_string]._used > 0) { + log_info(cds)("Shared string data from the CDS archive is being ignored. " + "The current CompressedOops/CompressedClassPointers encoding differs from " + "that archived due to heap size change. The archive was dumped using max heap " + "size " UINTX_FORMAT "M.", max_heap_size()/M); } } else { string_ranges = new MemRegion[MetaspaceShared::max_strings]; @@ -761,8 +768,8 @@ return true; } } else { - if (PrintSharedSpaces && _header->_space[MetaspaceShared::first_string]._used > 0) { - tty->print_cr("Shared string data from the CDS archive is being ignored. UseG1GC, " + if (log_is_enabled(Info, cds) && _header->_space[MetaspaceShared::first_string]._used > 0) { + log_info(cds)("Shared string data from the CDS archive is being ignored. UseG1GC, " "UseCompressedOops and UseCompressedClassPointers are required."); } }