8042891: Format issues embedded in macros for two g1 source files

Reviewed-by: brutisso, tschatzl
This commit is contained in:
Stefan Karlsson 2015-04-20 13:34:04 +02:00
parent e4a699552a
commit be6e9b9f50
3 changed files with 67 additions and 75 deletions

View file

@ -22,11 +22,6 @@
* *
*/ */
#if !defined(__clang_major__) && defined(__GNUC__)
// FIXME, formats have issues. Disable this macro definition, compile, and study warnings for more information.
#define ATTRIBUTE_PRINTF(x,y)
#endif
#include "precompiled.hpp" #include "precompiled.hpp"
#include "classfile/metadataOnStackMark.hpp" #include "classfile/metadataOnStackMark.hpp"
#include "classfile/stringTable.hpp" #include "classfile/stringTable.hpp"
@ -201,7 +196,7 @@ bool YoungList::check_list_well_formed() {
if (!curr->is_young()) { if (!curr->is_young()) {
gclog_or_tty->print_cr("### YOUNG REGION "PTR_FORMAT"-"PTR_FORMAT" " gclog_or_tty->print_cr("### YOUNG REGION "PTR_FORMAT"-"PTR_FORMAT" "
"incorrectly tagged (y: %d, surv: %d)", "incorrectly tagged (y: %d, surv: %d)",
curr->bottom(), curr->end(), p2i(curr->bottom()), p2i(curr->end()),
curr->is_young(), curr->is_survivor()); curr->is_young(), curr->is_survivor());
ret = false; ret = false;
} }
@ -330,8 +325,8 @@ void YoungList::print() {
while (curr != NULL) { while (curr != NULL) {
gclog_or_tty->print_cr(" "HR_FORMAT", P: "PTR_FORMAT ", N: "PTR_FORMAT", age: %4d", gclog_or_tty->print_cr(" "HR_FORMAT", P: "PTR_FORMAT ", N: "PTR_FORMAT", age: %4d",
HR_FORMAT_PARAMS(curr), HR_FORMAT_PARAMS(curr),
curr->prev_top_at_mark_start(), p2i(curr->prev_top_at_mark_start()),
curr->next_top_at_mark_start(), p2i(curr->next_top_at_mark_start()),
curr->age_in_surv_rate_group_cond()); curr->age_in_surv_rate_group_cond());
curr = curr->get_next_young_region(); curr = curr->get_next_young_region();
} }
@ -2752,9 +2747,9 @@ public:
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
if (_g1h->is_obj_dead_cond(obj, _vo)) { if (_g1h->is_obj_dead_cond(obj, _vo)) {
gclog_or_tty->print_cr("Root location "PTR_FORMAT" " gclog_or_tty->print_cr("Root location "PTR_FORMAT" "
"points to dead obj "PTR_FORMAT, p, (void*) obj); "points to dead obj "PTR_FORMAT, p2i(p), p2i(obj));
if (_vo == VerifyOption_G1UseMarkWord) { if (_vo == VerifyOption_G1UseMarkWord) {
gclog_or_tty->print_cr(" Mark word: "PTR_FORMAT, (void*)(obj->mark())); gclog_or_tty->print_cr(" Mark word: "INTPTR_FORMAT, (intptr_t)obj->mark());
} }
obj->print_on(gclog_or_tty); obj->print_on(gclog_or_tty);
_failures = true; _failures = true;
@ -2804,7 +2799,7 @@ class G1VerifyCodeRootOopClosure: public OopClosure {
gclog_or_tty->print_cr("Code root location "PTR_FORMAT" " gclog_or_tty->print_cr("Code root location "PTR_FORMAT" "
"from nmethod "PTR_FORMAT" not in strong " "from nmethod "PTR_FORMAT" not in strong "
"code roots for region ["PTR_FORMAT","PTR_FORMAT")", "code roots for region ["PTR_FORMAT","PTR_FORMAT")",
p, _nm, hr->bottom(), hr->end()); p2i(p), p2i(_nm), p2i(hr->bottom()), p2i(hr->end()));
_failures = true; _failures = true;
} }
} }
@ -2860,7 +2855,7 @@ class VerifyKlassClosure: public KlassClosure {
_young_ref_counter_closure.reset_count(); _young_ref_counter_closure.reset_count();
k->oops_do(&_young_ref_counter_closure); k->oops_do(&_young_ref_counter_closure);
if (_young_ref_counter_closure.count() > 0) { if (_young_ref_counter_closure.count() > 0) {
guarantee(k->has_modified_oops(), err_msg("Klass " PTR_FORMAT ", has young refs but is not dirty.", k)); guarantee(k->has_modified_oops(), err_msg("Klass " PTR_FORMAT ", has young refs but is not dirty.", p2i(k)));
} }
} }
}; };
@ -2953,7 +2948,7 @@ public:
gclog_or_tty->print_cr("["PTR_FORMAT","PTR_FORMAT"] " gclog_or_tty->print_cr("["PTR_FORMAT","PTR_FORMAT"] "
"max_live_bytes "SIZE_FORMAT" " "max_live_bytes "SIZE_FORMAT" "
"< calculated "SIZE_FORMAT, "< calculated "SIZE_FORMAT,
r->bottom(), r->end(), p2i(r->bottom()), p2i(r->end()),
r->max_live_bytes(), r->max_live_bytes(),
not_dead_yet_cl.live_bytes()); not_dead_yet_cl.live_bytes());
_failures = true; _failures = true;
@ -3151,10 +3146,10 @@ void G1CollectedHeap::print_on(outputStream* st) const {
st->print(" %-20s", "garbage-first heap"); st->print(" %-20s", "garbage-first heap");
st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
capacity()/K, used_unlocked()/K); capacity()/K, used_unlocked()/K);
st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", st->print(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
_hrm.reserved().start(), p2i(_hrm.reserved().start()),
_hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords, p2i(_hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords),
_hrm.reserved().end()); p2i(_hrm.reserved().end()));
st->cr(); st->cr();
st->print(" region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K); st->print(" region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
uint young_regions = _young_list->length(); uint young_regions = _young_list->length();
@ -4095,7 +4090,7 @@ G1CollectedHeap::handle_evacuation_failure_par(G1ParScanThreadState* _par_scan_s
oop old) { oop old) {
assert(obj_in_cs(old), assert(obj_in_cs(old),
err_msg("obj: "PTR_FORMAT" should still be in the CSet", err_msg("obj: "PTR_FORMAT" should still be in the CSet",
(HeapWord*) old)); p2i(old)));
markOop m = old->mark(); markOop m = old->mark();
oop forward_ptr = old->forward_to_atomic(old); oop forward_ptr = old->forward_to_atomic(old);
if (forward_ptr == NULL) { if (forward_ptr == NULL) {
@ -4130,7 +4125,7 @@ G1CollectedHeap::handle_evacuation_failure_par(G1ParScanThreadState* _par_scan_s
assert(old == forward_ptr || !obj_in_cs(forward_ptr), assert(old == forward_ptr || !obj_in_cs(forward_ptr),
err_msg("obj: "PTR_FORMAT" forwarded to: "PTR_FORMAT" " err_msg("obj: "PTR_FORMAT" forwarded to: "PTR_FORMAT" "
"should not be in the CSet", "should not be in the CSet",
(HeapWord*) old, (HeapWord*) forward_ptr)); p2i(old), p2i(forward_ptr)));
return forward_ptr; return forward_ptr;
} }
} }
@ -4980,8 +4975,7 @@ public:
_par_scan_state->push_on_queue(p); _par_scan_state->push_on_queue(p);
} else { } else {
assert(!Metaspace::contains((const void*)p), assert(!Metaspace::contains((const void*)p),
err_msg("Unexpectedly found a pointer from metadata: " err_msg("Unexpectedly found a pointer from metadata: " PTR_FORMAT, p2i(p)));
PTR_FORMAT, p));
_copy_non_heap_obj_cl->do_oop(p); _copy_non_heap_obj_cl->do_oop(p);
} }
} }
@ -5646,14 +5640,14 @@ void G1CollectedHeap::verify_dirty_young_regions() {
bool G1CollectedHeap::verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap, bool G1CollectedHeap::verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap,
HeapWord* tams, HeapWord* end) { HeapWord* tams, HeapWord* end) {
guarantee(tams <= end, guarantee(tams <= end,
err_msg("tams: "PTR_FORMAT" end: "PTR_FORMAT, tams, end)); err_msg("tams: "PTR_FORMAT" end: "PTR_FORMAT, p2i(tams), p2i(end)));
HeapWord* result = bitmap->getNextMarkedWordAddress(tams, end); HeapWord* result = bitmap->getNextMarkedWordAddress(tams, end);
if (result < end) { if (result < end) {
gclog_or_tty->cr(); gclog_or_tty->cr();
gclog_or_tty->print_cr("## wrong marked address on %s bitmap: "PTR_FORMAT, gclog_or_tty->print_cr("## wrong marked address on %s bitmap: "PTR_FORMAT,
bitmap_name, result); bitmap_name, p2i(result));
gclog_or_tty->print_cr("## %s tams: "PTR_FORMAT" end: "PTR_FORMAT, gclog_or_tty->print_cr("## %s tams: "PTR_FORMAT" end: "PTR_FORMAT,
bitmap_name, tams, end); bitmap_name, p2i(tams), p2i(end));
return false; return false;
} }
return true; return true;
@ -5977,10 +5971,10 @@ class G1FreeHumongousRegionClosure : public HeapRegionClosure {
!r->rem_set()->is_empty()) { !r->rem_set()->is_empty()) {
if (G1TraceEagerReclaimHumongousObjects) { if (G1TraceEagerReclaimHumongousObjects) {
gclog_or_tty->print_cr("Live humongous region %u size "SIZE_FORMAT" start "PTR_FORMAT" length "UINT32_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d reclaim candidate %d type array %d", gclog_or_tty->print_cr("Live humongous region %u size "SIZE_FORMAT" start "PTR_FORMAT" length %u with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d reclaim candidate %d type array %d",
region_idx, region_idx,
obj->size()*HeapWordSize, (size_t)obj->size() * HeapWordSize,
r->bottom(), p2i(r->bottom()),
r->region_num(), r->region_num(),
r->rem_set()->occupied(), r->rem_set()->occupied(),
r->rem_set()->strong_code_roots_list_length(), r->rem_set()->strong_code_roots_list_length(),
@ -5996,13 +5990,13 @@ class G1FreeHumongousRegionClosure : public HeapRegionClosure {
guarantee(obj->is_typeArray(), guarantee(obj->is_typeArray(),
err_msg("Only eagerly reclaiming type arrays is supported, but the object " err_msg("Only eagerly reclaiming type arrays is supported, but the object "
PTR_FORMAT " is not.", PTR_FORMAT " is not.",
r->bottom())); p2i(r->bottom())));
if (G1TraceEagerReclaimHumongousObjects) { if (G1TraceEagerReclaimHumongousObjects) {
gclog_or_tty->print_cr("Dead humongous region %u size "SIZE_FORMAT" start "PTR_FORMAT" length "UINT32_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d reclaim candidate %d type array %d", gclog_or_tty->print_cr("Dead humongous region %u size "SIZE_FORMAT" start "PTR_FORMAT" length %u with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d reclaim candidate %d type array %d",
region_idx, region_idx,
obj->size()*HeapWordSize, (size_t)obj->size() * HeapWordSize,
r->bottom(), p2i(r->bottom()),
r->region_num(), r->region_num(),
r->rem_set()->occupied(), r->rem_set()->occupied(),
r->rem_set()->strong_code_roots_list_length(), r->rem_set()->strong_code_roots_list_length(),
@ -6154,7 +6148,7 @@ public:
bool doHeapRegion(HeapRegion* r) { bool doHeapRegion(HeapRegion* r) {
if (r->is_young()) { if (r->is_young()) {
gclog_or_tty->print_cr("Region ["PTR_FORMAT", "PTR_FORMAT") tagged as young", gclog_or_tty->print_cr("Region ["PTR_FORMAT", "PTR_FORMAT") tagged as young",
r->bottom(), r->end()); p2i(r->bottom()), p2i(r->end()));
_success = false; _success = false;
} }
return false; return false;
@ -6504,7 +6498,7 @@ class RegisterNMethodOopClosure: public OopClosure {
assert(!hr->is_continues_humongous(), assert(!hr->is_continues_humongous(),
err_msg("trying to add code root "PTR_FORMAT" in continuation of humongous region "HR_FORMAT err_msg("trying to add code root "PTR_FORMAT" in continuation of humongous region "HR_FORMAT
" starting at "HR_FORMAT, " starting at "HR_FORMAT,
_nm, HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); p2i(_nm), HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region())));
// HeapRegion::add_strong_code_root_locked() avoids adding duplicate entries. // HeapRegion::add_strong_code_root_locked() avoids adding duplicate entries.
hr->add_strong_code_root_locked(_nm); hr->add_strong_code_root_locked(_nm);
@ -6531,7 +6525,7 @@ class UnregisterNMethodOopClosure: public OopClosure {
assert(!hr->is_continues_humongous(), assert(!hr->is_continues_humongous(),
err_msg("trying to remove code root "PTR_FORMAT" in continuation of humongous region "HR_FORMAT err_msg("trying to remove code root "PTR_FORMAT" in continuation of humongous region "HR_FORMAT
" starting at "HR_FORMAT, " starting at "HR_FORMAT,
_nm, HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); p2i(_nm), HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region())));
hr->remove_strong_code_root(_nm); hr->remove_strong_code_root(_nm);
} }

View file

@ -22,11 +22,6 @@
* *
*/ */
#ifndef __clang_major__
// FIXME, formats have issues. Disable this macro definition, compile, and study warnings for more information.
#define ATTRIBUTE_PRINTF(x,y)
#endif
#include "precompiled.hpp" #include "precompiled.hpp"
#include "gc_implementation/g1/concurrentG1Refine.hpp" #include "gc_implementation/g1/concurrentG1Refine.hpp"
#include "gc_implementation/g1/concurrentMark.hpp" #include "gc_implementation/g1/concurrentMark.hpp"
@ -302,7 +297,7 @@ G1CollectorPolicy::G1CollectorPolicy() :
if (reserve_perc > 50) { if (reserve_perc > 50) {
reserve_perc = 50; reserve_perc = 50;
warning("G1ReservePercent is set to a value that is too large, " warning("G1ReservePercent is set to a value that is too large, "
"it's been updated to %u", reserve_perc); "it's been updated to " UINTX_FORMAT, reserve_perc);
} }
_reserve_factor = (double) reserve_perc / 100.0; _reserve_factor = (double) reserve_perc / 100.0;
// This will be set when the heap is expanded // This will be set when the heap is expanded
@ -1800,7 +1795,7 @@ void G1CollectorPolicy::print_collection_set(HeapRegion* list_head, outputStream
assert(csr->in_collection_set(), "bad CS"); assert(csr->in_collection_set(), "bad CS");
st->print_cr(" "HR_FORMAT", P: "PTR_FORMAT "N: "PTR_FORMAT", age: %4d", st->print_cr(" "HR_FORMAT", P: "PTR_FORMAT "N: "PTR_FORMAT", age: %4d",
HR_FORMAT_PARAMS(csr), HR_FORMAT_PARAMS(csr),
csr->prev_top_at_mark_start(), csr->next_top_at_mark_start(), p2i(csr->prev_top_at_mark_start()), p2i(csr->next_top_at_mark_start()),
csr->age_in_surv_rate_group_cond()); csr->age_in_surv_rate_group_cond());
csr = next; csr = next;
} }
@ -2166,7 +2161,7 @@ void TraceYoungGenTimeData::print_summary(const char* str,
void TraceYoungGenTimeData::print_summary_sd(const char* str, void TraceYoungGenTimeData::print_summary_sd(const char* str,
const NumberSeq* seq) const { const NumberSeq* seq) const {
print_summary(str, seq); print_summary(str, seq);
gclog_or_tty->print_cr("%+45s = %5d, std dev = %8.2lf ms, max = %8.2lf ms)", gclog_or_tty->print_cr("%45s = %5d, std dev = %8.2lf ms, max = %8.2lf ms)",
"(num", seq->num(), seq->sd(), seq->maximum()); "(num", seq->num(), seq->sd(), seq->maximum());
} }

View file

@ -160,40 +160,43 @@ public:
} while (0) } while (0)
#define ergo_verbose(_tag_, _action_) \
ergo_verbose_common(_tag_, _action_, "", 0, 0, 0, 0, 0, 0)
#define ergo_verbose0(_tag_, _action_, _extra_format_) \
ergo_verbose_common(_tag_, _action_, _extra_format_, 0, 0, 0, 0, 0, 0)
#define ergo_verbose1(_tag_, _action_, _extra_format_, \
_arg0_) \
ergo_verbose_common(_tag_, _action_, _extra_format_, \
_arg0_, 0, 0, 0, 0, 0)
#define ergo_verbose2(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_) \
ergo_verbose_common(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, 0, 0, 0, 0)
#define ergo_verbose3(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, _arg2_) \
ergo_verbose_common(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, _arg2_, 0, 0, 0)
#define ergo_verbose4(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, _arg2_, _arg3_) \
ergo_verbose_common(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, _arg2_, _arg3_, 0, 0)
#define ergo_verbose5(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, _arg2_, _arg3_, _arg4_) \
ergo_verbose_common(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, _arg2_, _arg3_, _arg4_, 0)
#define ergo_verbose6(_tag_, _action_, _extra_format_, \ #define ergo_verbose6(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \ _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \
ergo_verbose_common(_tag_, _action_, _extra_format_, \ ergo_verbose_common(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_)
#define ergo_verbose5(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, _arg2_, _arg3_, _arg4_) \
ergo_verbose6(_tag_, _action_, _extra_format_ "%s", \
_arg0_, _arg1_, _arg2_, _arg3_, _arg4_, "")
#define ergo_verbose4(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, _arg2_, _arg3_) \
ergo_verbose5(_tag_, _action_, _extra_format_ "%s", \
_arg0_, _arg1_, _arg2_, _arg3_, "")
#define ergo_verbose3(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_, _arg2_) \
ergo_verbose4(_tag_, _action_, _extra_format_ "%s", \
_arg0_, _arg1_, _arg2_, "")
#define ergo_verbose2(_tag_, _action_, _extra_format_, \
_arg0_, _arg1_) \
ergo_verbose3(_tag_, _action_, _extra_format_ "%s", \
_arg0_, _arg1_, "")
#define ergo_verbose1(_tag_, _action_, _extra_format_, \
_arg0_) \
ergo_verbose2(_tag_, _action_, _extra_format_ "%s", \
_arg0_, "")
#define ergo_verbose0(_tag_, _action_, _extra_format_) \
ergo_verbose1(_tag_, _action_, _extra_format_ "%s", \
"")
#define ergo_verbose(_tag_, _action_) \
ergo_verbose0(_tag_, _action_, "")
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ERGOVERBOSE_HPP #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ERGOVERBOSE_HPP