8171924: Use SIZE_FORMAT to print size_t values.
Reviewed-by: dholmes, tschatzl, coleenp, goetz
Contributed-by: arno.zeller@sap.com
--- a/hotspot/src/share/vm/code/codeCache.cpp Thu Dec 22 17:26:02 2016 -0800
+++ b/hotspot/src/share/vm/code/codeCache.cpp Thu Dec 22 16:51:25 2016 +0100
@@ -149,16 +149,17 @@
size_t total_size = non_nmethod_size + profiled_size + non_profiled_size;
// Prepare error message
const char* error = "Invalid code heap sizes";
- err_msg message("NonNMethodCodeHeapSize (%zuK) + ProfiledCodeHeapSize (%zuK) + NonProfiledCodeHeapSize (%zuK) = %zuK",
+ err_msg message("NonNMethodCodeHeapSize (" SIZE_FORMAT "K) + ProfiledCodeHeapSize (" SIZE_FORMAT "K)"
+ " + NonProfiledCodeHeapSize (" SIZE_FORMAT "K) = " SIZE_FORMAT "K",
non_nmethod_size/K, profiled_size/K, non_profiled_size/K, total_size/K);
if (total_size > cache_size) {
// Some code heap sizes were explicitly set: total_size must be <= cache_size
- message.append(" is greater than ReservedCodeCacheSize (%zuK).", cache_size/K);
+ message.append(" is greater than ReservedCodeCacheSize (" SIZE_FORMAT "K).", cache_size/K);
vm_exit_during_initialization(error, message);
} else if (all_set && total_size != cache_size) {
// All code heap sizes were explicitly set: total_size must equal cache_size
- message.append(" is not equal to ReservedCodeCacheSize (%zuK).", cache_size/K);
+ message.append(" is not equal to ReservedCodeCacheSize (" SIZE_FORMAT "K).", cache_size/K);
vm_exit_during_initialization(error, message);
}
}
@@ -267,7 +268,7 @@
uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);
if (non_nmethod_size < (min_code_cache_size + code_buffers_size)) {
vm_exit_during_initialization(err_msg(
- "Not enough space in non-nmethod code heap to run VM: %zuK < %zuK",
+ "Not enough space in non-nmethod code heap to run VM: " SIZE_FORMAT "K < " SIZE_FORMAT "K",
non_nmethod_size/K, (min_code_cache_size + code_buffers_size)/K));
}
--- a/hotspot/src/share/vm/gc/g1/g1BiasedArray.hpp Thu Dec 22 17:26:02 2016 -0800
+++ b/hotspot/src/share/vm/gc/g1/g1BiasedArray.hpp Thu Dec 22 16:51:25 2016 +0100
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,12 +69,12 @@
void initialize(HeapWord* bottom, HeapWord* end, size_t target_elem_size_in_bytes, size_t mapping_granularity_in_bytes) {
assert(mapping_granularity_in_bytes > 0, "just checking");
assert(is_power_of_2(mapping_granularity_in_bytes),
- "mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes);
+ "mapping granularity must be power of 2, is " SIZE_FORMAT, mapping_granularity_in_bytes);
assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0,
- "bottom mapping area address must be a multiple of mapping granularity %zd, is " PTR_FORMAT,
+ "bottom mapping area address must be a multiple of mapping granularity " SIZE_FORMAT ", is " PTR_FORMAT,
mapping_granularity_in_bytes, p2i(bottom));
assert((uintptr_t)end % mapping_granularity_in_bytes == 0,
- "end mapping area address must be a multiple of mapping granularity %zd, is " PTR_FORMAT,
+ "end mapping area address must be a multiple of mapping granularity " SIZE_FORMAT ", is " PTR_FORMAT,
mapping_granularity_in_bytes, p2i(end));
size_t num_target_elems = pointer_delta(end, bottom, mapping_granularity_in_bytes);
idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes;
--- a/hotspot/src/share/vm/prims/jniCheck.cpp Thu Dec 22 17:26:02 2016 -0800
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp Thu Dec 22 16:51:25 2016 +0100
@@ -238,8 +238,8 @@
size_t live_handles = handles->get_number_of_live_handles();
if (live_handles > planned_capacity) {
IN_VM(
- tty->print_cr("WARNING: JNI local refs: %zu, exceeds capacity: %zu",
- live_handles, planned_capacity);
+ tty->print_cr("WARNING: JNI local refs: " SIZE_FORMAT ", exceeds capacity: " SIZE_FORMAT,
+ live_handles, planned_capacity);
thr->print_stack();
)
// Complain just the once, reset to current + warn threshold
--- a/hotspot/src/share/vm/prims/jvmtiEnter.xsl Thu Dec 22 17:26:02 2016 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiEnter.xsl Thu Dec 22 16:51:25 2016 +0100
@@ -1246,7 +1246,7 @@
<xsl:param name="name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$name"/>
- <xsl:text>=0x%zx</xsl:text>
+ <xsl:text>=" SIZE_FORMAT_HEX "</xsl:text>
</xsl:template>
<xsl:template match="jfloat|jdouble" mode="traceInFormat">
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp Thu Dec 22 17:26:02 2016 -0800
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp Thu Dec 22 16:51:25 2016 +0100
@@ -292,7 +292,7 @@
char *opt = (char *)os::malloc(opt_len, mtInternal);
if (opt == NULL) {
output()->print_cr("JVMTI agent attach failed: "
- "Could not allocate %zu bytes for argument.",
+ "Could not allocate " SIZE_FORMAT " bytes for argument.",
opt_len);
return;
}
--- a/hotspot/src/share/vm/utilities/copy.cpp Thu Dec 22 17:26:02 2016 -0800
+++ b/hotspot/src/share/vm/utilities/copy.cpp Thu Dec 22 16:51:25 2016 +0100
@@ -214,7 +214,7 @@
case 2: do_conjoint_swap<uint16_t,D>(src, dst, byte_count); break;
case 4: do_conjoint_swap<uint32_t,D>(src, dst, byte_count); break;
case 8: do_conjoint_swap<uint64_t,D>(src, dst, byte_count); break;
- default: guarantee(false, "do_conjoint_swap: Invalid elem_size %zd\n", elem_size);
+ default: guarantee(false, "do_conjoint_swap: Invalid elem_size " SIZE_FORMAT "\n", elem_size);
}
}
};