# HG changeset patch # User stefank # Date 1429529644 -7200 # Mon Apr 20 13:34:04 2015 +0200 # Node ID a005000dda3e714951696d1a1cd5159cb861c1a1 # Parent aacca898142ee3fe05b8b8267328793672d66068 8042891: Format issues embedded in macros for two g1 source files diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -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))); } } }; @@ -2935,7 +2930,7 @@ size_t word_sz = o->size(); gclog_or_tty->print("\nPrinting obj "PTR_FORMAT" of size " SIZE_FORMAT " isMarkedPrev %d isMarkedNext %d isAllocSince %d\n", - (void*) o, word_sz, + p2i(o), word_sz, _g1->isMarkedPrev(o), _g1->isMarkedNext(o), _hr->obj_allocated_since_prev_marking(o)); @@ -2944,7 +2939,7 @@ int *val; for (cur = start; cur < end; cur++) { val = (int *) cur; - gclog_or_tty->print("\t "PTR_FORMAT":%d\n", val, *val); + gclog_or_tty->print("\t "PTR_FORMAT":%d\n", p2i(val), *val); } } } @@ -2982,7 +2977,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; @@ -3180,10 +3175,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(); @@ -4124,7 +4119,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) { @@ -4159,7 +4154,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; } } @@ -5009,8 +5004,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); } } @@ -5675,14 +5669,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; @@ -6006,10 +6000,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(), @@ -6025,13 +6019,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(), @@ -6183,7 +6177,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; @@ -6533,7 +6527,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); @@ -6560,7 +6554,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); } diff --git a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -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()); } diff --git a/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp b/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp --- a/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp +++ b/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp @@ -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