8039244: Don't use UINT32_FORMAT and INT32_FORMAT when printing uints and ints in the GC code
Reviewed-by: brutisso, tschatzl
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp Thu Apr 03 16:20:16 2014 +0200
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp Fri Apr 04 09:46:10 2014 +0200
@@ -810,11 +810,11 @@
const int limit = the_table()->table_size();
assert(0 <= start_idx && start_idx <= limit,
- err_msg("start_idx (" INT32_FORMAT ") is out of bounds", start_idx));
+ err_msg("start_idx (%d) is out of bounds", start_idx));
assert(0 <= end_idx && end_idx <= limit,
- err_msg("end_idx (" INT32_FORMAT ") is out of bounds", end_idx));
+ err_msg("end_idx (%d) is out of bounds", end_idx));
assert(start_idx <= end_idx,
- err_msg("Index ordering: start_idx=" INT32_FORMAT", end_idx=" INT32_FORMAT,
+ err_msg("Index ordering: start_idx=%d, end_idx=%d",
start_idx, end_idx));
for (int i = start_idx; i < end_idx; i += 1) {
@@ -833,11 +833,11 @@
const int limit = the_table()->table_size();
assert(0 <= start_idx && start_idx <= limit,
- err_msg("start_idx (" INT32_FORMAT ") is out of bounds", start_idx));
+ err_msg("start_idx (%d) is out of bounds", start_idx));
assert(0 <= end_idx && end_idx <= limit,
- err_msg("end_idx (" INT32_FORMAT ") is out of bounds", end_idx));
+ err_msg("end_idx (%d) is out of bounds", end_idx));
assert(start_idx <= end_idx,
- err_msg("Index ordering: start_idx=" INT32_FORMAT", end_idx=" INT32_FORMAT,
+ err_msg("Index ordering: start_idx=%d, end_idx=%d",
start_idx, end_idx));
for (int i = start_idx; i < end_idx; ++i) {
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Thu Apr 03 16:20:16 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Fri Apr 04 09:46:10 2014 +0200
@@ -567,8 +567,8 @@
_root_regions.init(_g1h, this);
if (ConcGCThreads > ParallelGCThreads) {
- warning("Can't have more ConcGCThreads (" UINT32_FORMAT ") "
- "than ParallelGCThreads (" UINT32_FORMAT ").",
+ warning("Can't have more ConcGCThreads (" UINTX_FORMAT ") "
+ "than ParallelGCThreads (" UINTX_FORMAT ").",
ConcGCThreads, ParallelGCThreads);
return;
}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp Thu Apr 03 16:20:16 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp Fri Apr 04 09:46:10 2014 +0200
@@ -304,26 +304,26 @@
if (c - start_card > BlockOffsetArray::power_to_cards_back(1)) {
guarantee(entry > N_words,
err_msg("Should be in logarithmic region - "
- "entry: " UINT32_FORMAT ", "
- "_array->offset_array(c): " UINT32_FORMAT ", "
- "N_words: " UINT32_FORMAT,
- entry, _array->offset_array(c), N_words));
+ "entry: %u, "
+ "_array->offset_array(c): %u, "
+ "N_words: %u",
+ (uint)entry, (uint)_array->offset_array(c), (uint)N_words));
}
size_t backskip = BlockOffsetArray::entry_to_cards_back(entry);
size_t landing_card = c - backskip;
guarantee(landing_card >= (start_card - 1), "Inv");
if (landing_card >= start_card) {
guarantee(_array->offset_array(landing_card) <= entry,
- err_msg("Monotonicity - landing_card offset: " UINT32_FORMAT ", "
- "entry: " UINT32_FORMAT,
- _array->offset_array(landing_card), entry));
+ err_msg("Monotonicity - landing_card offset: %u, "
+ "entry: %u",
+ (uint)_array->offset_array(landing_card), (uint)entry));
} else {
guarantee(landing_card == start_card - 1, "Tautology");
// Note that N_words is the maximum offset value
guarantee(_array->offset_array(landing_card) <= N_words,
- err_msg("landing card offset: " UINT32_FORMAT ", "
- "N_words: " UINT32_FORMAT,
- _array->offset_array(landing_card), N_words));
+ err_msg("landing card offset: %u, "
+ "N_words: %u",
+ (uint)_array->offset_array(landing_card), (uint)N_words));
}
}
}
@@ -554,21 +554,20 @@
(_array->offset_array(orig_index) > 0 &&
_array->offset_array(orig_index) <= N_words),
err_msg("offset array should have been set - "
- "orig_index offset: " UINT32_FORMAT ", "
+ "orig_index offset: %u, "
"blk_start: " PTR_FORMAT ", "
"boundary: " PTR_FORMAT,
- _array->offset_array(orig_index),
+ (uint)_array->offset_array(orig_index),
blk_start, boundary));
for (size_t j = orig_index + 1; j <= end_index; j++) {
assert(_array->offset_array(j) > 0 &&
_array->offset_array(j) <=
(u_char) (N_words+BlockOffsetArray::N_powers-1),
err_msg("offset array should have been set - "
- UINT32_FORMAT " not > 0 OR "
- UINT32_FORMAT " not <= " UINT32_FORMAT,
- _array->offset_array(j),
- _array->offset_array(j),
- (u_char) (N_words+BlockOffsetArray::N_powers-1)));
+ "%u not > 0 OR %u not <= %u",
+ (uint) _array->offset_array(j),
+ (uint) _array->offset_array(j),
+ (uint) (N_words+BlockOffsetArray::N_powers-1)));
}
#endif
}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp Thu Apr 03 16:20:16 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp Fri Apr 04 09:46:10 2014 +0200
@@ -146,8 +146,8 @@
void check_offset(size_t offset, const char* msg) const {
assert(offset <= N_words,
err_msg("%s - "
- "offset: " UINT32_FORMAT", N_words: " UINT32_FORMAT,
- msg, offset, N_words));
+ "offset: " SIZE_FORMAT", N_words: %u",
+ msg, offset, (uint)N_words));
}
// Bounds checking accessors:
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Apr 03 16:20:16 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Apr 04 09:46:10 2014 +0200
@@ -5207,10 +5207,10 @@
~G1StringSymbolTableUnlinkTask() {
guarantee(!_process_strings || !_do_in_parallel || StringTable::parallel_claimed_index() >= _initial_string_table_size,
- err_msg("claim value "INT32_FORMAT" after unlink less than initial string table size "INT32_FORMAT,
+ err_msg("claim value %d after unlink less than initial string table size %d",
StringTable::parallel_claimed_index(), _initial_string_table_size));
guarantee(!_process_symbols || !_do_in_parallel || SymbolTable::parallel_claimed_index() >= _initial_symbol_table_size,
- err_msg("claim value "INT32_FORMAT" after unlink less than initial symbol table size "INT32_FORMAT,
+ err_msg("claim value %d after unlink less than initial symbol table size %d",
SymbolTable::parallel_claimed_index(), _initial_symbol_table_size));
}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp Thu Apr 03 16:20:16 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp Fri Apr 04 09:46:10 2014 +0200
@@ -147,7 +147,7 @@
void WorkerDataArray<T>::verify() {
for (uint i = 0; i < _length; i++) {
assert(_data[i] != _uninitialized,
- err_msg("Invalid data for worker " UINT32_FORMAT ", data: %lf, uninitialized: %lf",
+ err_msg("Invalid data for worker %u, data: %lf, uninitialized: %lf",
i, (double)_data[i], (double)_uninitialized));
}
}
@@ -247,7 +247,7 @@
}
void G1GCPhaseTimes::print_stats(int level, const char* str, double value, uint workers) {
- LineBuffer(level).append_and_print_cr("[%s: %.1lf ms, GC Workers: " UINT32_FORMAT "]", str, value, workers);
+ LineBuffer(level).append_and_print_cr("[%s: %.1lf ms, GC Workers: %u]", str, value, workers);
}
double G1GCPhaseTimes::accounted_time_ms() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp Thu Apr 03 16:20:16 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp Fri Apr 04 09:46:10 2014 +0200
@@ -123,7 +123,7 @@
// In this case worker_i should be the id of a GC worker thread
assert(SafepointSynchronize::is_at_safepoint(), "Should be at a safepoint");
assert(worker_i < (ParallelGCThreads == 0 ? 1 : ParallelGCThreads),
- err_msg("incorrect worker id: "UINT32_FORMAT, worker_i));
+ err_msg("incorrect worker id: %u", worker_i));
into_cset_dcq->enqueue(card_ptr);
}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp Thu Apr 03 16:20:16 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp Fri Apr 04 09:46:10 2014 +0200
@@ -162,7 +162,7 @@
void printCard(HeapRegion* card_region, size_t card_index,
HeapWord* card_start) {
- gclog_or_tty->print_cr("T " UINT32_FORMAT " Region [" PTR_FORMAT ", " PTR_FORMAT ") "
+ gclog_or_tty->print_cr("T %u Region [" PTR_FORMAT ", " PTR_FORMAT ") "
"RS names card %p: "
"[" PTR_FORMAT ", " PTR_FORMAT ")",
_worker_i,
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Thu Apr 03 16:20:16 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Fri Apr 04 09:46:10 2014 +0200
@@ -390,7 +390,7 @@
void FromCardCache::print(outputStream* out) {
for (uint i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) {
for (uint j = 0; j < _max_regions; j++) {
- out->print_cr("_from_card_cache["UINT32_FORMAT"]["UINT32_FORMAT"] = "INT32_FORMAT".",
+ out->print_cr("_from_card_cache[%u][%u] = %d.",
i, j, at(i, j));
}
}
@@ -430,7 +430,7 @@
int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);
if (G1TraceHeapRegionRememberedSet) {
- gclog_or_tty->print_cr("Table for [" PTR_FORMAT "...): card %d (cache = "INT32_FORMAT")",
+ gclog_or_tty->print_cr("Table for [" PTR_FORMAT "...): card %d (cache = %d)",
hr()->bottom(), from_card,
FromCardCache::at((uint)tid, cur_hrs_ind));
}
@@ -859,7 +859,7 @@
HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa,
HeapRegion* hr)
: _bosa(bosa),
- _m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #"UINT32_FORMAT, hr->hrs_index()), true),
+ _m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrs_index()), true),
_code_roots(), _other_regions(hr, &_m) {
reset_for_par_iteration();
}
--- a/hotspot/src/share/vm/utilities/taskqueue.cpp Thu Apr 03 16:20:16 2014 +0200
+++ b/hotspot/src/share/vm/utilities/taskqueue.cpp Fri Apr 04 09:46:10 2014 +0200
@@ -239,8 +239,8 @@
#ifdef TRACESPINNING
void ParallelTaskTerminator::print_termination_counts() {
- gclog_or_tty->print_cr("ParallelTaskTerminator Total yields: " UINT32_FORMAT
- " Total spins: " UINT32_FORMAT " Total peeks: " UINT32_FORMAT,
+ gclog_or_tty->print_cr("ParallelTaskTerminator Total yields: %u"
+ " Total spins: %u Total peeks: %u",
total_yields(),
total_spins(),
total_peeks());