8042891: Format issues embedded in macros for two g1 source files
Reviewed-by: brutisso, tschatzl
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Mon Apr 20 08:53:08 2015 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Mon Apr 20 13:34:04 2015 +0200
@@ -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 "classfile/metadataOnStackMark.hpp"
#include "classfile/stringTable.hpp"
@@ -201,7 +196,7 @@
if (!curr->is_young()) {
gclog_or_tty->print_cr("### YOUNG REGION "PTR_FORMAT"-"PTR_FORMAT" "
"incorrectly tagged (y: %d, surv: %d)",
- curr->bottom(), curr->end(),
+ p2i(curr->bottom()), p2i(curr->end()),
curr->is_young(), curr->is_survivor());
ret = false;
}
@@ -330,8 +325,8 @@
while (curr != NULL) {
gclog_or_tty->print_cr(" "HR_FORMAT", P: "PTR_FORMAT ", N: "PTR_FORMAT", age: %4d",
HR_FORMAT_PARAMS(curr),
- curr->prev_top_at_mark_start(),
- curr->next_top_at_mark_start(),
+ p2i(curr->prev_top_at_mark_start()),
+ p2i(curr->next_top_at_mark_start()),
curr->age_in_surv_rate_group_cond());
curr = curr->get_next_young_region();
}
@@ -2752,9 +2747,9 @@
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
if (_g1h->is_obj_dead_cond(obj, _vo)) {
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) {
- 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);
_failures = true;
@@ -2802,9 +2797,9 @@
// contains the nmethod
if (!hrrs->strong_code_roots_list_contains(_nm)) {
gclog_or_tty->print_cr("Code root location "PTR_FORMAT" "
- "from nmethod "PTR_FORMAT" not in strong "
- "code roots for region ["PTR_FORMAT","PTR_FORMAT")",
- p, _nm, hr->bottom(), hr->end());
+ "from nmethod "PTR_FORMAT" not in strong "
+ "code roots for region ["PTR_FORMAT","PTR_FORMAT")",
+ p2i(p), p2i(_nm), p2i(hr->bottom()), p2i(hr->end()));
_failures = true;
}
}
@@ -2860,7 +2855,7 @@
_young_ref_counter_closure.reset_count();
k->oops_do(&_young_ref_counter_closure);
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 @@
gclog_or_tty->print_cr("["PTR_FORMAT","PTR_FORMAT"] "
"max_live_bytes "SIZE_FORMAT" "
"< calculated "SIZE_FORMAT,
- r->bottom(), r->end(),
+ p2i(r->bottom()), p2i(r->end()),
r->max_live_bytes(),
not_dead_yet_cl.live_bytes());
_failures = true;
@@ -3151,10 +3146,10 @@
st->print(" %-20s", "garbage-first heap");
st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
capacity()/K, used_unlocked()/K);
- st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")",
- _hrm.reserved().start(),
- _hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords,
- _hrm.reserved().end());
+ st->print(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
+ p2i(_hrm.reserved().start()),
+ p2i(_hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords),
+ p2i(_hrm.reserved().end()));
st->cr();
st->print(" region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
uint young_regions = _young_list->length();
@@ -4095,7 +4090,7 @@
oop old) {
assert(obj_in_cs(old),
err_msg("obj: "PTR_FORMAT" should still be in the CSet",
- (HeapWord*) old));
+ p2i(old)));
markOop m = old->mark();
oop forward_ptr = old->forward_to_atomic(old);
if (forward_ptr == NULL) {
@@ -4130,7 +4125,7 @@
assert(old == forward_ptr || !obj_in_cs(forward_ptr),
err_msg("obj: "PTR_FORMAT" forwarded to: "PTR_FORMAT" "
"should not be in the CSet",
- (HeapWord*) old, (HeapWord*) forward_ptr));
+ p2i(old), p2i(forward_ptr)));
return forward_ptr;
}
}
@@ -4980,8 +4975,7 @@
_par_scan_state->push_on_queue(p);
} else {
assert(!Metaspace::contains((const void*)p),
- err_msg("Unexpectedly found a pointer from metadata: "
- PTR_FORMAT, p));
+ err_msg("Unexpectedly found a pointer from metadata: " PTR_FORMAT, p2i(p)));
_copy_non_heap_obj_cl->do_oop(p);
}
}
@@ -5646,14 +5640,14 @@
bool G1CollectedHeap::verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap,
HeapWord* tams, HeapWord* 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);
if (result < end) {
gclog_or_tty->cr();
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,
- bitmap_name, tams, end);
+ bitmap_name, p2i(tams), p2i(end));
return false;
}
return true;
@@ -5977,10 +5971,10 @@
!r->rem_set()->is_empty()) {
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,
- obj->size()*HeapWordSize,
- r->bottom(),
+ (size_t)obj->size() * HeapWordSize,
+ p2i(r->bottom()),
r->region_num(),
r->rem_set()->occupied(),
r->rem_set()->strong_code_roots_list_length(),
@@ -5996,13 +5990,13 @@
guarantee(obj->is_typeArray(),
err_msg("Only eagerly reclaiming type arrays is supported, but the object "
PTR_FORMAT " is not.",
- r->bottom()));
+ p2i(r->bottom())));
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,
- obj->size()*HeapWordSize,
- r->bottom(),
+ (size_t)obj->size() * HeapWordSize,
+ p2i(r->bottom()),
r->region_num(),
r->rem_set()->occupied(),
r->rem_set()->strong_code_roots_list_length(),
@@ -6154,7 +6148,7 @@
bool doHeapRegion(HeapRegion* r) {
if (r->is_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;
}
return false;
@@ -6504,7 +6498,7 @@
assert(!hr->is_continues_humongous(),
err_msg("trying to add code root "PTR_FORMAT" in continuation of humongous region "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.
hr->add_strong_code_root_locked(_nm);
@@ -6531,7 +6525,7 @@
assert(!hr->is_continues_humongous(),
err_msg("trying to remove code root "PTR_FORMAT" in continuation of humongous region "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);
}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Mon Apr 20 08:53:08 2015 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Mon Apr 20 13:34:04 2015 +0200
@@ -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 "gc_implementation/g1/concurrentG1Refine.hpp"
#include "gc_implementation/g1/concurrentMark.hpp"
@@ -302,7 +297,7 @@
if (reserve_perc > 50) {
reserve_perc = 50;
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;
// This will be set when the heap is expanded
@@ -1800,7 +1795,7 @@
assert(csr->in_collection_set(), "bad CS");
st->print_cr(" "HR_FORMAT", P: "PTR_FORMAT "N: "PTR_FORMAT", age: %4d",
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 = next;
}
@@ -2166,7 +2161,7 @@
void TraceYoungGenTimeData::print_summary_sd(const char* str,
const NumberSeq* seq) const {
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());
}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp Mon Apr 20 08:53:08 2015 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp Mon Apr 20 13:34:04 2015 +0200
@@ -160,40 +160,43 @@
} 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_, \
_arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \
ergo_verbose_common(_tag_, _action_, _extra_format_, \
_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