8152896: Convert PrintCompressedOopsMode to Unified Logging
Converted -XX:+PrintCompressedOopsMode to -Xlog:gc+heap+coops and aliased old option Reviewed-by: coleenp, sjohanss, kvn, hseigel
This commit is contained in:
parent
efb6b67d27
commit
02d268d760
@ -48,6 +48,7 @@
|
|||||||
LOG_TAG(classpath) \
|
LOG_TAG(classpath) \
|
||||||
LOG_TAG(compaction) \
|
LOG_TAG(compaction) \
|
||||||
LOG_TAG(constraints) \
|
LOG_TAG(constraints) \
|
||||||
|
LOG_TAG(coops) \
|
||||||
LOG_TAG(cpu) \
|
LOG_TAG(cpu) \
|
||||||
LOG_TAG(cset) \
|
LOG_TAG(cset) \
|
||||||
LOG_TAG(defaultmethods) \
|
LOG_TAG(defaultmethods) \
|
||||||
|
@ -747,8 +747,10 @@ jint Universe::initialize_heap() {
|
|||||||
|
|
||||||
Universe::set_narrow_ptrs_base(Universe::narrow_oop_base());
|
Universe::set_narrow_ptrs_base(Universe::narrow_oop_base());
|
||||||
|
|
||||||
if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
|
if (log_is_enabled(Info, gc, heap, coops)) {
|
||||||
Universe::print_compressed_oops_mode(tty);
|
ResourceMark rm;
|
||||||
|
outputStream* logst = Log(gc, heap, coops)::info_stream();
|
||||||
|
Universe::print_compressed_oops_mode(logst);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell tests in which mode we run.
|
// Tell tests in which mode we run.
|
||||||
@ -776,8 +778,8 @@ jint Universe::initialize_heap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Universe::print_compressed_oops_mode(outputStream* st) {
|
void Universe::print_compressed_oops_mode(outputStream* st) {
|
||||||
st->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB",
|
st->print("Heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB",
|
||||||
p2i(Universe::heap()->base()), Universe::heap()->reserved_region().byte_size()/M);
|
p2i(Universe::heap()->base()), Universe::heap()->reserved_region().byte_size()/M);
|
||||||
|
|
||||||
st->print(", Compressed Oops mode: %s", narrow_oop_mode_to_string(narrow_oop_mode()));
|
st->print(", Compressed Oops mode: %s", narrow_oop_mode_to_string(narrow_oop_mode()));
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "code/codeCacheExtensions.hpp"
|
#include "code/codeCacheExtensions.hpp"
|
||||||
|
#include "logging/log.hpp"
|
||||||
|
#include "memory/resourceArea.hpp"
|
||||||
#include "memory/virtualspace.hpp"
|
#include "memory/virtualspace.hpp"
|
||||||
#include "oops/markOop.hpp"
|
#include "oops/markOop.hpp"
|
||||||
#include "oops/oop.inline.hpp"
|
#include "oops/oop.inline.hpp"
|
||||||
@ -78,10 +80,7 @@ static bool failed_to_reserve_as_requested(char* base, char* requested_address,
|
|||||||
// Different reserve address may be acceptable in other cases
|
// Different reserve address may be acceptable in other cases
|
||||||
// but for compressed oops heap should be at requested address.
|
// but for compressed oops heap should be at requested address.
|
||||||
assert(UseCompressedOops, "currently requested address used only for compressed oops");
|
assert(UseCompressedOops, "currently requested address used only for compressed oops");
|
||||||
if (PrintCompressedOopsMode) {
|
log_debug(gc, heap, coops)("Reserved memory not at requested address: " PTR_FORMAT " vs " PTR_FORMAT, p2i(base), p2i(requested_address));
|
||||||
tty->cr();
|
|
||||||
tty->print_cr("Reserved memory not at requested address: " PTR_FORMAT " vs " PTR_FORMAT, p2i(base), p2i(requested_address));
|
|
||||||
}
|
|
||||||
// OS ignored requested address. Try different address.
|
// OS ignored requested address. Try different address.
|
||||||
if (special) {
|
if (special) {
|
||||||
if (!os::release_memory_special(base, size)) {
|
if (!os::release_memory_special(base, size)) {
|
||||||
@ -143,10 +142,7 @@ void ReservedSpace::initialize(size_t size, size_t alignment, bool large,
|
|||||||
// failed; try to reserve regular memory below
|
// failed; try to reserve regular memory below
|
||||||
if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) ||
|
if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) ||
|
||||||
!FLAG_IS_DEFAULT(LargePageSizeInBytes))) {
|
!FLAG_IS_DEFAULT(LargePageSizeInBytes))) {
|
||||||
if (PrintCompressedOopsMode) {
|
log_debug(gc, heap, coops)("Reserve regular memory without large pages");
|
||||||
tty->cr();
|
|
||||||
tty->print_cr("Reserve regular memory without large pages.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,11 +282,10 @@ void ReservedHeapSpace::establish_noaccess_prefix() {
|
|||||||
if (!os::protect_memory(_base, _noaccess_prefix, os::MEM_PROT_NONE, _special)) {
|
if (!os::protect_memory(_base, _noaccess_prefix, os::MEM_PROT_NONE, _special)) {
|
||||||
fatal("cannot protect protection page");
|
fatal("cannot protect protection page");
|
||||||
}
|
}
|
||||||
if (PrintCompressedOopsMode) {
|
log_debug(gc, heap, coops)("Protected page at the reserved heap base: "
|
||||||
tty->cr();
|
PTR_FORMAT " / " INTX_FORMAT " bytes",
|
||||||
tty->print_cr("Protected page at the reserved heap base: "
|
p2i(_base),
|
||||||
PTR_FORMAT " / " INTX_FORMAT " bytes", p2i(_base), _noaccess_prefix);
|
_noaccess_prefix);
|
||||||
}
|
|
||||||
assert(Universe::narrow_oop_use_implicit_null_checks() == true, "not initialized?");
|
assert(Universe::narrow_oop_use_implicit_null_checks() == true, "not initialized?");
|
||||||
} else {
|
} else {
|
||||||
Universe::set_narrow_oop_use_implicit_null_checks(false);
|
Universe::set_narrow_oop_use_implicit_null_checks(false);
|
||||||
@ -321,10 +316,10 @@ void ReservedHeapSpace::try_reserve_heap(size_t size,
|
|||||||
bool special = large && !os::can_commit_large_page_memory();
|
bool special = large && !os::can_commit_large_page_memory();
|
||||||
char* base = NULL;
|
char* base = NULL;
|
||||||
|
|
||||||
if (PrintCompressedOopsMode && Verbose) {
|
log_trace(gc, heap, coops)("Trying to allocate at address " PTR_FORMAT
|
||||||
tty->print("Trying to allocate at address " PTR_FORMAT " heap of size " SIZE_FORMAT_HEX ".\n",
|
" heap of size " SIZE_FORMAT_HEX,
|
||||||
p2i(requested_address), size);
|
p2i(requested_address),
|
||||||
}
|
size);
|
||||||
|
|
||||||
if (special) {
|
if (special) {
|
||||||
base = os::reserve_memory_special(size, alignment, requested_address, false);
|
base = os::reserve_memory_special(size, alignment, requested_address, false);
|
||||||
@ -343,10 +338,7 @@ void ReservedHeapSpace::try_reserve_heap(size_t size,
|
|||||||
// Failed; try to reserve regular memory below
|
// Failed; try to reserve regular memory below
|
||||||
if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) ||
|
if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) ||
|
||||||
!FLAG_IS_DEFAULT(LargePageSizeInBytes))) {
|
!FLAG_IS_DEFAULT(LargePageSizeInBytes))) {
|
||||||
if (PrintCompressedOopsMode) {
|
log_debug(gc, heap, coops)("Reserve regular memory without large pages");
|
||||||
tty->cr();
|
|
||||||
tty->print_cr("Reserve regular memory without large pages.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optimistically assume that the OSes returns an aligned base pointer.
|
// Optimistically assume that the OSes returns an aligned base pointer.
|
||||||
@ -558,9 +550,7 @@ void ReservedHeapSpace::initialize_compressed_heap(const size_t size, size_t ali
|
|||||||
|
|
||||||
// Last, desperate try without any placement.
|
// Last, desperate try without any placement.
|
||||||
if (_base == NULL) {
|
if (_base == NULL) {
|
||||||
if (PrintCompressedOopsMode && Verbose) {
|
log_trace(gc, heap, coops)("Trying to allocate at address NULL heap of size " SIZE_FORMAT_HEX, size + noaccess_prefix);
|
||||||
tty->print("Trying to allocate at address NULL heap of size " SIZE_FORMAT_HEX ".\n", size + noaccess_prefix);
|
|
||||||
}
|
|
||||||
initialize(size + noaccess_prefix, alignment, large, NULL, false);
|
initialize(size + noaccess_prefix, alignment, large, NULL, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,9 @@ static AliasedFlag const aliased_jvm_flags[] = {
|
|||||||
{ NULL, NULL}
|
{ NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 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) },
|
||||||
{ "TraceBiasedLocking", LogLevel::Info, true, LOG_TAGS(biasedlocking) },
|
{ "TraceBiasedLocking", LogLevel::Info, true, LOG_TAGS(biasedlocking) },
|
||||||
{ "TraceClassLoading", LogLevel::Info, true, LOG_TAGS(classload) },
|
{ "TraceClassLoading", LogLevel::Info, true, LOG_TAGS(classload) },
|
||||||
{ "TraceClassLoadingPreorder", LogLevel::Debug, true, LOG_TAGS(classload, preorder) },
|
{ "TraceClassLoadingPreorder", LogLevel::Debug, true, LOG_TAGS(classload, preorder) },
|
||||||
@ -2184,15 +2186,11 @@ void Arguments::set_heap_size() {
|
|||||||
if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) {
|
if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) {
|
||||||
if (HeapBaseMinAddress < DefaultHeapBaseMinAddress) {
|
if (HeapBaseMinAddress < DefaultHeapBaseMinAddress) {
|
||||||
// matches compressed oops printing flags
|
// matches compressed oops printing flags
|
||||||
if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
|
log_debug(gc, heap, coops)("HeapBaseMinAddress must be at least " SIZE_FORMAT
|
||||||
jio_fprintf(defaultStream::error_stream(),
|
" (" SIZE_FORMAT "G) which is greater than value given " SIZE_FORMAT,
|
||||||
"HeapBaseMinAddress must be at least " SIZE_FORMAT
|
DefaultHeapBaseMinAddress,
|
||||||
" (" SIZE_FORMAT "G) which is greater than value given "
|
DefaultHeapBaseMinAddress/G,
|
||||||
SIZE_FORMAT "\n",
|
HeapBaseMinAddress);
|
||||||
DefaultHeapBaseMinAddress,
|
|
||||||
DefaultHeapBaseMinAddress/G,
|
|
||||||
HeapBaseMinAddress);
|
|
||||||
}
|
|
||||||
FLAG_SET_ERGO(size_t, HeapBaseMinAddress, DefaultHeapBaseMinAddress);
|
FLAG_SET_ERGO(size_t, HeapBaseMinAddress, DefaultHeapBaseMinAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -641,9 +641,6 @@ public:
|
|||||||
"region.") \
|
"region.") \
|
||||||
range(1, max_uintx) \
|
range(1, max_uintx) \
|
||||||
\
|
\
|
||||||
diagnostic(bool, PrintCompressedOopsMode, false, \
|
|
||||||
"Print compressed oops base address and encoding mode") \
|
|
||||||
\
|
|
||||||
lp64_product(intx, ObjectAlignmentInBytes, 8, \
|
lp64_product(intx, ObjectAlignmentInBytes, 8, \
|
||||||
"Default object alignment in bytes, 8 is minimum") \
|
"Default object alignment in bytes, 8 is minimum") \
|
||||||
range(8, 256) \
|
range(8, 256) \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2016, 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
|
||||||
@ -85,8 +85,7 @@ public class CompressedClassPointers {
|
|||||||
public static void heapBaseMinAddressTest() throws Exception {
|
public static void heapBaseMinAddressTest() throws Exception {
|
||||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||||
"-XX:HeapBaseMinAddress=1m",
|
"-XX:HeapBaseMinAddress=1m",
|
||||||
"-XX:+UnlockDiagnosticVMOptions",
|
"-Xlog:gc+heap+coops=debug",
|
||||||
"-XX:+PrintCompressedOopsMode",
|
|
||||||
"-version");
|
"-version");
|
||||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
output.shouldContain("HeapBaseMinAddress must be at least");
|
output.shouldContain("HeapBaseMinAddress must be at least");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2016, 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
|
||||||
@ -169,7 +169,6 @@ public class UseCompressedOops {
|
|||||||
ArrayList<String> args = new ArrayList<>();
|
ArrayList<String> args = new ArrayList<>();
|
||||||
|
|
||||||
// Always run with these three:
|
// Always run with these three:
|
||||||
args.add("-XX:+UnlockDiagnosticVMOptions");
|
|
||||||
args.add("-XX:+PrintCompressedOopsMode");
|
args.add("-XX:+PrintCompressedOopsMode");
|
||||||
args.add("-Xms32m");
|
args.add("-Xms32m");
|
||||||
|
|
||||||
|
82
hotspot/test/runtime/logging/CompressedOopsTest.java
Normal file
82
hotspot/test/runtime/logging/CompressedOopsTest.java
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, 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
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8149991
|
||||||
|
* @requires (sun.arch.data.model == "64")
|
||||||
|
* @summary -Xlog:gc+heap+coops=info should have output from the code
|
||||||
|
* @library /testlibrary
|
||||||
|
* @modules java.base/sun.misc
|
||||||
|
* java.management
|
||||||
|
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools
|
||||||
|
* @run driver CompressedOopsTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
import jdk.test.lib.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
|
import jdk.test.lib.ProcessTools;
|
||||||
|
|
||||||
|
public class CompressedOopsTest {
|
||||||
|
static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
|
||||||
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
|
output.shouldContain("[gc,heap,coops] Heap address");
|
||||||
|
output.shouldHaveExitValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void analyzeOutputOff(ProcessBuilder pb) throws Exception {
|
||||||
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
|
output.shouldNotContain("[gc,heap,coops]");
|
||||||
|
output.shouldHaveExitValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseCompressedOops",
|
||||||
|
"-Xlog:gc+heap+coops=info",
|
||||||
|
InnerClass.class.getName());
|
||||||
|
analyzeOutputOn(pb);
|
||||||
|
|
||||||
|
pb = ProcessTools.createJavaProcessBuilder("-XX:+UseCompressedOops",
|
||||||
|
"-XX:+PrintCompressedOopsMode",
|
||||||
|
InnerClass.class.getName());
|
||||||
|
analyzeOutputOn(pb);
|
||||||
|
|
||||||
|
pb = ProcessTools.createJavaProcessBuilder("-XX:+UseCompressedOops",
|
||||||
|
"-XX:+PrintCompressedOopsMode",
|
||||||
|
"-Xlog:gc+heap+coops=off",
|
||||||
|
InnerClass.class.getName());
|
||||||
|
analyzeOutputOff(pb);
|
||||||
|
|
||||||
|
pb = ProcessTools.createJavaProcessBuilder("-XX:+UseCompressedOops",
|
||||||
|
"-Xlog:gc+heap+coops=info",
|
||||||
|
"-XX:-PrintCompressedOopsMode",
|
||||||
|
InnerClass.class.getName());
|
||||||
|
analyzeOutputOff(pb);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class InnerClass {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
System.out.println("Compressed Oops (gc+heap+coops) test");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user