8039244: Don't use UINT32_FORMAT and INT32_FORMAT when printing uints and ints in the GC code

Reviewed-by: brutisso, tschatzl
This commit is contained in:
Stefan Karlsson 2014-04-04 09:46:10 +02:00
parent 034d486b08
commit 6583b826bb
10 changed files with 37 additions and 38 deletions

View File

@ -810,11 +810,11 @@ void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) {
const int limit = the_table()->table_size(); const int limit = the_table()->table_size();
assert(0 <= start_idx && start_idx <= limit, 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, 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, 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)); start_idx, end_idx));
for (int i = start_idx; i < end_idx; i += 1) { for (int i = start_idx; i < end_idx; i += 1) {
@ -833,11 +833,11 @@ void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClos
const int limit = the_table()->table_size(); const int limit = the_table()->table_size();
assert(0 <= start_idx && start_idx <= limit, 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, 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, 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)); start_idx, end_idx));
for (int i = start_idx; i < end_idx; ++i) { for (int i = start_idx; i < end_idx; ++i) {

View File

@ -567,8 +567,8 @@ ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs) :
_root_regions.init(_g1h, this); _root_regions.init(_g1h, this);
if (ConcGCThreads > ParallelGCThreads) { if (ConcGCThreads > ParallelGCThreads) {
warning("Can't have more ConcGCThreads (" UINT32_FORMAT ") " warning("Can't have more ConcGCThreads (" UINTX_FORMAT ") "
"than ParallelGCThreads (" UINT32_FORMAT ").", "than ParallelGCThreads (" UINTX_FORMAT ").",
ConcGCThreads, ParallelGCThreads); ConcGCThreads, ParallelGCThreads);
return; return;
} }

View File

@ -304,26 +304,26 @@ void G1BlockOffsetArray::check_all_cards(size_t start_card, size_t end_card) con
if (c - start_card > BlockOffsetArray::power_to_cards_back(1)) { if (c - start_card > BlockOffsetArray::power_to_cards_back(1)) {
guarantee(entry > N_words, guarantee(entry > N_words,
err_msg("Should be in logarithmic region - " err_msg("Should be in logarithmic region - "
"entry: " UINT32_FORMAT ", " "entry: %u, "
"_array->offset_array(c): " UINT32_FORMAT ", " "_array->offset_array(c): %u, "
"N_words: " UINT32_FORMAT, "N_words: %u",
entry, _array->offset_array(c), N_words)); (uint)entry, (uint)_array->offset_array(c), (uint)N_words));
} }
size_t backskip = BlockOffsetArray::entry_to_cards_back(entry); size_t backskip = BlockOffsetArray::entry_to_cards_back(entry);
size_t landing_card = c - backskip; size_t landing_card = c - backskip;
guarantee(landing_card >= (start_card - 1), "Inv"); guarantee(landing_card >= (start_card - 1), "Inv");
if (landing_card >= start_card) { if (landing_card >= start_card) {
guarantee(_array->offset_array(landing_card) <= entry, guarantee(_array->offset_array(landing_card) <= entry,
err_msg("Monotonicity - landing_card offset: " UINT32_FORMAT ", " err_msg("Monotonicity - landing_card offset: %u, "
"entry: " UINT32_FORMAT, "entry: %u",
_array->offset_array(landing_card), entry)); (uint)_array->offset_array(landing_card), (uint)entry));
} else { } else {
guarantee(landing_card == start_card - 1, "Tautology"); guarantee(landing_card == start_card - 1, "Tautology");
// Note that N_words is the maximum offset value // Note that N_words is the maximum offset value
guarantee(_array->offset_array(landing_card) <= N_words, guarantee(_array->offset_array(landing_card) <= N_words,
err_msg("landing card offset: " UINT32_FORMAT ", " err_msg("landing card offset: %u, "
"N_words: " UINT32_FORMAT, "N_words: %u",
_array->offset_array(landing_card), N_words)); (uint)_array->offset_array(landing_card), (uint)N_words));
} }
} }
} }
@ -554,21 +554,20 @@ void G1BlockOffsetArray::alloc_block_work2(HeapWord** threshold_, size_t* index_
(_array->offset_array(orig_index) > 0 && (_array->offset_array(orig_index) > 0 &&
_array->offset_array(orig_index) <= N_words), _array->offset_array(orig_index) <= N_words),
err_msg("offset array should have been set - " err_msg("offset array should have been set - "
"orig_index offset: " UINT32_FORMAT ", " "orig_index offset: %u, "
"blk_start: " PTR_FORMAT ", " "blk_start: " PTR_FORMAT ", "
"boundary: " PTR_FORMAT, "boundary: " PTR_FORMAT,
_array->offset_array(orig_index), (uint)_array->offset_array(orig_index),
blk_start, boundary)); blk_start, boundary));
for (size_t j = orig_index + 1; j <= end_index; j++) { for (size_t j = orig_index + 1; j <= end_index; j++) {
assert(_array->offset_array(j) > 0 && assert(_array->offset_array(j) > 0 &&
_array->offset_array(j) <= _array->offset_array(j) <=
(u_char) (N_words+BlockOffsetArray::N_powers-1), (u_char) (N_words+BlockOffsetArray::N_powers-1),
err_msg("offset array should have been set - " err_msg("offset array should have been set - "
UINT32_FORMAT " not > 0 OR " "%u not > 0 OR %u not <= %u",
UINT32_FORMAT " not <= " UINT32_FORMAT, (uint) _array->offset_array(j),
_array->offset_array(j), (uint) _array->offset_array(j),
_array->offset_array(j), (uint) (N_words+BlockOffsetArray::N_powers-1)));
(u_char) (N_words+BlockOffsetArray::N_powers-1)));
} }
#endif #endif
} }

