# HG changeset patch # User goetz # Date 1443788714 -7200 # Node ID a09bac0c1193cc8e4215e1c1c45c99833f98b83d # Parent 38bd261644c071eba30394bd6d6848124c463566 [mq]: format.patch diff --git a/src/cpu/x86/vm/nativeInst_x86.cpp b/src/cpu/x86/vm/nativeInst_x86.cpp --- a/src/cpu/x86/vm/nativeInst_x86.cpp +++ b/src/cpu/x86/vm/nativeInst_x86.cpp @@ -396,7 +396,7 @@ void NativeMovRegMem::print() { - tty->print_cr("0x%x: mov reg, [reg + %x]", instruction_address(), offset()); + tty->print_cr(PTR_FORMAT ": mov reg, [reg + %x]", p2i(instruction_address()), offset()); } //------------------------------------------------------------------- @@ -418,7 +418,7 @@ void NativeLoadAddress::print() { - tty->print_cr("0x%x: lea [reg + %x], reg", instruction_address(), offset()); + tty->print_cr(PTR_FORMAT ": lea [reg + %x], reg", instruction_address(), offset()); } //-------------------------------------------------------------------------------- diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp --- a/src/os/linux/vm/os_linux.cpp +++ b/src/os/linux/vm/os_linux.cpp @@ -106,7 +106,6 @@ # include # include -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling // getrusage() is prepared to handle the associated failure. @@ -1969,7 +1968,8 @@ char name[PATH_MAX + 1]; // Parse fields from line - sscanf(line, "%lx-%lx %4s %lx %5s %ld %s", &base, &top, permissions, &offset, device, &inode, name); + sscanf(line, UINT64_FORMAT_X "-" UINT64_FORMAT_X " %4s " UINT64_FORMAT_X " %5s " INT64_FORMAT " %s", + &base, &top, permissions, &offset, device, &inode, name); // Filter by device id '00:00' so that we only get file system mapped files. if (strcmp(device, "00:00") != 0) { @@ -2632,7 +2632,7 @@ static void warn_fail_commit_memory(char* addr, size_t size, bool exec, int err) { warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT - ", %d) failed; error='%s' (errno=%d)", addr, size, exec, + ", %d) failed; error='%s' (errno=%d)", p2i(addr), size, exec, strerror(err), err); } @@ -2640,7 +2640,7 @@ size_t alignment_hint, bool exec, int err) { warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT - ", " SIZE_FORMAT ", %d) failed; error='%s' (errno=%d)", addr, size, + ", " SIZE_FORMAT ", %d) failed; error='%s' (errno=%d)", p2i(addr), size, alignment_hint, exec, strerror(err), err); } @@ -4717,7 +4717,7 @@ if (threadStackSizeInBytes != 0 && threadStackSizeInBytes < os::Linux::min_stack_allowed) { tty->print_cr("\nThe stack size specified is too small, " - "Specify at least %dk", + "Specify at least " SIZE_FORMAT "k", os::Linux::min_stack_allowed/ K); return JNI_ERR; } @@ -4918,12 +4918,12 @@ Dl_info dlinfo; memset(&dlinfo, 0, sizeof(dlinfo)); if (dladdr(addr, &dlinfo) != 0) { - st->print(PTR_FORMAT ": ", addr); + st->print(PTR_FORMAT ": ", p2i(addr)); if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { - st->print("%s+%#x", dlinfo.dli_sname, - addr - (intptr_t)dlinfo.dli_saddr); + st->print("%s+" INTPTR_FORMAT_W(#), dlinfo.dli_sname, + p2i(addr - (intptr_t)dlinfo.dli_saddr)); } else if (dlinfo.dli_fbase != NULL) { - st->print("", addr - (intptr_t)dlinfo.dli_fbase); + st->print("", p2i(addr - (intptr_t)dlinfo.dli_fbase)); } else { st->print(""); } @@ -4931,7 +4931,7 @@ st->print(" in %s", dlinfo.dli_fname); } if (dlinfo.dli_fbase != NULL) { - st->print(" at " PTR_FORMAT, dlinfo.dli_fbase); + st->print(" at " PTR_FORMAT, p2i(dlinfo.dli_fbase)); } st->cr(); @@ -5323,7 +5323,7 @@ void os::pause() { char filename[MAX_PATH]; if (PauseAtStartupFile && PauseAtStartupFile[0]) { - jio_snprintf(filename, MAX_PATH, PauseAtStartupFile); + jio_snprintf(filename, MAX_PATH, "%s", PauseAtStartupFile); } else { jio_snprintf(filename, MAX_PATH, "./vm.paused.%d", current_process_id()); } @@ -5959,7 +5959,7 @@ int written; if (core_pattern[0] == '/') { - written = jio_snprintf(buffer, bufferSize, core_pattern); + written = jio_snprintf(buffer, bufferSize, "%s", core_pattern); } else { char cwd[PATH_MAX]; @@ -6095,7 +6095,7 @@ for (size_t alignment = ag; is_size_aligned(size, alignment); alignment *= 2) { char* p = os::Linux::reserve_memory_special_huge_tlbfs_mixed(size, alignment, NULL, false); test_log(SIZE_FORMAT_HEX " " SIZE_FORMAT_HEX " -> " PTR_FORMAT " %s", - size, alignment, p, (p != NULL ? "" : "(failed)")); + size, alignment, p2i(p), (p != NULL ? "" : "(failed)")); if (p != NULL) { assert(is_ptr_aligned(p, alignment), "must be"); small_page_write(p, size); @@ -6114,8 +6114,8 @@ char* const req_addr = (char*) align_ptr_up(mapping1, alignment); char* p = os::Linux::reserve_memory_special_huge_tlbfs_mixed(size, alignment, req_addr, false); test_log(SIZE_FORMAT_HEX " " SIZE_FORMAT_HEX " " PTR_FORMAT " -> " PTR_FORMAT " %s", - size, alignment, req_addr, p, - ((p != NULL ? (p == req_addr ? "(exact match)" : "") : "(failed)"))); + size, alignment, p2i(req_addr), p2i(p), + ((p != NULL ? (p == req_addr ? "(exact match)" : "") : "(failed)"))); if (p != NULL) { assert(p == req_addr, "must be"); small_page_write(p, size); @@ -6134,8 +6134,8 @@ char* const req_addr = (char*) align_ptr_up(mapping2, alignment); char* p = os::Linux::reserve_memory_special_huge_tlbfs_mixed(size, alignment, req_addr, false); test_log(SIZE_FORMAT_HEX " " SIZE_FORMAT_HEX " " PTR_FORMAT " -> " PTR_FORMAT " %s", - size, alignment, req_addr, p, - ((p != NULL ? "" : "(failed)"))); + size, alignment, p2i(req_addr), p2i(p), + ((p != NULL ? "" : "(failed)"))); // as the area around req_addr contains already existing mappings, the API should always // return NULL (as per contract, it cannot return another address) assert(p == NULL, "must be"); diff --git a/src/os/posix/vm/os_posix.cpp b/src/os/posix/vm/os_posix.cpp --- a/src/os/posix/vm/os_posix.cpp +++ b/src/os/posix/vm/os_posix.cpp @@ -38,8 +38,6 @@ #include #include -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // Todo: provide a os::get_max_process_id() or similar. Number of processes // may have been configured, can be read more accurately from proc fs etc. #ifndef MAX_PID @@ -194,30 +192,30 @@ st->print(" STACK "); getrlimit(RLIMIT_STACK, &rlim); if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); + else st->print("%uk", (uint)rlim.rlim_cur >> 10); st->print(", CORE "); getrlimit(RLIMIT_CORE, &rlim); if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); + else st->print("%uk", (uint)rlim.rlim_cur >> 10); // Isn't there on solaris #if !defined(TARGET_OS_FAMILY_solaris) && !defined(TARGET_OS_FAMILY_aix) st->print(", NPROC "); getrlimit(RLIMIT_NPROC, &rlim); if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%d", rlim.rlim_cur); + else st->print("%d", (uint)rlim.rlim_cur); #endif st->print(", NOFILE "); getrlimit(RLIMIT_NOFILE, &rlim); if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%d", rlim.rlim_cur); + else st->print("%d", (uint)rlim.rlim_cur); st->print(", AS "); getrlimit(RLIMIT_AS, &rlim); if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); - else st->print("%uk", rlim.rlim_cur >> 10); + else st->print("%uk", (uint)rlim.rlim_cur >> 10); st->cr(); } @@ -961,7 +959,7 @@ } } else if (sig == SIGSEGV || sig == SIGBUS || sig == SIGILL || sig == SIGTRAP || sig == SIGFPE) { - os->print(", si_addr: " PTR_FORMAT, si->si_addr); + os->print(", si_addr: " PTR_FORMAT, p2i(si->si_addr)); #ifdef SIGPOLL } else if (sig == SIGPOLL) { os->print(", si_band: " PTR64_FORMAT, (uint64_t)si->si_band); diff --git a/src/share/vm/classfile/symbolTable.cpp b/src/share/vm/classfile/symbolTable.cpp --- a/src/share/vm/classfile/symbolTable.cpp +++ b/src/share/vm/classfile/symbolTable.cpp @@ -37,8 +37,6 @@ #include "runtime/mutexLocker.hpp" #include "utilities/hashtable.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // -------------------------------------------------------------------------- // the number of buckets a thread claims const int ClaimChunkSize = 32; @@ -623,8 +621,8 @@ ((float)_symbols_removed/(float)_symbols_counted)* 100); } tty->print_cr(" Reference counts %7d", Symbol::_total_count); - tty->print_cr(" Symbol arena used %7dK", arena()->used()/1024); - tty->print_cr(" Symbol arena size %7dK", arena()->size_in_bytes()/1024); + tty->print_cr(" Symbol arena used " SIZE_FORMAT_W(7) "K", arena()->used()/1024); + tty->print_cr(" Symbol arena size " SIZE_FORMAT_W(7) "K", arena()->size_in_bytes()/1024); tty->print_cr(" Total symbol length %7d", total_length); tty->print_cr(" Maximum symbol length %7d", max_length); tty->print_cr(" Average symbol length %7.2f", ((float) total_length / (float) total_count)); @@ -645,7 +643,7 @@ HashtableEntry* entry = the_table()->bucket(i); if (entry != NULL) { while (entry != NULL) { - tty->print(PTR_FORMAT " ", entry->literal()); + tty->print(PTR_FORMAT " ", p2i(entry->literal())); entry->literal()->print(); tty->print(" %d", entry->literal()->refcount()); p = entry->next_addr(); diff --git a/src/share/vm/code/nmethod.cpp b/src/share/vm/code/nmethod.cpp --- a/src/share/vm/code/nmethod.cpp +++ b/src/share/vm/code/nmethod.cpp @@ -50,8 +50,6 @@ #include "shark/sharkCompiler.hpp" #endif -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - unsigned char nmethod::_global_unloading_clock = 0; #ifdef DTRACE_ENABLED @@ -810,8 +808,8 @@ #define LOG_OFFSET(log, name) \ if ((intptr_t)name##_end() - (intptr_t)name##_begin()) \ - log->print(" " XSTR(name) "_offset='%d'" , \ - (intptr_t)name##_begin() - (intptr_t)this) + log->print(" " XSTR(name) "_offset='" SIZE_FORMAT "'" , \ + (size_t)((intptr_t)name##_begin() - (intptr_t)this)) void nmethod::log_new_nmethod() const { @@ -820,8 +818,8 @@ HandleMark hm; xtty->begin_elem("nmethod"); log_identity(xtty); - xtty->print(" entry='" INTPTR_FORMAT "' size='%d'", code_begin(), size()); - xtty->print(" address='" INTPTR_FORMAT "'", (intptr_t) this); + xtty->print(" entry='" INTPTR_FORMAT "' size='%d'", p2i(code_begin()), size()); + xtty->print(" address='" INTPTR_FORMAT "'", p2i(this)); LOG_OFFSET(xtty, relocation); LOG_OFFSET(xtty, consts); @@ -849,7 +847,7 @@ ttyLocker ttyl; if (WizardMode) { CompileTask::print(st, this, msg, /*short_form:*/ true); - st->print_cr(" (" INTPTR_FORMAT ")", this); + st->print_cr(" (" INTPTR_FORMAT ")", p2i(this)); } else { CompileTask::print(st, this, msg, /*short_form:*/ false); } @@ -1205,7 +1203,7 @@ tty->print_cr("[Class unloading: Making nmethod " INTPTR_FORMAT " unloadable], Method*(" INTPTR_FORMAT "), cause(" INTPTR_FORMAT ")", - this, (address)_method, (address)cause); + p2i(this), p2i(_method), p2i(cause)); if (!Universe::heap()->is_gc_active()) cause->klass()->print(); } @@ -1402,7 +1400,8 @@ } if (TraceCreateZombies) { - tty->print_cr("nmethod <" INTPTR_FORMAT "> code made %s", this, (state == not_entrant) ? "not entrant" : "zombie"); + tty->print_cr("nmethod <" INTPTR_FORMAT "> code made %s", + p2i(this), (state == not_entrant) ? "not entrant" : "zombie"); } NMethodSweeper::report_state_change(this); @@ -1418,10 +1417,12 @@ assert_locked_or_safepoint(CodeCache_lock); // completely deallocate this method - Events::log(JavaThread::current(), "flushing nmethod " INTPTR_FORMAT, this); + Events::log(JavaThread::current(), "flushing nmethod " INTPTR_FORMAT, p2i(this)); if (PrintMethodFlushing) { - tty->print_cr("*flushing nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT "/Free CodeCache:" SIZE_FORMAT "Kb", - _compile_id, this, CodeCache::nof_blobs(), CodeCache::unallocated_capacity(CodeCache::get_code_blob_type(this))/1024); + tty->print_cr("*flushing nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT + "/Free CodeCache:" SIZE_FORMAT "Kb", + _compile_id, p2i(this), CodeCache::nof_blobs(), + CodeCache::unallocated_capacity(CodeCache::get_code_blob_type(this))/1024); } // We need to deallocate any ExceptionCache data. @@ -2119,8 +2120,8 @@ if (_print_nm == NULL) return; if (!_detected_scavenge_root) _print_nm->print_on(tty, "new scavenge root"); tty->print_cr("" PTR_FORMAT "[offset=%d] detected scavengable oop " PTR_FORMAT " (found at " PTR_FORMAT ")", - _print_nm, (int)((intptr_t)p - (intptr_t)_print_nm), - (void *)(*p), (intptr_t)p); + p2i(_print_nm), (int)((intptr_t)p - (intptr_t)_print_nm), + p2i((*p)), p2i(p)); (*p)->print(); } #endif //PRODUCT @@ -2426,7 +2427,7 @@ ResourceMark rm(thread); CodeBlob* cb = CodeCache::find_blob(pc); assert(cb != NULL && cb == this, ""); - tty->print_cr("implicit exception happened at " INTPTR_FORMAT, pc); + tty->print_cr("implicit exception happened at " INTPTR_FORMAT, p2i(pc)); print(); method()->print_codes(); print_code(); @@ -2519,7 +2520,7 @@ _ok = false; } tty->print_cr("*** non-oop " PTR_FORMAT " found at " PTR_FORMAT " (offset %d)", - (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm)); + p2i((*p)), p2i(p), (int)((intptr_t)p - (intptr_t)_nm)); } virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } }; @@ -2540,7 +2541,7 @@ ResourceMark rm; if (!CodeCache::contains(this)) { - fatal("nmethod at " INTPTR_FORMAT " not in zone", this); + fatal("nmethod at " INTPTR_FORMAT " not in zone", p2i(this)); } if(is_native_method() ) @@ -2548,12 +2549,12 @@ nmethod* nm = CodeCache::find_nmethod(verified_entry_point()); if (nm != this) { - fatal("findNMethod did not find this nmethod (" INTPTR_FORMAT ")", this); + fatal("findNMethod did not find this nmethod (" INTPTR_FORMAT ")", p2i(this)); } for (PcDesc* p = scopes_pcs_begin(); p < scopes_pcs_end(); p++) { if (! p->verify(this)) { - tty->print_cr("\t\tin nmethod at " INTPTR_FORMAT " (pcs)", this); + tty->print_cr("\t\tin nmethod at " INTPTR_FORMAT " (pcs)", p2i(this)); } } @@ -2642,7 +2643,7 @@ _ok = false; } tty->print_cr("*** scavengable oop " PTR_FORMAT " found at " PTR_FORMAT " (offset %d)", - (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm)); + p2i((*p)), p2i(p), (int)((intptr_t)p - (intptr_t)_nm)); (*p)->print(); } virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } @@ -2686,8 +2687,8 @@ print_on(tty, NULL); if (WizardMode) { - tty->print("((nmethod*) " INTPTR_FORMAT ") ", this); - tty->print(" for method " INTPTR_FORMAT , (address)method()); + tty->print("((nmethod*) " INTPTR_FORMAT ") ", p2i(this)); + tty->print(" for method " INTPTR_FORMAT , p2i(method())); tty->print(" { "); if (is_in_use()) tty->print("in_use "); if (is_not_entrant()) tty->print("not_entrant "); @@ -2697,52 +2698,52 @@ tty->print_cr("}:"); } if (size () > 0) tty->print_cr(" total in heap [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - (address)this, - (address)this + size(), + p2i(this), + p2i(this + size()), size()); if (relocation_size () > 0) tty->print_cr(" relocation [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - relocation_begin(), - relocation_end(), + p2i(relocation_begin()), + p2i(relocation_end()), relocation_size()); if (consts_size () > 0) tty->print_cr(" constants [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - consts_begin(), - consts_end(), + p2i(consts_begin()), + p2i(consts_end()), consts_size()); if (insts_size () > 0) tty->print_cr(" main code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - insts_begin(), - insts_end(), + p2i(insts_begin()), + p2i(insts_end()), insts_size()); if (stub_size () > 0) tty->print_cr(" stub code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - stub_begin(), - stub_end(), + p2i(stub_begin()), + p2i(stub_end()), stub_size()); if (oops_size () > 0) tty->print_cr(" oops [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - oops_begin(), - oops_end(), + p2i(oops_begin()), + p2i(oops_end()), oops_size()); if (metadata_size () > 0) tty->print_cr(" metadata [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - metadata_begin(), - metadata_end(), + p2i(metadata_begin()), + p2i(metadata_end()), metadata_size()); if (scopes_data_size () > 0) tty->print_cr(" scopes data [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - scopes_data_begin(), - scopes_data_end(), + p2i(scopes_data_begin()), + p2i(scopes_data_end()), scopes_data_size()); if (scopes_pcs_size () > 0) tty->print_cr(" scopes pcs [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - scopes_pcs_begin(), - scopes_pcs_end(), + p2i(scopes_pcs_begin()), + p2i(scopes_pcs_end()), scopes_pcs_size()); if (dependencies_size () > 0) tty->print_cr(" dependencies [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - dependencies_begin(), - dependencies_end(), + p2i(dependencies_begin()), + p2i(dependencies_end()), dependencies_size()); if (handler_table_size() > 0) tty->print_cr(" handler table [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - handler_table_begin(), - handler_table_end(), + p2i(handler_table_begin()), + p2i(handler_table_end()), handler_table_size()); if (nul_chk_table_size() > 0) tty->print_cr(" nul chk table [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", - nul_chk_table_begin(), - nul_chk_table_end(), + p2i(nul_chk_table_begin()), + p2i(nul_chk_table_end()), nul_chk_table_size()); } @@ -2793,20 +2794,20 @@ jint* index_end = (jint*)relocation_end() - 1; jint index_size = *index_end; jint* index_start = (jint*)( (address)index_end - index_size ); - tty->print_cr(" index @" INTPTR_FORMAT ": index_size=%d", index_start, index_size); + tty->print_cr(" index @" INTPTR_FORMAT ": index_size=%d", p2i(index_start), index_size); if (index_size > 0) { jint* ip; for (ip = index_start; ip+2 <= index_end; ip += 2) tty->print_cr(" (%d %d) addr=" INTPTR_FORMAT " @" INTPTR_FORMAT, ip[0], ip[1], - header_end()+ip[0], - relocation_begin()-1+ip[1]); + p2i(header_end()+ip[0]), + p2i(relocation_begin()-1+ip[1])); for (; ip < index_end; ip++) tty->print_cr(" (%d ?)", ip[0]); - tty->print_cr(" @" INTPTR_FORMAT ": index_size=%d", ip, *ip); + tty->print_cr(" @" INTPTR_FORMAT ": index_size=%d", p2i(ip), *ip); ip++; - tty->print_cr("reloc_end @" INTPTR_FORMAT ":", ip); + tty->print_cr("reloc_end @" INTPTR_FORMAT ":", p2i(ip)); } } } @@ -3088,7 +3089,7 @@ int cont_offset = ImplicitExceptionTable(this).at(begin - code_begin()); if (cont_offset != 0) { st->move_to(column); - st->print("; implicit exception: dispatches to " INTPTR_FORMAT, code_begin() + cont_offset); + st->print("; implicit exception: dispatches to " INTPTR_FORMAT, p2i(code_begin() + cont_offset)); } } @@ -3111,7 +3112,7 @@ break; } case relocInfo::static_call_type: - st->print_cr("Static call at " INTPTR_FORMAT, iter.reloc()->addr()); + st->print_cr("Static call at " INTPTR_FORMAT, p2i(iter.reloc()->addr())); compiledStaticCall_at(iter.reloc())->print(); break; } diff --git a/src/share/vm/code/vtableStubs.cpp b/src/share/vm/code/vtableStubs.cpp --- a/src/share/vm/code/vtableStubs.cpp +++ b/src/share/vm/code/vtableStubs.cpp @@ -40,8 +40,6 @@ #include "opto/matcher.hpp" #endif -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // ----------------------------------------------------------------------------------------- // Implementation of VtableStub @@ -79,8 +77,10 @@ void VtableStub::print_on(outputStream* st) const { - st->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)", - index(), receiver_location(), code_begin(), code_end()); + st->print("vtable stub (index = %d, receiver_location = %s/" INTX_FORMAT ", code = " + "[" INTPTR_FORMAT ", " INTPTR_FORMAT "[)", + index(), receiver_location()->name(), receiver_location()->value(), + p2i(code_begin()), p2i(code_end())); } @@ -126,8 +126,9 @@ enter(is_vtable_stub, vtable_index, s); if (PrintAdapterHandlers) { - tty->print_cr("Decoding VtableStub %s[%d]@%d", - is_vtable_stub? "vtbl": "itbl", vtable_index, VtableStub::receiver_location()); + tty->print_cr("Decoding VtableStub %s[%d]@%s/" INTX_FORMAT "", + is_vtable_stub? "vtbl": "itbl", vtable_index, + VtableStub::receiver_location()->name(), VtableStub::receiver_location()->value()); Disassembler::decode(s->code_begin(), s->code_end()); } // Notify JVMTI about this stub. The event will be recorded by the enclosing @@ -224,7 +225,7 @@ ik->print(); fatal("bad compiled vtable dispatch: receiver " INTPTR_FORMAT ", " "index %d (vtable length %d)", - (address)receiver, index, vt->length()); + p2i(receiver), index, vt->length()); } #endif // PRODUCT diff --git a/src/share/vm/compiler/disassembler.cpp b/src/share/vm/compiler/disassembler.cpp --- a/src/share/vm/compiler/disassembler.cpp +++ b/src/share/vm/compiler/disassembler.cpp @@ -56,8 +56,6 @@ #include "shark/sharkEntry.hpp" #endif -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - void* Disassembler::_library = NULL; bool Disassembler::_tried_to_load_library = false; @@ -330,16 +328,19 @@ if (Universe::is_fully_initialized()) { if (StubRoutines::contains(adr)) { StubCodeDesc* desc = StubCodeDesc::desc_for(adr); - if (desc == NULL) + if (desc == NULL) { desc = StubCodeDesc::desc_for(adr + frame::pc_return_offset); + } if (desc != NULL) { st->print("Stub::%s", desc->name()); - if (desc->begin() != adr) - st->print("%+d 0x%p",adr - desc->begin(), adr); - else if (WizardMode) st->print(" " PTR_FORMAT, adr); + if (desc->begin() != adr) { + st->print("%+d " PTR_FORMAT, (int)(adr - desc->begin()), p2i(adr)); + } else if (WizardMode) { + st->print(" " PTR_FORMAT, p2i(adr)); + } return; } - st->print("Stub:: " PTR_FORMAT, adr); + st->print("Stub:: " PTR_FORMAT, p2i(adr)); return; } @@ -347,13 +348,13 @@ if (bs->is_a(BarrierSet::CardTableModRef) && adr == (address)(barrier_set_cast(bs)->byte_map_base)) { st->print("word_map_base"); - if (WizardMode) st->print(" " INTPTR_FORMAT, (intptr_t)adr); + if (WizardMode) st->print(" " INTPTR_FORMAT, p2i(adr)); return; } } // Fall through to a simple (hexadecimal) numeral. - st->print(PTR_FORMAT, adr); + st->print(PTR_FORMAT, p2i(adr)); } void decode_env::print_insn_labels() { @@ -365,7 +366,7 @@ } _strings.print_block_comment(st, (intptr_t)(p - _start)); if (_print_pc) { - st->print(" " PTR_FORMAT ": ", p); + st->print(" " PTR_FORMAT ": ", p2i(p)); } } @@ -386,13 +387,16 @@ address pc1 = pc + perline; if (pc1 > pc_limit) pc1 = pc_limit; for (; pc < pc1; pc += incr) { - if (pc == pc0) + if (pc == pc0) { st->print(BYTES_COMMENT); - else if ((uint)(pc - pc0) % sizeof(int) == 0) + } else if ((uint)(pc - pc0) % sizeof(int) == 0) { st->print(" "); // put out a space on word boundaries - if (incr == sizeof(int)) - st->print("%08lx", *(int*)pc); - else st->print("%02x", (*pc)&0xFF); + } + if (incr == sizeof(int)) { + st->print("%08x", *(int*)pc); + } else { + st->print("%02x", (*pc)&0xFF); + } } st->cr(); } @@ -488,7 +492,7 @@ void Disassembler::decode(CodeBlob* cb, outputStream* st) { if (!load_library()) return; decode_env env(cb, st); - env.output()->print_cr("Decoding CodeBlob " PTR_FORMAT, cb); + env.output()->print_cr("Decoding CodeBlob " PTR_FORMAT, p2i(cb)); env.decode_instructions(cb->code_begin(), cb->code_end()); } @@ -501,7 +505,7 @@ void Disassembler::decode(nmethod* nm, outputStream* st) { if (!load_library()) return; decode_env env(nm, st); - env.output()->print_cr("Decoding compiled method " PTR_FORMAT ":", nm); + env.output()->print_cr("Decoding compiled method " PTR_FORMAT ":", p2i(nm)); env.output()->print_cr("Code:"); #ifdef SHARK @@ -533,9 +537,9 @@ int offset = 0; for (address p = nm->consts_begin(); p < nm->consts_end(); p += 4, offset += 4) { if ((offset % 8) == 0) { - env.output()->print_cr(" " PTR_FORMAT " (offset: %4d): " PTR32_FORMAT " " PTR64_FORMAT, p, offset, *((int32_t*) p), *((int64_t*) p)); + env.output()->print_cr(" " PTR_FORMAT " (offset: %4d): " PTR32_FORMAT " " PTR64_FORMAT, p2i(p), offset, *((int32_t*) p), *((int64_t*) p)); } else { - env.output()->print_cr(" " PTR_FORMAT " (offset: %4d): " PTR32_FORMAT, p, offset, *((int32_t*) p)); + env.output()->print_cr(" " PTR_FORMAT " (offset: %4d): " PTR32_FORMAT, p2i(p), offset, *((int32_t*) p)); } } } diff --git a/src/share/vm/compiler/methodLiveness.cpp b/src/share/vm/compiler/methodLiveness.cpp --- a/src/share/vm/compiler/methodLiveness.cpp +++ b/src/share/vm/compiler/methodLiveness.cpp @@ -32,8 +32,6 @@ #include "memory/allocation.inline.hpp" #include "utilities/bitMap.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // The MethodLiveness class performs a simple liveness analysis on a method // in order to decide which locals are live (that is, will be used again) at // a particular bytecode index (bci). @@ -540,7 +538,7 @@ _time_flow.seconds() * 100 / _time_total.seconds()); tty->print_cr (" Query : %3.3f sec. (%2.2f%%)", _time_query.seconds(), _time_query.seconds() * 100 / _time_total.seconds()); - tty->print_cr (" #bytes : %8d (%3.0f bytes per sec)", + tty->print_cr (" #bytes : %8ld (%3.0f bytes per sec)", _total_bytes, _total_bytes / _time_total.seconds()); tty->print_cr (" #methods : %8d (%3.0f methods per sec)", @@ -554,7 +552,7 @@ _max_method_blocks); tty->print_cr (" avg bytes : %3.3f", (float)_total_bytes / _total_methods); - tty->print_cr (" #blocks : %8d", + tty->print_cr (" #blocks : %8ld", _total_blocks); tty->print_cr (" avg normal predecessors : %3.3f max normal predecessors : %3d", (float)_total_edges / _total_blocks, @@ -564,7 +562,7 @@ _max_block_exc_edges); tty->print_cr (" avg visits : %3.3f", (float)_total_visits / _total_blocks); - tty->print_cr (" #locals queried : %8d #live : %8d %%live : %2.2f%%", + tty->print_cr (" #locals queried : %8ld #live : %8ld %%live : %2.2f%%", _total_locals_queried, _total_live_locals_queried, 100.0 * _total_live_locals_queried / _total_locals_queried); diff --git a/src/share/vm/memory/filemap.cpp b/src/share/vm/memory/filemap.cpp --- a/src/share/vm/memory/filemap.cpp +++ b/src/share/vm/memory/filemap.cpp @@ -50,7 +50,6 @@ #define O_BINARY 0 // otherwise do nothing. #endif -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC extern address JVM_FunctionAtStart(); extern address JVM_FunctionAtEnd(); @@ -443,8 +442,8 @@ if (_file_open) { guarantee(si->_file_offset == _file_offset, "file offset mismatch."); if (PrintSharedSpaces) { - tty->print_cr("Shared file region %d: 0x%6x bytes, addr " INTPTR_FORMAT - " file offset 0x%6x", region, size, base, _file_offset); + tty->print_cr("Shared file region %d: " SIZE_FORMAT_HEX_W(6) " bytes, addr " INTPTR_FORMAT + " file offset " SIZE_FORMAT_HEX_W(6), region, size, p2i(base), _file_offset); } } else { si->_file_offset = _file_offset; @@ -602,7 +601,8 @@ // other reserved memory (like the code cache). ReservedSpace rs(size, os::vm_allocation_granularity(), false, requested_addr); if (!rs.is_reserved()) { - fail_continue("Unable to reserve shared space at required address " INTPTR_FORMAT, requested_addr); + fail_continue("Unable to reserve shared space at required address " + INTPTR_FORMAT, p2i(requested_addr)); return rs; } // the reserved virtual memory is for mapping class data sharing archive @@ -659,7 +659,7 @@ tty->print_cr("Shared string data from the CDS archive is being ignored. " "The current CompressedOops/CompressedClassPointers encoding differs from " "that archived due to heap size change. The archive was dumped using max heap " - "size %dM.", max_heap_size()/M); + "size " UINTX_FORMAT "M.", max_heap_size()/M); } } else { string_ranges = new MemRegion[MetaspaceShared::max_strings]; @@ -896,7 +896,7 @@ } if (_obj_alignment != ObjectAlignmentInBytes) { FileMapInfo::fail_continue("The shared archive file's ObjectAlignmentInBytes of %d" - " does not equal the current ObjectAlignmentInBytes of %d.", + " does not equal the current ObjectAlignmentInBytes of " INTX_FORMAT ".", _obj_alignment, ObjectAlignmentInBytes); return false; } @@ -951,7 +951,7 @@ char *base = _header->region_addr(i); gclog_or_tty->print(" %s " INTPTR_FORMAT "-" INTPTR_FORMAT, shared_region_name[i], - base, base + si->_used); + p2i(base), p2i(base + si->_used)); } } diff --git a/src/share/vm/memory/metaspaceShared.cpp b/src/share/vm/memory/metaspaceShared.cpp --- a/src/share/vm/memory/metaspaceShared.cpp +++ b/src/share/vm/memory/metaspaceShared.cpp @@ -44,8 +44,6 @@ #include "runtime/vm_operations.hpp" #include "utilities/hashtable.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - int MetaspaceShared::_max_alignment = 0; ReservedSpace* MetaspaceShared::_shared_rs = NULL; @@ -578,7 +576,7 @@ // Print shared spaces all the time // To make fmt_space be a syntactic constant (for format warnings), use #define. -#define fmt_space "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " INTPTR_FORMAT +#define fmt_space "%s space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [%4.1f%% used] at " INTPTR_FORMAT Metaspace* ro_space = _loader_data->ro_metaspace(); Metaspace* rw_space = _loader_data->rw_metaspace(); @@ -611,12 +609,12 @@ const double mc_u_perc = mc_bytes / double(mc_alloced) * 100.0; const double total_u_perc = total_bytes / double(total_alloced) * 100.0; - tty->print_cr(fmt_space, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom()); - tty->print_cr(fmt_space, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom()); - tty->print_cr(fmt_space, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low); - tty->print_cr(fmt_space, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low); - tty->print_cr(fmt_space, "st", ss_bytes, ss_t_perc, ss_bytes, 100.0, ss_low); - tty->print_cr("total : %9d [100.0%% of total] out of %9d bytes [%4.1f%% used]", + tty->print_cr(fmt_space, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, p2i(ro_space->bottom())); + tty->print_cr(fmt_space, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, p2i(rw_space->bottom())); + tty->print_cr(fmt_space, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, p2i(md_low)); + tty->print_cr(fmt_space, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, p2i(mc_low)); + tty->print_cr(fmt_space, "st", ss_bytes, ss_t_perc, ss_bytes, 100.0, p2i(ss_low)); + tty->print_cr("total : " SIZE_FORMAT_W(9) " [100.0%% of total] out of " SIZE_FORMAT_W(9) " bytes [%4.1f%% used]", total_bytes, total_alloced, total_u_perc); // Update the vtable pointers in all of the Klass objects in the @@ -738,9 +736,9 @@ TraceTime timer("Dump Shared Spaces", TraceStartupTime); ResourceMark rm; - tty->print_cr("Allocated shared space: %d bytes at " PTR_FORMAT, + tty->print_cr("Allocated shared space: " SIZE_FORMAT " bytes at " PTR_FORMAT, MetaspaceShared::shared_rs()->size(), - MetaspaceShared::shared_rs()->base()); + p2i(MetaspaceShared::shared_rs()->base())); // Preload classes to be shared. // Should use some os:: method rather than fopen() here. aB. diff --git a/src/share/vm/oops/instanceKlass.cpp b/src/share/vm/oops/instanceKlass.cpp --- a/src/share/vm/oops/instanceKlass.cpp +++ b/src/share/vm/oops/instanceKlass.cpp @@ -66,8 +66,6 @@ #include "c1/c1_Compiler.hpp" #endif -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - #ifdef DTRACE_ENABLED @@ -1028,7 +1026,7 @@ if (TraceFinalizerRegistration) { tty->print("Registered "); i->print_value_on(tty); - tty->print_cr(" (" INTPTR_FORMAT ") as finalizable", (address)i); + tty->print_cr(" (" INTPTR_FORMAT ") as finalizable", p2i(i)); } instanceHandle h_i(THREAD, i); // Pass the handle as argument, JavaCalls::call expects oop as jobjects @@ -1131,7 +1129,7 @@ if (TraceClassInitialization) { tty->print("%d Initializing ", call_class_initializer_impl_counter++); this_k->name()->print_value(); - tty->print_cr("%s (" INTPTR_FORMAT ")", h_method() == NULL ? "(no method)" : "", (address)this_k()); + tty->print_cr("%s (" INTPTR_FORMAT ")", h_method() == NULL ? "(no method)" : "", p2i(this_k())); } if (h_method() != NULL) { JavaCallArguments args; // No arguments @@ -2797,7 +2795,7 @@ st->print(" "); } } - if (n >= MaxSubklassPrintSize) st->print("(%d more klasses...)", n - MaxSubklassPrintSize); + if (n >= MaxSubklassPrintSize) st->print("(" INTX_FORMAT " more klasses...)", n - MaxSubklassPrintSize); st->cr(); if (is_interface()) { @@ -2873,9 +2871,9 @@ } st->print(BULLET"inner classes: "); inner_classes()->print_value_on(st); st->cr(); st->print(BULLET"java mirror: "); java_mirror()->print_value_on(st); st->cr(); - st->print(BULLET"vtable length %d (start addr: " INTPTR_FORMAT ")", vtable_length(), start_of_vtable()); st->cr(); + st->print(BULLET"vtable length %d (start addr: " INTPTR_FORMAT ")", vtable_length(), p2i(start_of_vtable())); st->cr(); if (vtable_length() > 0 && (Verbose || WizardMode)) print_vtable(start_of_vtable(), vtable_length(), st); - st->print(BULLET"itable length %d (start addr: " INTPTR_FORMAT ")", itable_length(), start_of_itable()); st->cr(); + st->print(BULLET"itable length %d (start addr: " INTPTR_FORMAT ")", itable_length(), p2i(start_of_itable())); st->cr(); if (itable_length() > 0 && (Verbose || WizardMode)) print_vtable(start_of_itable(), itable_length(), st); st->print_cr(BULLET"---- static fields (%d words):", static_field_size()); FieldPrinter print_static_field(st); @@ -3068,7 +3066,7 @@ template void do_oop_work(T* p) { oop obj = oopDesc::load_decode_heap_oop(p); if (!obj->is_oop_or_null()) { - tty->print_cr("Failed: " PTR_FORMAT " -> " PTR_FORMAT, p, (address)obj); + tty->print_cr("Failed: " PTR_FORMAT " -> " PTR_FORMAT, p2i(p), p2i(obj)); Universe::print(); guarantee(false, "boom"); } @@ -3110,7 +3108,7 @@ Klass* sib = next_sibling(); if (sib != NULL) { if (sib == this) { - fatal("subclass points to itself " PTR_FORMAT, sib); + fatal("subclass points to itself " PTR_FORMAT, p2i(sib)); } guarantee(sib->is_klass(), "should be klass"); @@ -3310,7 +3308,7 @@ // The previous version InstanceKlass is on the ClassLoaderData deallocate list // so will be deallocated during the next phase of class unloading. RC_TRACE(0x00000200, ("purge: previous version " INTPTR_FORMAT " is dead", - pv_node)); + p2i(pv_node))); // For debugging purposes. pv_node->set_is_scratch_class(); pv_node->class_loader_data()->add_to_deallocate_list(pv_node); @@ -3321,7 +3319,7 @@ continue; } else { RC_TRACE(0x00000200, ("purge: previous version " INTPTR_FORMAT " is alive", - pv_node)); + p2i(pv_node))); assert(pvcp->pool_holder() != NULL, "Constant pool with no holder"); guarantee (!loader_data->is_unloading(), "unloaded classes can't be on the stack"); live_count++; @@ -3472,10 +3470,10 @@ // is never reached, but this won't be noticeable to the programmer. old_method->set_running_emcp(true); RC_TRACE(0x00000400, ("add: EMCP method %s is on_stack " INTPTR_FORMAT, - old_method->name_and_sig_as_C_string(), old_method)); + old_method->name_and_sig_as_C_string(), p2i(old_method))); } else if (!old_method->is_obsolete()) { RC_TRACE(0x00000400, ("add: EMCP method %s is NOT on_stack " INTPTR_FORMAT, - old_method->name_and_sig_as_C_string(), old_method)); + old_method->name_and_sig_as_C_string(), p2i(old_method))); } } } diff --git a/src/share/vm/oops/klassVtable.cpp b/src/share/vm/oops/klassVtable.cpp --- a/src/share/vm/oops/klassVtable.cpp +++ b/src/share/vm/oops/klassVtable.cpp @@ -38,8 +38,6 @@ #include "runtime/handles.inline.hpp" #include "utilities/copy.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - inline InstanceKlass* klassVtable::ik() const { Klass* k = _klass(); assert(k->oop_is_instance(), "not an InstanceKlass"); @@ -1505,7 +1503,7 @@ #ifndef PRODUCT print(); #endif - fatal("vtableEntry " PTR_FORMAT ": method is from subclass", this); + fatal("vtableEntry " PTR_FORMAT ": method is from subclass", p2i(this)); } } @@ -1515,7 +1513,7 @@ ResourceMark rm; tty->print("vtableEntry %s: ", method()->name()->as_C_string()); if (Verbose) { - tty->print("m %#lx ", (address)method()); + tty->print("m " INTPTR_FORMAT_W(#) " ", p2i(method())); } } @@ -1586,7 +1584,7 @@ void klassItable::print_statistics() { tty->print_cr("itable statistics:"); tty->print_cr("%6d classes with itables", _total_classes); - tty->print_cr("%6d K uses for itables (average by class: %d bytes)", _total_size / K, _total_size / _total_classes); + tty->print_cr("%6ld K uses for itables (average by class: %ld bytes)", _total_size / K, _total_size / _total_classes); } #endif // PRODUCT diff --git a/src/share/vm/oops/markOop.cpp b/src/share/vm/oops/markOop.cpp --- a/src/share/vm/oops/markOop.cpp +++ b/src/share/vm/oops/markOop.cpp @@ -27,8 +27,6 @@ #include "runtime/thread.inline.hpp" #include "runtime/objectMonitor.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - void markOopDesc::print_on(outputStream* st) const { if (is_marked()) { st->print(" marked(" INTPTR_FORMAT ")", value()); @@ -39,8 +37,8 @@ if (mon == NULL) { st->print("NULL (this should never be seen!)"); } else { - st->print("{count=" INTPTR_FORMAT ",waiters=" INTPTR_FORMAT - ",recursions=" INTPTR_FORMAT ",owner=" INTPTR_FORMAT "}", + st->print("{count=0x%x,waiters=0x%x,recursions=" + INTPTR_FORMAT ",owner=" INTPTR_FORMAT "}", mon->count(), mon->waiters(), mon->recursions(), p2i(mon->owner())); } @@ -65,7 +63,7 @@ assert(is_unlocked() || has_bias_pattern(), "just checking"); st->print("mark("); if (has_bias_pattern()) st->print("biased,"); - st->print("hash %#lx,", hash()); + st->print("hash " INTPTR_FORMAT ",", hash()); st->print("age %d)", age()); } } diff --git a/src/share/vm/prims/jniCheck.cpp b/src/share/vm/prims/jniCheck.cpp --- a/src/share/vm/prims/jniCheck.cpp +++ b/src/share/vm/prims/jniCheck.cpp @@ -102,7 +102,8 @@ #define UNCHECKED() (unchecked_jni_NativeInterface) static const char * warn_wrong_jnienv = "Using JNIEnv in the wrong thread"; -static const char * warn_bad_class_descriptor = "JNI FindClass received a bad class descriptor \"%s\". A correct class descriptor " \ +static const char * warn_bad_class_descriptor1 = "JNI FindClass received a bad class descriptor \""; +static const char * warn_bad_class_descriptor2 = "\". A correct class descriptor " \ "has no leading \"L\" or trailing \";\". Incorrect descriptors will not be accepted in future releases."; static const char * fatal_using_jnienv_in_nonjava = "FATAL ERROR in native method: Using JNIEnv in non-Java thread"; static const char * warn_other_function_in_critical = "Warning: Calling other JNI functions in the scope of " \ @@ -484,7 +485,8 @@ name[0] == JVM_SIGNATURE_CLASS && // 'L' name[len-1] == JVM_SIGNATURE_ENDCLASS ) { // ';' char msg[JVM_MAXPATHLEN]; - jio_snprintf(msg, JVM_MAXPATHLEN, warn_bad_class_descriptor, name); + jio_snprintf(msg, JVM_MAXPATHLEN, "%s%s%s", + warn_bad_class_descriptor1, name, warn_bad_class_descriptor2); ReportJNIWarning(thr, msg); } } diff --git a/src/share/vm/prims/jvmtiEnter.xsl b/src/share/vm/prims/jvmtiEnter.xsl --- a/src/share/vm/prims/jvmtiEnter.xsl +++ b/src/share/vm/prims/jvmtiEnter.xsl @@ -44,9 +44,6 @@ # include "prims/jvmtiRawMonitor.hpp" # include "prims/jvmtiUtil.hpp" -// There are known-bad format/arg pairings in the code generated by this file. -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - @@ -543,8 +540,8 @@ if (trace_flags) { - tty->print_cr("JVMTI [%s] %s %s env=%d", curr_thread_name, func_name, - JvmtiUtil::error_name(JVMTI_ERROR_INVALID_ENVIRONMENT), env); + tty->print_cr("JVMTI [%s] %s %s env=" PTR_FORMAT, curr_thread_name, func_name, + JvmtiUtil::error_name(JVMTI_ERROR_INVALID_ENVIRONMENT), p2i(env)); } @@ -760,8 +757,8 @@ JVMTI_ERROR_INVALID_MONITOR - - not a raw monitor 0x%x - , rmonitor + - not a raw monitor " PTR_FORMAT " + , p2i(rmonitor) } @@ -777,8 +774,8 @@ JVMTI_ERROR_INVALID_THREAD - - jthread resolved to NULL - jthread = 0x%x - , + - jthread resolved to NULL - jthread = " PTR_FORMAT " + , p2i() } @@ -786,8 +783,8 @@ JVMTI_ERROR_INVALID_THREAD - - oop is not a thread - jthread = 0x%x - , + - oop is not a thread - jthread = " PTR_FORMAT " + , p2i() } @@ -798,8 +795,8 @@ JVMTI_ERROR_THREAD_NOT_ALIVE - - not a Java thread - jthread = 0x%x - , + - not a Java thread - jthread = " PTR_FORMAT " + , p2i() } @@ -842,7 +839,7 @@ JVMTI_ERROR_ILLEGAL_ARGUMENT - - negative depth - jthread = 0x%x + - negative depth - jthread = " INT32_FORMAT " , @@ -861,8 +858,8 @@ JVMTI_ERROR_INVALID_CLASS - - resolved to NULL - jclass = 0x%x - , + - resolved to NULL - jclass = " PTR_FORMAT " + , p2i() } @@ -870,8 +867,8 @@ JVMTI_ERROR_INVALID_CLASS - - not a class - jclass = 0x%x - , + - not a class - jclass = " PTR_FORMAT " + , p2i() } @@ -882,8 +879,8 @@ JVMTI_ERROR_INVALID_CLASS - - is a primitive class - jclass = 0x%x - , + - is a primitive class - jclass = " PTR_FORMAT " + , p2i() } @@ -892,8 +889,8 @@ JVMTI_ERROR_INVALID_CLASS - - no Klass* - jclass = 0x%x - , + - no Klass* - jclass = " PTR_FORMAT " + , p2i() } @@ -1034,12 +1031,12 @@ - + g ='%s' - =0x%x + =" PTR_FORMAT " @@ -1047,7 +1044,15 @@ , - + + + + + + + p2i() + + @@ -1057,7 +1062,7 @@ - =0x%x + =" PTR_FORMAT " @@ -1071,7 +1076,7 @@ , - + p2i() @@ -1083,13 +1088,13 @@ - =0x%x + =" PTR_FORMAT " , - + p2i() @@ -1214,18 +1219,25 @@ - + - =%d + =" INT32_FORMAT " + + + + + + + =" INT64_FORMAT " - =%ld + =" INT64_FORMAT " diff --git a/src/share/vm/prims/jvmtiExport.cpp b/src/share/vm/prims/jvmtiExport.cpp --- a/src/share/vm/prims/jvmtiExport.cpp +++ b/src/share/vm/prims/jvmtiExport.cpp @@ -58,8 +58,6 @@ #include "gc/parallel/psMarkSweep.hpp" #endif // INCLUDE_ALL_GCS -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - #ifdef JVMTI_TRACE #define EVT_TRACE(evt,out) if ((JvmtiTrace::event_trace_flags(evt) & JvmtiTrace::SHOW_EVENT_SENT) != 0) { SafeResourceMark rm; tty->print_cr out; } #define EVT_TRIG_TRACE(evt,out) if ((JvmtiTrace::event_trace_flags(evt) & JvmtiTrace::SHOW_EVENT_TRIGGER) != 0) { SafeResourceMark rm; tty->print_cr out; } @@ -770,7 +768,7 @@ EVT_TRACE(JVMTI_EVENT_COMPILED_METHOD_UNLOAD, ("JVMTI [%s] class compile method unload event sent jmethodID " PTR_FORMAT, - JvmtiTrace::safe_get_thread_name(thread), method)); + JvmtiTrace::safe_get_thread_name(thread), p2i(method))); ResourceMark rm(thread); @@ -805,7 +803,7 @@ if (!ets->breakpoint_posted() && ets->is_enabled(JVMTI_EVENT_BREAKPOINT)) { ThreadState old_os_state = thread->osthread()->get_state(); thread->osthread()->set_state(BREAKPOINTED); - EVT_TRACE(JVMTI_EVENT_BREAKPOINT, ("JVMTI [%s] Evt Breakpoint sent %s.%s @ %d", + EVT_TRACE(JVMTI_EVENT_BREAKPOINT, ("JVMTI [%s] Evt Breakpoint sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1258,7 +1256,7 @@ for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { ets->compare_and_set_current_location(mh(), location, JVMTI_EVENT_SINGLE_STEP); if (!ets->single_stepping_posted() && ets->is_enabled(JVMTI_EVENT_SINGLE_STEP)) { - EVT_TRACE(JVMTI_EVENT_SINGLE_STEP, ("JVMTI [%s] Evt Single Step sent %s.%s @ %d", + EVT_TRACE(JVMTI_EVENT_SINGLE_STEP, ("JVMTI [%s] Evt Single Step sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1298,7 +1296,7 @@ if (ets->is_enabled(JVMTI_EVENT_EXCEPTION) && (exception != NULL)) { EVT_TRACE(JVMTI_EVENT_EXCEPTION, - ("JVMTI [%s] Evt Exception thrown sent %s.%s @ %d", + ("JVMTI [%s] Evt Exception thrown sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1374,7 +1372,7 @@ return; } EVT_TRIG_TRACE(JVMTI_EVENT_EXCEPTION_CATCH, - ("JVMTI [%s] Trg unwind_due_to_exception triggered %s.%s @ %s%d - %s", + ("JVMTI [%s] Trg unwind_due_to_exception triggered %s.%s @ %s" INTX_FORMAT " - %s", JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1409,7 +1407,7 @@ for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_EXCEPTION_CATCH) && (exception_handle() != NULL)) { EVT_TRACE(JVMTI_EVENT_EXCEPTION_CATCH, - ("JVMTI [%s] Evt ExceptionCatch sent %s.%s @ %d", + ("JVMTI [%s] Evt ExceptionCatch sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1503,7 +1501,7 @@ JvmtiEnvThreadStateIterator it(state); for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_FIELD_ACCESS)) { - EVT_TRACE(JVMTI_EVENT_FIELD_ACCESS, ("JVMTI [%s] Evt Field Access event sent %s.%s @ %d", + EVT_TRACE(JVMTI_EVENT_FIELD_ACCESS, ("JVMTI [%s] Evt Field Access event sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1667,7 +1665,7 @@ for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_FIELD_MODIFICATION)) { EVT_TRACE(JVMTI_EVENT_FIELD_MODIFICATION, - ("JVMTI [%s] Evt Field Modification event sent %s.%s @ %d", + ("JVMTI [%s] Evt Field Modification event sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1807,7 +1805,7 @@ EVT_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, ("JVMTI [%s] class compile method load event sent (by GenerateEvents), jmethodID=" PTR_FORMAT, - JvmtiTrace::safe_get_thread_name(thread), method)); + JvmtiTrace::safe_get_thread_name(thread), p2i(method))); JvmtiEventMark jem(thread); JvmtiJavaThreadEventTransition jet(thread); diff --git a/src/share/vm/runtime/deoptimization.cpp b/src/share/vm/runtime/deoptimization.cpp --- a/src/share/vm/runtime/deoptimization.cpp +++ b/src/share/vm/runtime/deoptimization.cpp @@ -53,8 +53,6 @@ #include "utilities/events.hpp" #include "utilities/xmlstream.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - bool DeoptimizationMarker::_is_active = false; Deoptimization::UnrollBlock::UnrollBlock(int size_of_deoptimized_frame, @@ -112,7 +110,7 @@ tty->print_cr(" size_of_deoptimized_frame = %d", _size_of_deoptimized_frame); tty->print( " frame_sizes: "); for (int index = 0; index < number_of_frames(); index++) { - tty->print("%d ", frame_sizes()[index]); + tty->print(INTX_FORMAT " ", frame_sizes()[index]); } tty->cr(); } @@ -206,7 +204,7 @@ assert(Universe::heap()->is_in_or_null(result), "must be heap pointer"); if (TraceDeoptimization) { ttyLocker ttyl; - tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, (void *)result, thread); + tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, p2i(result), p2i(thread)); } } if (objects != NULL) { @@ -217,7 +215,7 @@ #ifndef PRODUCT if (TraceDeoptimization) { ttyLocker ttyl; - tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, thread); + tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, p2i(thread)); print_objects(objects, realloc_failures); } #endif @@ -245,13 +243,13 @@ if (mi->eliminated()) { if (first) { first = false; - tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, thread); + tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, p2i(thread)); } if (mi->owner_is_scalar_replaced()) { Klass* k = java_lang_Class::as_Klass(mi->owner_klass()); tty->print_cr(" failed reallocation for klass %s", k->external_name()); } else { - tty->print_cr(" object <" INTPTR_FORMAT "> locked", (void *)mi->owner()); + tty->print_cr(" object <" INTPTR_FORMAT "> locked", p2i(mi->owner())); } } } @@ -550,11 +548,12 @@ #ifndef PRODUCT if (TraceDeoptimization) { ttyLocker ttyl; - tty->print_cr("DEOPT UNPACKING thread " INTPTR_FORMAT " vframeArray " INTPTR_FORMAT " mode %d", thread, array, exec_mode); + tty->print_cr("DEOPT UNPACKING thread " INTPTR_FORMAT " vframeArray " INTPTR_FORMAT " mode %d", + p2i(thread), p2i(array), exec_mode); } #endif Events::log(thread, "DEOPT UNPACKING pc=" INTPTR_FORMAT " sp=" INTPTR_FORMAT " mode %d", - stub_frame.pc(), stub_frame.sp(), exec_mode); + p2i(stub_frame.pc()), p2i(stub_frame.sp()), exec_mode); UnrollBlock* info = array->unroll_block(); @@ -690,7 +689,7 @@ tty->print_cr(" top_frame_expression_stack_adjustment = %d", top_frame_expression_stack_adjustment); tty->print_cr(" exec_mode = %d", exec_mode); tty->print_cr(" cur_invoke_parameter_size = %d", cur_invoke_parameter_size); - tty->print_cr(" Thread = " INTPTR_FORMAT ", thread ID = " UINTX_FORMAT, thread, thread->osthread()->thread_id()); + tty->print_cr(" Thread = " INTPTR_FORMAT ", thread ID = %d", p2i(thread), thread->osthread()->thread_id()); tty->print_cr(" Interpreted frames:"); for (int k = 0; k < cur_array->frames(); k++) { vframeArrayElement* el = cur_array->element(k); @@ -966,7 +965,7 @@ KlassHandle k(java_lang_Class::as_Klass(sv->klass()->as_ConstantOopReadValue()->value()())); Handle obj = sv->value(); - tty->print(" object <" INTPTR_FORMAT "> of type ", (void *)sv->value()()); + tty->print(" object <" INTPTR_FORMAT "> of type ", p2i(sv->value()())); k->print_value(); assert(obj.not_null() || realloc_failures, "reallocation was missed"); if (obj.is_null()) { @@ -985,12 +984,12 @@ #endif // COMPILER2 vframeArray* Deoptimization::create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray* chunk, bool realloc_failures) { - Events::log(thread, "DEOPT PACKING pc=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, fr.pc(), fr.sp()); + Events::log(thread, "DEOPT PACKING pc=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, p2i(fr.pc()), p2i(fr.sp())); #ifndef PRODUCT if (TraceDeoptimization) { ttyLocker ttyl; - tty->print("DEOPT PACKING thread " INTPTR_FORMAT " ", thread); + tty->print("DEOPT PACKING thread " INTPTR_FORMAT " ", p2i(thread)); fr.print_on(tty); tty->print_cr(" Virtual frames (innermost first):"); for (int index = 0; index < chunk->length(); index++) { @@ -1035,7 +1034,7 @@ #ifndef PRODUCT if (TraceDeoptimization) { ttyLocker ttyl; - tty->print_cr(" Created vframeArray " INTPTR_FORMAT, array); + tty->print_cr(" Created vframeArray " INTPTR_FORMAT, p2i(array)); } #endif // PRODUCT @@ -1297,7 +1296,7 @@ // Log a message Events::log(thread, "Uncommon trap: trap_request=" PTR32_FORMAT " fr.pc=" INTPTR_FORMAT, - trap_request, fr.pc()); + trap_request, p2i(fr.pc())); { ResourceMark rm; @@ -1331,7 +1330,7 @@ // Log a message Events::log_deopt_message(thread, "Uncommon trap: reason=%s action=%s pc=" INTPTR_FORMAT " method=%s @ %d", - trap_reason_name(reason), trap_action_name(action), fr.pc(), + trap_reason_name(reason), trap_action_name(action), p2i(fr.pc()), trap_method->name_and_sig_as_C_string(), trap_bci); // Print a bunch of diagnostics, if requested. @@ -1386,7 +1385,7 @@ tty->print("Uncommon trap occurred in"); nm->method()->print_short_name(tty); tty->print(" (@" INTPTR_FORMAT ") thread=" UINTX_FORMAT " reason=%s action=%s unloaded_class_index=%d", - fr.pc(), + p2i(fr.pc()), os::current_thread_id(), trap_reason_name(reason), trap_action_name(action), diff --git a/src/share/vm/runtime/fprofiler.cpp b/src/share/vm/runtime/fprofiler.cpp --- a/src/share/vm/runtime/fprofiler.cpp +++ b/src/share/vm/runtime/fprofiler.cpp @@ -42,8 +42,6 @@ #include "runtime/vframe.hpp" #include "utilities/macros.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // Static fields of FlatProfiler int FlatProfiler::received_gc_ticks = 0; int FlatProfiler::vm_operation_ticks = 0; @@ -186,7 +184,7 @@ if (counters == NULL) return; tty->cr(); - tty->print_cr("Printing compiled methods with PC buckets having more than %d ticks", ProfilerPCTickThreshold); + tty->print_cr("Printing compiled methods with PC buckets having more than " INTX_FORMAT " ticks", ProfilerPCTickThreshold); tty->print_cr("==================================================================="); tty->cr(); @@ -1494,7 +1492,7 @@ } if (WizardMode) { - tty->print_cr("Node area used: %dKb", (area_top - area_bottom) / 1024); + tty->print_cr("Node area used: " INTX_FORMAT "Kb", (intx)((area_top - area_bottom) / 1024)); } reset(); } diff --git a/src/share/vm/runtime/frame.cpp b/src/share/vm/runtime/frame.cpp --- a/src/share/vm/runtime/frame.cpp +++ b/src/share/vm/runtime/frame.cpp @@ -50,9 +50,6 @@ #include "runtime/thread.inline.hpp" #include "utilities/decoder.hpp" - -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - RegisterMap::RegisterMap(JavaThread *thread, bool update_map) { _thread = thread; _update_map = update_map; @@ -112,7 +109,7 @@ if (src != NULL) { r->print_on(st); - st->print(" [" INTPTR_FORMAT "] = ", src); + st->print(" [" INTPTR_FORMAT "] = ", p2i(src)); if (((uintptr_t)src & (sizeof(*src)-1)) != 0) { st->print_cr(""); } else { @@ -494,9 +491,10 @@ NOT_PRODUCT(address begin = pc()-40;) NOT_PRODUCT(address end = NULL;) - st->print("%s frame (sp=" INTPTR_FORMAT " unextended sp=" INTPTR_FORMAT, print_name(), sp(), unextended_sp()); + st->print("%s frame (sp=" INTPTR_FORMAT " unextended sp=" INTPTR_FORMAT, print_name(), p2i(sp()), p2i(unextended_sp())); if (sp() != NULL) - st->print(", fp=" INTPTR_FORMAT ", real_fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT, fp(), real_fp(), pc()); + st->print(", fp=" INTPTR_FORMAT ", real_fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT, + p2i(fp()), p2i(real_fp()), p2i(pc())); if (StubRoutines::contains(pc())) { st->print_cr(")"); @@ -569,15 +567,15 @@ st->print_cr("]"); } // monitor - st->print_cr(" - monitor[" INTPTR_FORMAT "]", interpreter_frame_monitor_begin()); + st->print_cr(" - monitor[" INTPTR_FORMAT "]", p2i(interpreter_frame_monitor_begin())); // bcp - st->print(" - bcp [" INTPTR_FORMAT "]", interpreter_frame_bcp()); + st->print(" - bcp [" INTPTR_FORMAT "]", p2i(interpreter_frame_bcp())); st->fill_to(23); st->print_cr("; @%d", interpreter_frame_bci()); // locals - st->print_cr(" - locals [" INTPTR_FORMAT "]", interpreter_frame_local_at(0)); + st->print_cr(" - locals [" INTPTR_FORMAT "]", p2i(interpreter_frame_local_at(0))); // method - st->print(" - method [" INTPTR_FORMAT "]", (address)interpreter_frame_method()); + st->print(" - method [" INTPTR_FORMAT "]", p2i(interpreter_frame_method())); st->fill_to(23); st->print("; "); interpreter_frame_method()->print_name(st); @@ -606,7 +604,7 @@ while ((p2 = strstr(p1, os::file_separator())) != NULL) p1 = p2 + len; st->print(" [%s+0x%x]", p1, offset); } else { - st->print(" " PTR_FORMAT, pc); + st->print(" " PTR_FORMAT, p2i(pc)); } // function name - os::dll_address_to_function_name() may return confusing @@ -645,14 +643,14 @@ st->print("j %s", buf); st->print("+%d", this->interpreter_frame_bci()); } else { - st->print("j " PTR_FORMAT, pc()); + st->print("j " PTR_FORMAT, p2i(pc())); } } else if (StubRoutines::contains(pc())) { StubCodeDesc* desc = StubCodeDesc::desc_for(pc()); if (desc != NULL) { st->print("v ~StubRoutines::%s", desc->name()); } else { - st->print("v ~StubRoutines::" PTR_FORMAT, pc()); + st->print("v ~StubRoutines::" PTR_FORMAT, p2i(pc())); } } else if (_cb->is_buffer_blob()) { st->print("v ~BufferBlob::%s", ((BufferBlob *)_cb)->name()); @@ -661,12 +659,12 @@ Method* m = nm->method(); if (m != NULL) { m->name_and_sig_as_C_string(buf, buflen); - st->print("J %d%s %s %s (%d bytes) @ " PTR_FORMAT " [" PTR_FORMAT "+0x%x]", + st->print("J %d%s %s %s (%d bytes) @ " PTR_FORMAT " [" PTR_FORMAT "+" SIZE_FORMAT_HEX "]", nm->compile_id(), (nm->is_osr_method() ? "%" : ""), ((nm->compiler() != NULL) ? nm->compiler()->name() : ""), - buf, m->code_size(), _pc, _cb->code_begin(), _pc - _cb->code_begin()); + buf, m->code_size(), p2i(_pc), p2i(_cb->code_begin()), (size_t)(_pc - _cb->code_begin())); } else { - st->print("J " PTR_FORMAT, pc()); + st->print("J " PTR_FORMAT, p2i(pc())); } } else if (_cb->is_runtime_stub()) { st->print("v ~RuntimeStub::%s", ((RuntimeStub *)_cb)->name()); @@ -677,7 +675,7 @@ } else if (_cb->is_safepoint_stub()) { st->print("v ~SafepointBlob"); } else { - st->print("v blob " PTR_FORMAT, pc()); + st->print("v blob " PTR_FORMAT, p2i(pc())); } } else { print_C_frame(st, buf, buflen, pc()); @@ -998,7 +996,8 @@ } }; -void frame::oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f) { +void frame::oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, + const RegisterMap* reg_map, OopClosure* f) { ResourceMark rm; CompiledArgumentOopFinder finder(signature, has_receiver, has_appendix, f, *this, reg_map); finder.oops_do(); @@ -1022,7 +1021,7 @@ return NULL; } oop r = *oop_adr; - assert(Universe::heap()->is_in_or_null(r), "bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", (void *) r, (void *) r); + assert(Universe::heap()->is_in_or_null(r), "bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", p2i(r), p2i(r)); return r; } @@ -1321,7 +1320,7 @@ nmethod* nm = cb()->as_nmethod_or_null(); values.describe(-1, info_address, FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s", frame_no, - nm, nm->method()->name_and_sig_as_C_string(), + p2i(nm), nm->method()->name_and_sig_as_C_string(), (_deopt_state == is_deoptimized) ? " (deoptimized)" : ((_deopt_state == unknown) ? " (state unknown)" : "")), @@ -1331,7 +1330,7 @@ nmethod* nm = cb()->as_nmethod_or_null(); values.describe(-1, info_address, FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for native method %s", frame_no, - nm, nm->method()->name_and_sig_as_C_string()), 2); + p2i(nm), nm->method()->name_and_sig_as_C_string()), 2); } else { // provide default info if not handled before char *info = (char *) "special frame"; @@ -1388,8 +1387,8 @@ if (prev.location == fv.location) { if (fv.owner != prev.owner) { tty->print_cr("overlapping storage"); - tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", prev.location, *prev.location, prev.description); - tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", fv.location, *fv.location, fv.description); + tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", p2i(prev.location), *prev.location, prev.description); + tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", p2i(fv.location), *fv.location, fv.description); error = true; } } else { @@ -1433,14 +1432,14 @@ for (int i = max_index; i >= min_index; i--) { FrameValue fv = _values.at(i); while (cur > fv.location) { - tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT, cur, *cur); + tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT, p2i(cur), *cur); cur--; } if (last == fv.location) { const char* spacer = " " LP64_ONLY(" "); tty->print_cr(" %s %s %s", spacer, spacer, fv.description); } else { - tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", fv.location, *fv.location, fv.description); + tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", p2i(fv.location), *fv.location, fv.description); last = fv.location; cur--; } diff --git a/src/share/vm/runtime/handles.cpp b/src/share/vm/runtime/handles.cpp --- a/src/share/vm/runtime/handles.cpp +++ b/src/share/vm/runtime/handles.cpp @@ -36,7 +36,7 @@ oop* HandleArea::allocate_handle(oop obj) { assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark"); assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark"); - assert(obj->is_oop(), "not an oop: " INTPTR_FORMAT, (intptr_t*) obj); + assert(obj->is_oop(), "not an oop: " INTPTR_FORMAT, p2i(obj)); return real_allocate_handle(obj); } @@ -85,10 +85,9 @@ // The thread local handle areas should not get very large if (TraceHandleAllocation && (size_t)handles_visited > TotalHandleAllocationLimit) { #ifdef ASSERT - warning("%d: Visited in HandleMark : %d", - _nof_handlemarks, handles_visited); + warning("%d: Visited in HandleMark : " SIZE_FORMAT, _nof_handlemarks, handles_visited); #else - warning("Visited in HandleMark : %d", handles_visited); + warning("Visited in HandleMark : " SIZE_FORMAT, handles_visited); #endif } if (_prev != NULL) _prev->oops_do(f); @@ -137,10 +136,10 @@ handles /= sizeof(void *); // Adjust for size of a handle if (handles > HandleAllocationLimit) { // Note: _nof_handlemarks is only set in debug mode - warning("%d: Allocated in HandleMark : %d", _nof_handlemarks, handles); + warning("%d: Allocated in HandleMark : " SIZE_FORMAT, _nof_handlemarks, handles); } - tty->print_cr("Handles %d", handles); + tty->print_cr("Handles " SIZE_FORMAT, handles); } #endif diff --git a/src/share/vm/runtime/interfaceSupport.cpp b/src/share/vm/runtime/interfaceSupport.cpp --- a/src/share/vm/runtime/interfaceSupport.cpp +++ b/src/share/vm/runtime/interfaceSupport.cpp @@ -36,8 +36,6 @@ #include "runtime/vframe.hpp" #include "utilities/preserveException.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // Implementation of InterfaceSupport #ifdef ASSERT @@ -73,7 +71,7 @@ } void InterfaceSupport::trace(const char* result_type, const char* header) { - tty->print_cr("%6d %s", _number_of_calls, header); + tty->print_cr("%6ld %s", _number_of_calls, header); } void InterfaceSupport::gc_alot() { @@ -109,8 +107,7 @@ if (FullGCALotInterval > 1) { _fullgc_alot_counter = 1+(long)((double)FullGCALotInterval*os::random()/(max_jint+1.0)); if (PrintGCDetails && Verbose) { - tty->print_cr("Full gc no: %u\tInterval: %d", invocations, - _fullgc_alot_counter); + tty->print_cr("Full gc no: %u\tInterval: %ld", invocations, _fullgc_alot_counter); } } else { _fullgc_alot_counter = 1; @@ -130,8 +127,7 @@ if (ScavengeALotInterval > 1) { _scavenge_alot_counter = 1+(long)((double)ScavengeALotInterval*os::random()/(max_jint+1.0)); if (PrintGCDetails && Verbose) { - tty->print_cr("Scavenge no: %u\tInterval: %d", invocations, - _scavenge_alot_counter); + tty->print_cr("Scavenge no: %u\tInterval: %ld", invocations, _scavenge_alot_counter); } } else { _scavenge_alot_counter = 1; diff --git a/src/share/vm/runtime/java.cpp b/src/share/vm/runtime/java.cpp --- a/src/share/vm/runtime/java.cpp +++ b/src/share/vm/runtime/java.cpp @@ -80,8 +80,6 @@ #include "opto/runtime.hpp" #endif -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - GrowableArray* collected_profiled_methods; int compare_methods(Method** a, Method** b) { @@ -159,7 +157,7 @@ collected_invoked_methods->sort(&compare_methods); // tty->cr(); - tty->print_cr("Histogram Over MethodOop Invocation Counters (cutoff = %d):", MethodHistogramCutoff); + tty->print_cr("Histogram Over MethodOop Invocation Counters (cutoff = " INTX_FORMAT "):", MethodHistogramCutoff); tty->cr(); tty->print_cr("____Count_(I+C)____Method________________________Module_________________"); unsigned total = 0, int_total = 0, comp_total = 0, static_total = 0, final_total = 0, diff --git a/src/share/vm/runtime/os.cpp b/src/share/vm/runtime/os.cpp --- a/src/share/vm/runtime/os.cpp +++ b/src/share/vm/runtime/os.cpp @@ -61,8 +61,6 @@ # include -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - OSThread* os::_starting_thread = NULL; address os::_polling_page = NULL; volatile int32_t* os::_mem_serialize_page = NULL; @@ -621,12 +619,12 @@ ptr = guarded.get_user_ptr(); #endif if ((intptr_t)ptr == (intptr_t)MallocCatchPtr) { - tty->print_cr("os::malloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, ptr); + tty->print_cr("os::malloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, p2i(ptr)); breakpoint(); } debug_only(if (paranoid) verify_memory(ptr)); if (PrintMalloc && tty != NULL) { - tty->print_cr("os::malloc " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, ptr); + tty->print_cr("os::malloc " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, p2i(ptr)); } // we do not track guard memory @@ -658,7 +656,7 @@ return os::malloc(size, memflags, stack); } if ((intptr_t)memblock == (intptr_t)MallocCatchPtr) { - tty->print_cr("os::realloc caught " PTR_FORMAT, memblock); + tty->print_cr("os::realloc caught " PTR_FORMAT, p2i(memblock)); breakpoint(); } // NMT support @@ -671,7 +669,7 @@ // always move the block void* ptr = os::malloc(size, memflags, stack); if (PrintMalloc && tty != NULL) { - tty->print_cr("os::realloc " SIZE_FORMAT " bytes, " PTR_FORMAT " --> " PTR_FORMAT, size, memblock, ptr); + tty->print_cr("os::realloc " SIZE_FORMAT " bytes, " PTR_FORMAT " --> " PTR_FORMAT, size, p2i(memblock), p2i(ptr)); } // Copy to new memory if malloc didn't fail if ( ptr != NULL ) { @@ -681,7 +679,7 @@ memcpy(ptr, memblock, MIN2(size, memblock_size)); if (paranoid) verify_memory(MemTracker::malloc_base(ptr)); if ((intptr_t)ptr == (intptr_t)MallocCatchPtr) { - tty->print_cr("os::realloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, ptr); + tty->print_cr("os::realloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, p2i(ptr)); breakpoint(); } os::free(memblock); @@ -696,7 +694,7 @@ #ifdef ASSERT if (memblock == NULL) return; if ((intptr_t)memblock == (intptr_t)MallocCatchPtr) { - if (tty != NULL) tty->print_cr("os::free caught " PTR_FORMAT, memblock); + if (tty != NULL) tty->print_cr("os::free caught " PTR_FORMAT, p2i(memblock)); breakpoint(); } void* membase = MemTracker::record_free(memblock); @@ -796,7 +794,7 @@ } address p = start; - st->print(PTR_FORMAT ": ", start); + st->print(PTR_FORMAT ": ", p2i(start)); while (p < end) { switch (unitsize) { case 1: st->print("%02x", *(u1*)p); break; @@ -809,7 +807,7 @@ if (cols >= cols_per_line && p < end) { cols = 0; st->cr(); - st->print(PTR_FORMAT ": ", p); + st->print(PTR_FORMAT ": ", p2i(p)); } else { st->print(" "); } @@ -856,9 +854,9 @@ size_t mem = physical_memory()/G; if (mem == 0) { // for low memory systems mem = physical_memory()/M; - st->print("%d cores, %dM, ", processor_count(), mem); + st->print("%d cores, " SIZE_FORMAT "M, ", processor_count(), mem); } else { - st->print("%d cores, %dG, ", processor_count(), mem); + st->print("%d cores, " SIZE_FORMAT "G, ", processor_count(), mem); } get_summary_os_info(buf, buflen); st->print_raw(buf); @@ -914,41 +912,40 @@ // the interpreter is generated into a buffer blob InterpreterCodelet* i = Interpreter::codelet_containing(addr); if (i != NULL) { - st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an Interpreter codelet", addr, (int)(addr - i->code_begin())); + st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an Interpreter codelet", p2i(addr), (int)(addr - i->code_begin())); i->print_on(st); return; } if (Interpreter::contains(addr)) { st->print_cr(INTPTR_FORMAT " is pointing into interpreter code" - " (not bytecode specific)", addr); + " (not bytecode specific)", p2i(addr)); return; } // if (AdapterHandlerLibrary::contains(b)) { - st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an AdapterHandler", addr, (int)(addr - b->code_begin())); + st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an AdapterHandler", p2i(addr), (int)(addr - b->code_begin())); AdapterHandlerLibrary::print_handler_on(st, b); } // the stubroutines are generated into a buffer blob StubCodeDesc* d = StubCodeDesc::desc_for(addr); if (d != NULL) { - st->print_cr(INTPTR_FORMAT " is at begin+%d in a stub", addr, (int)(addr - d->begin())); + st->print_cr(INTPTR_FORMAT " is at begin+%d in a stub", p2i(addr), (int)(addr - d->begin())); d->print_on(st); st->cr(); return; } if (StubRoutines::contains(addr)) { - st->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) " - "stub routine", addr); + st->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) stub routine", p2i(addr)); return; } // the InlineCacheBuffer is using stubs generated into a buffer blob if (InlineCacheBuffer::contains(addr)) { - st->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", addr); + st->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", p2i(addr)); return; } VtableStub* v = VtableStubs::stub_containing(addr); if (v != NULL) { - st->print_cr(INTPTR_FORMAT " is at entry_point+%d in a vtable stub", addr, (int)(addr - v->entry_point())); + st->print_cr(INTPTR_FORMAT " is at entry_point+%d in a vtable stub", p2i(addr), (int)(addr - v->entry_point())); v->print_on(st); st->cr(); return; @@ -958,7 +955,7 @@ if (nm != NULL) { ResourceMark rm; st->print(INTPTR_FORMAT " is at entry_point+%d in (nmethod*)" INTPTR_FORMAT, - addr, (int)(addr - nm->entry_point()), nm); + p2i(addr), (int)(addr - nm->entry_point()), p2i(nm)); if (verbose) { st->print(" for "); nm->method()->print_value_on(st); @@ -967,7 +964,7 @@ nm->print_nmethod(verbose); return; } - st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", addr, (int)(addr - b->code_begin())); + st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", p2i(addr), (int)(addr - b->code_begin())); b->print_on(st); return; } @@ -985,9 +982,9 @@ } if (print) { if (p == (HeapWord*) addr) { - st->print_cr(INTPTR_FORMAT " is an oop", addr); + st->print_cr(INTPTR_FORMAT " is an oop", p2i(addr)); } else { - st->print_cr(INTPTR_FORMAT " is pointing into object: " INTPTR_FORMAT, addr, p); + st->print_cr(INTPTR_FORMAT " is pointing into object: " INTPTR_FORMAT, p2i(addr), p2i(p)); } oop(p)->print_on(st); return; @@ -995,22 +992,22 @@ } else { if (Universe::heap()->is_in_reserved(addr)) { st->print_cr(INTPTR_FORMAT " is an unallocated location " - "in the heap", addr); + "in the heap", p2i(addr)); return; } } if (JNIHandles::is_global_handle((jobject) addr)) { - st->print_cr(INTPTR_FORMAT " is a global jni handle", addr); + st->print_cr(INTPTR_FORMAT " is a global jni handle", p2i(addr)); return; } if (JNIHandles::is_weak_global_handle((jobject) addr)) { - st->print_cr(INTPTR_FORMAT " is a weak global jni handle", addr); + st->print_cr(INTPTR_FORMAT " is a weak global jni handle", p2i(addr)); return; } #ifndef PRODUCT // we don't keep the block list in product mode if (JNIHandleBlock::any_contains((jobject) addr)) { - st->print_cr(INTPTR_FORMAT " is a local jni handle", addr); + st->print_cr(INTPTR_FORMAT " is a local jni handle", p2i(addr)); return; } #endif @@ -1020,7 +1017,7 @@ if (thread->privileged_stack_top() != NULL && thread->privileged_stack_top()->contains(addr)) { st->print_cr(INTPTR_FORMAT " is pointing into the privilege stack " - "for thread: " INTPTR_FORMAT, addr, thread); + "for thread: " INTPTR_FORMAT, p2i(addr), p2i(thread)); if (verbose) thread->print_on(st); return; } @@ -1029,7 +1026,7 @@ if (verbose) { thread->print_on(st); } else { - st->print_cr(INTPTR_FORMAT " is a thread", addr); + st->print_cr(INTPTR_FORMAT " is a thread", p2i(addr)); } return; } @@ -1038,7 +1035,7 @@ if (thread->stack_base() >= addr && addr > (thread->stack_base() - thread->stack_size())) { st->print_cr(INTPTR_FORMAT " is pointing into the stack for thread: " - INTPTR_FORMAT, addr, thread); + INTPTR_FORMAT, p2i(addr), p2i(thread)); if (verbose) thread->print_on(st); return; } @@ -1052,7 +1049,7 @@ st->cr(); } else { // Use addr->print() from the debugger instead (not here) - st->print_cr(INTPTR_FORMAT " is pointing into metadata", addr); + st->print_cr(INTPTR_FORMAT " is pointing into metadata", p2i(addr)); } return; } @@ -1062,7 +1059,7 @@ return; } - st->print_cr(INTPTR_FORMAT " is an unknown value", addr); + st->print_cr(INTPTR_FORMAT " is an unknown value", p2i(addr)); } // Looks like all platforms except IA64 can use the same function to check @@ -1461,7 +1458,7 @@ " pg_sz=" SIZE_FORMAT " base=" PTR_FORMAT " size=" SIZE_FORMAT, str, region_min_size, region_max_size, - page_size, base, size); + page_size, p2i(base), size); } } #endif // #ifndef PRODUCT diff --git a/src/share/vm/runtime/osThread.cpp b/src/share/vm/runtime/osThread.cpp --- a/src/share/vm/runtime/osThread.cpp +++ b/src/share/vm/runtime/osThread.cpp @@ -26,8 +26,6 @@ #include "oops/oop.inline.hpp" #include "runtime/osThread.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - OSThread::OSThread(OSThreadStartFunc start_proc, void* start_parm) { pd_initialize(); set_start_proc(start_proc); @@ -41,7 +39,7 @@ // Printing void OSThread::print_on(outputStream *st) const { - st->print("nid=0x%lx ", thread_id()); + st->print("nid=0x%x ", thread_id()); switch (_state) { case ALLOCATED: st->print("allocated "); break; case INITIALIZED: st->print("initialized "); break; diff --git a/src/share/vm/runtime/perfData.cpp b/src/share/vm/runtime/perfData.cpp --- a/src/share/vm/runtime/perfData.cpp +++ b/src/share/vm/runtime/perfData.cpp @@ -34,8 +34,6 @@ #include "utilities/exceptions.hpp" #include "utilities/globalDefinitions.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - PerfDataList* PerfDataManager::_all = NULL; PerfDataList* PerfDataManager::_sampled = NULL; PerfDataList* PerfDataManager::_constants = NULL; @@ -170,14 +168,14 @@ if (PerfTraceDataCreation) { tty->print("name = %s, dtype = %d, variability = %d," - " units = %d, dsize = %d, vlen = %d," - " pad_length = %d, size = %d, on_c_heap = %s," + " units = %d, dsize = " SIZE_FORMAT ", vlen = " SIZE_FORMAT "," + " pad_length = " SIZE_FORMAT ", size = " SIZE_FORMAT ", on_c_heap = %s," " address = " INTPTR_FORMAT "," " data address = " INTPTR_FORMAT "\n", cname, dtype, variability(), units(), dsize, vlen, pad_length, size, is_on_c_heap() ? "TRUE":"FALSE", - psmp, valuep); + p2i(psmp), p2i(valuep)); } // record the start of the entry and the location of the data field. diff --git a/src/share/vm/runtime/perfMemory.cpp b/src/share/vm/runtime/perfMemory.cpp --- a/src/share/vm/runtime/perfMemory.cpp +++ b/src/share/vm/runtime/perfMemory.cpp @@ -36,8 +36,6 @@ #include "runtime/statSampler.hpp" #include "utilities/globalDefinitions.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // Prefix of performance data file. const char PERFDATA_NAME[] = "hsperfdata"; @@ -95,8 +93,8 @@ os::vm_allocation_granularity()); if (PerfTraceMemOps) { - tty->print("PerfDataMemorySize = " SIZE_FORMAT "," - " os::vm_allocation_granularity = " SIZE_FORMAT "," + tty->print("PerfDataMemorySize = " INTX_FORMAT "," + " os::vm_allocation_granularity = %d," " adjusted size = " SIZE_FORMAT "\n", PerfDataMemorySize, os::vm_allocation_granularity(), @@ -129,7 +127,7 @@ if (PerfTraceMemOps) { tty->print("PerfMemory created: address = " INTPTR_FORMAT "," " size = " SIZE_FORMAT "\n", - (void*)_start, + p2i(_start), _capacity); } diff --git a/src/share/vm/runtime/safepoint.cpp b/src/share/vm/runtime/safepoint.cpp --- a/src/share/vm/runtime/safepoint.cpp +++ b/src/share/vm/runtime/safepoint.cpp @@ -63,8 +63,6 @@ #include "c1/c1_globals.hpp" #endif -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // -------------------------------------------------------------------------------------------------- // Implementation of Safepoint begin/end @@ -893,7 +891,7 @@ case _running: default: tty->print_cr("restart thread " INTPTR_FORMAT " with state %d", - _thread, _type); + p2i(_thread), _type); _thread->print(); ShouldNotReachHere(); } @@ -915,7 +913,7 @@ st->print_cr("Thread: " INTPTR_FORMAT " [0x%2x] State: %s _has_called_back %d _at_poll_safepoint %d", - _thread, _thread->osthread()->thread_id(), s, _has_called_back, + p2i(_thread), _thread->osthread()->thread_id(), s, _has_called_back, _at_poll_safepoint); _thread->print_thread_state_on(st); @@ -934,7 +932,7 @@ // Step 1: Find the nmethod from the return address if (ShowSafepointMsgs && Verbose) { - tty->print_cr("Polling page exception at " INTPTR_FORMAT, thread()->saved_exception_pc()); + tty->print_cr("Polling page exception at " INTPTR_FORMAT, p2i(thread()->saved_exception_pc())); } address real_return_addr = thread()->saved_exception_pc(); @@ -1241,7 +1239,7 @@ if (!need_to_track_page_armed_status) { tty->print_cr("Polling page always armed"); } else { - tty->print_cr("Defer polling page loop count = %d\n", + tty->print_cr("Defer polling page loop count = " INTX_FORMAT "\n", DeferPollingPageLoopCount); } diff --git a/src/share/vm/runtime/signature.cpp b/src/share/vm/runtime/signature.cpp --- a/src/share/vm/runtime/signature.cpp +++ b/src/share/vm/runtime/signature.cpp @@ -32,8 +32,6 @@ #include "oops/typeArrayKlass.hpp" #include "runtime/signature.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // Implementation of SignatureIterator // Signature syntax: @@ -209,7 +207,7 @@ return; break; default: - tty->print_cr("*** parameter is %d", fingerprint & parameter_feature_mask); + tty->print_cr("*** parameter is " INT64_FORMAT, fingerprint & parameter_feature_mask); tty->print_cr("*** fingerprint is " PTR64_FORMAT, saved_fingerprint); ShouldNotReachHere(); break; diff --git a/src/share/vm/runtime/sweeper.cpp b/src/share/vm/runtime/sweeper.cpp --- a/src/share/vm/runtime/sweeper.cpp +++ b/src/share/vm/runtime/sweeper.cpp @@ -43,8 +43,6 @@ #include "utilities/ticks.inline.hpp" #include "utilities/xmlstream.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - #ifdef ASSERT #define SWEEP(nm) record_sweep(nm, __LINE__) @@ -62,12 +60,12 @@ void print() { tty->print_cr("traversal = %d compile_id = %d %s uep = " PTR_FORMAT " vep = " - PTR_FORMAT " state = %d traversal_mark %d line = %d", + PTR_FORMAT " state = %d traversal_mark %ld line = %d", traversal, compile_id, kind == NULL ? "" : kind, - uep, - vep, + p2i(uep), + p2i(vep), state, traversal_mark, line); @@ -223,7 +221,7 @@ _total_time_this_sweep = Tickspan(); if (PrintMethodFlushing) { - tty->print_cr("### Sweep: stack traversal %d", _traversals); + tty->print_cr("### Sweep: stack traversal %ld", _traversals); } Threads::nmethods_do(&mark_activation_closure); @@ -482,7 +480,7 @@ #ifdef ASSERT if(PrintMethodFlushing) { - tty->print_cr("### sweeper: sweep time(%d): ", (jlong)sweep_time.value()); + tty->print_cr("### sweeper: sweep time(" INT64_FORMAT "): ", (jlong)sweep_time.value()); } #endif @@ -592,14 +590,14 @@ if (nm->is_marked_for_reclamation()) { assert(!nm->is_locked_by_vm(), "must not flush locked nmethods"); if (PrintMethodFlushing && Verbose) { - tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (marked for reclamation) being flushed", nm->compile_id(), nm); + tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (marked for reclamation) being flushed", nm->compile_id(), p2i(nm)); } release_nmethod(nm); assert(result == None, "sanity"); result = Flushed; } else { if (PrintMethodFlushing && Verbose) { - tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (zombie) being marked for reclamation", nm->compile_id(), nm); + tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (zombie) being marked for reclamation", nm->compile_id(), p2i(nm)); } nm->mark_for_reclamation(); // Keep track of code cache state change @@ -619,7 +617,7 @@ nm->clear_ic_stubs(); } if (PrintMethodFlushing && Verbose) { - tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), nm); + tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), p2i(nm)); } // Code cache state change is tracked in make_zombie() nm->make_zombie(); @@ -636,7 +634,7 @@ } else if (nm->is_unloaded()) { // Unloaded code, just make it a zombie if (PrintMethodFlushing && Verbose) { - tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (unloaded) being made zombie", nm->compile_id(), nm); + tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (unloaded) being made zombie", nm->compile_id(), p2i(nm)); } if (nm->is_osr_method()) { SWEEP(nm); @@ -743,7 +741,7 @@ // Code cache state change is tracked in make_not_entrant() if (PrintMethodFlushing && Verbose) { tty->print_cr("### Nmethod %d/" PTR_FORMAT "made not-entrant: hotness counter %d/%d threshold %f", - nm->compile_id(), nm, nm->hotness_counter(), reset_val, threshold); + nm->compile_id(), p2i(nm), nm->hotness_counter(), reset_val, threshold); } } } diff --git a/src/share/vm/services/writeableFlags.cpp b/src/share/vm/services/writeableFlags.cpp --- a/src/share/vm/services/writeableFlags.cpp +++ b/src/share/vm/services/writeableFlags.cpp @@ -89,10 +89,7 @@ break; } - PRAGMA_DIAG_PUSH - PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL - err_msg.print(buffer); - PRAGMA_DIAG_POP + err_msg.print("%s", buffer); } // set a boolean global flag @@ -295,7 +292,8 @@ } // a writeable flag setter accepting 'jvalue' values -Flag::Error WriteableFlags::set_flag_from_jvalue(Flag* f, const void* value, Flag::Flags origin, FormatBuffer<80>& err_msg) { +Flag::Error WriteableFlags::set_flag_from_jvalue(Flag* f, const void* value, Flag::Flags origin, + FormatBuffer<80>& err_msg) { jvalue new_value = *(jvalue*)value; if (f->is_bool()) { bool bvalue = (new_value.z == JNI_TRUE ? true : false); diff --git a/src/share/vm/utilities/vmError.cpp b/src/share/vm/utilities/vmError.cpp --- a/src/share/vm/utilities/vmError.cpp +++ b/src/share/vm/utilities/vmError.cpp @@ -45,8 +45,6 @@ #include "utilities/top.hpp" #include "utilities/vmError.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // List of environment variables that should be reported in error log file. const char *env_list[] = { // All platforms @@ -284,14 +282,14 @@ // error handler after a secondary crash works. STEP(20, "(test secondary crash 1)") if (_verbose && TestCrashInErrorHandler != 0) { - st->print_cr("Will crash now (TestCrashInErrorHandler=%d)...", + st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", TestCrashInErrorHandler); controlled_crash(TestCrashInErrorHandler); } STEP(30, "(test secondary crash 2)") if (_verbose && TestCrashInErrorHandler != 0) { - st->print_cr("Will crash now (TestCrashInErrorHandler=%d)...", + st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", TestCrashInErrorHandler); controlled_crash(TestCrashInErrorHandler); } @@ -360,7 +358,7 @@ if (os::exception_name(_id, buf, sizeof(buf))) { st->print("%s", buf); st->print(" (0x%x)", _id); // signal number - st->print(" at pc=" PTR_FORMAT, _pc); + st->print(" at pc=" PTR_FORMAT, p2i(_pc)); } else { if (should_report_bug(_id)) { st->print("Internal Error"); @@ -495,7 +493,7 @@ // current thread if (_verbose) { if (_thread) { - st->print("Current thread (" PTR_FORMAT "): ", _thread); + st->print("Current thread (" PTR_FORMAT "): ", p2i(_thread)); _thread->print_on_error(st, buf, sizeof(buf)); st->cr(); } else { @@ -534,13 +532,13 @@ } address stack_bottom = stack_top - stack_size; - st->print("[" PTR_FORMAT "," PTR_FORMAT "]", stack_bottom, stack_top); + st->print("[" PTR_FORMAT "," PTR_FORMAT "]", p2i(stack_bottom), p2i(stack_top)); frame fr = _context ? os::fetch_frame_from_context(_context) : os::current_frame(); if (fr.sp()) { - st->print(", sp=" PTR_FORMAT, fr.sp()); + st->print(", sp=" PTR_FORMAT, p2i(fr.sp())); size_t free_stack_size = pointer_delta(fr.sp(), stack_bottom, 1024); st->print(", free space=" SIZE_FORMAT "k", free_stack_size); } @@ -574,7 +572,7 @@ if (_verbose && _thread && (_thread->is_Named_thread())) { JavaThread* jt = ((NamedThread *)_thread)->processed_thread(); if (jt != NULL) { - st->print_cr("JavaThread " PTR_FORMAT " (nid = " UINTX_FORMAT ") was being processed", jt, jt->osthread()->thread_id()); + st->print_cr("JavaThread " PTR_FORMAT " (nid = %d) was being processed", p2i(jt), jt->osthread()->thread_id()); print_stack_trace(st, jt, buf, sizeof(buf), true); } } @@ -686,7 +684,7 @@ Universe::heap()->print_on_error(st); st->cr(); - st->print_cr("Polling page: " INTPTR_FORMAT, os::get_polling_page()); + st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page())); st->cr(); }