8171924: Use SIZE_FORMAT to print size_t values

Reviewed-by: dholmes, tschatzl, coleenp, goetz
This commit is contained in:
Arno Zeller 2016-12-22 16:51:25 +01:00 committed by Goetz Lindenmaier
parent 2d444d6f19
commit 43b7b1bd77
6 changed files with 14 additions and 13 deletions

View File

@ -149,16 +149,17 @@ void CodeCache::check_heap_sizes(size_t non_nmethod_size, size_t profiled_size,
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 @@ void CodeCache::initialize_heaps() {
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));
}

View File

@ -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 @@ protected:
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;

View File

@ -238,8 +238,8 @@ functionExit(JavaThread* thr)
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

View File

@ -1246,7 +1246,7 @@ static jvmtiError JNICALL
<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">

View File

@ -292,7 +292,7 @@ void JVMTIAgentLoadDCmd::execute(DCmdSource source, TRAPS) {
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;
}

View File

@ -214,7 +214,7 @@ private:
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);
}
}
};