View File

@ -146,8 +146,8 @@ private:
void check_offset(size_t offset, const char* msg) const { void check_offset(size_t offset, const char* msg) const {
assert(offset <= N_words, assert(offset <= N_words,
err_msg("%s - " err_msg("%s - "
"offset: " UINT32_FORMAT", N_words: " UINT32_FORMAT, "offset: " SIZE_FORMAT", N_words: %u",
msg, offset, N_words)); msg, offset, (uint)N_words));
} }
// Bounds checking accessors: // Bounds checking accessors:

View File

@ -5207,10 +5207,10 @@ public:
~G1StringSymbolTableUnlinkTask() { ~G1StringSymbolTableUnlinkTask() {
guarantee(!_process_strings || !_do_in_parallel || StringTable::parallel_claimed_index() >= _initial_string_table_size, 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)); StringTable::parallel_claimed_index(), _initial_string_table_size));
guarantee(!_process_symbols || !_do_in_parallel || SymbolTable::parallel_claimed_index() >= _initial_symbol_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)); SymbolTable::parallel_claimed_index(), _initial_symbol_table_size));
} }

View File

@ -147,7 +147,7 @@ template <class T>
void WorkerDataArray<T>::verify() { void WorkerDataArray<T>::verify() {
for (uint i = 0; i < _length; i++) { for (uint i = 0; i < _length; i++) {
assert(_data[i] != _uninitialized, 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)); i, (double)_data[i], (double)_uninitialized));
} }
} }
@ -247,7 +247,7 @@ void G1GCPhaseTimes::print_stats(int level, const char* str, double value) {
} }
void G1GCPhaseTimes::print_stats(int level, const char* str, double value, uint workers) { 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() { double G1GCPhaseTimes::accounted_time_ms() {

View File

@ -123,7 +123,7 @@ void G1HotCardCache::drain(uint worker_i,
// In this case worker_i should be the id of a GC worker thread // 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(SafepointSynchronize::is_at_safepoint(), "Should be at a safepoint");
assert(worker_i < (ParallelGCThreads == 0 ? 1 : ParallelGCThreads), 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); into_cset_dcq->enqueue(card_ptr);
} }

View File

@ -162,7 +162,7 @@ public:
void printCard(HeapRegion* card_region, size_t card_index, void printCard(HeapRegion* card_region, size_t card_index,
HeapWord* card_start) { 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: " "RS names card %p: "
"[" PTR_FORMAT ", " PTR_FORMAT ")", "[" PTR_FORMAT ", " PTR_FORMAT ")",
_worker_i, _worker_i,

View File

@ -390,7 +390,7 @@ void FromCardCache::shrink(uint new_num_regions) {
void FromCardCache::print(outputStream* out) { void FromCardCache::print(outputStream* out) {
for (uint i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) { for (uint i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) {
for (uint j = 0; j < _max_regions; j++) { 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)); i, j, at(i, j));
} }
} }
@ -430,7 +430,7 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift); int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);
if (G1TraceHeapRegionRememberedSet) { 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, hr()->bottom(), from_card,
FromCardCache::at((uint)tid, cur_hrs_ind)); FromCardCache::at((uint)tid, cur_hrs_ind));
} }
@ -859,7 +859,7 @@ uint HeapRegionRemSet::num_par_rem_sets() {
HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa,
HeapRegion* hr) HeapRegion* hr)
: _bosa(bosa), : _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) { _code_roots(), _other_regions(hr, &_m) {
reset_for_par_iteration(); reset_for_par_iteration();
} }

View File

@ -239,8 +239,8 @@ ParallelTaskTerminator::offer_termination(TerminatorTerminator* terminator) {
#ifdef TRACESPINNING #ifdef TRACESPINNING
void ParallelTaskTerminator::print_termination_counts() { void ParallelTaskTerminator::print_termination_counts() {
gclog_or_tty->print_cr("ParallelTaskTerminator Total yields: " UINT32_FORMAT gclog_or_tty->print_cr("ParallelTaskTerminator Total yields: %u"
" Total spins: " UINT32_FORMAT " Total peeks: " UINT32_FORMAT, " Total spins: %u Total peeks: %u",
total_yields(), total_yields(),
total_spins(), total_spins(),
total_peeks()); total_peeks());