# HG changeset patch # User david # Date 1442843925 -7200 # Mon Sep 21 15:58:45 2015 +0200 # Node ID 859e6763588f4088281d06fee11a6eb241d3de25 # Parent e144340c417a6920c720e8f91ea3d496920b187d imported patch assert diff --git a/src/share/vm/runtime/vm_version.cpp b/src/share/vm/runtime/vm_version.cpp --- a/src/share/vm/runtime/vm_version.cpp +++ b/src/share/vm/runtime/vm_version.cpp @@ -154,8 +154,9 @@ #endif } - const char* Abstract_VM_Version::vm_info_string() { + vmassert2(false, "Apa %s %d", "björn", 5); + vmassert2(false, "banan"); if (CodeCacheExtensions::use_pregenerated_interpreter()) { return "interpreted mode, pregenerated"; } diff --git a/src/share/vm/utilities/debug.cpp b/src/share/vm/utilities/debug.cpp --- a/src/share/vm/utilities/debug.cpp +++ b/src/share/vm/utilities/debug.cpp @@ -81,10 +81,10 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC FormatBufferResource::FormatBufferResource(const char * format, ...) - : FormatBufferBase((char*)resource_allocate_bytes(RES_BUFSZ)) { + : FormatBufferBase((char*)resource_allocate_bytes(BUFSZ)) { va_list argp; va_start(argp, format); - jio_vsnprintf(_buf, RES_BUFSZ, format, argp); + jio_vsnprintf(_buf, BUFSZ, format, argp); va_end(argp); } @@ -216,6 +216,20 @@ err.report_and_die(); } +void report_vm_error2(const char* file, int line, const char* error_msg, ...) +{ + char detail_msg[BUFSZ]; + va_list args; + char* format; + + va_start(args, error_msg); + format = va_arg(args, char*); + jio_vsnprintf(detail_msg, BUFSZ, format, args); + va_end(args); + + report_vm_error(file, line, error_msg, detail_msg); +} + void report_fatal(const char* file, int line, const char* message) { report_vm_error(file, line, "fatal error", message); diff --git a/src/share/vm/utilities/debug.hpp b/src/share/vm/utilities/debug.hpp --- a/src/share/vm/utilities/debug.hpp +++ b/src/share/vm/utilities/debug.hpp @@ -40,14 +40,14 @@ }; // Use resource area for buffer -#define RES_BUFSZ 256 +#define BUFSZ 256 class FormatBufferResource : public FormatBufferBase { public: FormatBufferResource(const char * format, ...) ATTRIBUTE_PRINTF(2, 3); }; // Use stack for buffer -template +template class FormatBuffer : public FormatBufferBase { public: inline FormatBuffer(const char * format, ...) ATTRIBUTE_PRINTF(2, 3); @@ -112,6 +112,7 @@ // assertions #ifndef ASSERT #define vmassert(p, msg) +#define vmassert2(p, ...) #else // Note: message says "assert" rather than "vmassert" for backward // compatibility with tools that parse/match the message text. @@ -122,10 +123,20 @@ BREAKPOINT; \ } \ } while (0) + +#define vmassert2(p, ...) \ +do { \ + if (!(p)) { \ + report_vm_error2(__FILE__, __LINE__, "assert(" #p ") failed", __VA_ARGS__); \ + BREAKPOINT; \ + } \ +} while (0) + #endif // For backward compatibility. #define assert(p, msg) vmassert(p, msg) +#define assert2(p, ...) vmassert2(p, __VA_ARGS__) // This version of vmassert is for use with checking return status from // library calls that return actual error values eg. EINVAL, @@ -199,6 +210,7 @@ // error reporting helper functions void report_vm_error(const char* file, int line, const char* error_msg, const char* detail_msg = NULL); +void report_vm_error2(const char* file, int line, const char* error_msg, ...); void report_fatal(const char* file, int line, const char* message); void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type, const char* message); # HG changeset patch # User david # Date 1442843926 -7200 # Mon Sep 21 15:58:46 2015 +0200 # Node ID 6bf67b4ae97f6cf13ced31814f951624870a8489 # Parent 859e6763588f4088281d06fee11a6eb241d3de25 imported patch remove_err_msg diff --git a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp --- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -2238,7 +2238,7 @@ ttyLocker ttyl; ::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n", msg); - assert(false, err_msg("DEBUG MESSAGE: %s", msg)); + assert(false, "DEBUG MESSAGE: %s", msg); } } diff --git a/src/cpu/aarch64/vm/methodHandles_aarch64.cpp b/src/cpu/aarch64/vm/methodHandles_aarch64.cpp --- a/src/cpu/aarch64/vm/methodHandles_aarch64.cpp +++ b/src/cpu/aarch64/vm/methodHandles_aarch64.cpp @@ -50,7 +50,7 @@ #ifdef ASSERT static int check_nonzero(const char* xname, int x) { - assert(x != 0, err_msg("%s should be nonzero", xname)); + assert(x != 0, "%s should be nonzero", xname); return x; } #define NONZERO(x) check_nonzero(#x, x) diff --git a/src/cpu/ppc/vm/macroAssembler_ppc.cpp b/src/cpu/ppc/vm/macroAssembler_ppc.cpp --- a/src/cpu/ppc/vm/macroAssembler_ppc.cpp +++ b/src/cpu/ppc/vm/macroAssembler_ppc.cpp @@ -4292,7 +4292,7 @@ static void stop_on_request(int tp, const char* msg) { tty->print("PPC assembly code requires stop: (%s) %s\n", stop_types[tp%/*stop_end*/4], msg); - guarantee(false, err_msg("PPC assembly code requires stop: %s", msg)); + guarantee(false, "PPC assembly code requires stop: %s", msg); } // Call a C-function that prints output. diff --git a/src/cpu/ppc/vm/methodHandles_ppc.cpp b/src/cpu/ppc/vm/methodHandles_ppc.cpp --- a/src/cpu/ppc/vm/methodHandles_ppc.cpp +++ b/src/cpu/ppc/vm/methodHandles_ppc.cpp @@ -60,7 +60,7 @@ #ifdef ASSERT static int check_nonzero(const char* xname, int x) { - assert(x != 0, err_msg("%s should be nonzero", xname)); + assert(x != 0, "%s should be nonzero", xname); return x; } #define NONZERO(x) check_nonzero(#x, x) diff --git a/src/cpu/ppc/vm/nativeInst_ppc.cpp b/src/cpu/ppc/vm/nativeInst_ppc.cpp --- a/src/cpu/ppc/vm/nativeInst_ppc.cpp +++ b/src/cpu/ppc/vm/nativeInst_ppc.cpp @@ -149,7 +149,7 @@ if (!NativeCall::is_call_at(addr)) { tty->print_cr("not a NativeCall at " PTR_FORMAT, p2i(addr)); // TODO: PPC port: Disassembler::decode(addr - 20, addr + 20, tty); - fatal(err_msg("not a NativeCall at " PTR_FORMAT, p2i(addr))); + fatal("not a NativeCall at " PTR_FORMAT, p2i(addr)); } } #endif // ASSERT @@ -162,7 +162,7 @@ if (!NativeFarCall::is_far_call_at(addr)) { tty->print_cr("not a NativeFarCall at " PTR_FORMAT, p2i(addr)); // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); - fatal(err_msg("not a NativeFarCall at " PTR_FORMAT, p2i(addr))); + fatal("not a NativeFarCall at " PTR_FORMAT, p2i(addr)); } } #endif // ASSERT @@ -308,7 +308,7 @@ ! MacroAssembler::is_bl(*((int*) addr))) { tty->print_cr("not a NativeMovConstReg at " PTR_FORMAT, p2i(addr)); // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); - fatal(err_msg("not a NativeMovConstReg at " PTR_FORMAT, p2i(addr))); + fatal("not a NativeMovConstReg at " PTR_FORMAT, p2i(addr)); } } } @@ -346,7 +346,7 @@ if (!NativeJump::is_jump_at(addr)) { tty->print_cr("not a NativeJump at " PTR_FORMAT, p2i(addr)); // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty); - fatal(err_msg("not a NativeJump at " PTR_FORMAT, p2i(addr))); + fatal("not a NativeJump at " PTR_FORMAT, p2i(addr)); } } #endif // ASSERT diff --git a/src/cpu/sparc/vm/assembler_sparc.hpp b/src/cpu/sparc/vm/assembler_sparc.hpp --- a/src/cpu/sparc/vm/assembler_sparc.hpp +++ b/src/cpu/sparc/vm/assembler_sparc.hpp @@ -389,7 +389,7 @@ static void assert_signed_range(intptr_t x, int nbits) { assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1)), - err_msg("value out of range: x=" INTPTR_FORMAT ", nbits=%d", x, nbits)); + "value out of range: x=" INTPTR_FORMAT ", nbits=%d", x, nbits); } static void assert_signed_word_disp_range(intptr_t x, int nbits) { diff --git a/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -1596,7 +1596,7 @@ else { ::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n", msg); } - assert(false, err_msg("DEBUG MESSAGE: %s", msg)); + assert(false, "DEBUG MESSAGE: %s", msg); } diff --git a/src/cpu/sparc/vm/methodHandles_sparc.cpp b/src/cpu/sparc/vm/methodHandles_sparc.cpp --- a/src/cpu/sparc/vm/methodHandles_sparc.cpp +++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp @@ -56,7 +56,7 @@ #ifdef ASSERT static int check_nonzero(const char* xname, int x) { - assert(x != 0, err_msg("%s should be nonzero", xname)); + assert(x != 0, "%s should be nonzero", xname); return x; } #define NONZERO(x) check_nonzero(#x, x) diff --git a/src/cpu/sparc/vm/sparc.ad b/src/cpu/sparc/vm/sparc.ad --- a/src/cpu/sparc/vm/sparc.ad +++ b/src/cpu/sparc/vm/sparc.ad @@ -1098,7 +1098,7 @@ Register r = as_Register(ra_->get_encode(this)); CodeSection* consts_section = __ code()->consts(); int consts_size = consts_section->align_at_start(consts_section->size()); - assert(constant_table.size() == consts_size, err_msg("must be: %d == %d", constant_table.size(), consts_size)); + assert(constant_table.size() == consts_size, "must be: %d == %d", constant_table.size(), consts_size); if (UseRDPCForConstantTableBase) { // For the following RDPC logic to work correctly the consts diff --git a/src/cpu/x86/vm/assembler_x86.cpp b/src/cpu/x86/vm/assembler_x86.cpp --- a/src/cpu/x86/vm/assembler_x86.cpp +++ b/src/cpu/x86/vm/assembler_x86.cpp @@ -733,11 +733,11 @@ // these asserts are somewhat nonsensical #ifndef _LP64 assert(which == imm_operand || which == disp32_operand, - err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip))); + "which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip)); #else assert((which == call32_operand || which == imm_operand) && is_64bit || which == narrow_oop_operand && !is_64bit, - err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip))); + "which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip)); #endif // _LP64 return ip; diff --git a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @@ -2684,7 +2684,7 @@ #endif // _LP64 } } else { - fatal(err_msg("unexpected type: %s", basictype_to_str(c->type()))); + fatal("unexpected type: %s", basictype_to_str(c->type())); } // cpu register - address } else if (opr2->is_address()) { diff --git a/src/cpu/x86/vm/macroAssembler_x86.cpp b/src/cpu/x86/vm/macroAssembler_x86.cpp --- a/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -417,7 +417,7 @@ ::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n", msg); } // Don't assert holding the ttyLock - assert(false, err_msg("DEBUG MESSAGE: %s", msg)); + assert(false, "DEBUG MESSAGE: %s", msg); ThreadStateTransition::transition(thread, _thread_in_vm, saved_state); } @@ -883,7 +883,7 @@ ttyLocker ttyl; ::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n", msg); - assert(false, err_msg("DEBUG MESSAGE: %s", msg)); + assert(false, "DEBUG MESSAGE: %s", msg); } } diff --git a/src/cpu/x86/vm/methodHandles_x86.cpp b/src/cpu/x86/vm/methodHandles_x86.cpp --- a/src/cpu/x86/vm/methodHandles_x86.cpp +++ b/src/cpu/x86/vm/methodHandles_x86.cpp @@ -53,7 +53,7 @@ #ifdef ASSERT static int check_nonzero(const char* xname, int x) { - assert(x != 0, err_msg("%s should be nonzero", xname)); + assert(x != 0, "%s should be nonzero", xname); return x; } #define NONZERO(x) check_nonzero(#x, x) diff --git a/src/cpu/x86/vm/register_x86.hpp b/src/cpu/x86/vm/register_x86.hpp --- a/src/cpu/x86/vm/register_x86.hpp +++ b/src/cpu/x86/vm/register_x86.hpp @@ -162,7 +162,7 @@ XMMRegister successor() const { return as_XMMRegister(encoding() + 1); } // accessors - int encoding() const { assert(is_valid(), err_msg("invalid register (%d)", (int)(intptr_t)this )); return (intptr_t)this; } + int encoding() const { assert(is_valid(), "invalid register (%d)", (int)(intptr_t)this ); return (intptr_t)this; } bool is_valid() const { return 0 <= (intptr_t)this && (intptr_t)this < number_of_registers; } const char* name() const; }; @@ -245,7 +245,7 @@ KRegister successor() const { return as_KRegister(encoding() + 1); } // accessors - int encoding() const { assert(is_valid(), err_msg("invalid register (%d)", (int)(intptr_t)this)); return (intptr_t)this; } + int encoding() const { assert(is_valid(), "invalid register (%d)", (int)(intptr_t)this); return (intptr_t)this; } bool is_valid() const { return 0 <= (intptr_t)this && (intptr_t)this < number_of_registers; } const char* name() const; }; diff --git a/src/os/aix/vm/os_aix.cpp b/src/os/aix/vm/os_aix.cpp --- a/src/os/aix/vm/os_aix.cpp +++ b/src/os/aix/vm/os_aix.cpp @@ -3120,8 +3120,8 @@ // libjsig also interposes the sigaction() call below and saves the // old sigaction on it own. } else { - fatal(err_msg("Encountered unexpected pre-existing sigaction handler " - "%#lx for signal %d.", (long)oldhand, sig)); + fatal("Encountered unexpected pre-existing sigaction handler " + "%#lx for signal %d.", (long)oldhand, sig); } } @@ -3699,7 +3699,7 @@ void os::make_polling_page_readable(void) { // Changed according to os_linux.cpp. if (!checked_mprotect((char *)_polling_page, Aix::page_size(), PROT_READ)) { - fatal(err_msg("Could not enable polling page at " PTR_FORMAT, _polling_page)); + fatal("Could not enable polling page at " PTR_FORMAT, _polling_page); } }; diff --git a/src/os/bsd/vm/os_bsd.cpp b/src/os/bsd/vm/os_bsd.cpp --- a/src/os/bsd/vm/os_bsd.cpp +++ b/src/os/bsd/vm/os_bsd.cpp @@ -1977,7 +1977,7 @@ OSXSemaphore::OSXSemaphore(uint value) { kern_return_t ret = SEM_INIT(_semaphore, value); - guarantee(ret == KERN_SUCCESS, err_msg("Failed to create semaphore: %s", sem_init_strerror(ret))); + guarantee(ret == KERN_SUCCESS, "Failed to create semaphore: %s", sem_init_strerror(ret)); } OSXSemaphore::~OSXSemaphore() { @@ -3100,8 +3100,8 @@ // libjsig also interposes the sigaction() call below and saves the // old sigaction on it own. } else { - fatal(err_msg("Encountered unexpected pre-existing sigaction handler " - "%#lx for signal %d.", (long)oldhand, sig)); + fatal("Encountered unexpected pre-existing sigaction handler " + "%#lx for signal %d.", (long)oldhand, sig); } } @@ -3459,8 +3459,7 @@ Bsd::set_page_size(getpagesize()); if (Bsd::page_size() == -1) { - fatal(err_msg("os_bsd.cpp: os::init: sysconf failed (%s)", - strerror(errno))); + fatal("os_bsd.cpp: os::init: sysconf failed (%s)", strerror(errno)); } init_page_sizes((size_t) Bsd::page_size()); 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 @@ -4278,8 +4278,8 @@ // libjsig also interposes the sigaction() call below and saves the // old sigaction on it own. } else { - fatal(err_msg("Encountered unexpected pre-existing sigaction handler " - "%#lx for signal %d.", (long)oldhand, sig)); + fatal("Encountered unexpected pre-existing sigaction handler " + "%#lx for signal %d.", (long)oldhand, sig); } } @@ -4611,8 +4611,8 @@ Linux::set_page_size(sysconf(_SC_PAGESIZE)); if (Linux::page_size() == -1) { - fatal(err_msg("os_linux.cpp: os::init: sysconf failed (%s)", - strerror(errno))); + fatal("os_linux.cpp: os::init: sysconf failed (%s)", + strerror(errno)); } init_page_sizes((size_t) Linux::page_size()); @@ -4628,7 +4628,7 @@ int status; pthread_condattr_t* _condattr = os::Linux::condAttr(); if ((status = pthread_condattr_init(_condattr)) != 0) { - fatal(err_msg("pthread_condattr_init: %s", strerror(status))); + fatal("pthread_condattr_init: %s", strerror(status)); } // Only set the clock if CLOCK_MONOTONIC is available if (os::supports_monotonic_clock()) { @@ -4637,7 +4637,7 @@ warning("Unable to use monotonic clock with relative timed-waits" \ " - changes to the time-of-day clock may have adverse affects"); } else { - fatal(err_msg("pthread_condattr_setclock: %s", strerror(status))); + fatal("pthread_condattr_setclock: %s", strerror(status)); } } } 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 @@ -1027,10 +1027,10 @@ } } -#define check_with_errno(check_type, cond, msg) \ - do { \ - int err = errno; \ - check_type(cond, err_msg("%s; error='%s' (errno=%d)", msg, strerror(err), err)); \ +#define check_with_errno(check_type, cond, msg) \ + do { \ + int err = errno; \ + check_type(cond, "%s; error='%s' (errno=%d)", msg, strerror(err), err); \ } while (false) #define assert_with_errno(cond, msg) check_with_errno(assert, cond, msg) diff --git a/src/os/solaris/vm/os_solaris.cpp b/src/os/solaris/vm/os_solaris.cpp --- a/src/os/solaris/vm/os_solaris.cpp +++ b/src/os/solaris/vm/os_solaris.cpp @@ -1330,7 +1330,7 @@ jlong os::javaTimeMillis() { timeval t; if (gettimeofday(&t, NULL) == -1) { - fatal(err_msg("os::javaTimeMillis: gettimeofday (%s)", strerror(errno))); + fatal("os::javaTimeMillis: gettimeofday (%s)", strerror(errno)); } return jlong(t.tv_sec) * 1000 + jlong(t.tv_usec) / 1000; } @@ -1338,7 +1338,7 @@ void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) { timeval t; if (gettimeofday(&t, NULL) == -1) { - fatal(err_msg("os::javaTimeSystemUTC: gettimeofday (%s)", strerror(errno))); + fatal("os::javaTimeSystemUTC: gettimeofday (%s)", strerror(errno)); } seconds = jlong(t.tv_sec); nanos = jlong(t.tv_usec) * 1000; @@ -2398,8 +2398,8 @@ size_t os::Solaris::page_size_for_alignment(size_t alignment) { assert(is_size_aligned(alignment, (size_t) vm_page_size()), - err_msg(SIZE_FORMAT " is not aligned to " SIZE_FORMAT, - alignment, (size_t) vm_page_size())); + SIZE_FORMAT " is not aligned to " SIZE_FORMAT, + alignment, (size_t) vm_page_size()); for (int i = 0; _page_sizes[i] != 0; i++) { if (is_size_aligned(alignment, _page_sizes[i])) { @@ -2415,7 +2415,7 @@ int err = Solaris::commit_memory_impl(addr, bytes, exec); if (err == 0 && UseLargePages && alignment_hint > 0) { assert(is_size_aligned(bytes, alignment_hint), - err_msg(SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, alignment_hint)); + SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, alignment_hint); // The syscall memcntl requires an exact page size (see man memcntl for details). size_t page_size = page_size_for_alignment(alignment_hint); @@ -2969,11 +2969,11 @@ } bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, size_t align) { - assert(is_valid_page_size(align), err_msg(SIZE_FORMAT " is not a valid page size", align)); + assert(is_valid_page_size(align), SIZE_FORMAT " is not a valid page size", align); assert(is_ptr_aligned((void*) start, align), - err_msg(PTR_FORMAT " is not aligned to " SIZE_FORMAT, p2i((void*) start), align)); + PTR_FORMAT " is not aligned to " SIZE_FORMAT, p2i((void*) start), align); assert(is_size_aligned(bytes, align), - err_msg(SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, align)); + SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, align); // Signal to OS that we want large pages for addresses // from addr, addr + bytes @@ -3956,8 +3956,8 @@ // libjsig also interposes the sigaction() call below and saves the // old sigaction on it own. } else { - fatal(err_msg("Encountered unexpected pre-existing sigaction handler " - "%#lx for signal %d.", (long)oldhand, sig)); + fatal("Encountered unexpected pre-existing sigaction handler " + "%#lx for signal %d.", (long)oldhand, sig); } } @@ -4403,8 +4403,7 @@ page_size = sysconf(_SC_PAGESIZE); if (page_size == -1) { - fatal(err_msg("os_solaris.cpp: os::init: sysconf failed (%s)", - strerror(errno))); + fatal("os_solaris.cpp: os::init: sysconf failed (%s)", strerror(errno)); } init_page_sizes((size_t) page_size); @@ -4416,7 +4415,7 @@ int fd = ::open("/dev/zero", O_RDWR); if (fd < 0) { - fatal(err_msg("os::init: cannot open /dev/zero (%s)", strerror(errno))); + fatal("os::init: cannot open /dev/zero (%s)", strerror(errno)); } else { Solaris::set_dev_zero_fd(fd); diff --git a/src/os/solaris/vm/threadCritical_solaris.cpp b/src/os/solaris/vm/threadCritical_solaris.cpp --- a/src/os/solaris/vm/threadCritical_solaris.cpp +++ b/src/os/solaris/vm/threadCritical_solaris.cpp @@ -48,8 +48,8 @@ thread_t owner = thr_self(); if (global_mut_owner != owner) { if (os::Solaris::mutex_lock(&global_mut)) - fatal(err_msg("ThreadCritical::ThreadCritical: mutex_lock failed (%s)", - strerror(errno))); + fatal("ThreadCritical::ThreadCritical: mutex_lock failed (%s)", + strerror(errno)); assert(global_mut_count == 0, "must have clean count"); assert(global_mut_owner == -1, "must have clean owner"); } @@ -68,8 +68,8 @@ if (global_mut_count == 0) { global_mut_owner = -1; if (os::Solaris::mutex_unlock(&global_mut)) - fatal(err_msg("ThreadCritical::~ThreadCritical: mutex_unlock failed " - "(%s)", strerror(errno))); + fatal("ThreadCritical::~ThreadCritical: mutex_unlock failed " + "(%s)", strerror(errno)); } } else { assert (Threads::number_of_threads() == 0, "valid only during initialization"); diff --git a/src/os/windows/vm/os_windows.cpp b/src/os/windows/vm/os_windows.cpp --- a/src/os/windows/vm/os_windows.cpp +++ b/src/os/windows/vm/os_windows.cpp @@ -823,7 +823,7 @@ java_origin.wMilliseconds = 0; FILETIME jot; if (!SystemTimeToFileTime(&java_origin, &jot)) { - fatal(err_msg("Error = %d\nWindows error", GetLastError())); + fatal("Error = %d\nWindows error", GetLastError()); } _calculated_offset = jlong_from(jot.dwHighDateTime, jot.dwLowDateTime); _has_calculated_offset = 1; @@ -1936,7 +1936,7 @@ WindowsSemaphore::WindowsSemaphore(uint value) { _semaphore = ::CreateSemaphore(NULL, value, LONG_MAX, NULL); - guarantee(_semaphore != NULL, err_msg("CreateSemaphore failed with error code: %lu", GetLastError())); + guarantee(_semaphore != NULL, "CreateSemaphore failed with error code: %lu", GetLastError()); } WindowsSemaphore::~WindowsSemaphore() { @@ -1947,14 +1947,14 @@ if (count > 0) { BOOL ret = ::ReleaseSemaphore(_semaphore, count, NULL); - assert(ret != 0, err_msg("ReleaseSemaphore failed with error code: %lu", GetLastError())); + assert(ret != 0, "ReleaseSemaphore failed with error code: %lu", GetLastError()); } } void WindowsSemaphore::wait() { DWORD ret = ::WaitForSingleObject(_semaphore, INFINITE); - assert(ret != WAIT_FAILED, err_msg("WaitForSingleObject failed with error code: %lu", GetLastError())); - assert(ret == WAIT_OBJECT_0, err_msg("WaitForSingleObject failed with return value: %lu", ret)); + assert(ret != WAIT_FAILED, "WaitForSingleObject failed with error code: %lu", GetLastError()); + assert(ret == WAIT_OBJECT_0, "WaitForSingleObject failed with return value: %lu", ret); } // sun.misc.Signal @@ -5259,7 +5259,7 @@ } DWORD err = GetLastError(); if (err != ERROR_NO_MORE_ITEMS && err != ERROR_CALL_NOT_IMPLEMENTED) { - fatal(err_msg("heap walk aborted with error %d", err)); + fatal("heap walk aborted with error %d", err); } HeapUnlock(heap); } @@ -5978,8 +5978,8 @@ os::release_memory_special(actual_location, expected_allocation_size); // only now check, after releasing any memory to avoid any leaks. assert(actual_location == expected_location, - err_msg("Failed to allocate memory at requested location " PTR_FORMAT " of size " SIZE_FORMAT ", is " PTR_FORMAT " instead", - expected_location, expected_allocation_size, actual_location)); + "Failed to allocate memory at requested location " PTR_FORMAT " of size " SIZE_FORMAT ", is " PTR_FORMAT " instead", + expected_location, expected_allocation_size, actual_location); } } diff --git a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp --- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp +++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp @@ -865,7 +865,7 @@ int rslt = pthread_stackseg_np(pthread_self(), &ss); if (rslt != 0) - fatal(err_msg("pthread_stackseg_np failed with err = %d", rslt)); + fatal("pthread_stackseg_np failed with err = %d", rslt); *bottom = (address)((char *)ss.ss_sp - ss.ss_size); *size = ss.ss_size; @@ -876,12 +876,12 @@ // JVM needs to know exact stack location, abort if it fails if (rslt != 0) - fatal(err_msg("pthread_attr_init failed with err = %d", rslt)); + fatal("pthread_attr_init failed with err = %d", rslt); rslt = pthread_attr_get_np(pthread_self(), &attr); if (rslt != 0) - fatal(err_msg("pthread_attr_get_np failed with err = %d", rslt)); + fatal("pthread_attr_get_np failed with err = %d", rslt); if (pthread_attr_getstackaddr(&attr, (void **)bottom) != 0 || pthread_attr_getstacksize(&attr, size) != 0) { diff --git a/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp b/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp --- a/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp +++ b/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp @@ -320,8 +320,7 @@ int rslt = pthread_stackseg_np(pthread_self(), &ss); if (rslt != 0) - fatal(err_msg("pthread_stackseg_np failed with err = " INT32_FORMAT, - rslt)); + fatal("pthread_stackseg_np failed with err = " INT32_FORMAT, rslt); stack_top = (address) ss.ss_sp; stack_bytes = ss.ss_size; @@ -333,13 +332,12 @@ // JVM needs to know exact stack location, abort if it fails if (rslt != 0) - fatal(err_msg("pthread_attr_init failed with err = " INT32_FORMAT, rslt)); + fatal("pthread_attr_init failed with err = " INT32_FORMAT, rslt); rslt = pthread_attr_get_np(pthread_self(), &attr); if (rslt != 0) - fatal(err_msg("pthread_attr_get_np failed with err = " INT32_FORMAT, - rslt)); + fatal("pthread_attr_get_np failed with err = " INT32_FORMAT, rslt); if (pthread_attr_getstackaddr(&attr, (void **) &stack_bottom) != 0 || pthread_attr_getstacksize(&attr, &stack_bytes) != 0) { diff --git a/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp b/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp --- a/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +++ b/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp @@ -558,7 +558,7 @@ if (rslt == ENOMEM) { vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); } else { - fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt)); + fatal("pthread_getattr_np failed with errno = %d", rslt); } } diff --git a/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp b/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp --- a/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp +++ b/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp @@ -531,7 +531,7 @@ if (rslt == ENOMEM) { vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); } else { - fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt)); + fatal("pthread_getattr_np failed with errno = %d", rslt); } } diff --git a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp --- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp +++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @@ -172,7 +172,7 @@ if (rslt == ENOMEM) { vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); } else { - fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt)); + fatal("pthread_getattr_np failed with errno = %d", rslt); } } diff --git a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp --- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -689,7 +689,7 @@ if (rslt == ENOMEM) { vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); } else { - fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt)); + fatal("pthread_getattr_np failed with errno = %d", rslt); } } diff --git a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp --- a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +++ b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp @@ -328,7 +328,7 @@ vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); } else { - fatal(err_msg("pthread_getattr_np failed with errno = %d", res)); + fatal("pthread_getattr_np failed with errno = %d", res); } } @@ -336,7 +336,7 @@ size_t stack_bytes; res = pthread_attr_getstack(&attr, (void **) &stack_bottom, &stack_bytes); if (res != 0) { - fatal(err_msg("pthread_attr_getstack failed with errno = %d", res)); + fatal("pthread_attr_getstack failed with errno = %d", res); } address stack_top = stack_bottom + stack_bytes; @@ -348,7 +348,7 @@ size_t guard_bytes; res = pthread_attr_getguardsize(&attr, &guard_bytes); if (res != 0) { - fatal(err_msg("pthread_attr_getguardsize failed with errno = %d", res)); + fatal("pthread_attr_getguardsize failed with errno = %d", res); } int guard_pages = align_size_up(guard_bytes, page_bytes) / page_bytes; assert(guard_bytes == guard_pages * page_bytes, "unaligned guard"); diff --git a/src/share/vm/asm/assembler.cpp b/src/share/vm/asm/assembler.cpp --- a/src/share/vm/asm/assembler.cpp +++ b/src/share/vm/asm/assembler.cpp @@ -43,8 +43,7 @@ CodeSection* cs = code->insts(); cs->clear_mark(); // new assembler kills old mark if (cs->start() == NULL) { - vm_exit_out_of_memory(0, OOM_MMAP_ERROR, err_msg("CodeCache: no room for %s", - code->name())); + vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "CodeCache: no room for %s", code->name()); } _code_section = cs; _oop_recorder= code->oop_recorder(); diff --git a/src/share/vm/asm/codeBuffer.hpp b/src/share/vm/asm/codeBuffer.hpp --- a/src/share/vm/asm/codeBuffer.hpp +++ b/src/share/vm/asm/codeBuffer.hpp @@ -173,7 +173,7 @@ bool allocates(address pc) const { return pc >= _start && pc < _limit; } bool allocates2(address pc) const { return pc >= _start && pc <= _limit; } - void set_end(address pc) { assert(allocates2(pc), err_msg("not in CodeBuffer memory: " INTPTR_FORMAT " <= " INTPTR_FORMAT " <= " INTPTR_FORMAT, p2i(_start), p2i(pc), p2i(_limit))); _end = pc; } + void set_end(address pc) { assert(allocates2(pc), "not in CodeBuffer memory: " INTPTR_FORMAT " <= " INTPTR_FORMAT " <= " INTPTR_FORMAT, p2i(_start), p2i(pc), p2i(_limit)); _end = pc; } void set_mark(address pc) { assert(contains2(pc), "not in codeBuffer"); _mark = pc; } void set_mark_off(int offset) { assert(contains2(offset+_start),"not in codeBuffer"); diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp --- a/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/src/share/vm/c1/c1_GraphBuilder.cpp @@ -4020,7 +4020,7 @@ break; default: - fatal(err_msg("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid))); + fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid)); break; } set_state(state_before); diff --git a/src/share/vm/c1/c1_LIRGenerator.cpp b/src/share/vm/c1/c1_LIRGenerator.cpp --- a/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/src/share/vm/c1/c1_LIRGenerator.cpp @@ -2973,7 +2973,7 @@ break; } default: - fatal(err_msg("unexpected bytecode: %s", Bytecodes::name(x->code()))); + fatal("unexpected bytecode: %s", Bytecodes::name(x->code())); break; } diff --git a/src/share/vm/ci/ciKlass.cpp b/src/share/vm/ci/ciKlass.cpp --- a/src/share/vm/ci/ciKlass.cpp +++ b/src/share/vm/ci/ciKlass.cpp @@ -66,8 +66,8 @@ // ------------------------------------------------------------------ // ciKlass::is_subtype_of bool ciKlass::is_subtype_of(ciKlass* that) { - assert(this->is_loaded(), err_msg("must be loaded: %s", this->name()->as_quoted_ascii())); - assert(that->is_loaded(), err_msg("must be loaded: %s", that->name()->as_quoted_ascii())); + assert(this->is_loaded(), "must be loaded: %s", this->name()->as_quoted_ascii()); + assert(that->is_loaded(), "must be loaded: %s", that->name()->as_quoted_ascii()); // Check to see if the klasses are identical. if (this == that) { @@ -85,8 +85,8 @@ // ------------------------------------------------------------------ // ciKlass::is_subclass_of bool ciKlass::is_subclass_of(ciKlass* that) { - assert(this->is_loaded(), err_msg("must be loaded: %s", this->name()->as_quoted_ascii())); - assert(that->is_loaded(), err_msg("must be loaded: %s", that->name()->as_quoted_ascii())); + assert(this->is_loaded(), "must be loaded: %s", this->name()->as_quoted_ascii()); + assert(that->is_loaded(), "must be loaded: %s", that->name()->as_quoted_ascii()); VM_ENTRY_MARK; Klass* this_klass = get_Klass(); diff --git a/src/share/vm/ci/ciMethod.cpp b/src/share/vm/ci/ciMethod.cpp --- a/src/share/vm/ci/ciMethod.cpp +++ b/src/share/vm/ci/ciMethod.cpp @@ -576,13 +576,13 @@ void ciMethod::assert_virtual_call_type_ok(int bci) { assert(java_code_at_bci(bci) == Bytecodes::_invokevirtual || - java_code_at_bci(bci) == Bytecodes::_invokeinterface, err_msg("unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci)))); + java_code_at_bci(bci) == Bytecodes::_invokeinterface, "unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci))); } void ciMethod::assert_call_type_ok(int bci) { assert(java_code_at_bci(bci) == Bytecodes::_invokestatic || java_code_at_bci(bci) == Bytecodes::_invokespecial || - java_code_at_bci(bci) == Bytecodes::_invokedynamic, err_msg("unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci)))); + java_code_at_bci(bci) == Bytecodes::_invokedynamic, "unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci))); } /** diff --git a/src/share/vm/ci/ciMethodData.cpp b/src/share/vm/ci/ciMethodData.cpp --- a/src/share/vm/ci/ciMethodData.cpp +++ b/src/share/vm/ci/ciMethodData.cpp @@ -122,7 +122,7 @@ // An empty slot or ArgInfoData entry marks the end of the trap data return; default: - fatal(err_msg("bad tag = %d", dp_dst->tag())); + fatal("bad tag = %d", dp_dst->tag()); } } } @@ -289,7 +289,7 @@ break; } default: - fatal(err_msg("bad tag = %d", dp->tag())); + fatal("bad tag = %d", dp->tag()); } } return NULL; @@ -578,7 +578,7 @@ break; } default: - fatal(err_msg("bad tag = %d", dp->tag())); + fatal("bad tag = %d", dp->tag()); } } } @@ -690,7 +690,7 @@ data = new ciSpeculativeTrapData(dp); break; default: - fatal(err_msg("unexpected tag %d", dp->tag())); + fatal("unexpected tag %d", dp->tag()); } st->print("%d", dp_to_di(data->dp())); st->fill_to(6); diff --git a/src/share/vm/ci/ciTypeFlow.cpp b/src/share/vm/ci/ciTypeFlow.cpp --- a/src/share/vm/ci/ciTypeFlow.cpp +++ b/src/share/vm/ci/ciTypeFlow.cpp @@ -1964,7 +1964,7 @@ _has_irreducible_entry = false; _osr_bci = osr_bci; _failure_reason = NULL; - assert(0 <= start_bci() && start_bci() < code_size() , err_msg("correct osr_bci argument: 0 <= %d < %d", start_bci(), code_size())); + assert(0 <= start_bci() && start_bci() < code_size() , "correct osr_bci argument: 0 <= %d < %d", start_bci(), code_size()); _work_list = NULL; _ciblock_count = _methodBlocks->num_blocks(); diff --git a/src/share/vm/classfile/altHashing.cpp b/src/share/vm/classfile/altHashing.cpp --- a/src/share/vm/classfile/altHashing.cpp +++ b/src/share/vm/classfile/altHashing.cpp @@ -262,10 +262,9 @@ juint final_hash = murmur3_32(hashes, 4*256); assert (MURMUR3_32_X86_CHECK_VALUE == final_hash, - err_msg( - "Calculated hash result not as expected. Expected %08X got %08X\n", - MURMUR3_32_X86_CHECK_VALUE, - final_hash)); + "Calculated hash result not as expected. Expected %08X got %08X\n", + MURMUR3_32_X86_CHECK_VALUE, + final_hash); } void AltHashing::testEquivalentHashes() { @@ -276,24 +275,24 @@ jbytes = murmur3_32(TWO_BYTE, 2); jchars = murmur3_32(ONE_CHAR, 1); assert (jbytes == jchars, - err_msg("Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars)); + "Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars); jbytes = murmur3_32(FOUR_BYTE, 4); jchars = murmur3_32(TWO_CHAR, 2); ints = murmur3_32(ONE_INT, 1); assert ((jbytes == jchars) && (jbytes == ints), - err_msg("Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints)); + "Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints); jbytes = murmur3_32(SIX_BYTE, 6); jchars = murmur3_32(THREE_CHAR, 3); assert (jbytes == jchars, - err_msg("Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars)); + "Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars); jbytes = murmur3_32(EIGHT_BYTE, 8); jchars = murmur3_32(FOUR_CHAR, 4); ints = murmur3_32(TWO_INT, 2); assert ((jbytes == jchars) && (jbytes == ints), - err_msg("Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints)); + "Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints); } // Returns true if the alternate hashcode is correct diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp --- a/src/share/vm/classfile/classFileParser.cpp +++ b/src/share/vm/classfile/classFileParser.cpp @@ -319,12 +319,12 @@ PRAGMA_FORMAT_NONLITERAL_IGNORED void ClassFileParser::report_assert_property_failure(const char* msg, TRAPS) { ResourceMark rm(THREAD); - fatal(err_msg(msg, _class_name->as_C_string())); + fatal(msg, _class_name->as_C_string()); } void ClassFileParser::report_assert_property_failure(const char* msg, int index, TRAPS) { ResourceMark rm(THREAD); - fatal(err_msg(msg, index, _class_name->as_C_string())); + fatal(msg, index, _class_name->as_C_string()); } PRAGMA_DIAG_POP @@ -492,8 +492,7 @@ break; } default: - fatal(err_msg("bad constant pool tag value %u", - cp->tag_at(index).value())); + fatal("bad constant pool tag value %u", cp->tag_at(index).value()); ShouldNotReachHere(); break; } // end of switch diff --git a/src/share/vm/classfile/classLoaderData.cpp b/src/share/vm/classfile/classLoaderData.cpp --- a/src/share/vm/classfile/classLoaderData.cpp +++ b/src/share/vm/classfile/classLoaderData.cpp @@ -913,7 +913,7 @@ } // Nothing more for the iterator to hand out. - assert(head == NULL, err_msg("head is " PTR_FORMAT ", expected not null:", p2i(head))); + assert(head == NULL, "head is " PTR_FORMAT ", expected not null:", p2i(head)); return NULL; } diff --git a/src/share/vm/classfile/metadataOnStackMark.cpp b/src/share/vm/classfile/metadataOnStackMark.cpp --- a/src/share/vm/classfile/metadataOnStackMark.cpp +++ b/src/share/vm/classfile/metadataOnStackMark.cpp @@ -119,7 +119,7 @@ allocated = new MetadataOnStackBuffer(); } - assert(!allocated->is_full(), err_msg("Should not be full: " PTR_FORMAT, p2i(allocated))); + assert(!allocated->is_full(), "Should not be full: " PTR_FORMAT, p2i(allocated)); return allocated; } diff --git a/src/share/vm/classfile/stringTable.cpp b/src/share/vm/classfile/stringTable.cpp --- a/src/share/vm/classfile/stringTable.cpp +++ b/src/share/vm/classfile/stringTable.cpp @@ -312,12 +312,12 @@ const int limit = the_table()->table_size(); assert(0 <= start_idx && start_idx <= limit, - err_msg("start_idx (%d) is out of bounds", start_idx)); + "start_idx (%d) is out of bounds", start_idx); assert(0 <= end_idx && end_idx <= limit, - err_msg("end_idx (%d) is out of bounds", end_idx)); + "end_idx (%d) is out of bounds", end_idx); assert(start_idx <= end_idx, - err_msg("Index ordering: start_idx=%d, end_idx=%d", - start_idx, end_idx)); + "Index ordering: start_idx=%d, end_idx=%d", + start_idx, end_idx); for (int i = start_idx; i < end_idx; i += 1) { HashtableEntry* entry = the_table()->bucket(i); @@ -335,12 +335,12 @@ const int limit = the_table()->table_size(); assert(0 <= start_idx && start_idx <= limit, - err_msg("start_idx (%d) is out of bounds", start_idx)); + "start_idx (%d) is out of bounds", start_idx); assert(0 <= end_idx && end_idx <= limit, - err_msg("end_idx (%d) is out of bounds", end_idx)); + "end_idx (%d) is out of bounds", end_idx); assert(start_idx <= end_idx, - err_msg("Index ordering: start_idx=%d, end_idx=%d", - start_idx, end_idx)); + "Index ordering: start_idx=%d, end_idx=%d", + start_idx, end_idx); for (int i = start_idx; i < end_idx; ++i) { HashtableEntry** p = the_table()->bucket_addr(i); diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp --- a/src/share/vm/classfile/systemDictionary.cpp +++ b/src/share/vm/classfile/systemDictionary.cpp @@ -229,9 +229,9 @@ Klass* SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS) { assert(!THREAD->is_Compiler_thread(), - err_msg("can not load classes with compiler thread: class=%s, classloader=%s", - class_name->as_C_string(), - class_loader.is_null() ? "null" : class_loader->klass()->name()->as_C_string())); + "can not load classes with compiler thread: class=%s, classloader=%s", + class_name->as_C_string(), + class_loader.is_null() ? "null" : class_loader->klass()->name()->as_C_string()); if (FieldType::is_array(class_name)) { return resolve_array_class_or_null(class_name, class_loader, protection_domain, THREAD); } else if (FieldType::is_obj(class_name)) { @@ -2264,7 +2264,7 @@ assert(MethodHandles::is_signature_polymorphic(iid) && MethodHandles::is_signature_polymorphic_intrinsic(iid) && iid != vmIntrinsics::_invokeGeneric, - err_msg("must be a known MH intrinsic iid=%d: %s", iid, vmIntrinsics::name_at(iid))); + "must be a known MH intrinsic iid=%d: %s", iid, vmIntrinsics::name_at(iid)); unsigned int hash = invoke_method_table()->compute_hash(signature, iid); int index = invoke_method_table()->hash_to_index(hash); diff --git a/src/share/vm/code/dependencies.cpp b/src/share/vm/code/dependencies.cpp --- a/src/share/vm/code/dependencies.cpp +++ b/src/share/vm/code/dependencies.cpp @@ -400,7 +400,7 @@ } void Dependencies::check_valid_dependency_type(DepType dept) { - guarantee(FIRST_TYPE <= dept && dept < TYPE_LIMIT, err_msg("invalid dependency type: %d", (int) dept)); + guarantee(FIRST_TYPE <= dept && dept < TYPE_LIMIT, "invalid dependency type: %d", (int) dept); } // for the sake of the compiler log, print out current dependencies: diff --git a/src/share/vm/code/exceptionHandlerTable.cpp b/src/share/vm/code/exceptionHandlerTable.cpp --- a/src/share/vm/code/exceptionHandlerTable.cpp +++ b/src/share/vm/code/exceptionHandlerTable.cpp @@ -225,6 +225,6 @@ for (uint i = 0; i < len(); i++) { if ((*adr(i) > (unsigned int)nm->insts_size()) || (*(adr(i)+1) > (unsigned int)nm->insts_size())) - fatal(err_msg("Invalid offset in ImplicitExceptionTable at " PTR_FORMAT, _data)); + fatal("Invalid offset in ImplicitExceptionTable at " PTR_FORMAT, _data); } } 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 @@ -1709,7 +1709,7 @@ // Clean inline caches pointing to both zombie and not_entrant methods if (!nm->is_in_use() || (nm->method()->code() != nm)) { ic->set_to_clean(); - assert(ic->is_clean(), err_msg("nmethod " PTR_FORMAT "not clean %s", from, from->method()->name_and_sig_as_C_string())); + assert(ic->is_clean(), "nmethod " PTR_FORMAT "not clean %s", from, from->method()->name_and_sig_as_C_string()); } } @@ -2540,7 +2540,7 @@ ResourceMark rm; if (!CodeCache::contains(this)) { - fatal(err_msg("nmethod at " INTPTR_FORMAT " not in zone", this)); + fatal("nmethod at " INTPTR_FORMAT " not in zone", this); } if(is_native_method() ) @@ -2548,8 +2548,7 @@ nmethod* nm = CodeCache::find_nmethod(verified_entry_point()); if (nm != this) { - fatal(err_msg("findNMethod did not find this nmethod (" INTPTR_FORMAT ")", - this)); + fatal("findNMethod did not find this nmethod (" INTPTR_FORMAT ")", this); } for (PcDesc* p = scopes_pcs_begin(); p < scopes_pcs_end(); p++) { diff --git a/src/share/vm/code/stubs.cpp b/src/share/vm/code/stubs.cpp --- a/src/share/vm/code/stubs.cpp +++ b/src/share/vm/code/stubs.cpp @@ -67,7 +67,7 @@ intptr_t size = round_to(buffer_size, 2*BytesPerWord); BufferBlob* blob = BufferBlob::create(name, size); if( blob == NULL) { - vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, err_msg("CodeCache: no room for %s", name)); + vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "CodeCache: no room for %s", name); } _stub_interface = stub_interface; _buffer_size = blob->content_size(); 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 @@ -222,9 +222,9 @@ InstanceKlass* ik = InstanceKlass::cast(klass); klassVtable* vt = ik->vtable(); ik->print(); - fatal(err_msg("bad compiled vtable dispatch: receiver " INTPTR_FORMAT ", " - "index %d (vtable length %d)", - (address)receiver, index, vt->length())); + fatal("bad compiled vtable dispatch: receiver " INTPTR_FORMAT ", " + "index %d (vtable length %d)", + (address)receiver, index, vt->length()); } #endif // Product diff --git a/src/share/vm/gc/cms/adaptiveFreeList.cpp b/src/share/vm/gc/cms/adaptiveFreeList.cpp --- a/src/share/vm/gc/cms/adaptiveFreeList.cpp +++ b/src/share/vm/gc/cms/adaptiveFreeList.cpp @@ -133,17 +133,17 @@ + _allocation_stats.coal_births() + 1) // Total Production Stock + 1 >= (_allocation_stats.split_deaths() + _allocation_stats.coal_deaths() + (ssize_t)count()), // Total Current Stock + depletion - err_msg("FreeList " PTR_FORMAT " of size " SIZE_FORMAT - " violates Conservation Principle: " - "prev_sweep(" SIZE_FORMAT ")" - " + split_births(" SIZE_FORMAT ")" - " + coal_births(" SIZE_FORMAT ") + 1 >= " - " split_deaths(" SIZE_FORMAT ")" - " coal_deaths(" SIZE_FORMAT ")" - " + count(" SSIZE_FORMAT ")", - p2i(this), size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(), - _allocation_stats.coal_births(), _allocation_stats.split_deaths(), - _allocation_stats.coal_deaths(), count())); + "FreeList " PTR_FORMAT " of size " SIZE_FORMAT + " violates Conservation Principle: " + "prev_sweep(" SIZE_FORMAT ")" + " + split_births(" SIZE_FORMAT ")" + " + coal_births(" SIZE_FORMAT ") + 1 >= " + " split_deaths(" SIZE_FORMAT ")" + " coal_deaths(" SIZE_FORMAT ")" + " + count(" SSIZE_FORMAT ")", + p2i(this), size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(), + _allocation_stats.coal_births(), _allocation_stats.split_deaths(), + _allocation_stats.coal_deaths(), count()); } #endif diff --git a/src/share/vm/gc/cms/allocationStats.hpp b/src/share/vm/gc/cms/allocationStats.hpp --- a/src/share/vm/gc/cms/allocationStats.hpp +++ b/src/share/vm/gc/cms/allocationStats.hpp @@ -105,9 +105,9 @@ ssize_t demand = prev_sweep() - (ssize_t)count + split_births() + coal_births() - split_deaths() - coal_deaths(); assert(demand >= 0, - err_msg("Demand (" SSIZE_FORMAT ") should be non-negative for " - PTR_FORMAT " (size=" SIZE_FORMAT ")", - demand, p2i(this), count)); + "Demand (" SSIZE_FORMAT ") should be non-negative for " + PTR_FORMAT " (size=" SIZE_FORMAT ")", + demand, p2i(this), count); // Defensive: adjust for imprecision in event counting if (demand < 0) { demand = 0; diff --git a/src/share/vm/gc/cms/compactibleFreeListSpace.cpp b/src/share/vm/gc/cms/compactibleFreeListSpace.cpp --- a/src/share/vm/gc/cms/compactibleFreeListSpace.cpp +++ b/src/share/vm/gc/cms/compactibleFreeListSpace.cpp @@ -1959,9 +1959,9 @@ MemRegion ur = used_region(); MemRegion urasm = used_region_at_save_marks(); assert(ur.contains(urasm), - err_msg(" Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")" - " should contain [" PTR_FORMAT "," PTR_FORMAT ")", - p2i(ur.start()), p2i(ur.end()), p2i(urasm.start()), p2i(urasm.end()))); + " Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")" + " should contain [" PTR_FORMAT "," PTR_FORMAT ")", + p2i(ur.start()), p2i(ur.end()), p2i(urasm.start()), p2i(urasm.end())); #endif // inform allocator that promotions should be tracked. assert(_promoInfo.noPromotions(), "_promoInfo inconsistency"); @@ -2875,9 +2875,9 @@ smallSplitBirth(rem); } assert(n * word_sz == fc->size(), - err_msg("Chunk size " SIZE_FORMAT " is not exactly splittable by " + "Chunk size " SIZE_FORMAT " is not exactly splittable by " SIZE_FORMAT " sized chunks of size " SIZE_FORMAT, - fc->size(), n, word_sz)); + fc->size(), n, word_sz); return fc; } diff --git a/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp b/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp --- a/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp +++ b/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp @@ -3476,7 +3476,7 @@ // been published), so we do not need to check for // uninitialized objects before pushing here. void Par_ConcMarkingClosure::do_oop(oop obj) { - assert(obj->is_oop_or_null(true), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(obj))); + assert(obj->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj)); HeapWord* addr = (HeapWord*)obj; // Check if oop points into the CMS generation // and is not marked @@ -6458,7 +6458,7 @@ // isMarked() query is "safe". bool ScanMarkedObjectsAgainClosure::do_object_bm(oop p, MemRegion mr) { // Ignore mark word because we are running concurrent with mutators - assert(p->is_oop_or_null(true), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(p))); + assert(p->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(p)); HeapWord* addr = (HeapWord*)p; assert(_span.contains(addr), "we are scanning the CMS generation"); bool is_obj_array = false; @@ -6893,7 +6893,7 @@ } void PushAndMarkVerifyClosure::do_oop(oop obj) { - assert(obj->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(obj))); + assert(obj->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj)); HeapWord* addr = (HeapWord*)obj; if (_span.contains(addr) && !_verification_bm->isMarked(addr)) { // Oop lies in _span and isn't yet grey or black @@ -6991,7 +6991,7 @@ void PushOrMarkClosure::do_oop(oop obj) { // Ignore mark word because we are running concurrent with mutators. - assert(obj->is_oop_or_null(true), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(obj))); + assert(obj->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj)); HeapWord* addr = (HeapWord*)obj; if (_span.contains(addr) && !_bitMap->isMarked(addr)) { // Oop lies in _span and isn't yet grey or black @@ -7029,7 +7029,7 @@ void Par_PushOrMarkClosure::do_oop(oop obj) { // Ignore mark word because we are running concurrent with mutators. - assert(obj->is_oop_or_null(true), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(obj))); + assert(obj->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj)); HeapWord* addr = (HeapWord*)obj; if (_whole_span.contains(addr) && !_bit_map->isMarked(addr)) { // Oop lies in _span and isn't yet grey or black @@ -7106,7 +7106,7 @@ // path and may be at the end of the global overflow list (so // the mark word may be NULL). assert(obj->is_oop_or_null(true /* ignore mark word */), - err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(obj))); + "Expected an oop or NULL at " PTR_FORMAT, p2i(obj)); HeapWord* addr = (HeapWord*)obj; // Check if oop points into the CMS generation // and is not marked @@ -7186,7 +7186,7 @@ // the debugger, is_oop_or_null(false) may subsequently start // to hold. assert(obj->is_oop_or_null(true), - err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(obj))); + "Expected an oop or NULL at " PTR_FORMAT, p2i(obj)); HeapWord* addr = (HeapWord*)obj; // Check if oop points into the CMS generation // and is not marked @@ -7423,7 +7423,7 @@ // coalesced chunk to the appropriate free list. if (inFreeRange()) { assert(freeFinger() >= _sp->bottom() && freeFinger() < _limit, - err_msg("freeFinger() " PTR_FORMAT " is out-of-bounds", p2i(freeFinger()))); + "freeFinger() " PTR_FORMAT " is out-of-bounds", p2i(freeFinger())); flush_cur_free_chunk(freeFinger(), pointer_delta(addr, freeFinger())); if (CMSTraceSweeper) { @@ -7825,10 +7825,10 @@ assert(inFreeRange(), "Should only be called if currently in a free range."); HeapWord* const eob = ((HeapWord*)fc) + chunk_size; assert(_sp->used_region().contains(eob - 1), - err_msg("eob = " PTR_FORMAT " eob-1 = " PTR_FORMAT " _limit = " PTR_FORMAT - " out of bounds wrt _sp = [" PTR_FORMAT "," PTR_FORMAT ")" - " when examining fc = " PTR_FORMAT "(" SIZE_FORMAT ")", - p2i(eob), p2i(eob-1), p2i(_limit), p2i(_sp->bottom()), p2i(_sp->end()), p2i(fc), chunk_size)); + "eob = " PTR_FORMAT " eob-1 = " PTR_FORMAT " _limit = " PTR_FORMAT + " out of bounds wrt _sp = [" PTR_FORMAT "," PTR_FORMAT ")" + " when examining fc = " PTR_FORMAT "(" SIZE_FORMAT ")", + p2i(eob), p2i(eob-1), p2i(_limit), p2i(_sp->bottom()), p2i(_sp->end()), p2i(fc), chunk_size); if (eob >= _limit) { assert(eob == _limit || fc->is_free(), "Only a free chunk should allow us to cross over the limit"); if (CMSTraceSweeper) { diff --git a/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp b/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp --- a/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp +++ b/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp @@ -296,8 +296,8 @@ size_t end() { assert(_index <= capacity(), - err_msg("_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT "): out of bounds", - _index, _capacity)); + "_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT "): out of bounds", + _index, _capacity); return _index; } // exclusive @@ -322,9 +322,9 @@ } else { ++_overflows; assert(_index == _capacity, - err_msg("_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT - "): out of bounds at overflow#" SIZE_FORMAT, - _index, _capacity, _overflows)); + "_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT + "): out of bounds at overflow#" SIZE_FORMAT, + _index, _capacity, _overflows); } } }; diff --git a/src/share/vm/gc/cms/parCardTableModRefBS.cpp b/src/share/vm/gc/cms/parCardTableModRefBS.cpp --- a/src/share/vm/gc/cms/parCardTableModRefBS.cpp +++ b/src/share/vm/gc/cms/parCardTableModRefBS.cpp @@ -43,7 +43,7 @@ uint n_threads) { assert(n_threads > 0, "expected n_threads > 0"); assert(n_threads <= ParallelGCThreads, - err_msg("n_threads: %u > ParallelGCThreads: %u", n_threads, ParallelGCThreads)); + "n_threads: %u > ParallelGCThreads: %u", n_threads, ParallelGCThreads); // Make sure the LNC array is valid for the space. jbyte** lowest_non_clean; @@ -370,18 +370,18 @@ - lowest_non_clean_base_chunk_index; if (last_chunk_index_to_check > last_chunk_index) { assert(last_block + last_block_size > used.end(), - err_msg("Inconsistency detected: last_block [" PTR_FORMAT "," PTR_FORMAT "]" - " does not exceed used.end() = " PTR_FORMAT "," - " yet last_chunk_index_to_check " INTPTR_FORMAT - " exceeds last_chunk_index " INTPTR_FORMAT, - p2i(last_block), p2i(last_block + last_block_size), - p2i(used.end()), - last_chunk_index_to_check, last_chunk_index)); + "Inconsistency detected: last_block [" PTR_FORMAT "," PTR_FORMAT "]" + " does not exceed used.end() = " PTR_FORMAT "," + " yet last_chunk_index_to_check " INTPTR_FORMAT + " exceeds last_chunk_index " INTPTR_FORMAT, + p2i(last_block), p2i(last_block + last_block_size), + p2i(used.end()), + last_chunk_index_to_check, last_chunk_index); assert(sp->used_region().end() > used.end(), - err_msg("Expansion did not happen: " - "[" PTR_FORMAT "," PTR_FORMAT ") -> [" PTR_FORMAT "," PTR_FORMAT ")", - p2i(sp->used_region().start()), p2i(sp->used_region().end()), - p2i(used.start()), p2i(used.end()))); + "Expansion did not happen: " + "[" PTR_FORMAT "," PTR_FORMAT ") -> [" PTR_FORMAT "," PTR_FORMAT ")", + p2i(sp->used_region().start()), p2i(sp->used_region().end()), + p2i(used.start()), p2i(used.end())); NOISY(tty->print_cr(" process_chunk_boundary: heap expanded; explicitly bounding last_chunk");) last_chunk_index_to_check = last_chunk_index; } diff --git a/src/share/vm/gc/cms/promotionInfo.hpp b/src/share/vm/gc/cms/promotionInfo.hpp --- a/src/share/vm/gc/cms/promotionInfo.hpp +++ b/src/share/vm/gc/cms/promotionInfo.hpp @@ -73,7 +73,7 @@ } else { res = (PromotedObject*)(_next & next_mask); } - assert(oop(res)->is_oop_or_null(true /* ignore mark word */), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(oop(res)))); + assert(oop(res)->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(res))); return res; } inline void setNext(PromotedObject* x) { diff --git a/src/share/vm/gc/g1/bufferingOopClosure.cpp b/src/share/vm/gc/g1/bufferingOopClosure.cpp --- a/src/share/vm/gc/g1/bufferingOopClosure.cpp +++ b/src/share/vm/gc/g1/bufferingOopClosure.cpp @@ -153,10 +153,10 @@ boc.done(); - #define assert_testCount(got, expected) \ - assert((got) == (expected), \ - err_msg("Expected: %d, got: %d, when running testCount(%d, %d, %d)", \ - (got), (expected), num_narrow, num_full, do_oop_order)) + #define assert_testCount(got, expected) \ + assert((got) == (expected), \ + "Expected: %d, got: %d, when running testCount(%d, %d, %d)", \ + (got), (expected), num_narrow, num_full, do_oop_order) assert_testCount(num_narrow, coc.narrow_oop_count()); assert_testCount(num_full, coc.full_oop_count()); @@ -190,11 +190,11 @@ fr.oops_do(&boc, 0); - #define assert_testIsBufferEmptyOrFull(got, expected) \ - assert((got) == (expected), \ - err_msg("Expected: %d, got: %d. testIsBufferEmptyOrFull(%d, %d, %s, %s)", \ - (got), (expected), num_narrow, num_full, \ - BOOL_TO_STR(expect_empty), BOOL_TO_STR(expect_full))) + #define assert_testIsBufferEmptyOrFull(got, expected) \ + assert((got) == (expected), \ + "Expected: %d, got: %d. testIsBufferEmptyOrFull(%d, %d, %s, %s)", \ + (got), (expected), num_narrow, num_full, \ + BOOL_TO_STR(expect_empty), BOOL_TO_STR(expect_full)) assert_testIsBufferEmptyOrFull(expect_empty, boc.is_buffer_empty()); assert_testIsBufferEmptyOrFull(expect_full, boc.is_buffer_full()); @@ -232,8 +232,8 @@ boc.done(); assert(boc.is_buffer_empty(), - err_msg("Should be empty after call to done(). testEmptyAfterDone(%d, %d)", - num_narrow, num_full)); + "Should be empty after call to done(). testEmptyAfterDone(%d, %d)", + num_narrow, num_full); } static void testEmptyAfterDone() { diff --git a/src/share/vm/gc/g1/collectionSetChooser.cpp b/src/share/vm/gc/g1/collectionSetChooser.cpp --- a/src/share/vm/gc/g1/collectionSetChooser.cpp +++ b/src/share/vm/gc/g1/collectionSetChooser.cpp @@ -91,10 +91,8 @@ #ifndef PRODUCT void CollectionSetChooser::verify() { - guarantee(_end <= regions_length(), - err_msg("_end: %u regions length: %u", _end, regions_length())); - guarantee(_front <= _end, - err_msg("_front: %u _end: %u", _front, _end)); + guarantee(_end <= regions_length(), "_end: %u regions length: %u", _end, regions_length()); + guarantee(_front <= _end, "_front: %u _end: %u", _front, _end); uint index = 0; size_t sum_of_reclaimable_bytes = 0; while (index < _front) { @@ -108,19 +106,19 @@ guarantee(curr != NULL, "Regions in _regions array cannot be NULL"); guarantee(!curr->is_young(), "should not be young!"); guarantee(!curr->is_pinned(), - err_msg("Pinned region should not be in collection set (index %u)", curr->hrm_index())); + "Pinned region should not be in collection set (index %u)", curr->hrm_index()); if (prev != NULL) { guarantee(order_regions(prev, curr) != 1, - err_msg("GC eff prev: %1.4f GC eff curr: %1.4f", - prev->gc_efficiency(), curr->gc_efficiency())); + "GC eff prev: %1.4f GC eff curr: %1.4f", + prev->gc_efficiency(), curr->gc_efficiency()); } sum_of_reclaimable_bytes += curr->reclaimable_bytes(); prev = curr; } guarantee(sum_of_reclaimable_bytes == _remaining_reclaimable_bytes, - err_msg("reclaimable bytes inconsistent, " - "remaining: " SIZE_FORMAT " sum: " SIZE_FORMAT, - _remaining_reclaimable_bytes, sum_of_reclaimable_bytes)); + "reclaimable bytes inconsistent, " + "remaining: " SIZE_FORMAT " sum: " SIZE_FORMAT, + _remaining_reclaimable_bytes, sum_of_reclaimable_bytes); } #endif // !PRODUCT @@ -151,7 +149,7 @@ void CollectionSetChooser::add_region(HeapRegion* hr) { assert(!hr->is_pinned(), - err_msg("Pinned region shouldn't be added to the collection set (index %u)", hr->hrm_index())); + "Pinned region shouldn't be added to the collection set (index %u)", hr->hrm_index()); assert(!hr->is_young(), "should not be young!"); _regions.append(hr); _end++; diff --git a/src/share/vm/gc/g1/collectionSetChooser.hpp b/src/share/vm/gc/g1/collectionSetChooser.hpp --- a/src/share/vm/gc/g1/collectionSetChooser.hpp +++ b/src/share/vm/gc/g1/collectionSetChooser.hpp @@ -73,9 +73,7 @@ HeapRegion* res = NULL; if (_front < _end) { res = regions_at(_front); - assert(res != NULL, - err_msg("Unexpected NULL hr in _regions at index %u", - _front)); + assert(res != NULL, "Unexpected NULL hr in _regions at index %u", _front); } return res; } @@ -88,9 +86,9 @@ assert(_front < _end, "pre-condition"); regions_at_put(_front, NULL); assert(hr->reclaimable_bytes() <= _remaining_reclaimable_bytes, - err_msg("remaining reclaimable bytes inconsistent " - "from region: " SIZE_FORMAT " remaining: " SIZE_FORMAT, - hr->reclaimable_bytes(), _remaining_reclaimable_bytes)); + "remaining reclaimable bytes inconsistent " + "from region: " SIZE_FORMAT " remaining: " SIZE_FORMAT, + hr->reclaimable_bytes(), _remaining_reclaimable_bytes); _remaining_reclaimable_bytes -= hr->reclaimable_bytes(); _front += 1; return hr; diff --git a/src/share/vm/gc/g1/concurrentMark.cpp b/src/share/vm/gc/g1/concurrentMark.cpp --- a/src/share/vm/gc/g1/concurrentMark.cpp +++ b/src/share/vm/gc/g1/concurrentMark.cpp @@ -399,7 +399,7 @@ // only check this once per GC anyway, so it won't be a performance // issue in any way. guarantee(_saved_index == _index, - err_msg("saved index: %d index: %d", _saved_index, _index)); + "saved index: %d index: %d", _saved_index, _index); _saved_index = -1; } @@ -794,8 +794,8 @@ // in a STW phase. assert(!concurrent_marking_in_progress(), "invariant"); assert(out_of_regions(), - err_msg("only way to get here: _finger: " PTR_FORMAT ", _heap_end: " PTR_FORMAT, - p2i(_finger), p2i(_heap_end))); + "only way to get here: _finger: " PTR_FORMAT ", _heap_end: " PTR_FORMAT, + p2i(_finger), p2i(_heap_end)); } } @@ -1415,9 +1415,9 @@ HeapWord* start = hr->bottom(); assert(start <= hr->end() && start <= ntams && ntams <= hr->end(), - err_msg("Preconditions not met - " - "start: " PTR_FORMAT ", ntams: " PTR_FORMAT ", end: " PTR_FORMAT, - p2i(start), p2i(ntams), p2i(hr->end()))); + "Preconditions not met - " + "start: " PTR_FORMAT ", ntams: " PTR_FORMAT ", end: " PTR_FORMAT, + p2i(start), p2i(ntams), p2i(hr->end())); // Find the first marked object at or after "start". start = _bm->getNextMarkedWordAddress(start, ntams); @@ -1717,11 +1717,11 @@ } assert(end_idx <= _card_bm->size(), - err_msg("oob: end_idx= " SIZE_FORMAT ", bitmap size= " SIZE_FORMAT, - end_idx, _card_bm->size())); + "oob: end_idx= " SIZE_FORMAT ", bitmap size= " SIZE_FORMAT, + end_idx, _card_bm->size()); assert(start_idx < _card_bm->size(), - err_msg("oob: start_idx= " SIZE_FORMAT ", bitmap size= " SIZE_FORMAT, - start_idx, _card_bm->size())); + "oob: start_idx= " SIZE_FORMAT ", bitmap size= " SIZE_FORMAT, + start_idx, _card_bm->size()); _cm->set_card_bitmap_range(_card_bm, start_idx, end_idx, true /* is_par */); } @@ -2471,7 +2471,7 @@ // object; it could instead have been a stale reference. oop obj = static_cast(entry); assert(obj->is_oop(true /* ignore mark word */), - err_msg("Invalid oop in SATB buffer: " PTR_FORMAT, p2i(obj))); + "Invalid oop in SATB buffer: " PTR_FORMAT, p2i(obj)); _task->make_reference_grey(obj, hr); } } @@ -2588,9 +2588,9 @@ SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); guarantee(has_overflown() || satb_mq_set.completed_buffers_num() == 0, - err_msg("Invariant: has_overflown = %s, num buffers = %d", - BOOL_TO_STR(has_overflown()), - satb_mq_set.completed_buffers_num())); + "Invariant: has_overflown = %s, num buffers = %d", + BOOL_TO_STR(has_overflown()), + satb_mq_set.completed_buffers_num()); print_stats(); } @@ -2724,11 +2724,11 @@ void operator()(oop obj) const { guarantee(obj->is_oop(), - err_msg("Non-oop " PTR_FORMAT ", phase: %s, info: %d", - p2i(obj), _phase, _info)); + "Non-oop " PTR_FORMAT ", phase: %s, info: %d", + p2i(obj), _phase, _info); guarantee(!_g1h->obj_in_cs(obj), - err_msg("obj: " PTR_FORMAT " in CSet, phase: %s, info: %d", - p2i(obj), _phase, _info)); + "obj: " PTR_FORMAT " in CSet, phase: %s, info: %d", + p2i(obj), _phase, _info); } }; @@ -2761,8 +2761,8 @@ // here. HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger); guarantee(global_hr == NULL || global_finger == global_hr->bottom(), - err_msg("global finger: " PTR_FORMAT " region: " HR_FORMAT, - p2i(global_finger), HR_FORMAT_PARAMS(global_hr))); + "global finger: " PTR_FORMAT " region: " HR_FORMAT, + p2i(global_finger), HR_FORMAT_PARAMS(global_hr)); } // Verify the task fingers @@ -2775,8 +2775,8 @@ HeapRegion* task_hr = _g1h->heap_region_containing_raw(task_finger); guarantee(task_hr == NULL || task_finger == task_hr->bottom() || !task_hr->in_collection_set(), - err_msg("task finger: " PTR_FORMAT " region: " HR_FORMAT, - p2i(task_finger), HR_FORMAT_PARAMS(task_hr))); + "task finger: " PTR_FORMAT " region: " HR_FORMAT, + p2i(task_finger), HR_FORMAT_PARAMS(task_hr)); } } } @@ -2816,10 +2816,10 @@ HeapWord* end = hr->end(); assert(start <= limit && limit <= hr->top() && hr->top() <= hr->end(), - err_msg("Preconditions not met - " - "start: " PTR_FORMAT ", limit: " PTR_FORMAT ", " - "top: " PTR_FORMAT ", end: " PTR_FORMAT, - p2i(start), p2i(limit), p2i(hr->top()), p2i(hr->end()))); + "Preconditions not met - " + "start: " PTR_FORMAT ", limit: " PTR_FORMAT ", " + "top: " PTR_FORMAT ", end: " PTR_FORMAT, + p2i(start), p2i(limit), p2i(hr->top()), p2i(hr->end())); assert(hr->next_marked_bytes() == 0, "Precondition"); diff --git a/src/share/vm/gc/g1/concurrentMark.inline.hpp b/src/share/vm/gc/g1/concurrentMark.inline.hpp --- a/src/share/vm/gc/g1/concurrentMark.inline.hpp +++ b/src/share/vm/gc/g1/concurrentMark.inline.hpp @@ -197,9 +197,9 @@ assert(_bmStartWord <= (addr) && (addr) < (_bmStartWord + _bmWordSize), \ "outside underlying space?"); \ assert(G1CollectedHeap::heap()->is_in_exact(addr), \ - err_msg("Trying to access not available bitmap " PTR_FORMAT \ - " corresponding to " PTR_FORMAT " (%u)", \ - p2i(this), p2i(addr), G1CollectedHeap::heap()->addr_to_region(addr))); + "Trying to access not available bitmap " PTR_FORMAT \ + " corresponding to " PTR_FORMAT " (%u)", \ + p2i(this), p2i(addr), G1CollectedHeap::heap()->addr_to_region(addr)); inline void CMBitMap::mark(HeapWord* addr) { check_mark(addr); @@ -225,8 +225,7 @@ template inline void CMMarkStack::iterate(Fn fn) { - assert(_saved_index == _index, - err_msg("saved index: %d index: %d", _saved_index, _index)); + assert(_saved_index == _index, "saved index: %d index: %d", _saved_index, _index); for (int i = 0; i < _index; ++i) { fn(_base[i]); } @@ -385,7 +384,7 @@ increment_refs_reached(); HeapWord* objAddr = (HeapWord*) obj; - assert(obj->is_oop_or_null(true /* ignore mark word */), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(obj))); + assert(obj->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj)); if (_g1h->is_in_g1_reserved(objAddr)) { assert(obj != NULL, "null check is implicit"); if (!_nextMarkBitMap->isMarked(objAddr)) { @@ -427,9 +426,9 @@ // assert that word_size is under an upper bound which is its // containing region's capacity. assert(word_size * HeapWordSize <= hr->capacity(), - err_msg("size: " SIZE_FORMAT " capacity: " SIZE_FORMAT " " HR_FORMAT, - word_size * HeapWordSize, hr->capacity(), - HR_FORMAT_PARAMS(hr))); + "size: " SIZE_FORMAT " capacity: " SIZE_FORMAT " " HR_FORMAT, + word_size * HeapWordSize, hr->capacity(), + HR_FORMAT_PARAMS(hr)); if (addr < hr->next_top_at_mark_start()) { if (!_nextMarkBitMap->isMarked(addr)) { diff --git a/src/share/vm/gc/g1/g1AllocRegion.cpp b/src/share/vm/gc/g1/g1AllocRegion.cpp --- a/src/share/vm/gc/g1/g1AllocRegion.cpp +++ b/src/share/vm/gc/g1/g1AllocRegion.cpp @@ -91,7 +91,7 @@ } size_t G1AllocRegion::retire(bool fill_up) { - assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly")); + assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly").buffer()); size_t result = 0; @@ -102,14 +102,14 @@ // and potentially free it if it is, given that it's guaranteed that // it will never be empty. assert(!alloc_region->is_empty(), - ar_ext_msg(this, "the alloc region should never be empty")); + ar_ext_msg(this, "the alloc region should never be empty").buffer()); if (fill_up) { result = fill_up_remaining_space(alloc_region, _bot_updates); } assert(alloc_region->used() >= _used_bytes_before, - ar_ext_msg(this, "invariant")); + ar_ext_msg(this, "invariant").buffer()); size_t allocated_bytes = alloc_region->used() - _used_bytes_before; retire_region(alloc_region, allocated_bytes); _used_bytes_before = 0; @@ -122,8 +122,8 @@ HeapWord* G1AllocRegion::new_alloc_region_and_allocate(size_t word_size, bool force) { - assert(_alloc_region == _dummy_region, ar_ext_msg(this, "pre-condition")); - assert(_used_bytes_before == 0, ar_ext_msg(this, "pre-condition")); + assert(_alloc_region == _dummy_region, ar_ext_msg(this, "pre-condition").buffer()); + assert(_used_bytes_before == 0, ar_ext_msg(this, "pre-condition").buffer()); trace("attempting region allocation"); HeapRegion* new_alloc_region = allocate_new_region(word_size, force); @@ -132,7 +132,7 @@ // Need to do this before the allocation _used_bytes_before = new_alloc_region->used(); HeapWord* result = allocate(new_alloc_region, word_size, _bot_updates); - assert(result != NULL, ar_ext_msg(this, "the allocation should succeeded")); + assert(result != NULL, ar_ext_msg(this, "the allocation should succeeded").buffer()); OrderAccess::storestore(); // Note that we first perform the allocation and then we store the @@ -157,8 +157,8 @@ void G1AllocRegion::init() { trace("initializing"); assert(_alloc_region == NULL && _used_bytes_before == 0, - ar_ext_msg(this, "pre-condition")); - assert(_dummy_region != NULL, ar_ext_msg(this, "should have been set")); + ar_ext_msg(this, "pre-condition").buffer()); + assert(_dummy_region != NULL, ar_ext_msg(this, "should have been set").buffer()); _alloc_region = _dummy_region; _count = 0; trace("initialized"); @@ -169,10 +169,10 @@ // We explicitly check that the region is not empty to make sure we // maintain the "the alloc region cannot be empty" invariant. assert(alloc_region != NULL && !alloc_region->is_empty(), - ar_ext_msg(this, "pre-condition")); + ar_ext_msg(this, "pre-condition").buffer()); assert(_alloc_region == _dummy_region && _used_bytes_before == 0 && _count == 0, - ar_ext_msg(this, "pre-condition")); + ar_ext_msg(this, "pre-condition").buffer()); _used_bytes_before = alloc_region->used(); _alloc_region = alloc_region; @@ -185,7 +185,7 @@ // We explicitly check that the region is not empty to make sure we // maintain the "the alloc region cannot be empty" invariant. assert(alloc_region != NULL && !alloc_region->is_empty(), - ar_ext_msg(this, "pre-condition")); + ar_ext_msg(this, "pre-condition").buffer()); _alloc_region = alloc_region; _alloc_region->set_allocation_context(allocation_context()); @@ -198,7 +198,7 @@ HeapRegion* alloc_region = _alloc_region; retire(false /* fill_up */); assert(_alloc_region == _dummy_region, - ar_ext_msg(this, "post-condition of retire()")); + ar_ext_msg(this, "post-condition of retire()").buffer()); _alloc_region = NULL; trace("released"); return (alloc_region == _dummy_region) ? NULL : alloc_region; diff --git a/src/share/vm/gc/g1/g1AllocRegion.inline.hpp b/src/share/vm/gc/g1/g1AllocRegion.inline.hpp --- a/src/share/vm/gc/g1/g1AllocRegion.inline.hpp +++ b/src/share/vm/gc/g1/g1AllocRegion.inline.hpp @@ -31,7 +31,7 @@ inline HeapWord* G1AllocRegion::allocate(HeapRegion* alloc_region, size_t word_size, bool bot_updates) { - assert(alloc_region != NULL, err_msg("pre-condition")); + assert(alloc_region != NULL, "pre-condition"); if (!bot_updates) { return alloc_region->allocate_no_bot_updates(word_size); @@ -50,8 +50,8 @@ size_t desired_word_size, size_t* actual_word_size, bool bot_updates) { - assert(alloc_region != NULL, err_msg("pre-condition")); - assert(!alloc_region->is_empty(), err_msg("pre-condition")); + assert(alloc_region != NULL, "pre-condition"); + assert(!alloc_region->is_empty(), "pre-condition"); if (!bot_updates) { return alloc_region->par_allocate_no_bot_updates(min_word_size, desired_word_size, actual_word_size); @@ -69,10 +69,10 @@ size_t desired_word_size, size_t* actual_word_size, bool bot_updates) { - assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition")); + assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition").buffer()); HeapRegion* alloc_region = _alloc_region; - assert(alloc_region != NULL, ar_ext_msg(this, "not initialized properly")); + assert(alloc_region != NULL, ar_ext_msg(this, "not initialized properly").buffer()); HeapWord* result = par_allocate(alloc_region, min_word_size, desired_word_size, actual_word_size, bot_updates); if (result != NULL) { @@ -113,8 +113,8 @@ inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size, bool bot_updates) { - assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition")); - assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly")); + assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition").buffer()); + assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly").buffer()); trace("forcing alloc", word_size, word_size); HeapWord* result = new_alloc_region_and_allocate(word_size, true /* force */); diff --git a/src/share/vm/gc/g1/g1Allocator.cpp b/src/share/vm/gc/g1/g1Allocator.cpp --- a/src/share/vm/gc/g1/g1Allocator.cpp +++ b/src/share/vm/gc/g1/g1Allocator.cpp @@ -54,7 +54,7 @@ HeapRegion* retained_region = *retained_old; *retained_old = NULL; assert(retained_region == NULL || !retained_region->is_archive(), - err_msg("Archive region should not be alloc region (index %u)", retained_region->hrm_index())); + "Archive region should not be alloc region (index %u)", retained_region->hrm_index()); // We will discard the current GC alloc region if: // a) it's in the collection set (it can happen!), @@ -147,8 +147,8 @@ size_t temp = 0; HeapWord* result = par_allocate_during_gc(dest, word_size, word_size, &temp, context); assert(result == NULL || temp == word_size, - err_msg("Requested " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT, - word_size, temp, p2i(result))); + "Requested " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT, + word_size, temp, p2i(result)); return result; } @@ -276,16 +276,16 @@ context); assert(buf == NULL || ((actual_plab_size >= required_in_plab) && (actual_plab_size <= plab_word_size)), - err_msg("Requested at minimum " SIZE_FORMAT ", desired " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT, - required_in_plab, plab_word_size, actual_plab_size, p2i(buf))); + "Requested at minimum " SIZE_FORMAT ", desired " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT, + required_in_plab, plab_word_size, actual_plab_size, p2i(buf)); if (buf != NULL) { alloc_buf->set_buf(buf, actual_plab_size); HeapWord* const obj = alloc_buf->allocate(word_sz); - assert(obj != NULL, err_msg("PLAB should have been big enough, tried to allocate " - SIZE_FORMAT " requiring " SIZE_FORMAT " PLAB size " SIZE_FORMAT, - word_sz, required_in_plab, plab_word_size)); + assert(obj != NULL, "PLAB should have been big enough, tried to allocate " + SIZE_FORMAT " requiring " SIZE_FORMAT " PLAB size " SIZE_FORMAT, + word_sz, required_in_plab, plab_word_size); return obj; } // Otherwise. @@ -354,7 +354,7 @@ if (hr == NULL) { return false; } - assert(hr->is_empty(), err_msg("expected empty region (index %u)", hr->hrm_index())); + assert(hr->is_empty(), "expected empty region (index %u)", hr->hrm_index()); hr->set_archive(); _g1h->old_set_add(hr); _g1h->hr_printer()->alloc(hr, G1HRPrinter::Archive); @@ -383,15 +383,15 @@ } HeapWord* old_top = _allocation_region->top(); assert(_bottom >= _allocation_region->bottom(), - err_msg("inconsistent allocation state: " PTR_FORMAT " < " PTR_FORMAT, - p2i(_bottom), p2i(_allocation_region->bottom()))); + "inconsistent allocation state: " PTR_FORMAT " < " PTR_FORMAT, + p2i(_bottom), p2i(_allocation_region->bottom())); assert(_max <= _allocation_region->end(), - err_msg("inconsistent allocation state: " PTR_FORMAT " > " PTR_FORMAT, - p2i(_max), p2i(_allocation_region->end()))); + "inconsistent allocation state: " PTR_FORMAT " > " PTR_FORMAT, + p2i(_max), p2i(_allocation_region->end())); assert(_bottom <= old_top && old_top <= _max, - err_msg("inconsistent allocation state: expected " - PTR_FORMAT " <= " PTR_FORMAT " <= " PTR_FORMAT, - p2i(_bottom), p2i(old_top), p2i(_max))); + "inconsistent allocation state: expected " + PTR_FORMAT " <= " PTR_FORMAT " <= " PTR_FORMAT, + p2i(_bottom), p2i(old_top), p2i(_max)); // Allocate the next word_size words in the current allocation chunk. // If allocation would cross the _max boundary, insert a filler and begin @@ -430,9 +430,9 @@ void G1ArchiveAllocator::complete_archive(GrowableArray* ranges, size_t end_alignment_in_bytes) { assert((end_alignment_in_bytes >> LogHeapWordSize) < HeapRegion::min_region_size_in_words(), - err_msg("alignment " SIZE_FORMAT " too large", end_alignment_in_bytes)); + "alignment " SIZE_FORMAT " too large", end_alignment_in_bytes); assert(is_size_aligned(end_alignment_in_bytes, HeapWordSize), - err_msg("alignment " SIZE_FORMAT " is not HeapWord (%u) aligned", end_alignment_in_bytes, HeapWordSize)); + "alignment " SIZE_FORMAT " is not HeapWord (%u) aligned", end_alignment_in_bytes, HeapWordSize); // If we've allocated nothing, simply return. if (_allocation_region == NULL) { @@ -465,8 +465,8 @@ // MemRegions to the GrowableArray provided by the caller. int index = _allocated_regions.length() - 1; assert(_allocated_regions.at(index) == _allocation_region, - err_msg("expected region %u at end of array, found %u", - _allocation_region->hrm_index(), _allocated_regions.at(index)->hrm_index())); + "expected region %u at end of array, found %u", + _allocation_region->hrm_index(), _allocated_regions.at(index)->hrm_index()); HeapWord* base_address = _allocation_region->bottom(); HeapWord* top = base_address; @@ -482,7 +482,7 @@ index = index - 1; } - assert(top != base_address, err_msg("zero-sized range, address " PTR_FORMAT, p2i(base_address))); + assert(top != base_address, "zero-sized range, address " PTR_FORMAT, p2i(base_address)); ranges->append(MemRegion(base_address, pointer_delta(top, base_address))); _allocated_regions.clear(); _allocation_region = NULL; diff --git a/src/share/vm/gc/g1/g1Allocator.hpp b/src/share/vm/gc/g1/g1Allocator.hpp --- a/src/share/vm/gc/g1/g1Allocator.hpp +++ b/src/share/vm/gc/g1/g1Allocator.hpp @@ -295,9 +295,9 @@ virtual G1PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) { assert(dest.is_valid(), - err_msg("Allocation buffer index out-of-bounds: " CSETSTATE_FORMAT, dest.value())); + "Allocation buffer index out-of-bounds: " CSETSTATE_FORMAT, dest.value()); assert(_alloc_buffers[dest.value()] != NULL, - err_msg("Allocation buffer is NULL: " CSETSTATE_FORMAT, dest.value())); + "Allocation buffer is NULL: " CSETSTATE_FORMAT, dest.value()); return _alloc_buffers[dest.value()]; } diff --git a/src/share/vm/gc/g1/g1Allocator.inline.hpp b/src/share/vm/gc/g1/g1Allocator.inline.hpp --- a/src/share/vm/gc/g1/g1Allocator.inline.hpp +++ b/src/share/vm/gc/g1/g1Allocator.inline.hpp @@ -36,7 +36,7 @@ HeapWord* G1Allocator::attempt_allocation_locked(size_t word_size, AllocationContext_t context) { HeapWord* result = mutator_alloc_region(context)->attempt_allocation_locked(word_size, false /* bot_updates */); assert(result != NULL || mutator_alloc_region(context)->get() == NULL, - err_msg("Must not have a mutator alloc region if there is no memory, but is " PTR_FORMAT, p2i(mutator_alloc_region(context)->get()))); + "Must not have a mutator alloc region if there is no memory, but is " PTR_FORMAT, p2i(mutator_alloc_region(context)->get())); return result; } diff --git a/src/share/vm/gc/g1/g1BiasedArray.cpp b/src/share/vm/gc/g1/g1BiasedArray.cpp --- a/src/share/vm/gc/g1/g1BiasedArray.cpp +++ b/src/share/vm/gc/g1/g1BiasedArray.cpp @@ -36,19 +36,19 @@ #ifndef PRODUCT void G1BiasedMappedArrayBase::verify_index(idx_t index) const { guarantee(_base != NULL, "Array not initialized"); - guarantee(index < length(), err_msg("Index out of bounds index: " SIZE_FORMAT " length: " SIZE_FORMAT, index, length())); + guarantee(index < length(), "Index out of bounds index: " SIZE_FORMAT " length: " SIZE_FORMAT, index, length()); } void G1BiasedMappedArrayBase::verify_biased_index(idx_t biased_index) const { guarantee(_biased_base != NULL, "Array not initialized"); guarantee(biased_index >= bias() && biased_index < (bias() + length()), - err_msg("Biased index out of bounds, index: " SIZE_FORMAT " bias: " SIZE_FORMAT " length: " SIZE_FORMAT, biased_index, bias(), length())); + "Biased index out of bounds, index: " SIZE_FORMAT " bias: " SIZE_FORMAT " length: " SIZE_FORMAT, biased_index, bias(), length()); } void G1BiasedMappedArrayBase::verify_biased_index_inclusive_end(idx_t biased_index) const { guarantee(_biased_base != NULL, "Array not initialized"); guarantee(biased_index >= bias() && biased_index <= (bias() + length()), - err_msg("Biased index out of inclusive bounds, index: " SIZE_FORMAT " bias: " SIZE_FORMAT " length: " SIZE_FORMAT, biased_index, bias(), length())); + "Biased index out of inclusive bounds, index: " SIZE_FORMAT " bias: " SIZE_FORMAT " length: " SIZE_FORMAT, biased_index, bias(), length()); } class TestMappedArray : public G1BiasedMappedArray { @@ -65,7 +65,7 @@ REGION_SIZE_IN_WORDS * HeapWordSize); // Check address calculation (bounds) assert(array.bottom_address_mapped() == fake_heap, - err_msg("bottom mapped address should be " PTR_FORMAT ", but is " PTR_FORMAT, p2i(fake_heap), p2i(array.bottom_address_mapped()))); + "bottom mapped address should be " PTR_FORMAT ", but is " PTR_FORMAT, p2i(fake_heap), p2i(array.bottom_address_mapped())); assert(array.end_address_mapped() == (fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS), "must be"); int* bottom = array.address_mapped_to(fake_heap); diff --git a/src/share/vm/gc/g1/g1BiasedArray.hpp b/src/share/vm/gc/g1/g1BiasedArray.hpp --- a/src/share/vm/gc/g1/g1BiasedArray.hpp +++ b/src/share/vm/gc/g1/g1BiasedArray.hpp @@ -56,7 +56,7 @@ void initialize_base(address base, size_t length, size_t bias, size_t elem_size, uint shift_by) { assert(base != NULL, "just checking"); assert(length > 0, "just checking"); - assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %u, larger than word size?", shift_by)); + assert(shift_by < sizeof(uintptr_t) * 8, "Shifting by %u, larger than word size?", shift_by); _base = base; _length = length; _biased_base = base - (bias * elem_size); @@ -69,13 +69,13 @@ void initialize(HeapWord* bottom, HeapWord* end, size_t target_elem_size_in_bytes, size_t mapping_granularity_in_bytes) { assert(mapping_granularity_in_bytes > 0, "just checking"); assert(is_power_of_2(mapping_granularity_in_bytes), - err_msg("mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes)); + "mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes); assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0, - err_msg("bottom mapping area address must be a multiple of mapping granularity %zd, is " PTR_FORMAT, - mapping_granularity_in_bytes, p2i(bottom))); + "bottom mapping area address must be a multiple of mapping granularity %zd, is " PTR_FORMAT, + mapping_granularity_in_bytes, p2i(bottom)); assert((uintptr_t)end % mapping_granularity_in_bytes == 0, - err_msg("end mapping area address must be a multiple of mapping granularity %zd, is " PTR_FORMAT, - mapping_granularity_in_bytes, p2i(end))); + "end mapping area address must be a multiple of mapping granularity %zd, is " PTR_FORMAT, + mapping_granularity_in_bytes, p2i(end)); size_t num_target_elems = pointer_delta(end, bottom, mapping_granularity_in_bytes); idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes; address base = create_new_base_array(num_target_elems, target_elem_size_in_bytes); diff --git a/src/share/vm/gc/g1/g1BlockOffsetTable.cpp b/src/share/vm/gc/g1/g1BlockOffsetTable.cpp --- a/src/share/vm/gc/g1/g1BlockOffsetTable.cpp +++ b/src/share/vm/gc/g1/g1BlockOffsetTable.cpp @@ -69,14 +69,14 @@ #ifdef ASSERT void G1BlockOffsetSharedArray::check_index(size_t index, const char* msg) const { assert((index) < (_reserved.word_size() >> LogN_words), - err_msg("%s - index: " SIZE_FORMAT ", _vs.committed_size: " SIZE_FORMAT, - msg, (index), (_reserved.word_size() >> LogN_words))); + "%s - index: " SIZE_FORMAT ", _vs.committed_size: " SIZE_FORMAT, + msg, (index), (_reserved.word_size() >> LogN_words)); assert(G1CollectedHeap::heap()->is_in_exact(address_for_index_raw(index)), - err_msg("Index " SIZE_FORMAT " corresponding to " PTR_FORMAT - " (%u) is not in committed area.", - (index), - p2i(address_for_index_raw(index)), - G1CollectedHeap::heap()->addr_to_region(address_for_index_raw(index)))); + "Index " SIZE_FORMAT " corresponding to " PTR_FORMAT + " (%u) is not in committed area.", + (index), + p2i(address_for_index_raw(index)), + G1CollectedHeap::heap()->addr_to_region(address_for_index_raw(index))); } #endif // ASSERT @@ -192,27 +192,27 @@ u_char entry = _array->offset_array(c); if (c - start_card > BlockOffsetArray::power_to_cards_back(1)) { guarantee(entry > N_words, - err_msg("Should be in logarithmic region - " - "entry: %u, " - "_array->offset_array(c): %u, " - "N_words: %u", - (uint)entry, (uint)_array->offset_array(c), (uint)N_words)); + "Should be in logarithmic region - " + "entry: %u, " + "_array->offset_array(c): %u, " + "N_words: %u", + (uint)entry, (uint)_array->offset_array(c), (uint)N_words); } size_t backskip = BlockOffsetArray::entry_to_cards_back(entry); size_t landing_card = c - backskip; guarantee(landing_card >= (start_card - 1), "Inv"); if (landing_card >= start_card) { guarantee(_array->offset_array(landing_card) <= entry, - err_msg("Monotonicity - landing_card offset: %u, " - "entry: %u", - (uint)_array->offset_array(landing_card), (uint)entry)); + "Monotonicity - landing_card offset: %u, " + "entry: %u", + (uint)_array->offset_array(landing_card), (uint)entry); } else { guarantee(landing_card == start_card - 1, "Tautology"); // Note that N_words is the maximum offset value guarantee(_array->offset_array(landing_card) <= N_words, - err_msg("landing card offset: %u, " - "N_words: %u", - (uint)_array->offset_array(landing_card), (uint)N_words)); + "landing card offset: %u, " + "N_words: %u", + (uint)_array->offset_array(landing_card), (uint)N_words); } } } @@ -271,9 +271,9 @@ HeapWord* next_boundary = _array->address_for_index(n_index) + (n_index == next_index ? 0 : N_words); assert(next_boundary <= _array->_end, - err_msg("next_boundary is beyond the end of the covered region " - " next_boundary " PTR_FORMAT " _array->_end " PTR_FORMAT, - p2i(next_boundary), p2i(_array->_end))); + "next_boundary is beyond the end of the covered region " + " next_boundary " PTR_FORMAT " _array->_end " PTR_FORMAT, + p2i(next_boundary), p2i(_array->_end)); if (addr >= gsp()->top()) return gsp()->top(); while (next_boundary < addr) { while (n <= next_boundary) { @@ -365,21 +365,21 @@ blk_start == boundary) || (_array->offset_array(orig_index) > 0 && _array->offset_array(orig_index) <= N_words), - err_msg("offset array should have been set - " - "orig_index offset: %u, " - "blk_start: " PTR_FORMAT ", " - "boundary: " PTR_FORMAT, - (uint)_array->offset_array(orig_index), - p2i(blk_start), p2i(boundary))); + "offset array should have been set - " + "orig_index offset: %u, " + "blk_start: " PTR_FORMAT ", " + "boundary: " PTR_FORMAT, + (uint)_array->offset_array(orig_index), + p2i(blk_start), p2i(boundary)); for (size_t j = orig_index + 1; j <= end_index; j++) { assert(_array->offset_array(j) > 0 && _array->offset_array(j) <= (u_char) (N_words+BlockOffsetArray::N_powers-1), - err_msg("offset array should have been set - " - "%u not > 0 OR %u not <= %u", - (uint) _array->offset_array(j), - (uint) _array->offset_array(j), - (uint) (N_words+BlockOffsetArray::N_powers-1))); + "offset array should have been set - " + "%u not > 0 OR %u not <= %u", + (uint) _array->offset_array(j), + (uint) _array->offset_array(j), + (uint) (N_words+BlockOffsetArray::N_powers-1)); } #endif } @@ -402,8 +402,8 @@ size_t obj_size = block_size(obj); obj_end = obj + obj_size; guarantee(obj_end > obj && obj_end <= gsp()->top(), - err_msg("Invalid object end. obj: " PTR_FORMAT " obj_size: " SIZE_FORMAT " obj_end: " PTR_FORMAT " top: " PTR_FORMAT, - p2i(obj), obj_size, p2i(obj_end), p2i(gsp()->top()))); + "Invalid object end. obj: " PTR_FORMAT " obj_size: " SIZE_FORMAT " obj_end: " PTR_FORMAT " top: " PTR_FORMAT, + p2i(obj), obj_size, p2i(obj_end), p2i(gsp()->top())); } } else { // Because we refine the BOT based on which cards are dirty there is not much we can verify here. @@ -414,13 +414,13 @@ size_t max_backskip = current_card - start_card; guarantee(backskip <= max_backskip, - err_msg("Going backwards beyond the start_card. start_card: " SIZE_FORMAT " current_card: " SIZE_FORMAT " backskip: " SIZE_FORMAT, - start_card, current_card, backskip)); + "Going backwards beyond the start_card. start_card: " SIZE_FORMAT " current_card: " SIZE_FORMAT " backskip: " SIZE_FORMAT, + start_card, current_card, backskip); HeapWord* backskip_address = _array->address_for_index(current_card - backskip); guarantee(backskip_address >= gsp()->bottom(), - err_msg("Going backwards beyond bottom of the region: bottom: " PTR_FORMAT ", backskip_address: " PTR_FORMAT, - p2i(gsp()->bottom()), p2i(backskip_address))); + "Going backwards beyond bottom of the region: bottom: " PTR_FORMAT ", backskip_address: " PTR_FORMAT, + p2i(gsp()->bottom()), p2i(backskip_address)); } } } diff --git a/src/share/vm/gc/g1/g1BlockOffsetTable.hpp b/src/share/vm/gc/g1/g1BlockOffsetTable.hpp --- a/src/share/vm/gc/g1/g1BlockOffsetTable.hpp +++ b/src/share/vm/gc/g1/g1BlockOffsetTable.hpp @@ -80,8 +80,8 @@ virtual void set_bottom(HeapWord* new_bottom) { assert(new_bottom <= _end, - err_msg("new_bottom (" PTR_FORMAT ") > _end (" PTR_FORMAT ")", - p2i(new_bottom), p2i(_end))); + "new_bottom (" PTR_FORMAT ") > _end (" PTR_FORMAT ")", + p2i(new_bottom), p2i(_end)); _bottom = new_bottom; resize(pointer_delta(_end, _bottom)); } @@ -149,9 +149,9 @@ void check_offset(size_t offset, const char* msg) const { assert(offset <= N_words, - err_msg("%s - " - "offset: " SIZE_FORMAT ", N_words: %u", - msg, offset, (uint)N_words)); + "%s - " + "offset: " SIZE_FORMAT ", N_words: %u", + msg, offset, (uint)N_words); } // Bounds checking accessors: diff --git a/src/share/vm/gc/g1/g1BlockOffsetTable.inline.hpp b/src/share/vm/gc/g1/g1BlockOffsetTable.inline.hpp --- a/src/share/vm/gc/g1/g1BlockOffsetTable.inline.hpp +++ b/src/share/vm/gc/g1/g1BlockOffsetTable.inline.hpp @@ -81,8 +81,8 @@ char* pc = (char*)p; assert(pc >= (char*)_reserved.start() && pc < (char*)_reserved.end(), - err_msg("p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(p), p2i(_reserved.start()), p2i(_reserved.end()))); + "p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")", + p2i(p), p2i(_reserved.start()), p2i(_reserved.end())); size_t result = index_for_raw(p); check_index(result, "bad index from address"); return result; @@ -93,10 +93,10 @@ check_index(index, "index out of range"); HeapWord* result = address_for_index_raw(index); assert(result >= _reserved.start() && result < _reserved.end(), - err_msg("bad address from index result " PTR_FORMAT - " _reserved.start() " PTR_FORMAT " _reserved.end() " - PTR_FORMAT, - p2i(result), p2i(_reserved.start()), p2i(_reserved.end()))); + "bad address from index result " PTR_FORMAT + " _reserved.start() " PTR_FORMAT " _reserved.end() " + PTR_FORMAT, + p2i(result), p2i(_reserved.start()), p2i(_reserved.end())); return result; } diff --git a/src/share/vm/gc/g1/g1CardCounts.cpp b/src/share/vm/gc/g1/g1CardCounts.cpp --- a/src/share/vm/gc/g1/g1CardCounts.cpp +++ b/src/share/vm/gc/g1/g1CardCounts.cpp @@ -53,8 +53,8 @@ void G1CardCounts::clear_range(size_t from_card_num, size_t to_card_num) { if (has_count_table()) { assert(from_card_num < to_card_num, - err_msg("Wrong order? from: " SIZE_FORMAT ", to: " SIZE_FORMAT, - from_card_num, to_card_num)); + "Wrong order? from: " SIZE_FORMAT ", to: " SIZE_FORMAT, + from_card_num, to_card_num); Copy::fill_to_bytes(&_card_counts[from_card_num], (to_card_num - from_card_num)); } } @@ -96,8 +96,8 @@ if (has_count_table()) { size_t card_num = ptr_2_card_num(card_ptr); assert(card_num < _reserved_max_card_num, - err_msg("Card " SIZE_FORMAT " outside of card counts table (max size " SIZE_FORMAT ")", - card_num, _reserved_max_card_num)); + "Card " SIZE_FORMAT " outside of card counts table (max size " SIZE_FORMAT ")", + card_num, _reserved_max_card_num); count = (uint) _card_counts[card_num]; if (count < G1ConcRSHotCardLimit) { _card_counts[card_num] = diff --git a/src/share/vm/gc/g1/g1CardCounts.hpp b/src/share/vm/gc/g1/g1CardCounts.hpp --- a/src/share/vm/gc/g1/g1CardCounts.hpp +++ b/src/share/vm/gc/g1/g1CardCounts.hpp @@ -79,19 +79,19 @@ size_t ptr_2_card_num(const jbyte* card_ptr) { assert(card_ptr >= _ct_bot, - err_msg("Invalid card pointer: " - "card_ptr: " PTR_FORMAT ", " - "_ct_bot: " PTR_FORMAT, - p2i(card_ptr), p2i(_ct_bot))); + "Invalid card pointer: " + "card_ptr: " PTR_FORMAT ", " + "_ct_bot: " PTR_FORMAT, + p2i(card_ptr), p2i(_ct_bot)); size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte)); assert(card_num < _reserved_max_card_num, - err_msg("card pointer out of range: " PTR_FORMAT, p2i(card_ptr))); + "card pointer out of range: " PTR_FORMAT, p2i(card_ptr)); return card_num; } jbyte* card_num_2_ptr(size_t card_num) { assert(card_num < _reserved_max_card_num, - err_msg("card num out of range: " SIZE_FORMAT, card_num)); + "card num out of range: " SIZE_FORMAT, card_num); return (jbyte*) (_ct_bot + card_num); } diff --git a/src/share/vm/gc/g1/g1CodeCacheRemSet.cpp b/src/share/vm/gc/g1/g1CodeCacheRemSet.cpp --- a/src/share/vm/gc/g1/g1CodeCacheRemSet.cpp +++ b/src/share/vm/gc/g1/g1CodeCacheRemSet.cpp @@ -350,11 +350,11 @@ assert(set1.is_empty(), "Code root set must be initially empty but is not."); assert(G1CodeRootSet::static_mem_size() == sizeof(void*), - err_msg("The code root set's static memory usage is incorrect, " SIZE_FORMAT " bytes", G1CodeRootSet::static_mem_size())); + "The code root set's static memory usage is incorrect, " SIZE_FORMAT " bytes", G1CodeRootSet::static_mem_size()); set1.add((nmethod*)1); - assert(set1.length() == 1, err_msg("Added exactly one element, but set contains " - SIZE_FORMAT " elements", set1.length())); + assert(set1.length() == 1, "Added exactly one element, but set contains " + SIZE_FORMAT " elements", set1.length()); const size_t num_to_add = (size_t)G1CodeRootSet::Threshold + 1; @@ -362,16 +362,16 @@ set1.add((nmethod*)1); } assert(set1.length() == 1, - err_msg("Duplicate detection should not have increased the set size but " - "is " SIZE_FORMAT, set1.length())); + "Duplicate detection should not have increased the set size but " + "is " SIZE_FORMAT, set1.length()); for (size_t i = 2; i <= num_to_add; i++) { set1.add((nmethod*)(uintptr_t)(i)); } assert(set1.length() == num_to_add, - err_msg("After adding in total " SIZE_FORMAT " distinct code roots, they " - "need to be in the set, but there are only " SIZE_FORMAT, - num_to_add, set1.length())); + "After adding in total " SIZE_FORMAT " distinct code roots, they " + "need to be in the set, but there are only " SIZE_FORMAT, + num_to_add, set1.length()); assert(CodeRootSetTable::_purge_list != NULL, "should have grown to large hashtable"); @@ -385,8 +385,8 @@ } } assert(num_popped == num_to_add, - err_msg("Managed to pop " SIZE_FORMAT " code roots, but only " SIZE_FORMAT " " - "were added", num_popped, num_to_add)); + "Managed to pop " SIZE_FORMAT " code roots, but only " SIZE_FORMAT " " + "were added", num_popped, num_to_add); assert(CodeRootSetTable::_purge_list != NULL, "should have grown to large hashtable"); G1CodeRootSet::purge(); diff --git a/src/share/vm/gc/g1/g1CollectedHeap.cpp b/src/share/vm/gc/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc/g1/g1CollectedHeap.cpp @@ -971,11 +971,11 @@ size_t commits = 0; guarantee(reserved.contains(start_address) && reserved.contains(last_address), - err_msg("MemRegion outside of heap [" PTR_FORMAT ", " PTR_FORMAT "]", - p2i(start_address), p2i(last_address))); + "MemRegion outside of heap [" PTR_FORMAT ", " PTR_FORMAT "]", + p2i(start_address), p2i(last_address)); guarantee(start_address > prev_last_addr, - err_msg("Ranges not in ascending order: " PTR_FORMAT " <= " PTR_FORMAT , - p2i(start_address), p2i(prev_last_addr))); + "Ranges not in ascending order: " PTR_FORMAT " <= " PTR_FORMAT , + p2i(start_address), p2i(prev_last_addr)); prev_last_addr = last_address; // Check for ranges that start in the same G1 region in which the previous @@ -1017,7 +1017,7 @@ while (curr_region != NULL) { assert(curr_region->is_empty() && !curr_region->is_pinned(), - err_msg("Region already in use (index %u)", curr_region->hrm_index())); + "Region already in use (index %u)", curr_region->hrm_index()); _hr_printer.alloc(curr_region, G1HRPrinter::Archive); curr_region->set_allocation_context(AllocationContext::system()); curr_region->set_archive(); @@ -1055,11 +1055,11 @@ HeapWord* last_address = ranges[i].last(); assert(reserved.contains(start_address) && reserved.contains(last_address), - err_msg("MemRegion outside of heap [" PTR_FORMAT ", " PTR_FORMAT "]", - p2i(start_address), p2i(last_address))); + "MemRegion outside of heap [" PTR_FORMAT ", " PTR_FORMAT "]", + p2i(start_address), p2i(last_address)); assert(start_address > prev_last_addr, - err_msg("Ranges not in ascending order: " PTR_FORMAT " <= " PTR_FORMAT , - p2i(start_address), p2i(prev_last_addr))); + "Ranges not in ascending order: " PTR_FORMAT " <= " PTR_FORMAT , + p2i(start_address), p2i(prev_last_addr)); HeapRegion* start_region = _hrm.addr_to_region(start_address); HeapRegion* last_region = _hrm.addr_to_region(last_address); @@ -1076,7 +1076,7 @@ HeapRegion* curr_region = start_region; while (curr_region != NULL) { guarantee(curr_region->is_archive(), - err_msg("Expected archive region at index %u", curr_region->hrm_index())); + "Expected archive region at index %u", curr_region->hrm_index()); if (curr_region != last_region) { curr_region = _hrm.next_region_in_heap(curr_region); } else { @@ -1139,11 +1139,11 @@ HeapWord* last_address = ranges[i].last(); assert(reserved.contains(start_address) && reserved.contains(last_address), - err_msg("MemRegion outside of heap [" PTR_FORMAT ", " PTR_FORMAT "]", - p2i(start_address), p2i(last_address))); + "MemRegion outside of heap [" PTR_FORMAT ", " PTR_FORMAT "]", + p2i(start_address), p2i(last_address)); assert(start_address > prev_last_addr, - err_msg("Ranges not in ascending order: " PTR_FORMAT " <= " PTR_FORMAT , - p2i(start_address), p2i(prev_last_addr))); + "Ranges not in ascending order: " PTR_FORMAT " <= " PTR_FORMAT , + p2i(start_address), p2i(prev_last_addr)); size_used += ranges[i].byte_size(); prev_last_addr = last_address; @@ -1168,7 +1168,7 @@ HeapRegion* curr_region = start_region; while (curr_region != NULL) { guarantee(curr_region->is_archive(), - err_msg("Expected archive region at index %u", curr_region->hrm_index())); + "Expected archive region at index %u", curr_region->hrm_index()); uint curr_index = curr_region->hrm_index(); _old_set.remove(curr_region); curr_region->set_free(); @@ -1755,9 +1755,9 @@ // This assert only makes sense here, before we adjust them // with respect to the min and max heap size. assert(minimum_desired_capacity <= maximum_desired_capacity, - err_msg("minimum_desired_capacity = " SIZE_FORMAT ", " - "maximum_desired_capacity = " SIZE_FORMAT, - minimum_desired_capacity, maximum_desired_capacity)); + "minimum_desired_capacity = " SIZE_FORMAT ", " + "maximum_desired_capacity = " SIZE_FORMAT, + minimum_desired_capacity, maximum_desired_capacity); // Should not be greater than the heap max size. No need to adjust // it with respect to the heap min size as it's a lower bound (i.e., @@ -2539,8 +2539,8 @@ void G1CollectedHeap::increment_old_marking_cycles_started() { assert(_old_marking_cycles_started == _old_marking_cycles_completed || _old_marking_cycles_started == _old_marking_cycles_completed + 1, - err_msg("Wrong marking cycle count (started: %d, completed: %d)", - _old_marking_cycles_started, _old_marking_cycles_completed)); + "Wrong marking cycle count (started: %d, completed: %d)", + _old_marking_cycles_started, _old_marking_cycles_completed); _old_marking_cycles_started++; } @@ -2564,17 +2564,17 @@ assert(concurrent || (_old_marking_cycles_started == _old_marking_cycles_completed + 1) || (_old_marking_cycles_started == _old_marking_cycles_completed + 2), - err_msg("for inner caller (Full GC): _old_marking_cycles_started = %u " - "is inconsistent with _old_marking_cycles_completed = %u", - _old_marking_cycles_started, _old_marking_cycles_completed)); + "for inner caller (Full GC): _old_marking_cycles_started = %u " + "is inconsistent with _old_marking_cycles_completed = %u", + _old_marking_cycles_started, _old_marking_cycles_completed); // This is the case for the outer caller, i.e. the concurrent cycle. assert(!concurrent || (_old_marking_cycles_started == _old_marking_cycles_completed + 1), - err_msg("for outer caller (concurrent cycle): " - "_old_marking_cycles_started = %u " - "is inconsistent with _old_marking_cycles_completed = %u", - _old_marking_cycles_started, _old_marking_cycles_completed)); + "for outer caller (concurrent cycle): " + "_old_marking_cycles_started = %u " + "is inconsistent with _old_marking_cycles_completed = %u", + _old_marking_cycles_started, _old_marking_cycles_completed); _old_marking_cycles_completed += 1; @@ -3124,7 +3124,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.", p2i(k))); + guarantee(k->has_modified_oops(), "Klass " PTR_FORMAT ", has young refs but is not dirty.", p2i(k)); } } }; @@ -3194,8 +3194,8 @@ template void do_oop_work(T *p) { oop obj = oopDesc::load_decode_heap_oop(p); guarantee(obj == NULL || G1MarkSweep::in_archive_range(obj), - err_msg("Archive object at " PTR_FORMAT " references a non-archive object at " PTR_FORMAT, - p2i(p), p2i(obj))); + "Archive object at " PTR_FORMAT " references a non-archive object at " PTR_FORMAT, + p2i(p), p2i(obj)); } }; @@ -4709,11 +4709,11 @@ ~G1StringSymbolTableUnlinkTask() { guarantee(!_process_strings || StringTable::parallel_claimed_index() >= _initial_string_table_size, - err_msg("claim value %d after unlink less than initial string table size %d", - StringTable::parallel_claimed_index(), _initial_string_table_size)); + "claim value %d after unlink less than initial string table size %d", + StringTable::parallel_claimed_index(), _initial_string_table_size); guarantee(!_process_symbols || SymbolTable::parallel_claimed_index() >= _initial_symbol_table_size, - err_msg("claim value %d after unlink less than initial symbol table size %d", - SymbolTable::parallel_claimed_index(), _initial_symbol_table_size)); + "claim value %d after unlink less than initial symbol table size %d", + SymbolTable::parallel_claimed_index(), _initial_symbol_table_size); if (G1TraceStringSymbolTableScrubbing) { gclog_or_tty->print_cr("Cleaned string and symbol table, " @@ -5113,7 +5113,7 @@ } else { assert(!obj->is_forwarded(), "invariant" ); assert(cset_state.is_humongous(), - err_msg("Only allowed InCSet state is IsHumongous, but is %d", cset_state.value())); + "Only allowed InCSet state is IsHumongous, but is %d", cset_state.value()); _g1->set_humongous_is_live(obj); } } @@ -5167,7 +5167,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, p2i(p))); + "Unexpectedly found a pointer from metadata: " PTR_FORMAT, p2i(p)); _copy_non_heap_obj_cl->do_oop(p); } } @@ -5823,7 +5823,7 @@ 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, p2i(tams), p2i(end))); + "tams: " PTR_FORMAT " end: " PTR_FORMAT, p2i(tams), p2i(end)); HeapWord* result = bitmap->getNextMarkedWordAddress(tams, end); if (result < end) { gclog_or_tty->cr(); @@ -6174,9 +6174,8 @@ } guarantee(obj->is_typeArray(), - err_msg("Only eagerly reclaiming type arrays is supported, but the object " - PTR_FORMAT " is not.", - p2i(r->bottom()))); + "Only eagerly reclaiming type arrays is supported, but the object " + PTR_FORMAT " is not.", p2i(r->bottom())); if (G1TraceEagerReclaimHumongousObjects) { 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", @@ -6405,8 +6404,8 @@ void G1CollectedHeap::decrease_used(size_t bytes) { assert(_summary_bytes_used >= bytes, - err_msg("invariant: _summary_bytes_used: " SIZE_FORMAT " should be >= bytes: " SIZE_FORMAT, - _summary_bytes_used, bytes)); + "invariant: _summary_bytes_used: " SIZE_FORMAT " should be >= bytes: " SIZE_FORMAT, + _summary_bytes_used, bytes); _summary_bytes_used -= bytes; } @@ -6488,9 +6487,9 @@ } } assert(used_unlocked() == recalculate_used(), - err_msg("inconsistent used_unlocked(), " - "value: " SIZE_FORMAT " recalculated: " SIZE_FORMAT, - used_unlocked(), recalculate_used())); + "inconsistent used_unlocked(), " + "value: " SIZE_FORMAT " recalculated: " SIZE_FORMAT, + used_unlocked(), recalculate_used()); } void G1CollectedHeap::set_refine_cte_cl_concurrency(bool concurrent) { @@ -6631,35 +6630,35 @@ if (hr->is_young()) { // TODO } else if (hr->is_starts_humongous()) { - assert(hr->containing_set() == _humongous_set, err_msg("Heap region %u is starts humongous but not in humongous set.", hr->hrm_index())); + assert(hr->containing_set() == _humongous_set, "Heap region %u is starts humongous but not in humongous set.", hr->hrm_index()); _humongous_count.increment(1u, hr->capacity()); } else if (hr->is_empty()) { - assert(_hrm->is_free(hr), err_msg("Heap region %u is empty but not on the free list.", hr->hrm_index())); + assert(_hrm->is_free(hr), "Heap region %u is empty but not on the free list.", hr->hrm_index()); _free_count.increment(1u, hr->capacity()); } else if (hr->is_old()) { - assert(hr->containing_set() == _old_set, err_msg("Heap region %u is old but not in the old set.", hr->hrm_index())); + assert(hr->containing_set() == _old_set, "Heap region %u is old but not in the old set.", hr->hrm_index()); _old_count.increment(1u, hr->capacity()); } else { // There are no other valid region types. Check for one invalid // one we can identify: pinned without old or humongous set. - assert(!hr->is_pinned(), err_msg("Heap region %u is pinned but not old (archive) or humongous.", hr->hrm_index())); + assert(!hr->is_pinned(), "Heap region %u is pinned but not old (archive) or humongous.", hr->hrm_index()); ShouldNotReachHere(); } return false; } void verify_counts(HeapRegionSet* old_set, HeapRegionSet* humongous_set, HeapRegionManager* free_list) { - guarantee(old_set->length() == _old_count.length(), err_msg("Old set count mismatch. Expected %u, actual %u.", old_set->length(), _old_count.length())); - guarantee(old_set->total_capacity_bytes() == _old_count.capacity(), err_msg("Old set capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT, - old_set->total_capacity_bytes(), _old_count.capacity())); - - guarantee(humongous_set->length() == _humongous_count.length(), err_msg("Hum set count mismatch. Expected %u, actual %u.", humongous_set->length(), _humongous_count.length())); - guarantee(humongous_set->total_capacity_bytes() == _humongous_count.capacity(), err_msg("Hum set capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT, - humongous_set->total_capacity_bytes(), _humongous_count.capacity())); - - guarantee(free_list->num_free_regions() == _free_count.length(), err_msg("Free list count mismatch. Expected %u, actual %u.", free_list->num_free_regions(), _free_count.length())); - guarantee(free_list->total_capacity_bytes() == _free_count.capacity(), err_msg("Free list capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT, - free_list->total_capacity_bytes(), _free_count.capacity())); + guarantee(old_set->length() == _old_count.length(), "Old set count mismatch. Expected %u, actual %u.", old_set->length(), _old_count.length()); + guarantee(old_set->total_capacity_bytes() == _old_count.capacity(), "Old set capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT, + old_set->total_capacity_bytes(), _old_count.capacity()); + + guarantee(humongous_set->length() == _humongous_count.length(), "Hum set count mismatch. Expected %u, actual %u.", humongous_set->length(), _humongous_count.length()); + guarantee(humongous_set->total_capacity_bytes() == _humongous_count.capacity(), "Hum set capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT, + humongous_set->total_capacity_bytes(), _humongous_count.capacity()); + + guarantee(free_list->num_free_regions() == _free_count.length(), "Free list count mismatch. Expected %u, actual %u.", free_list->num_free_regions(), _free_count.length()); + guarantee(free_list->total_capacity_bytes() == _free_count.capacity(), "Free list capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT, + free_list->total_capacity_bytes(), _free_count.capacity()); } }; @@ -6715,9 +6714,9 @@ oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); HeapRegion* hr = _g1h->heap_region_containing(obj); 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, - p2i(_nm), HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); + "trying to add code root " PTR_FORMAT " in continuation of humongous region " HR_FORMAT + " starting at " HR_FORMAT, + 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); @@ -6742,9 +6741,9 @@ oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); HeapRegion* hr = _g1h->heap_region_containing(obj); 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, - p2i(_nm), HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); + "trying to remove code root " PTR_FORMAT " in continuation of humongous region " HR_FORMAT + " starting at " HR_FORMAT, + 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/g1/g1CollectedHeap.hpp b/src/share/vm/gc/g1/g1CollectedHeap.hpp --- a/src/share/vm/gc/g1/g1CollectedHeap.hpp +++ b/src/share/vm/gc/g1/g1CollectedHeap.hpp @@ -368,17 +368,17 @@ // These are macros so that, if the assert fires, we get the correct // line number, file, etc. -#define heap_locking_asserts_err_msg(_extra_message_) \ - err_msg("%s : Heap_lock locked: %s, at safepoint: %s, is VM thread: %s", \ - (_extra_message_), \ - BOOL_TO_STR(Heap_lock->owned_by_self()), \ - BOOL_TO_STR(SafepointSynchronize::is_at_safepoint()), \ - BOOL_TO_STR(Thread::current()->is_VM_thread())) +#define heap_locking_asserts_params(_extra_message_) \ + "%s : Heap_lock locked: %s, at safepoint: %s, is VM thread: %s", \ + (_extra_message_), \ + BOOL_TO_STR(Heap_lock->owned_by_self()), \ + BOOL_TO_STR(SafepointSynchronize::is_at_safepoint()), \ + BOOL_TO_STR(Thread::current()->is_VM_thread()) #define assert_heap_locked() \ do { \ assert(Heap_lock->owned_by_self(), \ - heap_locking_asserts_err_msg("should be holding the Heap_lock")); \ + heap_locking_asserts_params("should be holding the Heap_lock")); \ } while (0) #define assert_heap_locked_or_at_safepoint(_should_be_vm_thread_) \ @@ -386,7 +386,7 @@ assert(Heap_lock->owned_by_self() || \ (SafepointSynchronize::is_at_safepoint() && \ ((_should_be_vm_thread_) == Thread::current()->is_VM_thread())), \ - heap_locking_asserts_err_msg("should be holding the Heap_lock or " \ + heap_locking_asserts_params("should be holding the Heap_lock or " \ "should be at a safepoint")); \ } while (0) @@ -394,21 +394,21 @@ do { \ assert(Heap_lock->owned_by_self() && \ !SafepointSynchronize::is_at_safepoint(), \ - heap_locking_asserts_err_msg("should be holding the Heap_lock and " \ + heap_locking_asserts_params("should be holding the Heap_lock and " \ "should not be at a safepoint")); \ } while (0) #define assert_heap_not_locked() \ do { \ assert(!Heap_lock->owned_by_self(), \ - heap_locking_asserts_err_msg("should not be holding the Heap_lock")); \ + heap_locking_asserts_params("should not be holding the Heap_lock")); \ } while (0) #define assert_heap_not_locked_and_not_at_safepoint() \ do { \ assert(!Heap_lock->owned_by_self() && \ !SafepointSynchronize::is_at_safepoint(), \ - heap_locking_asserts_err_msg("should not be holding the Heap_lock and " \ + heap_locking_asserts_params("should not be holding the Heap_lock and " \ "should not be at a safepoint")); \ } while (0) @@ -416,13 +416,13 @@ do { \ assert(SafepointSynchronize::is_at_safepoint() && \ ((_should_be_vm_thread_) == Thread::current()->is_VM_thread()), \ - heap_locking_asserts_err_msg("should be at a safepoint")); \ + heap_locking_asserts_params("should be at a safepoint")); \ } while (0) #define assert_not_at_safepoint() \ do { \ assert(!SafepointSynchronize::is_at_safepoint(), \ - heap_locking_asserts_err_msg("should not be at a safepoint")); \ + heap_locking_asserts_params("should not be at a safepoint")); \ } while (0) protected: diff --git a/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp b/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp --- a/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp +++ b/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp @@ -67,8 +67,8 @@ inline uint G1CollectedHeap::addr_to_region(HeapWord* addr) const { assert(is_in_reserved(addr), - err_msg("Cannot calculate region index for address " PTR_FORMAT " that is outside of the heap [" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(addr), p2i(reserved_region().start()), p2i(reserved_region().end()))); + "Cannot calculate region index for address " PTR_FORMAT " that is outside of the heap [" PTR_FORMAT ", " PTR_FORMAT ")", + p2i(addr), p2i(reserved_region().start()), p2i(reserved_region().end())); return (uint)(pointer_delta(addr, reserved_region().start(), sizeof(uint8_t)) >> HeapRegion::LogOfHRGrainBytes); } @@ -80,8 +80,8 @@ inline HeapRegion* G1CollectedHeap::heap_region_containing_raw(const T addr) const { assert(addr != NULL, "invariant"); assert(is_in_g1_reserved((const void*) addr), - err_msg("Address " PTR_FORMAT " is outside of the heap ranging from [" PTR_FORMAT " to " PTR_FORMAT ")", - p2i((void*)addr), p2i(g1_reserved().start()), p2i(g1_reserved().end()))); + "Address " PTR_FORMAT " is outside of the heap ranging from [" PTR_FORMAT " to " PTR_FORMAT ")", + p2i((void*)addr), p2i(g1_reserved().start()), p2i(g1_reserved().end())); return _hrm.addr_to_region((HeapWord*) addr); } diff --git a/src/share/vm/gc/g1/g1CollectorPolicy.cpp b/src/share/vm/gc/g1/g1CollectorPolicy.cpp --- a/src/share/vm/gc/g1/g1CollectorPolicy.cpp +++ b/src/share/vm/gc/g1/g1CollectorPolicy.cpp @@ -813,8 +813,8 @@ update_survivors_policy(); assert(_g1->used() == _g1->recalculate_used(), - err_msg("sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT, - _g1->used(), _g1->recalculate_used())); + "sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT, + _g1->used(), _g1->recalculate_used()); double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0; _trace_young_gen_time_data.record_start_collection(s_w_t_ms); @@ -1876,8 +1876,7 @@ finalize_incremental_cset_building(); guarantee(target_pause_time_ms > 0.0, - err_msg("target_pause_time_ms = %1.6lf should be positive", - target_pause_time_ms)); + "target_pause_time_ms = %1.6lf should be positive", target_pause_time_ms); guarantee(_collection_set == NULL, "Precondition"); double base_time_ms = predict_base_elapsed_time_ms(_pending_cards); diff --git a/src/share/vm/gc/g1/g1CollectorPolicy.hpp b/src/share/vm/gc/g1/g1CollectorPolicy.hpp --- a/src/share/vm/gc/g1/g1CollectorPolicy.hpp +++ b/src/share/vm/gc/g1/g1CollectorPolicy.hpp @@ -839,7 +839,7 @@ case InCSetState::Old: return REGIONS_UNLIMITED; default: - assert(false, err_msg("Unknown dest state: " CSETSTATE_FORMAT, dest.value())); + assert(false, "Unknown dest state: " CSETSTATE_FORMAT, dest.value()); break; } // keep some compilers happy diff --git a/src/share/vm/gc/g1/g1EvacFailure.cpp b/src/share/vm/gc/g1/g1EvacFailure.cpp --- a/src/share/vm/gc/g1/g1EvacFailure.cpp +++ b/src/share/vm/gc/g1/g1EvacFailure.cpp @@ -165,9 +165,9 @@ size_t size_second_obj = ((oop)end_first_obj)->size(); HeapWord* end_of_second_obj = end_first_obj + size_second_obj; assert(end == end_of_second_obj, - err_msg("More than two objects were used to fill the area from " PTR_FORMAT " to " PTR_FORMAT ", " - "second objects size " SIZE_FORMAT " ends at " PTR_FORMAT, - p2i(start), p2i(end), size_second_obj, p2i(end_of_second_obj))); + "More than two objects were used to fill the area from " PTR_FORMAT " to " PTR_FORMAT ", " + "second objects size " SIZE_FORMAT " ends at " PTR_FORMAT, + p2i(start), p2i(end), size_second_obj, p2i(end_of_second_obj)); #endif } } @@ -215,7 +215,7 @@ bool during_initial_mark = _g1h->collector_state()->during_initial_mark_pause(); bool during_conc_mark = _g1h->collector_state()->mark_in_progress(); - assert(!hr->is_pinned(), err_msg("Unexpected pinned region at index %u", hr->hrm_index())); + assert(!hr->is_pinned(), "Unexpected pinned region at index %u", hr->hrm_index()); assert(hr->in_collection_set(), "bad CS"); if (_hrclaimer->claim_region(hr->hrm_index())) { diff --git a/src/share/vm/gc/g1/g1EvacStats.cpp b/src/share/vm/gc/g1/g1EvacStats.cpp --- a/src/share/vm/gc/g1/g1EvacStats.cpp +++ b/src/share/vm/gc/g1/g1EvacStats.cpp @@ -45,13 +45,13 @@ if (_allocated == 0) { assert((_unused == 0), - err_msg("Inconsistency in PLAB stats: " - "_allocated: " SIZE_FORMAT ", " - "_wasted: " SIZE_FORMAT ", " - "_region_end_waste: " SIZE_FORMAT ", " - "_unused: " SIZE_FORMAT ", " - "_used : " SIZE_FORMAT, - _allocated, _wasted, _region_end_waste, _unused, used())); + "Inconsistency in PLAB stats: " + "_allocated: " SIZE_FORMAT ", " + "_wasted: " SIZE_FORMAT ", " + "_region_end_waste: " SIZE_FORMAT ", " + "_unused: " SIZE_FORMAT ", " + "_used : " SIZE_FORMAT, + _allocated, _wasted, _region_end_waste, _unused, used()); _allocated = 1; } // The size of the PLAB caps the amount of space that can be wasted at the diff --git a/src/share/vm/gc/g1/g1GCPhaseTimes.cpp b/src/share/vm/gc/g1/g1GCPhaseTimes.cpp --- a/src/share/vm/gc/g1/g1GCPhaseTimes.cpp +++ b/src/share/vm/gc/g1/g1GCPhaseTimes.cpp @@ -130,8 +130,8 @@ WorkerDataArray* thread_work_items() { return _thread_work_items; } void set(uint worker_i, T value) { - assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length)); - assert(_data[worker_i] == WorkerDataArray::uninitialized(), err_msg("Overwriting data for worker %d in %s", worker_i, _title)); + assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length); + assert(_data[worker_i] == WorkerDataArray::uninitialized(), "Overwriting data for worker %d in %s", worker_i, _title); _data[worker_i] = value; _has_new_data = true; } @@ -142,14 +142,14 @@ } T get(uint worker_i) { - assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length)); - assert(_data[worker_i] != WorkerDataArray::uninitialized(), err_msg("No data added for worker %d", worker_i)); + assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length); + assert(_data[worker_i] != WorkerDataArray::uninitialized(), "No data added for worker %d", worker_i); return _data[worker_i]; } void add(uint worker_i, T value) { - assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length)); - assert(_data[worker_i] != WorkerDataArray::uninitialized(), err_msg("No data to add to for worker %d", worker_i)); + assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length); + assert(_data[worker_i] != WorkerDataArray::uninitialized(), "No data to add to for worker %d", worker_i); _data[worker_i] += value; _has_new_data = true; } @@ -235,7 +235,7 @@ assert(active_threads <= _length, "Wrong number of active threads"); for (uint i = 0; i < active_threads; i++) { assert(_data[i] != WorkerDataArray::uninitialized(), - err_msg("Invalid data for worker %u in '%s'", i, _title)); + "Invalid data for worker %u in '%s'", i, _title); } if (_thread_work_items != NULL) { _thread_work_items->verify(active_threads); @@ -479,7 +479,7 @@ print_count_values(buf, phase_id, thread_work_items); } - assert(thread_work_items->_print_sum, err_msg("%s does not have print sum true even though it is a count", thread_work_items->_title)); + assert(thread_work_items->_print_sum, "%s does not have print sum true even though it is a count", thread_work_items->_title); buf.append_and_print_cr(" Min: " SIZE_FORMAT ", Avg: %.1lf, Max: " SIZE_FORMAT ", Diff: " SIZE_FORMAT ", Sum: " SIZE_FORMAT "]", _phase_times->min_thread_work_items(phase_id), _phase_times->average_thread_work_items(phase_id), _phase_times->max_thread_work_items(phase_id), diff --git a/src/share/vm/gc/g1/g1HotCardCache.cpp b/src/share/vm/gc/g1/g1HotCardCache.cpp --- a/src/share/vm/gc/g1/g1HotCardCache.cpp +++ b/src/share/vm/gc/g1/g1HotCardCache.cpp @@ -112,8 +112,7 @@ // RSet updating while within an evacuation pause. // In this case worker_i should be the id of a GC worker thread assert(SafepointSynchronize::is_at_safepoint(), "Should be at a safepoint"); - assert(worker_i < ParallelGCThreads, - err_msg("incorrect worker id: %u", worker_i)); + assert(worker_i < ParallelGCThreads, "incorrect worker id: %u", worker_i); into_cset_dcq->enqueue(card_ptr); } diff --git a/src/share/vm/gc/g1/g1InCSetState.hpp b/src/share/vm/gc/g1/g1InCSetState.hpp --- a/src/share/vm/gc/g1/g1InCSetState.hpp +++ b/src/share/vm/gc/g1/g1InCSetState.hpp @@ -67,7 +67,7 @@ }; InCSetState(in_cset_state_t value = NotInCSet) : _value(value) { - assert(is_valid(), err_msg("Invalid state %d", _value)); + assert(is_valid(), "Invalid state %d", _value); } in_cset_state_t value() const { return _value; } @@ -104,7 +104,7 @@ public: void set_humongous(uintptr_t index) { assert(get_by_index(index).is_default(), - err_msg("State at index " INTPTR_FORMAT " should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value())); + "State at index " INTPTR_FORMAT " should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value()); set_by_index(index, InCSetState::Humongous); } @@ -114,13 +114,13 @@ void set_in_young(uintptr_t index) { assert(get_by_index(index).is_default(), - err_msg("State at index " INTPTR_FORMAT " should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value())); + "State at index " INTPTR_FORMAT " should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value()); set_by_index(index, InCSetState::Young); } void set_in_old(uintptr_t index) { assert(get_by_index(index).is_default(), - err_msg("State at index " INTPTR_FORMAT " should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value())); + "State at index " INTPTR_FORMAT " should be default but is " CSETSTATE_FORMAT, index, get_by_index(index).value()); set_by_index(index, InCSetState::Old); } diff --git a/src/share/vm/gc/g1/g1OopClosures.cpp b/src/share/vm/gc/g1/g1OopClosures.cpp --- a/src/share/vm/gc/g1/g1OopClosures.cpp +++ b/src/share/vm/gc/g1/g1OopClosures.cpp @@ -55,7 +55,7 @@ _worker_id = par_scan_state->worker_id(); assert(_worker_id < ParallelGCThreads, - err_msg("The given worker id %u must be less than the number of threads %u", _worker_id, ParallelGCThreads)); + "The given worker id %u must be less than the number of threads %u", _worker_id, ParallelGCThreads); } // Generate G1 specialized oop_oop_iterate functions. diff --git a/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp b/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp --- a/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp +++ b/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp @@ -57,13 +57,13 @@ vmassert(page_size > 0, "Page size must be non-zero."); guarantee(is_ptr_aligned(rs.base(), page_size), - err_msg("Reserved space base " PTR_FORMAT " is not aligned to requested page size " SIZE_FORMAT, p2i(rs.base()), page_size)); + "Reserved space base " PTR_FORMAT " is not aligned to requested page size " SIZE_FORMAT, p2i(rs.base()), page_size); guarantee(is_size_aligned(used_size, os::vm_page_size()), - err_msg("Given used reserved space size needs to be OS page size aligned (%d bytes) but is " SIZE_FORMAT, os::vm_page_size(), used_size)); + "Given used reserved space size needs to be OS page size aligned (%d bytes) but is " SIZE_FORMAT, os::vm_page_size(), used_size); guarantee(used_size <= rs.size(), - err_msg("Used size of reserved space " SIZE_FORMAT " bytes is smaller than reservation at " SIZE_FORMAT " bytes", used_size, rs.size())); + "Used size of reserved space " SIZE_FORMAT " bytes is smaller than reservation at " SIZE_FORMAT " bytes", used_size, rs.size()); guarantee(is_size_aligned(rs.size(), page_size), - err_msg("Expected that the virtual space is size aligned, but " SIZE_FORMAT " is not aligned to page size " SIZE_FORMAT, rs.size(), page_size)); + "Expected that the virtual space is size aligned, but " SIZE_FORMAT " is not aligned to page size " SIZE_FORMAT, rs.size(), page_size); _low_boundary = rs.base(); _high_boundary = _low_boundary + used_size; @@ -137,23 +137,23 @@ bool G1PageBasedVirtualSpace::is_after_last_page(size_t index) const { guarantee(index <= _committed.size(), - err_msg("Given boundary page " SIZE_FORMAT " is beyond managed page count " SIZE_FORMAT, index, _committed.size())); + "Given boundary page " SIZE_FORMAT " is beyond managed page count " SIZE_FORMAT, index, _committed.size()); return index == _committed.size(); } void G1PageBasedVirtualSpace::commit_preferred_pages(size_t start, size_t num_pages) { vmassert(num_pages > 0, "No full pages to commit"); vmassert(start + num_pages <= _committed.size(), - err_msg("Tried to commit area from page " SIZE_FORMAT " to page " SIZE_FORMAT " " - "that is outside of managed space of " SIZE_FORMAT " pages", - start, start + num_pages, _committed.size())); + "Tried to commit area from page " SIZE_FORMAT " to page " SIZE_FORMAT " " + "that is outside of managed space of " SIZE_FORMAT " pages", + start, start + num_pages, _committed.size()); char* start_addr = page_start(start); size_t size = num_pages * _page_size; os::commit_memory_or_exit(start_addr, size, _page_size, _executable, err_msg("Failed to commit area from " PTR_FORMAT " to " PTR_FORMAT " of length " SIZE_FORMAT ".", - p2i(start_addr), p2i(start_addr + size), size)); + p2i(start_addr), p2i(start_addr + size), size)); } void G1PageBasedVirtualSpace::commit_tail() { @@ -162,14 +162,14 @@ char* const aligned_end_address = (char*)align_ptr_down(_high_boundary, _page_size); os::commit_memory_or_exit(aligned_end_address, _tail_size, os::vm_page_size(), _executable, err_msg("Failed to commit tail area from " PTR_FORMAT " to " PTR_FORMAT " of length " SIZE_FORMAT ".", - p2i(aligned_end_address), p2i(_high_boundary), _tail_size)); + p2i(aligned_end_address), p2i(_high_boundary), _tail_size)); } void G1PageBasedVirtualSpace::commit_internal(size_t start_page, size_t end_page) { guarantee(start_page < end_page, - err_msg("Given start page " SIZE_FORMAT " is larger or equal to end page " SIZE_FORMAT, start_page, end_page)); + "Given start page " SIZE_FORMAT " is larger or equal to end page " SIZE_FORMAT, start_page, end_page); guarantee(end_page <= _committed.size(), - err_msg("Given end page " SIZE_FORMAT " is beyond end of managed page amount of " SIZE_FORMAT, end_page, _committed.size())); + "Given end page " SIZE_FORMAT " is beyond end of managed page amount of " SIZE_FORMAT, end_page, _committed.size()); size_t pages = end_page - start_page; bool need_to_commit_tail = is_after_last_page(end_page) && is_last_page_partial(); @@ -195,7 +195,7 @@ void G1PageBasedVirtualSpace::pretouch_internal(size_t start_page, size_t end_page) { guarantee(start_page < end_page, - err_msg("Given start page " SIZE_FORMAT " is larger or equal to end page " SIZE_FORMAT, start_page, end_page)); + "Given start page " SIZE_FORMAT " is larger or equal to end page " SIZE_FORMAT, start_page, end_page); os::pretouch_memory(page_start(start_page), bounded_end_addr(end_page)); } @@ -226,7 +226,7 @@ void G1PageBasedVirtualSpace::uncommit_internal(size_t start_page, size_t end_page) { guarantee(start_page < end_page, - err_msg("Given start page " SIZE_FORMAT " is larger or equal to end page " SIZE_FORMAT, start_page, end_page)); + "Given start page " SIZE_FORMAT " is larger or equal to end page " SIZE_FORMAT, start_page, end_page); char* start_addr = page_start(start_page); os::uncommit_memory(start_addr, pointer_delta(bounded_end_addr(end_page), start_addr, sizeof(char))); diff --git a/src/share/vm/gc/g1/g1ParScanThreadState.cpp b/src/share/vm/gc/g1/g1ParScanThreadState.cpp --- a/src/share/vm/gc/g1/g1ParScanThreadState.cpp +++ b/src/share/vm/gc/g1/g1ParScanThreadState.cpp @@ -97,10 +97,10 @@ bool G1ParScanThreadState::verify_ref(narrowOop* ref) const { assert(ref != NULL, "invariant"); assert(UseCompressedOops, "sanity"); - assert(!has_partial_array_mask(ref), err_msg("ref=" PTR_FORMAT, p2i(ref))); + assert(!has_partial_array_mask(ref), "ref=" PTR_FORMAT, p2i(ref)); oop p = oopDesc::load_decode_heap_oop(ref); assert(_g1h->is_in_g1_reserved(p), - err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p))); + "ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p)); return true; } @@ -110,11 +110,11 @@ // Must be in the collection set--it's already been copied. oop p = clear_partial_array_mask(ref); assert(_g1h->obj_in_cs(p), - err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p))); + "ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p)); } else { oop p = oopDesc::load_decode_heap_oop(ref); assert(_g1h->is_in_g1_reserved(p), - err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p))); + "ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p)); } return true; } @@ -147,8 +147,8 @@ size_t word_sz, AllocationContext_t const context, bool previous_plab_refill_failed) { - assert(state.is_in_cset_or_humongous(), err_msg("Unexpected state: " CSETSTATE_FORMAT, state.value())); - assert(dest->is_in_cset_or_humongous(), err_msg("Unexpected dest: " CSETSTATE_FORMAT, dest->value())); + assert(state.is_in_cset_or_humongous(), "Unexpected state: " CSETSTATE_FORMAT, state.value()); + assert(dest->is_in_cset_or_humongous(), "Unexpected dest: " CSETSTATE_FORMAT, dest->value()); // Right now we only have two types of regions (young / old) so // let's keep the logic here simple. We can generalize it when necessary. @@ -177,7 +177,7 @@ return obj_ptr; } else { _old_gen_is_full = previous_plab_refill_failed; - assert(dest->is_old(), err_msg("Unexpected dest: " CSETSTATE_FORMAT, dest->value())); + assert(dest->is_old(), "Unexpected dest: " CSETSTATE_FORMAT, dest->value()); // no other space to try. return NULL; } @@ -359,8 +359,7 @@ } oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markOop m) { - assert(_g1h->obj_in_cs(old), - err_msg("Object " PTR_FORMAT " should be in the CSet", p2i(old))); + assert(_g1h->obj_in_cs(old), "Object " PTR_FORMAT " should be in the CSet", p2i(old)); oop forward_ptr = old->forward_to_atomic(old); if (forward_ptr == NULL) { @@ -383,9 +382,9 @@ // space for this object (old != forward_ptr) or they beat us in // self-forwarding it (old == forward_ptr). assert(old == forward_ptr || !_g1h->obj_in_cs(forward_ptr), - err_msg("Object " PTR_FORMAT " forwarded to: " PTR_FORMAT " " - "should not be in the CSet", - p2i(old), p2i(forward_ptr))); + "Object " PTR_FORMAT " forwarded to: " PTR_FORMAT " " + "should not be in the CSet", + p2i(old), p2i(forward_ptr)); return forward_ptr; } } diff --git a/src/share/vm/gc/g1/g1ParScanThreadState.hpp b/src/share/vm/gc/g1/g1ParScanThreadState.hpp --- a/src/share/vm/gc/g1/g1ParScanThreadState.hpp +++ b/src/share/vm/gc/g1/g1ParScanThreadState.hpp @@ -75,9 +75,9 @@ InCSetState dest(InCSetState original) const { assert(original.is_valid(), - err_msg("Original state invalid: " CSETSTATE_FORMAT, original.value())); + "Original state invalid: " CSETSTATE_FORMAT, original.value()); assert(_dest[original.value()].is_valid_gen(), - err_msg("Dest state is invalid: " CSETSTATE_FORMAT, _dest[original.value()].value())); + "Dest state is invalid: " CSETSTATE_FORMAT, _dest[original.value()].value()); return _dest[original.value()]; } diff --git a/src/share/vm/gc/g1/g1ParScanThreadState.inline.hpp b/src/share/vm/gc/g1/g1ParScanThreadState.inline.hpp --- a/src/share/vm/gc/g1/g1ParScanThreadState.inline.hpp +++ b/src/share/vm/gc/g1/g1ParScanThreadState.inline.hpp @@ -52,7 +52,7 @@ _g1h->set_humongous_is_live(obj); } else { assert(!in_cset_state.is_in_cset_or_humongous(), - err_msg("In_cset_state must be NotInCSet here, but is " CSETSTATE_FORMAT, in_cset_state.value())); + "In_cset_state must be NotInCSet here, but is " CSETSTATE_FORMAT, in_cset_state.value()); } assert(obj != NULL, "Must be"); @@ -82,7 +82,7 @@ // to-space object. int next_index = to_obj_array->length(); assert(0 <= next_index && next_index < length, - err_msg("invariant, next index: %d, length: %d", next_index, length)); + "invariant, next index: %d, length: %d", next_index, length); int start = next_index; int end = length; diff --git a/src/share/vm/gc/g1/g1RegionToSpaceMapper.cpp b/src/share/vm/gc/g1/g1RegionToSpaceMapper.cpp --- a/src/share/vm/gc/g1/g1RegionToSpaceMapper.cpp +++ b/src/share/vm/gc/g1/g1RegionToSpaceMapper.cpp @@ -113,7 +113,7 @@ virtual void commit_regions(uint start_idx, size_t num_regions) { for (uint i = start_idx; i < start_idx + num_regions; i++) { - assert(!_commit_map.at(i), err_msg("Trying to commit storage at region %u that is already committed", i)); + assert(!_commit_map.at(i), "Trying to commit storage at region %u that is already committed", i); size_t idx = region_idx_to_page_idx(i); uint old_refcount = _refcounts.get_by_index(idx); bool zero_filled = false; @@ -128,7 +128,7 @@ virtual void uncommit_regions(uint start_idx, size_t num_regions) { for (uint i = start_idx; i < start_idx + num_regions; i++) { - assert(_commit_map.at(i), err_msg("Trying to uncommit storage at region %u that is not committed", i)); + assert(_commit_map.at(i), "Trying to uncommit storage at region %u that is not committed", i); size_t idx = region_idx_to_page_idx(i); uint old_refcount = _refcounts.get_by_index(idx); assert(old_refcount > 0, "must be"); diff --git a/src/share/vm/gc/g1/g1RemSet.cpp b/src/share/vm/gc/g1/g1RemSet.cpp --- a/src/share/vm/gc/g1/g1RemSet.cpp +++ b/src/share/vm/gc/g1/g1RemSet.cpp @@ -413,11 +413,11 @@ bool G1RemSet::refine_card(jbyte* card_ptr, uint worker_i, bool check_for_refs_into_cset) { assert(_g1->is_in_exact(_ct_bs->addr_for(card_ptr)), - err_msg("Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap", - p2i(card_ptr), - _ct_bs->index_for(_ct_bs->addr_for(card_ptr)), - p2i(_ct_bs->addr_for(card_ptr)), - _g1->addr_to_region(_ct_bs->addr_for(card_ptr)))); + "Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap", + p2i(card_ptr), + _ct_bs->index_for(_ct_bs->addr_for(card_ptr)), + p2i(_ct_bs->addr_for(card_ptr)), + _g1->addr_to_region(_ct_bs->addr_for(card_ptr))); // If the card is no longer dirty, nothing to do. if (*card_ptr != CardTableModRefBS::dirty_card_val()) { diff --git a/src/share/vm/gc/g1/heapRegion.cpp b/src/share/vm/gc/g1/heapRegion.cpp --- a/src/share/vm/gc/g1/heapRegion.cpp +++ b/src/share/vm/gc/g1/heapRegion.cpp @@ -165,7 +165,7 @@ assert(_end == orig_end(), "we should have already filtered out humongous regions"); assert(!in_collection_set(), - err_msg("Should not clear heap region %u in the collection set", hrm_index())); + "Should not clear heap region %u in the collection set", hrm_index()); set_allocation_context(AllocationContext::system()); set_young_index_in_cset(-1); @@ -292,9 +292,9 @@ record_timestamp(); assert(mr.end() == orig_end(), - err_msg("Given region end address " PTR_FORMAT " should match exactly " - "bottom plus one region size, i.e. " PTR_FORMAT, - p2i(mr.end()), p2i(orig_end()))); + "Given region end address " PTR_FORMAT " should match exactly " + "bottom plus one region size, i.e. " PTR_FORMAT, + p2i(mr.end()), p2i(orig_end())); } CompactibleSpace* HeapRegion::next_compaction_space() const { @@ -327,7 +327,7 @@ bool during_conc_mark, size_t marked_bytes) { assert(marked_bytes <= used(), - err_msg("marked: " SIZE_FORMAT " used: " SIZE_FORMAT, marked_bytes, used())); + "marked: " SIZE_FORMAT " used: " SIZE_FORMAT, marked_bytes, used()); _prev_top_at_mark_start = top(); _prev_marked_bytes = marked_bytes; } diff --git a/src/share/vm/gc/g1/heapRegion.hpp b/src/share/vm/gc/g1/heapRegion.hpp --- a/src/share/vm/gc/g1/heapRegion.hpp +++ b/src/share/vm/gc/g1/heapRegion.hpp @@ -542,9 +542,9 @@ void set_containing_set(HeapRegionSetBase* containing_set) { assert((containing_set == NULL && _containing_set != NULL) || (containing_set != NULL && _containing_set == NULL), - err_msg("containing_set: " PTR_FORMAT " " - "_containing_set: " PTR_FORMAT, - p2i(containing_set), p2i(_containing_set))); + "containing_set: " PTR_FORMAT " " + "_containing_set: " PTR_FORMAT, + p2i(containing_set), p2i(_containing_set)); _containing_set = containing_set; } diff --git a/src/share/vm/gc/g1/heapRegion.inline.hpp b/src/share/vm/gc/g1/heapRegion.inline.hpp --- a/src/share/vm/gc/g1/heapRegion.inline.hpp +++ b/src/share/vm/gc/g1/heapRegion.inline.hpp @@ -132,10 +132,10 @@ } assert(ClassUnloadingWithConcurrentMark, - err_msg("All blocks should be objects if G1 Class Unloading isn't used. " - "HR: [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ") " - "addr: " PTR_FORMAT, - p2i(bottom()), p2i(top()), p2i(end()), p2i(addr))); + "All blocks should be objects if G1 Class Unloading isn't used. " + "HR: [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ") " + "addr: " PTR_FORMAT, + p2i(bottom()), p2i(top()), p2i(end()), p2i(addr)); // Old regions' dead objects may have dead classes // We need to find the next live object in some other diff --git a/src/share/vm/gc/g1/heapRegionManager.cpp b/src/share/vm/gc/g1/heapRegionManager.cpp --- a/src/share/vm/gc/g1/heapRegionManager.cpp +++ b/src/share/vm/gc/g1/heapRegionManager.cpp @@ -92,7 +92,7 @@ } void HeapRegionManager::uncommit_regions(uint start, size_t num_regions) { - guarantee(num_regions >= 1, err_msg("Need to specify at least one region to uncommit, tried to uncommit zero regions at %u", start)); + guarantee(num_regions >= 1, "Need to specify at least one region to uncommit, tried to uncommit zero regions at %u", start); guarantee(_num_committed >= num_regions, "pre-condition"); // Print before uncommitting. @@ -132,7 +132,7 @@ _available_map.par_set_range(start, start + num_regions, BitMap::unknown_range); for (uint i = start; i < start + num_regions; i++) { - assert(is_available(i), err_msg("Just made region %u available but is apparently not.", i)); + assert(is_available(i), "Just made region %u available but is apparently not.", i); HeapRegion* hr = at(i); if (G1CollectedHeap::heap()->hr_printer()->is_active()) { G1CollectedHeap::heap()->hr_printer()->commit(hr->bottom(), hr->end()); @@ -213,8 +213,8 @@ HeapRegion* hr = _regions.get_by_index(i); // sanity check guarantee((!empty_only && !is_available(i)) || (is_available(i) && hr != NULL && hr->is_empty()), - err_msg("Found region sequence starting at " UINT32_FORMAT ", length " SIZE_FORMAT - " that is not empty at " UINT32_FORMAT ". Hr is " PTR_FORMAT, found, num, i, p2i(hr))); + "Found region sequence starting at " UINT32_FORMAT ", length " SIZE_FORMAT + " that is not empty at " UINT32_FORMAT ". Hr is " PTR_FORMAT, found, num, i, p2i(hr)); } return found; } else { @@ -224,7 +224,7 @@ HeapRegion* HeapRegionManager::next_region_in_heap(const HeapRegion* r) const { guarantee(r != NULL, "Start region must be a valid region"); - guarantee(is_available(r->hrm_index()), err_msg("Trying to iterate starting from region %u which is not in the heap", r->hrm_index())); + guarantee(is_available(r->hrm_index()), "Trying to iterate starting from region %u which is not in the heap", r->hrm_index()); for (uint i = r->hrm_index() + 1; i < _allocated_heapregions_length; i++) { HeapRegion* hr = _regions.get_by_index(i); if (is_available(i)) { @@ -241,7 +241,7 @@ if (!is_available(i)) { continue; } - guarantee(at(i) != NULL, err_msg("Tried to access region %u that has a NULL HeapRegion*", i)); + guarantee(at(i) != NULL, "Tried to access region %u that has a NULL HeapRegion*", i); bool res = blk->doHeapRegion(at(i)); if (res) { blk->incomplete(); @@ -273,7 +273,7 @@ assert(!is_available(i), "just checking"); } assert(cur == max_length() || num_regions == 0 || is_available(cur), - err_msg("The region at the current position %u must be available or at the end of the heap.", cur)); + "The region at the current position %u must be available or at the end of the heap.", cur); #endif return num_regions; } @@ -374,8 +374,8 @@ assert(chr->is_continues_humongous(), "Must be humongous region"); assert(chr->humongous_start_region() == r, - err_msg("Must work on humongous continuation of the original start region " - PTR_FORMAT ", but is " PTR_FORMAT, p2i(r), p2i(chr))); + "Must work on humongous continuation of the original start region " + PTR_FORMAT ", but is " PTR_FORMAT, p2i(r), p2i(chr)); assert(!hrclaimer->is_region_claimed(ch_index), "Must not have been claimed yet because claiming of humongous continuation first claims the start region"); @@ -440,9 +440,9 @@ void HeapRegionManager::shrink_at(uint index, size_t num_regions) { #ifdef ASSERT for (uint i = index; i < (index + num_regions); i++) { - assert(is_available(i), err_msg("Expected available region at index %u", i)); - assert(at(i)->is_empty(), err_msg("Expected empty region at index %u", i)); - assert(at(i)->is_free(), err_msg("Expected free region at index %u", i)); + assert(is_available(i), "Expected available region at index %u", i); + assert(at(i)->is_empty(), "Expected empty region at index %u", i); + assert(at(i)->is_free(), "Expected free region at index %u", i); } #endif uncommit_regions(index, num_regions); @@ -479,11 +479,11 @@ void HeapRegionManager::verify() { guarantee(length() <= _allocated_heapregions_length, - err_msg("invariant: _length: %u _allocated_length: %u", - length(), _allocated_heapregions_length)); + "invariant: _length: %u _allocated_length: %u", + length(), _allocated_heapregions_length); guarantee(_allocated_heapregions_length <= max_length(), - err_msg("invariant: _allocated_length: %u _max_length: %u", - _allocated_heapregions_length, max_length())); + "invariant: _allocated_length: %u _max_length: %u", + _allocated_heapregions_length, max_length()); bool prev_committed = true; uint num_committed = 0; @@ -495,12 +495,12 @@ } num_committed++; HeapRegion* hr = _regions.get_by_index(i); - guarantee(hr != NULL, err_msg("invariant: i: %u", i)); + guarantee(hr != NULL, "invariant: i: %u", i); guarantee(!prev_committed || hr->bottom() == prev_end, - err_msg("invariant i: %u " HR_FORMAT " prev_end: " PTR_FORMAT, - i, HR_FORMAT_PARAMS(hr), p2i(prev_end))); + "invariant i: %u " HR_FORMAT " prev_end: " PTR_FORMAT, + i, HR_FORMAT_PARAMS(hr), p2i(prev_end)); guarantee(hr->hrm_index() == i, - err_msg("invariant: i: %u hrm_index(): %u", i, hr->hrm_index())); + "invariant: i: %u hrm_index(): %u", i, hr->hrm_index()); // Asserts will fire if i is >= _length HeapWord* addr = hr->bottom(); guarantee(addr_to_region(addr) == hr, "sanity"); @@ -515,10 +515,10 @@ } } for (uint i = _allocated_heapregions_length; i < max_length(); i++) { - guarantee(_regions.get_by_index(i) == NULL, err_msg("invariant i: %u", i)); + guarantee(_regions.get_by_index(i) == NULL, "invariant i: %u", i); } - guarantee(num_committed == _num_committed, err_msg("Found %u committed regions, but should be %u", num_committed, _num_committed)); + guarantee(num_committed == _num_committed, "Found %u committed regions, but should be %u", num_committed, _num_committed); _free_list.verify(); } diff --git a/src/share/vm/gc/g1/heapRegionManager.inline.hpp b/src/share/vm/gc/g1/heapRegionManager.inline.hpp --- a/src/share/vm/gc/g1/heapRegionManager.inline.hpp +++ b/src/share/vm/gc/g1/heapRegionManager.inline.hpp @@ -31,9 +31,9 @@ inline HeapRegion* HeapRegionManager::addr_to_region(HeapWord* addr) const { assert(addr < heap_end(), - err_msg("addr: " PTR_FORMAT " end: " PTR_FORMAT, p2i(addr), p2i(heap_end()))); + "addr: " PTR_FORMAT " end: " PTR_FORMAT, p2i(addr), p2i(heap_end())); assert(addr >= heap_bottom(), - err_msg("addr: " PTR_FORMAT " bottom: " PTR_FORMAT, p2i(addr), p2i(heap_bottom()))); + "addr: " PTR_FORMAT " bottom: " PTR_FORMAT, p2i(addr), p2i(heap_bottom())); HeapRegion* hr = _regions.get_by_address(addr); return hr; diff --git a/src/share/vm/gc/g1/heapRegionRemSet.cpp b/src/share/vm/gc/g1/heapRegionRemSet.cpp --- a/src/share/vm/gc/g1/heapRegionRemSet.cpp +++ b/src/share/vm/gc/g1/heapRegionRemSet.cpp @@ -376,8 +376,8 @@ void FromCardCache::invalidate(uint start_idx, size_t new_num_regions) { guarantee((size_t)start_idx + new_num_regions <= max_uintx, - err_msg("Trying to invalidate beyond maximum region, from %u size " SIZE_FORMAT, - start_idx, new_num_regions)); + "Trying to invalidate beyond maximum region, from %u size " SIZE_FORMAT, + start_idx, new_num_regions); for (uint i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) { uint end_idx = (start_idx + (uint)new_num_regions); assert(end_idx <= _max_regions, "Must be within max."); @@ -1013,7 +1013,7 @@ card_index = _cur_region_card_offset + _cur_card_in_prt; guarantee(_cur_card_in_prt < HeapRegion::CardsPerRegion, - err_msg("Card index " SIZE_FORMAT " must be within the region", _cur_card_in_prt)); + "Card index " SIZE_FORMAT " must be within the region", _cur_card_in_prt); return true; } @@ -1182,8 +1182,8 @@ size_t min_prt_size = sizeof(void*) + dummy->bm()->size_in_words() * HeapWordSize; assert(dummy->mem_size() > min_prt_size, - err_msg("PerRegionTable memory usage is suspiciously small, only has " SIZE_FORMAT " bytes. " - "Should be at least " SIZE_FORMAT " bytes.", dummy->mem_size(), min_prt_size)); + "PerRegionTable memory usage is suspiciously small, only has " SIZE_FORMAT " bytes. " + "Should be at least " SIZE_FORMAT " bytes.", dummy->mem_size(), min_prt_size); free(dummy); guarantee(dummy->mem_size() == fl_mem_size(), "fl_mem_size() does not return the correct element size"); // try to reset the state diff --git a/src/share/vm/gc/g1/heapRegionSet.cpp b/src/share/vm/gc/g1/heapRegionSet.cpp --- a/src/share/vm/gc/g1/heapRegionSet.cpp +++ b/src/share/vm/gc/g1/heapRegionSet.cpp @@ -37,14 +37,14 @@ #ifndef PRODUCT void HeapRegionSetBase::verify_region(HeapRegion* hr) { - assert(hr->containing_set() == this, err_msg("Inconsistent containing set for %u", hr->hrm_index())); - assert(!hr->is_young(), err_msg("Adding young region %u", hr->hrm_index())); // currently we don't use these sets for young regions - assert(hr->is_humongous() == regions_humongous(), err_msg("Wrong humongous state for region %u and set %s", hr->hrm_index(), name())); - assert(hr->is_free() == regions_free(), err_msg("Wrong free state for region %u and set %s", hr->hrm_index(), name())); - assert(!hr->is_free() || hr->is_empty(), err_msg("Free region %u is not empty for set %s", hr->hrm_index(), name())); + assert(hr->containing_set() == this, "Inconsistent containing set for %u", hr->hrm_index()); + assert(!hr->is_young(), "Adding young region %u", hr->hrm_index()); // currently we don't use these sets for young regions + assert(hr->is_humongous() == regions_humongous(), "Wrong humongous state for region %u and set %s", hr->hrm_index(), name()); + assert(hr->is_free() == regions_free(), "Wrong free state for region %u and set %s", hr->hrm_index(), name()); + assert(!hr->is_free() || hr->is_empty(), "Free region %u is not empty for set %s", hr->hrm_index(), name()); assert(!hr->is_empty() || hr->is_free() || hr->is_archive(), - err_msg("Empty region %u is not free or archive for set %s", hr->hrm_index(), name())); - assert(hr->rem_set()->verify_ready_for_par_iteration(), err_msg("Wrong iteration state %u", hr->hrm_index())); + "Empty region %u is not free or archive for set %s", hr->hrm_index(), name()); + assert(hr->rem_set()->verify_ready_for_par_iteration(), "Wrong iteration state %u", hr->hrm_index()); } #endif @@ -57,14 +57,14 @@ guarantee(( is_empty() && length() == 0 && total_capacity_bytes() == 0) || (!is_empty() && length() > 0 && total_capacity_bytes() > 0) , - hrs_ext_msg(this, "invariant")); + hrs_ext_msg(this, "invariant").buffer()); } void HeapRegionSetBase::verify_start() { // See comment in verify() about MT safety and verification. check_mt_safety(); assert(!_verify_in_progress, - hrs_ext_msg(this, "verification should not be in progress")); + hrs_ext_msg(this, "verification should not be in progress").buffer()); // Do the basic verification first before we do the checks over the regions. HeapRegionSetBase::verify(); @@ -76,7 +76,7 @@ // See comment in verify() about MT safety and verification. check_mt_safety(); assert(_verify_in_progress, - hrs_ext_msg(this, "verification should be in progress")); + hrs_ext_msg(this, "verification should be in progress").buffer()); _verify_in_progress = false; } @@ -151,7 +151,7 @@ #endif // ASSERT if (is_empty()) { - assert(length() == 0 && _tail == NULL, hrs_ext_msg(this, "invariant")); + assert(length() == 0 && _tail == NULL, hrs_ext_msg(this, "invariant").buffer()); _head = from_list->_head; _tail = from_list->_tail; } else { @@ -198,8 +198,8 @@ void FreeRegionList::remove_starting_at(HeapRegion* first, uint num_regions) { check_mt_safety(); - assert(num_regions >= 1, hrs_ext_msg(this, "pre-condition")); - assert(!is_empty(), hrs_ext_msg(this, "pre-condition")); + assert(num_regions >= 1, hrs_ext_msg(this, "pre-condition").buffer()); + assert(!is_empty(), hrs_ext_msg(this, "pre-condition").buffer()); verify_optional(); DEBUG_ONLY(uint old_length = length();) @@ -214,20 +214,20 @@ assert(count < num_regions, hrs_err_msg("[%s] should not come across more regions " "pending for removal than num_regions: %u", - name(), num_regions)); + name(), num_regions).buffer()); if (prev == NULL) { - assert(_head == curr, hrs_ext_msg(this, "invariant")); + assert(_head == curr, hrs_ext_msg(this, "invariant").buffer()); _head = next; } else { - assert(_head != curr, hrs_ext_msg(this, "invariant")); + assert(_head != curr, hrs_ext_msg(this, "invariant").buffer()); prev->set_next(next); } if (next == NULL) { - assert(_tail == curr, hrs_ext_msg(this, "invariant")); + assert(_tail == curr, hrs_ext_msg(this, "invariant").buffer()); _tail = prev; } else { - assert(_tail != curr, hrs_ext_msg(this, "invariant")); + assert(_tail != curr, hrs_ext_msg(this, "invariant").buffer()); next->set_prev(prev); } if (_last = curr) { @@ -244,11 +244,11 @@ assert(count == num_regions, hrs_err_msg("[%s] count: %u should be == num_regions: %u", - name(), count, num_regions)); + name(), count, num_regions).buffer()); assert(length() + num_regions == old_length, hrs_err_msg("[%s] new length should be consistent " "new length: %u old length: %u num_regions: %u", - name(), length(), old_length, num_regions)); + name(), length(), old_length, num_regions).buffer()); verify_optional(); } @@ -306,7 +306,7 @@ count++; guarantee(count < _unrealistically_long_length, hrs_err_msg("[%s] the calculated length: %u seems very long, is there maybe a cycle? curr: " PTR_FORMAT " prev0: " PTR_FORMAT " " "prev1: " PTR_FORMAT " length: %u", - name(), count, p2i(curr), p2i(prev0), p2i(prev1), length())); + name(), count, p2i(curr), p2i(prev0), p2i(prev1), length()).buffer()); if (curr->next() != NULL) { guarantee(curr->next()->prev() == curr, "Next or prev pointers messed up"); @@ -321,11 +321,11 @@ curr = curr->next(); } - guarantee(_tail == prev0, err_msg("Expected %s to end with %u but it ended with %u.", name(), _tail->hrm_index(), prev0->hrm_index())); + guarantee(_tail == prev0, "Expected %s to end with %u but it ended with %u.", name(), _tail->hrm_index(), prev0->hrm_index()); guarantee(_tail == NULL || _tail->next() == NULL, "_tail should not have a next"); - guarantee(length() == count, err_msg("%s count mismatch. Expected %u, actual %u.", name(), length(), count)); - guarantee(total_capacity_bytes() == capacity, err_msg("%s capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT, - name(), total_capacity_bytes(), capacity)); + guarantee(length() == count, "%s count mismatch. Expected %u, actual %u.", name(), length(), count); + guarantee(total_capacity_bytes() == capacity, "%s capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT, + name(), total_capacity_bytes(), capacity); } // Note on the check_mt_safety() methods below: diff --git a/src/share/vm/gc/g1/heapRegionSet.inline.hpp b/src/share/vm/gc/g1/heapRegionSet.inline.hpp --- a/src/share/vm/gc/g1/heapRegionSet.inline.hpp +++ b/src/share/vm/gc/g1/heapRegionSet.inline.hpp @@ -29,9 +29,9 @@ inline void HeapRegionSetBase::add(HeapRegion* hr) { check_mt_safety(); - assert(hr->containing_set() == NULL, hrs_ext_msg(this, "should not already have a containing set %u")); - assert(hr->next() == NULL, hrs_ext_msg(this, "should not already be linked")); - assert(hr->prev() == NULL, hrs_ext_msg(this, "should not already be linked")); + assert(hr->containing_set() == NULL, hrs_ext_msg(this, "should not already have a containing set %u").buffer()); + assert(hr->next() == NULL, hrs_ext_msg(this, "should not already be linked").buffer()); + assert(hr->prev() == NULL, hrs_ext_msg(this, "should not already be linked").buffer()); _count.increment(1u, hr->capacity()); hr->set_containing_set(this); @@ -41,18 +41,18 @@ inline void HeapRegionSetBase::remove(HeapRegion* hr) { check_mt_safety(); verify_region(hr); - assert(hr->next() == NULL, hrs_ext_msg(this, "should already be unlinked")); - assert(hr->prev() == NULL, hrs_ext_msg(this, "should already be unlinked")); + assert(hr->next() == NULL, hrs_ext_msg(this, "should already be unlinked").buffer()); + assert(hr->prev() == NULL, hrs_ext_msg(this, "should already be unlinked").buffer()); hr->set_containing_set(NULL); - assert(_count.length() > 0, hrs_ext_msg(this, "pre-condition")); + assert(_count.length() > 0, hrs_ext_msg(this, "pre-condition").buffer()); _count.decrement(1u, hr->capacity()); } inline void FreeRegionList::add_ordered(HeapRegion* hr) { assert((length() == 0 && _head == NULL && _tail == NULL && _last == NULL) || (length() > 0 && _head != NULL && _tail != NULL), - hrs_ext_msg(this, "invariant")); + hrs_ext_msg(this, "invariant").buffer()); // add() will verify the region and check mt safety. add(hr); @@ -129,7 +129,7 @@ return NULL; } assert(length() > 0 && _head != NULL && _tail != NULL, - hrs_ext_msg(this, "invariant")); + hrs_ext_msg(this, "invariant").buffer()); HeapRegion* hr; diff --git a/src/share/vm/gc/g1/heapRegionType.hpp b/src/share/vm/gc/g1/heapRegionType.hpp --- a/src/share/vm/gc/g1/heapRegionType.hpp +++ b/src/share/vm/gc/g1/heapRegionType.hpp @@ -28,7 +28,7 @@ #include "memory/allocation.hpp" #define hrt_assert_is_valid(tag) \ - assert(is_valid((tag)), err_msg("invalid HR type: %u", (uint) (tag))) + assert(is_valid((tag)), "invalid HR type: %u", (uint) (tag)) class HeapRegionType VALUE_OBJ_CLASS_SPEC { private: @@ -97,8 +97,7 @@ hrt_assert_is_valid(tag); hrt_assert_is_valid(before); hrt_assert_is_valid(_tag); - assert(_tag == before, - err_msg("HR tag: %u, expected: %u new tag; %u", _tag, before, tag)); + assert(_tag == before, "HR tag: %u, expected: %u new tag; %u", _tag, before, tag); _tag = tag; } diff --git a/src/share/vm/gc/g1/satbQueue.cpp b/src/share/vm/gc/g1/satbQueue.cpp --- a/src/share/vm/gc/g1/satbQueue.cpp +++ b/src/share/vm/gc/g1/satbQueue.cpp @@ -77,16 +77,16 @@ inline bool requires_marking(const void* entry, G1CollectedHeap* heap) { // Includes rejection of NULL pointers. assert(heap->is_in_reserved(entry), - err_msg("Non-heap pointer in SATB buffer: " PTR_FORMAT, p2i(entry))); + "Non-heap pointer in SATB buffer: " PTR_FORMAT, p2i(entry)); HeapRegion* region = heap->heap_region_containing_raw(entry); - assert(region != NULL, err_msg("No region for " PTR_FORMAT, p2i(entry))); + assert(region != NULL, "No region for " PTR_FORMAT, p2i(entry)); if (entry >= region->next_top_at_mark_start()) { return false; } assert(((oop)entry)->is_oop(true /* ignore mark word */), - err_msg("Invalid oop in SATB buffer: " PTR_FORMAT, p2i(entry))); + "Invalid oop in SATB buffer: " PTR_FORMAT, p2i(entry)); return true; } diff --git a/src/share/vm/gc/g1/vm_operations_g1.cpp b/src/share/vm/gc/g1/vm_operations_g1.cpp --- a/src/share/vm/gc/g1/vm_operations_g1.cpp +++ b/src/share/vm/gc/g1/vm_operations_g1.cpp @@ -66,8 +66,8 @@ _should_retry_gc(false), _old_marking_cycles_completed_before(0) { guarantee(target_pause_time_ms > 0.0, - err_msg("target_pause_time_ms = %1.6lf should be positive", - target_pause_time_ms)); + "target_pause_time_ms = %1.6lf should be positive", + target_pause_time_ms); _gc_cause = gc_cause; } diff --git a/src/share/vm/gc/parallel/cardTableExtension.cpp b/src/share/vm/gc/parallel/cardTableExtension.cpp --- a/src/share/vm/gc/parallel/cardTableExtension.cpp +++ b/src/share/vm/gc/parallel/cardTableExtension.cpp @@ -285,7 +285,7 @@ while (p < to) { Prefetch::write(p, interval); oop m = oop(p); - assert(m->is_oop_or_null(), err_msg("Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m))); + assert(m->is_oop_or_null(), "Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m)); pm->push_contents(m); p += m->size(); } @@ -293,7 +293,7 @@ } else { while (p < to) { oop m = oop(p); - assert(m->is_oop_or_null(), err_msg("Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m))); + assert(m->is_oop_or_null(), "Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m)); pm->push_contents(m); p += m->size(); } diff --git a/src/share/vm/gc/parallel/gcTaskManager.cpp b/src/share/vm/gc/parallel/gcTaskManager.cpp --- a/src/share/vm/gc/parallel/gcTaskManager.cpp +++ b/src/share/vm/gc/parallel/gcTaskManager.cpp @@ -483,9 +483,9 @@ Threads::number_of_non_daemon_threads()); assert(!all_workers_active() || active_workers() == ParallelGCThreads, - err_msg("all_workers_active() is incorrect: " - "active %d ParallelGCThreads %u", active_workers(), - ParallelGCThreads)); + "all_workers_active() is incorrect: " + "active %d ParallelGCThreads %u", active_workers(), + ParallelGCThreads); if (TraceDynamicGCThreads) { gclog_or_tty->print_cr("GCTaskManager::set_active_gang(): " "all_workers_active() %d workers %d " diff --git a/src/share/vm/gc/parallel/mutableNUMASpace.cpp b/src/share/vm/gc/parallel/mutableNUMASpace.cpp --- a/src/share/vm/gc/parallel/mutableNUMASpace.cpp +++ b/src/share/vm/gc/parallel/mutableNUMASpace.cpp @@ -85,8 +85,8 @@ while (words_left_to_fill > 0) { size_t words_to_fill = MIN2(words_left_to_fill, CollectedHeap::filler_array_max_size()); assert(words_to_fill >= CollectedHeap::min_fill_size(), - err_msg("Remaining size (" SIZE_FORMAT ") is too small to fill (based on " SIZE_FORMAT " and " SIZE_FORMAT ")", - words_to_fill, words_left_to_fill, CollectedHeap::filler_array_max_size())); + "Remaining size (" SIZE_FORMAT ") is too small to fill (based on " SIZE_FORMAT " and " SIZE_FORMAT ")", + words_to_fill, words_left_to_fill, CollectedHeap::filler_array_max_size()); CollectedHeap::fill_with_object((HeapWord*)cur_top, words_to_fill); if (!os::numa_has_static_binding()) { size_t touched_words = words_to_fill; @@ -971,7 +971,7 @@ break; } if (e != scan_end) { - assert(e < scan_end, err_msg("e: " PTR_FORMAT " scan_end: " PTR_FORMAT, p2i(e), p2i(scan_end))); + assert(e < scan_end, "e: " PTR_FORMAT " scan_end: " PTR_FORMAT, p2i(e), p2i(scan_end)); if ((page_expected.size != page_size || page_expected.lgrp_id != lgrp_id()) && page_expected.size != 0) { diff --git a/src/share/vm/gc/parallel/objectStartArray.cpp b/src/share/vm/gc/parallel/objectStartArray.cpp --- a/src/share/vm/gc/parallel/objectStartArray.cpp +++ b/src/share/vm/gc/parallel/objectStartArray.cpp @@ -127,8 +127,8 @@ bool ObjectStartArray::object_starts_in_range(HeapWord* start_addr, HeapWord* end_addr) const { assert(start_addr <= end_addr, - err_msg("Range is wrong. start_addr (" PTR_FORMAT ") is after end_addr (" PTR_FORMAT ")", - p2i(start_addr), p2i(end_addr))); + "Range is wrong. start_addr (" PTR_FORMAT ") is after end_addr (" PTR_FORMAT ")", + p2i(start_addr), p2i(end_addr)); if (start_addr > end_addr) { return false; } diff --git a/src/share/vm/gc/parallel/objectStartArray.hpp b/src/share/vm/gc/parallel/objectStartArray.hpp --- a/src/share/vm/gc/parallel/objectStartArray.hpp +++ b/src/share/vm/gc/parallel/objectStartArray.hpp @@ -121,8 +121,8 @@ #define assert_covered_region_contains(addr) \ assert(_covered_region.contains(addr), \ - err_msg(#addr " (" PTR_FORMAT ") is not in covered region [" PTR_FORMAT ", " PTR_FORMAT "]", \ - p2i(addr), p2i(_covered_region.start()), p2i(_covered_region.end()))) + #addr " (" PTR_FORMAT ") is not in covered region [" PTR_FORMAT ", " PTR_FORMAT "]", \ + p2i(addr), p2i(_covered_region.start()), p2i(_covered_region.end())) void allocate_block(HeapWord* p) { assert_covered_region_contains(p); diff --git a/src/share/vm/gc/parallel/parMarkBitMap.hpp b/src/share/vm/gc/parallel/parMarkBitMap.hpp --- a/src/share/vm/gc/parallel/parMarkBitMap.hpp +++ b/src/share/vm/gc/parallel/parMarkBitMap.hpp @@ -390,9 +390,9 @@ inline void ParMarkBitMap::verify_addr(HeapWord* addr) const { // Allow one past the last valid address; useful for loop bounds. assert(addr >= region_start(), - err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, p2i(addr), p2i(region_start()))); + "addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, p2i(addr), p2i(region_start())); assert(addr <= region_end(), - err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, p2i(addr), p2i(region_end()))); + "addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, p2i(addr), p2i(region_end())); } #endif // #ifdef ASSERT diff --git a/src/share/vm/gc/parallel/parallelScavengeHeap.inline.hpp b/src/share/vm/gc/parallel/parallelScavengeHeap.inline.hpp --- a/src/share/vm/gc/parallel/parallelScavengeHeap.inline.hpp +++ b/src/share/vm/gc/parallel/parallelScavengeHeap.inline.hpp @@ -48,7 +48,7 @@ // Assumes the the old gen address range is lower than that of the young gen. bool result = ((HeapWord*)p) >= young_gen()->reserved().start(); assert(result == young_gen()->is_in_reserved(p), - err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, p2i((void*)p))); + "incorrect test - result=%d, p=" PTR_FORMAT, result, p2i((void*)p)); return result; } #endif // SHARE_VM_GC_PARALLEL_PARALLELSCAVENGEHEAP_INLINE_HPP diff --git a/src/share/vm/gc/parallel/pcTasks.cpp b/src/share/vm/gc/parallel/pcTasks.cpp --- a/src/share/vm/gc/parallel/pcTasks.cpp +++ b/src/share/vm/gc/parallel/pcTasks.cpp @@ -254,9 +254,9 @@ if (use_all_workers) { which_stack_index = which; assert(manager->active_workers() == ParallelGCThreads, - err_msg("all_workers_active has been incorrectly set: " - " active %d ParallelGCThreads %u", manager->active_workers(), - ParallelGCThreads)); + "all_workers_active has been incorrectly set: " + " active %d ParallelGCThreads %u", manager->active_workers(), + ParallelGCThreads); } else { which_stack_index = ParCompactionManager::pop_recycled_stack_index(); } @@ -333,9 +333,9 @@ if (use_all_workers) { which_stack_index = which; assert(manager->active_workers() == ParallelGCThreads, - err_msg("all_workers_active has been incorrectly set: " - " active %d ParallelGCThreads %u", manager->active_workers(), - ParallelGCThreads)); + "all_workers_active has been incorrectly set: " + " active %d ParallelGCThreads %u", manager->active_workers(), + ParallelGCThreads); } else { which_stack_index = stack_index(); } diff --git a/src/share/vm/gc/parallel/psOldGen.hpp b/src/share/vm/gc/parallel/psOldGen.hpp --- a/src/share/vm/gc/parallel/psOldGen.hpp +++ b/src/share/vm/gc/parallel/psOldGen.hpp @@ -65,15 +65,15 @@ // Explictly capture current covered_region in a local MemRegion covered_region = this->start_array()->covered_region(); assert(covered_region.contains(new_memregion), - err_msg("new region is not in covered_region [ " PTR_FORMAT ", " PTR_FORMAT " ], " - "new region [ " PTR_FORMAT ", " PTR_FORMAT " ], " - "object space [ " PTR_FORMAT ", " PTR_FORMAT " ]", - p2i(covered_region.start()), - p2i(covered_region.end()), - p2i(new_memregion.start()), - p2i(new_memregion.end()), - p2i(this->object_space()->used_region().start()), - p2i(this->object_space()->used_region().end()))); + "new region is not in covered_region [ " PTR_FORMAT ", " PTR_FORMAT " ], " + "new region [ " PTR_FORMAT ", " PTR_FORMAT " ], " + "object space [ " PTR_FORMAT ", " PTR_FORMAT " ]", + p2i(covered_region.start()), + p2i(covered_region.end()), + p2i(new_memregion.start()), + p2i(new_memregion.end()), + p2i(this->object_space()->used_region().start()), + p2i(this->object_space()->used_region().end())); } #endif diff --git a/src/share/vm/gc/parallel/psParallelCompact.cpp b/src/share/vm/gc/parallel/psParallelCompact.cpp --- a/src/share/vm/gc/parallel/psParallelCompact.cpp +++ b/src/share/vm/gc/parallel/psParallelCompact.cpp @@ -2851,7 +2851,7 @@ start_array->allocate_block(addr); } cm->update_contents(oop(addr)); - assert(oop(addr)->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr)))); + assert(oop(addr)->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr))); } } } @@ -3400,7 +3400,7 @@ oop moved_oop = (oop) destination(); compaction_manager()->update_contents(moved_oop); - assert(moved_oop->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(moved_oop))); + assert(moved_oop->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(moved_oop)); update_state(words); assert(destination() == (HeapWord*)moved_oop + moved_oop->size(), "sanity"); diff --git a/src/share/vm/gc/parallel/psScavenge.cpp b/src/share/vm/gc/parallel/psScavenge.cpp --- a/src/share/vm/gc/parallel/psScavenge.cpp +++ b/src/share/vm/gc/parallel/psScavenge.cpp @@ -819,7 +819,7 @@ if (AlwaysTenure || NeverTenure) { assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1, - err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is %d", (int) MaxTenuringThreshold)); + "MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is %d", (int) MaxTenuringThreshold); _tenuring_threshold = MaxTenuringThreshold; } else { // We want to smooth out our startup times for the AdaptiveSizePolicy diff --git a/src/share/vm/gc/serial/tenuredGeneration.cpp b/src/share/vm/gc/serial/tenuredGeneration.cpp --- a/src/share/vm/gc/serial/tenuredGeneration.cpp +++ b/src/share/vm/gc/serial/tenuredGeneration.cpp @@ -129,8 +129,8 @@ CardGeneration::compute_new_size(); assert(used() == used_after_gc && used_after_gc <= capacity(), - err_msg("used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT - " capacity: " SIZE_FORMAT, used(), used_after_gc, capacity())); + "used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT + " capacity: " SIZE_FORMAT, used(), used_after_gc, capacity()); } void TenuredGeneration::update_gc_stats(Generation* current_generation, diff --git a/src/share/vm/gc/shared/ageTable.cpp b/src/share/vm/gc/shared/ageTable.cpp --- a/src/share/vm/gc/shared/ageTable.cpp +++ b/src/share/vm/gc/shared/ageTable.cpp @@ -78,7 +78,7 @@ if (AlwaysTenure || NeverTenure) { assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1, - err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is " UINTX_FORMAT, MaxTenuringThreshold)); + "MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is " UINTX_FORMAT, MaxTenuringThreshold); result = MaxTenuringThreshold; } else { size_t total = 0; diff --git a/src/share/vm/gc/shared/blockOffsetTable.cpp b/src/share/vm/gc/shared/blockOffsetTable.cpp --- a/src/share/vm/gc/shared/blockOffsetTable.cpp +++ b/src/share/vm/gc/shared/blockOffsetTable.cpp @@ -543,11 +543,11 @@ size_t n_cards_back = entry_to_cards_back(offset); q -= (N_words * n_cards_back); assert(q >= _sp->bottom(), - err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, - p2i(q), p2i(_sp->bottom()))); + "q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, + p2i(q), p2i(_sp->bottom())); assert(q < _sp->end(), - err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, - p2i(q), p2i(_sp->end()))); + "q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, + p2i(q), p2i(_sp->end())); index -= n_cards_back; offset = _array->offset_array(index); } @@ -555,11 +555,11 @@ index--; q -= offset; assert(q >= _sp->bottom(), - err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, - p2i(q), p2i(_sp->bottom()))); + "q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, + p2i(q), p2i(_sp->bottom())); assert(q < _sp->end(), - err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, - p2i(q), p2i(_sp->end()))); + "q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, + p2i(q), p2i(_sp->end())); HeapWord* n = q; while (n <= addr) { @@ -567,17 +567,17 @@ q = n; n += _sp->block_size(n); assert(n > q, - err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT "," - " while querying blk_start(" PTR_FORMAT ")" - " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")", - p2i(n), p2i(last), p2i(addr), p2i(_sp->bottom()), p2i(_sp->end()))); + "Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT "," + " while querying blk_start(" PTR_FORMAT ")" + " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")", + p2i(n), p2i(last), p2i(addr), p2i(_sp->bottom()), p2i(_sp->end())); } assert(q <= addr, - err_msg("wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")", - p2i(q), p2i(addr))); + "wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")", + p2i(q), p2i(addr)); assert(addr <= n, - err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")", - p2i(addr), p2i(n))); + "wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")", + p2i(addr), p2i(n)); return q; } diff --git a/src/share/vm/gc/shared/cardTableModRefBS.hpp b/src/share/vm/gc/shared/cardTableModRefBS.hpp --- a/src/share/vm/gc/shared/cardTableModRefBS.hpp +++ b/src/share/vm/gc/shared/cardTableModRefBS.hpp @@ -126,9 +126,9 @@ // Mapping from address to card marking array entry jbyte* byte_for(const void* p) const { assert(_whole_heap.contains(p), - err_msg("Attempt to access p = " PTR_FORMAT " out of bounds of " - " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", - p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); + "Attempt to access p = " PTR_FORMAT " out of bounds of " + " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", + p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())); jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift]; assert(result >= _byte_map && result < _byte_map + _byte_map_size, "out of bounds accessor for card marking array"); @@ -294,18 +294,18 @@ size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte)); HeapWord* result = (HeapWord*) (delta << card_shift); assert(_whole_heap.contains(result), - err_msg("Returning result = " PTR_FORMAT " out of bounds of " - " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", - p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); + "Returning result = " PTR_FORMAT " out of bounds of " + " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", + p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end())); return result; } // Mapping from address to card marking array index. size_t index_for(void* p) { assert(_whole_heap.contains(p), - err_msg("Attempt to access p = " PTR_FORMAT " out of bounds of " - " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", - p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); + "Attempt to access p = " PTR_FORMAT " out of bounds of " + " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", + p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())); return byte_for(p) - _byte_map; } diff --git a/src/share/vm/gc/shared/cardTableRS.cpp b/src/share/vm/gc/shared/cardTableRS.cpp --- a/src/share/vm/gc/shared/cardTableRS.cpp +++ b/src/share/vm/gc/shared/cardTableRS.cpp @@ -278,10 +278,10 @@ // CMS+ParNew until related bug is fixed. MemRegion ur = sp->used_region(); assert(ur.contains(urasm) || (UseConcMarkSweepGC), - err_msg("Did you forget to call save_marks()? " - "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in " - "[" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end()))); + "Did you forget to call save_marks()? " + "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in " + "[" PTR_FORMAT ", " PTR_FORMAT ")", + p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end())); // In the case of CMS+ParNew, issue a warning if (!ur.contains(urasm)) { assert(UseConcMarkSweepGC, "Tautology: see assert above"); @@ -342,25 +342,25 @@ template void do_oop_work(T* p) { HeapWord* jp = (HeapWord*)p; assert(jp >= _begin && jp < _end, - err_msg("Error: jp " PTR_FORMAT " should be within " - "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")", - p2i(jp), p2i(_begin), p2i(_end))); + "Error: jp " PTR_FORMAT " should be within " + "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")", + p2i(jp), p2i(_begin), p2i(_end)); oop obj = oopDesc::load_decode_heap_oop(p); guarantee(obj == NULL || (HeapWord*)obj >= _boundary, - err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on " - "clean card crosses boundary" PTR_FORMAT, - p2i((HeapWord*)obj), p2i(jp), p2i(_boundary))); + "pointer " PTR_FORMAT " at " PTR_FORMAT " on " + "clean card crosses boundary" PTR_FORMAT, + p2i((HeapWord*)obj), p2i(jp), p2i(_boundary)); } public: VerifyCleanCardClosure(HeapWord* b, HeapWord* begin, HeapWord* end) : _boundary(b), _begin(begin), _end(end) { assert(b <= begin, - err_msg("Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT, - p2i(b), p2i(begin))); + "Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT, + p2i(b), p2i(begin)); assert(begin <= end, - err_msg("Error: begin " PTR_FORMAT " should be strictly below end " PTR_FORMAT, - p2i(begin), p2i(end))); + "Error: begin " PTR_FORMAT " should be strictly below end " PTR_FORMAT, + p2i(begin), p2i(end)); } virtual void do_oop(oop* p) { VerifyCleanCardClosure::do_oop_work(p); } diff --git a/src/share/vm/gc/shared/collectedHeap.cpp b/src/share/vm/gc/shared/collectedHeap.cpp --- a/src/share/vm/gc/shared/collectedHeap.cpp +++ b/src/share/vm/gc/shared/collectedHeap.cpp @@ -459,7 +459,7 @@ const size_t payload_size = words - filler_array_hdr_size(); const size_t len = payload_size * HeapWordSize / sizeof(jint); - assert((int)len >= 0, err_msg("size too large " SIZE_FORMAT " becomes %d", words, (int)len)); + assert((int)len >= 0, "size too large " SIZE_FORMAT " becomes %d", words, (int)len); // Set the length first for concurrent GC. ((arrayOop)start)->set_length((int)len); @@ -622,12 +622,12 @@ assert(heap_start >= ((uintptr_t)NULL + epsilon), "sanity"); void* before_heap = (void*)(heap_start - epsilon); assert(!heap->is_in(before_heap), - err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(before_heap))); + "before_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(before_heap)); // Test that a pointer to after the heap end is reported as outside the heap. assert(heap_end <= ((uintptr_t)-1 - epsilon), "sanity"); void* after_heap = (void*)(heap_end + epsilon); assert(!heap->is_in(after_heap), - err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(after_heap))); + "after_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(after_heap)); } #endif diff --git a/src/share/vm/gc/shared/collectedHeap.inline.hpp b/src/share/vm/gc/shared/collectedHeap.inline.hpp --- a/src/share/vm/gc/shared/collectedHeap.inline.hpp +++ b/src/share/vm/gc/shared/collectedHeap.inline.hpp @@ -244,9 +244,9 @@ } assert(is_ptr_aligned(addr, HeapWordSize), - err_msg("Address " PTR_FORMAT " is not properly aligned.", p2i(addr))); + "Address " PTR_FORMAT " is not properly aligned.", p2i(addr)); assert(is_size_aligned(alignment_in_bytes, HeapWordSize), - err_msg("Alignment size %u is incorrect.", alignment_in_bytes)); + "Alignment size %u is incorrect.", alignment_in_bytes); HeapWord* new_addr = (HeapWord*) align_pointer_up(addr, alignment_in_bytes); size_t padding = pointer_delta(new_addr, addr); @@ -258,13 +258,13 @@ if (padding < CollectedHeap::min_fill_size()) { padding += alignment_in_bytes / HeapWordSize; assert(padding >= CollectedHeap::min_fill_size(), - err_msg("alignment_in_bytes %u is expect to be larger " - "than the minimum object size", alignment_in_bytes)); + "alignment_in_bytes %u is expect to be larger " + "than the minimum object size", alignment_in_bytes); new_addr = addr + padding; } - assert(new_addr > addr, err_msg("Unexpected arithmetic overflow " - PTR_FORMAT " not greater than " PTR_FORMAT, p2i(new_addr), p2i(addr))); + assert(new_addr > addr, "Unexpected arithmetic overflow " + PTR_FORMAT " not greater than " PTR_FORMAT, p2i(new_addr), p2i(addr)); if(new_addr < end) { CollectedHeap::fill_with_object(addr, padding); return new_addr; diff --git a/src/share/vm/gc/shared/collectorPolicy.cpp b/src/share/vm/gc/shared/collectorPolicy.cpp --- a/src/share/vm/gc/shared/collectorPolicy.cpp +++ b/src/share/vm/gc/shared/collectorPolicy.cpp @@ -78,11 +78,11 @@ assert(_space_alignment != 0, "Space alignment not set up properly"); assert(_heap_alignment != 0, "Heap alignment not set up properly"); assert(_heap_alignment >= _space_alignment, - err_msg("heap_alignment: " SIZE_FORMAT " less than space_alignment: " SIZE_FORMAT, - _heap_alignment, _space_alignment)); + "heap_alignment: " SIZE_FORMAT " less than space_alignment: " SIZE_FORMAT, + _heap_alignment, _space_alignment); assert(_heap_alignment % _space_alignment == 0, - err_msg("heap_alignment: " SIZE_FORMAT " not aligned by space_alignment: " SIZE_FORMAT, - _heap_alignment, _space_alignment)); + "heap_alignment: " SIZE_FORMAT " not aligned by space_alignment: " SIZE_FORMAT, + _heap_alignment, _space_alignment); if (FLAG_IS_CMDLINE(MaxHeapSize)) { if (FLAG_IS_CMDLINE(InitialHeapSize) && InitialHeapSize > MaxHeapSize) { @@ -275,14 +275,14 @@ assert(_gen_alignment != 0, "Generation alignment not set up properly"); assert(_heap_alignment >= _gen_alignment, - err_msg("heap_alignment: " SIZE_FORMAT " less than gen_alignment: " SIZE_FORMAT, - _heap_alignment, _gen_alignment)); + "heap_alignment: " SIZE_FORMAT " less than gen_alignment: " SIZE_FORMAT, + _heap_alignment, _gen_alignment); assert(_gen_alignment % _space_alignment == 0, - err_msg("gen_alignment: " SIZE_FORMAT " not aligned by space_alignment: " SIZE_FORMAT, - _gen_alignment, _space_alignment)); + "gen_alignment: " SIZE_FORMAT " not aligned by space_alignment: " SIZE_FORMAT, + _gen_alignment, _space_alignment); assert(_heap_alignment % _gen_alignment == 0, - err_msg("heap_alignment: " SIZE_FORMAT " not aligned by gen_alignment: " SIZE_FORMAT, - _heap_alignment, _gen_alignment)); + "heap_alignment: " SIZE_FORMAT " not aligned by gen_alignment: " SIZE_FORMAT, + _heap_alignment, _gen_alignment); // All generational heaps have a youngest gen; handle those flags here @@ -1012,14 +1012,14 @@ MarkSweepPolicy msp; msp.initialize_all(); - assert(msp.min_young_size() <= expected, err_msg("%zu > %zu", msp.min_young_size(), expected)); + assert(msp.min_young_size() <= expected, "%zu > %zu", msp.min_young_size(), expected); } static void verify_young_initial(size_t expected) { MarkSweepPolicy msp; msp.initialize_all(); - assert(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected)); + assert(msp.initial_young_size() == expected, "%zu != %zu", msp.initial_young_size(), expected); } static void verify_scaled_young_initial(size_t initial_heap_size) { @@ -1033,23 +1033,23 @@ } size_t expected = msp.scale_by_NewRatio_aligned(initial_heap_size); - assert(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected)); + assert(msp.initial_young_size() == expected, "%zu != %zu", msp.initial_young_size(), expected); assert(FLAG_IS_ERGO(NewSize) && NewSize == expected, - err_msg("NewSize should have been set ergonomically to %zu, but was %zu", expected, NewSize)); + "NewSize should have been set ergonomically to %zu, but was %zu", expected, NewSize); } static void verify_old_min(size_t expected) { MarkSweepPolicy msp; msp.initialize_all(); - assert(msp.min_old_size() <= expected, err_msg("%zu > %zu", msp.min_old_size(), expected)); + assert(msp.min_old_size() <= expected, "%zu > %zu", msp.min_old_size(), expected); } static void verify_old_initial(size_t expected) { MarkSweepPolicy msp; msp.initialize_all(); - assert(msp.initial_old_size() == expected, err_msg("%zu != %zu", msp.initial_old_size(), expected)); + assert(msp.initial_old_size() == expected, "%zu != %zu", msp.initial_old_size(), expected); } diff --git a/src/share/vm/gc/shared/gcCause.hpp b/src/share/vm/gc/shared/gcCause.hpp --- a/src/share/vm/gc/shared/gcCause.hpp +++ b/src/share/vm/gc/shared/gcCause.hpp @@ -96,8 +96,8 @@ inline static bool is_tenured_allocation_failure_gc(GCCause::Cause cause) { assert(cause != GCCause::_old_generation_too_full_to_scavenge && cause != GCCause::_old_generation_expanded_on_last_scavenge, - err_msg("This GCCause may be correct but is not expected yet: %s", - to_string(cause))); + "This GCCause may be correct but is not expected yet: %s", + to_string(cause)); // _tenured_generation_full or _cms_generation_full for full tenured generations // _adaptive_size_policy for a full collection after a young GC // _allocation_failure is the generic cause a collection which could result @@ -141,14 +141,14 @@ _position = jio_snprintf(_buffer, _length, "%s ", prefix); } assert(_position >= 0 && _position <= _length, - err_msg("Need to increase the buffer size in GCCauseString? %d", _position)); + "Need to increase the buffer size in GCCauseString? %d", _position); } GCCauseString& append(const char* str) { int res = jio_snprintf(_buffer + _position, _length - _position, "%s", str); _position += res; assert(res >= 0 && _position <= _length, - err_msg("Need to increase the buffer size in GCCauseString? %d", res)); + "Need to increase the buffer size in GCCauseString? %d", res); return *this; } diff --git a/src/share/vm/gc/shared/genCollectedHeap.cpp b/src/share/vm/gc/shared/genCollectedHeap.cpp --- a/src/share/vm/gc/shared/genCollectedHeap.cpp +++ b/src/share/vm/gc/shared/genCollectedHeap.cpp @@ -162,8 +162,8 @@ "the maximum representable size"); } assert(total_reserved % alignment == 0, - err_msg("Gen size; total_reserved=" SIZE_FORMAT ", alignment=" - SIZE_FORMAT, total_reserved, alignment)); + "Gen size; total_reserved=" SIZE_FORMAT ", alignment=" + SIZE_FORMAT, total_reserved, alignment); *heap_rs = Universe::reserve_heap(total_reserved, alignment); return heap_rs->base(); @@ -891,7 +891,7 @@ bool GenCollectedHeap::is_in_young(oop p) { bool result = ((HeapWord*)p) < _old_gen->reserved().start(); assert(result == _young_gen->is_in_reserved(p), - err_msg("incorrect test - result=%d, p=" INTPTR_FORMAT, result, p2i((void*)p))); + "incorrect test - result=%d, p=" INTPTR_FORMAT, result, p2i((void*)p)); return result; } diff --git a/src/share/vm/gc/shared/plab.cpp b/src/share/vm/gc/shared/plab.cpp --- a/src/share/vm/gc/shared/plab.cpp +++ b/src/share/vm/gc/shared/plab.cpp @@ -45,8 +45,8 @@ // ArrayOopDesc::header_size depends on command line initialization. AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0; assert(min_size() > AlignmentReserve, - err_msg("Minimum PLAB size " SIZE_FORMAT " must be larger than alignment reserve " SIZE_FORMAT " " - "to be able to contain objects", min_size(), AlignmentReserve)); + "Minimum PLAB size " SIZE_FORMAT " must be larger than alignment reserve " SIZE_FORMAT " " + "to be able to contain objects", min_size(), AlignmentReserve); } // If the minimum object size is greater than MinObjAlignment, we can @@ -125,12 +125,12 @@ if (_allocated == 0) { assert(_unused == 0, - err_msg("Inconsistency in PLAB stats: " - "_allocated: " SIZE_FORMAT ", " - "_wasted: " SIZE_FORMAT ", " - "_unused: " SIZE_FORMAT ", " - "_undo_wasted: " SIZE_FORMAT, - _allocated, _wasted, _unused, _undo_wasted)); + "Inconsistency in PLAB stats: " + "_allocated: " SIZE_FORMAT ", " + "_wasted: " SIZE_FORMAT ", " + "_unused: " SIZE_FORMAT ", " + "_undo_wasted: " SIZE_FORMAT, + _allocated, _wasted, _unused, _undo_wasted); _allocated = 1; } diff --git a/src/share/vm/gc/shared/referenceProcessor.cpp b/src/share/vm/gc/shared/referenceProcessor.cpp --- a/src/share/vm/gc/shared/referenceProcessor.cpp +++ b/src/share/vm/gc/shared/referenceProcessor.cpp @@ -437,7 +437,7 @@ _discovered_addr = java_lang_ref_Reference::discovered_addr(_ref); oop discovered = java_lang_ref_Reference::discovered(_ref); assert(_discovered_addr && discovered->is_oop_or_null(), - err_msg("Expected an oop or NULL for discovered field at " PTR_FORMAT, p2i(discovered))); + "Expected an oop or NULL for discovered field at " PTR_FORMAT, p2i(discovered)); _next = discovered; _referent_addr = java_lang_ref_Reference::referent_addr(_ref); _referent = java_lang_ref_Reference::referent(_ref); @@ -446,9 +446,9 @@ assert(allow_null_referent ? _referent->is_oop_or_null() : _referent->is_oop(), - err_msg("Expected an oop%s for referent field at " PTR_FORMAT, - (allow_null_referent ? " or NULL" : ""), - p2i(_referent))); + "Expected an oop%s for referent field at " PTR_FORMAT, + (allow_null_referent ? " or NULL" : ""), + p2i(_referent)); } void DiscoveredListIterator::remove() { @@ -578,7 +578,7 @@ oop next = java_lang_ref_Reference::next(iter.obj()); if ((iter.referent() == NULL || iter.is_referent_alive() || next != NULL)) { - assert(next->is_oop_or_null(), err_msg("Expected an oop or NULL for next field at " PTR_FORMAT, p2i(next))); + assert(next->is_oop_or_null(), "Expected an oop or NULL for next field at " PTR_FORMAT, p2i(next)); // Remove Reference object from list iter.remove(); // Trace the cohorts @@ -943,7 +943,7 @@ case REF_NONE: // we should not reach here if we are an InstanceRefKlass default: - ShouldNotReachHere(); + guarantee(false, "rt should not be %d", rt); } if (TraceReferenceGC && PrintGCDetails) { gclog_or_tty->print_cr("Thread %d gets list " INTPTR_FORMAT, id, p2i(list)); @@ -993,9 +993,9 @@ bool da = discovery_is_atomic(); oop referent = java_lang_ref_Reference::referent(obj); assert(da ? referent->is_oop() : referent->is_oop_or_null(), - err_msg("Bad referent " INTPTR_FORMAT " found in Reference " - INTPTR_FORMAT " during %satomic discovery ", - p2i(referent), p2i(obj), da ? "" : "non-")); + "Bad referent " INTPTR_FORMAT " found in Reference " + INTPTR_FORMAT " during %satomic discovery ", + p2i(referent), p2i(obj), da ? "" : "non-"); } #endif @@ -1070,7 +1070,7 @@ HeapWord* const discovered_addr = java_lang_ref_Reference::discovered_addr(obj); const oop discovered = java_lang_ref_Reference::discovered(obj); - assert(discovered->is_oop_or_null(), err_msg("Expected an oop or NULL for discovered field at " PTR_FORMAT, p2i(discovered))); + assert(discovered->is_oop_or_null(), "Expected an oop or NULL for discovered field at " PTR_FORMAT, p2i(discovered)); if (discovered != NULL) { // The reference has already been discovered... if (TraceReferenceGC) { diff --git a/src/share/vm/gc/shared/space.cpp b/src/share/vm/gc/shared/space.cpp --- a/src/share/vm/gc/shared/space.cpp +++ b/src/share/vm/gc/shared/space.cpp @@ -592,8 +592,8 @@ // Very general, slow implementation. HeapWord* ContiguousSpace::block_start_const(const void* p) const { assert(MemRegion(bottom(), end()).contains(p), - err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(p), p2i(bottom()), p2i(end()))); + "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", + p2i(p), p2i(bottom()), p2i(end())); if (p >= top()) { return top(); } else { @@ -603,24 +603,23 @@ last = cur; cur += oop(cur)->size(); } - assert(oop(last)->is_oop(), - err_msg(PTR_FORMAT " should be an object start", p2i(last))); + assert(oop(last)->is_oop(),PTR_FORMAT " should be an object start", p2i(last)); return last; } } size_t ContiguousSpace::block_size(const HeapWord* p) const { assert(MemRegion(bottom(), end()).contains(p), - err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(p), p2i(bottom()), p2i(end()))); + "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", + p2i(p), p2i(bottom()), p2i(end())); HeapWord* current_top = top(); assert(p <= current_top, - err_msg("p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT, - p2i(p), p2i(current_top))); + "p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT, + p2i(p), p2i(current_top)); assert(p == current_top || oop(p)->is_oop(), - err_msg("p (" PTR_FORMAT ") is not a block start - " - "current_top: " PTR_FORMAT ", is_oop: %s", - p2i(p), p2i(current_top), BOOL_TO_STR(oop(p)->is_oop()))); + "p (" PTR_FORMAT ") is not a block start - " + "current_top: " PTR_FORMAT ", is_oop: %s", + p2i(p), p2i(current_top), BOOL_TO_STR(oop(p)->is_oop())); if (p < current_top) { return oop(p)->size(); } else { diff --git a/src/share/vm/gc/shared/taskqueue.cpp b/src/share/vm/gc/shared/taskqueue.cpp --- a/src/share/vm/gc/shared/taskqueue.cpp +++ b/src/share/vm/gc/shared/taskqueue.cpp @@ -92,20 +92,20 @@ void TaskQueueStats::verify() const { assert(get(push) == get(pop) + get(steal), - err_msg("push=" SIZE_FORMAT " pop=" SIZE_FORMAT " steal=" SIZE_FORMAT, - get(push), get(pop), get(steal))); + "push=" SIZE_FORMAT " pop=" SIZE_FORMAT " steal=" SIZE_FORMAT, + get(push), get(pop), get(steal)); assert(get(pop_slow) <= get(pop), - err_msg("pop_slow=" SIZE_FORMAT " pop=" SIZE_FORMAT, - get(pop_slow), get(pop))); + "pop_slow=" SIZE_FORMAT " pop=" SIZE_FORMAT, + get(pop_slow), get(pop)); assert(get(steal) <= get(steal_attempt), - err_msg("steal=" SIZE_FORMAT " steal_attempt=" SIZE_FORMAT, - get(steal), get(steal_attempt))); + "steal=" SIZE_FORMAT " steal_attempt=" SIZE_FORMAT, + get(steal), get(steal_attempt)); assert(get(overflow) == 0 || get(push) != 0, - err_msg("overflow=" SIZE_FORMAT " push=" SIZE_FORMAT, - get(overflow), get(push))); + "overflow=" SIZE_FORMAT " push=" SIZE_FORMAT, + get(overflow), get(push)); assert(get(overflow_max_len) == 0 || get(overflow) != 0, - err_msg("overflow_max_len=" SIZE_FORMAT " overflow=" SIZE_FORMAT, - get(overflow_max_len), get(overflow))); + "overflow_max_len=" SIZE_FORMAT " overflow=" SIZE_FORMAT, + get(overflow_max_len), get(overflow)); } #endif // ASSERT #endif // TASKQUEUE_STATS diff --git a/src/share/vm/gc/shared/workgroup.cpp b/src/share/vm/gc/shared/workgroup.cpp --- a/src/share/vm/gc/shared/workgroup.cpp +++ b/src/share/vm/gc/shared/workgroup.cpp @@ -140,7 +140,7 @@ _end_semaphore->wait(); // No workers are allowed to read the state variables after the coordinator has been signaled. - assert(_not_finished == 0, err_msg("%d not finished workers?", _not_finished)); + assert(_not_finished == 0, "%d not finished workers?", _not_finished); _task = NULL; _started = 0; diff --git a/src/share/vm/gc/shared/workgroup.hpp b/src/share/vm/gc/shared/workgroup.hpp --- a/src/share/vm/gc/shared/workgroup.hpp +++ b/src/share/vm/gc/shared/workgroup.hpp @@ -132,7 +132,7 @@ virtual uint active_workers() const { assert(_active_workers <= _total_workers, - err_msg("_active_workers: %u > _total_workers: %u", _active_workers, _total_workers)); + "_active_workers: %u > _total_workers: %u", _active_workers, _total_workers); assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers, "Unless dynamic should use total workers"); return _active_workers; diff --git a/src/share/vm/interpreter/bytecodeInterpreter.cpp b/src/share/vm/interpreter/bytecodeInterpreter.cpp --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp @@ -2734,8 +2734,8 @@ } DEFAULT: - fatal(err_msg("Unimplemented opcode %d = %s", opcode, - Bytecodes::name((Bytecodes::Code)opcode))); + fatal("Unimplemented opcode %d = %s", opcode, + Bytecodes::name((Bytecodes::Code)opcode)); goto finish; } /* switch(opc) */ diff --git a/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp b/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp --- a/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp +++ b/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp @@ -35,7 +35,7 @@ #ifdef ASSERT #define VERIFY_OOP(o_) \ if (VerifyOops) { \ - assert((oop(o_))->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(oop(o_)))); \ + assert((oop(o_))->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(o_))); \ StubRoutines::_verify_oop_count++; \ } #else diff --git a/src/share/vm/interpreter/bytecodes.cpp b/src/share/vm/interpreter/bytecodes.cpp --- a/src/share/vm/interpreter/bytecodes.cpp +++ b/src/share/vm/interpreter/bytecodes.cpp @@ -542,8 +542,7 @@ Code code = cast(i); Code java = java_code(code); if (can_trap(code) && !can_trap(java)) - fatal(err_msg("%s can trap => %s can trap, too", name(code), - name(java))); + fatal("%s can trap => %s can trap, too", name(code), name(java)); } } } diff --git a/src/share/vm/interpreter/bytecodes.hpp b/src/share/vm/interpreter/bytecodes.hpp --- a/src/share/vm/interpreter/bytecodes.hpp +++ b/src/share/vm/interpreter/bytecodes.hpp @@ -353,8 +353,8 @@ public: // Conversion - static void check (Code code) { assert(is_defined(code), err_msg("illegal code: %d", (int)code)); } - static void wide_check (Code code) { assert(wide_is_defined(code), err_msg("illegal code: %d", (int)code)); } + static void check (Code code) { assert(is_defined(code), "illegal code: %d", (int)code); } + static void wide_check (Code code) { assert(wide_is_defined(code), "illegal code: %d", (int)code); } static Code cast (int code) { return (Code)code; } diff --git a/src/share/vm/interpreter/interpreter.cpp b/src/share/vm/interpreter/interpreter.cpp --- a/src/share/vm/interpreter/interpreter.cpp +++ b/src/share/vm/interpreter/interpreter.cpp @@ -588,7 +588,7 @@ #endif // defined(TARGET_ARCH_x86) && !defined(_LP64) #endif // CC_INTERP default: - fatal(err_msg("unexpected method kind: %d", kind)); + fatal("unexpected method kind: %d", kind); break; } diff --git a/src/share/vm/interpreter/interpreterRuntime.cpp b/src/share/vm/interpreter/interpreterRuntime.cpp --- a/src/share/vm/interpreter/interpreterRuntime.cpp +++ b/src/share/vm/interpreter/interpreterRuntime.cpp @@ -858,7 +858,7 @@ resolve_invokedynamic(thread); break; default: - fatal(err_msg("unexpected bytecode: %s", Bytecodes::name(bytecode))); + fatal("unexpected bytecode: %s", Bytecodes::name(bytecode)); break; } } diff --git a/src/share/vm/interpreter/linkResolver.cpp b/src/share/vm/interpreter/linkResolver.cpp --- a/src/share/vm/interpreter/linkResolver.cpp +++ b/src/share/vm/interpreter/linkResolver.cpp @@ -179,11 +179,11 @@ KlassHandle object_klass = SystemDictionary::Object_klass(); Method * object_resolved_method = object_klass()->vtable()->method_at(index); assert(object_resolved_method->name() == resolved_method->name(), - err_msg("Object and interface method names should match at vtable index %d, %s != %s", - index, object_resolved_method->name()->as_C_string(), resolved_method->name()->as_C_string())); + "Object and interface method names should match at vtable index %d, %s != %s", + index, object_resolved_method->name()->as_C_string(), resolved_method->name()->as_C_string()); assert(object_resolved_method->signature() == resolved_method->signature(), - err_msg("Object and interface method signatures should match at vtable index %d, %s != %s", - index, object_resolved_method->signature()->as_C_string(), resolved_method->signature()->as_C_string())); + "Object and interface method signatures should match at vtable index %d, %s != %s", + index, object_resolved_method->signature()->as_C_string(), resolved_method->signature()->as_C_string()); #endif // ASSERT kind = CallInfo::vtable_call; @@ -192,7 +192,7 @@ kind = CallInfo::itable_call; index = resolved_method->itable_index(); } - assert(index == Method::nonvirtual_vtable_index || index >= 0, err_msg("bad index %d", index)); + assert(index == Method::nonvirtual_vtable_index || index >= 0, "bad index %d", index); _call_kind = kind; _call_index = index; _resolved_appendix = Handle(); @@ -499,7 +499,7 @@ result->print(); } assert(actual_size_of_params == expected_size_of_params, - err_msg("%d != %d", actual_size_of_params, expected_size_of_params)); + "%d != %d", actual_size_of_params, expected_size_of_params); #endif //ASSERT assert(appendix_result_or_null != NULL, ""); diff --git a/src/share/vm/interpreter/templateInterpreter.cpp b/src/share/vm/interpreter/templateInterpreter.cpp --- a/src/share/vm/interpreter/templateInterpreter.cpp +++ b/src/share/vm/interpreter/templateInterpreter.cpp @@ -602,7 +602,7 @@ case Bytecodes::_invokedynamic: return Interpreter::invokedynamic_return_entry_table(); default: - fatal(err_msg("invalid bytecode: %s", Bytecodes::name(code))); + fatal("invalid bytecode: %s", Bytecodes::name(code)); return NULL; } } @@ -624,7 +624,7 @@ case Bytecodes::_invokedynamic: return _invokedynamic_return_entry[index]; default: - assert(!Bytecodes::is_invoke(code), err_msg("invoke instructions should be handled separately: %s", Bytecodes::name(code))); + assert(!Bytecodes::is_invoke(code), "invoke instructions should be handled separately: %s", Bytecodes::name(code)); return _return_entry[length].entry(state); } } diff --git a/src/share/vm/memory/allocation.cpp b/src/share/vm/memory/allocation.cpp --- a/src/share/vm/memory/allocation.cpp +++ b/src/share/vm/memory/allocation.cpp @@ -125,7 +125,7 @@ void ResourceObj::set_allocation_type(address res, allocation_type type) { // Set allocation type in the resource object uintptr_t allocation = (uintptr_t)res; - assert((allocation & allocation_mask) == 0, err_msg("address should be aligned to 4 bytes at least: " INTPTR_FORMAT, p2i(res))); + assert((allocation & allocation_mask) == 0, "address should be aligned to 4 bytes at least: " INTPTR_FORMAT, p2i(res)); assert(type <= allocation_mask, "incorrect allocation type"); ResourceObj* resobj = (ResourceObj *)res; resobj->_allocation_t[0] = ~(allocation + type); @@ -161,8 +161,8 @@ } else if (is_type_set()) { // Operator new() was called and type was set. assert(!allocated_on_stack(), - err_msg("not embedded or stack, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", - p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1])); + "not embedded or stack, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", + p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]); } else { // Operator new() was not called. // Assume that it is embedded or stack object. @@ -175,8 +175,8 @@ // Used in ClassFileParser::parse_constant_pool_entries() for ClassFileStream. // Note: garbage may resembles valid value. assert(~(_allocation_t[0] | allocation_mask) != (uintptr_t)this || !is_type_set(), - err_msg("embedded or stack only, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", - p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1])); + "embedded or stack only, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", + p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]); set_allocation_type((address)this, STACK_OR_EMBEDDED); _allocation_t[1] = 0; // Zap verification value } @@ -184,8 +184,8 @@ ResourceObj& ResourceObj::operator=(const ResourceObj& r) { // default copy assignment // Used in InlineTree::ok_to_inline() for WarmCallInfo. assert(allocated_on_stack(), - err_msg("copy only into local, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", - p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1])); + "copy only into local, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", + p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]); // Keep current _allocation_t value; return *this; } diff --git a/src/share/vm/memory/binaryTreeDictionary.cpp b/src/share/vm/memory/binaryTreeDictionary.cpp --- a/src/share/vm/memory/binaryTreeDictionary.cpp +++ b/src/share/vm/memory/binaryTreeDictionary.cpp @@ -708,8 +708,8 @@ size_t size = fc->size(); assert((size >= min_size()), - err_msg(SIZE_FORMAT " is too small to be a TreeChunk " SIZE_FORMAT, - size, min_size())); + SIZE_FORMAT " is too small to be a TreeChunk " SIZE_FORMAT, + size, min_size()); if (FLSVerifyDictionary) { verify_tree(); } diff --git a/src/share/vm/memory/iterator.inline.hpp b/src/share/vm/memory/iterator.inline.hpp --- a/src/share/vm/memory/iterator.inline.hpp +++ b/src/share/vm/memory/iterator.inline.hpp @@ -58,7 +58,7 @@ if (!oopDesc::is_null(heap_oop)) { oop o = oopDesc::decode_heap_oop_not_null(heap_oop); assert(Universe::heap()->is_in_closed_subset(o), - err_msg("should be in closed *p " PTR_FORMAT " " PTR_FORMAT, p2i(p), p2i(o))); + "should be in closed *p " PTR_FORMAT " " PTR_FORMAT, p2i(p), p2i(o)); } } } diff --git a/src/share/vm/memory/metaspace.cpp b/src/share/vm/memory/metaspace.cpp --- a/src/share/vm/memory/metaspace.cpp +++ b/src/share/vm/memory/metaspace.cpp @@ -189,7 +189,7 @@ assert(index == SpecializedIndex || \ index == SmallIndex || \ index == MediumIndex || \ - index == HumongousIndex, err_msg("Bad index: %d", (int) index)) + index == HumongousIndex, "Bad index: %d", (int) index) size_t num_free_chunks(ChunkIndex index) const { index_bounds_check(index); @@ -378,13 +378,13 @@ #define assert_is_ptr_aligned(ptr, alignment) \ assert(is_ptr_aligned(ptr, alignment), \ - err_msg(PTR_FORMAT " is not aligned to " \ - SIZE_FORMAT, p2i(ptr), alignment)) + PTR_FORMAT " is not aligned to " \ + SIZE_FORMAT, p2i(ptr), alignment) #define assert_is_size_aligned(size, alignment) \ assert(is_size_aligned(size, alignment), \ - err_msg(SIZE_FORMAT " is not aligned to " \ - SIZE_FORMAT, size, alignment)) + SIZE_FORMAT " is not aligned to " \ + SIZE_FORMAT, size, alignment) // Decide if large pages should be committed when the memory is reserved. @@ -801,8 +801,8 @@ #ifdef ASSERT void VirtualSpaceNode::verify_container_count() { assert(_container_count == container_count_slow(), - err_msg("Inconsistency in container_count _container_count " UINTX_FORMAT - " container_count_slow() " UINTX_FORMAT, _container_count, container_count_slow())); + "Inconsistency in container_count _container_count " UINTX_FORMAT + " container_count_slow() " UINTX_FORMAT, _container_count, container_count_slow()); } #endif @@ -965,12 +965,12 @@ (HeapWord*)(_rs.base() + _rs.size()))); assert(reserved()->start() == (HeapWord*) _rs.base(), - err_msg("Reserved start was not set properly " PTR_FORMAT - " != " PTR_FORMAT, p2i(reserved()->start()), p2i(_rs.base()))); + "Reserved start was not set properly " PTR_FORMAT + " != " PTR_FORMAT, p2i(reserved()->start()), p2i(_rs.base())); assert(reserved()->word_size() == _rs.size() / BytesPerWord, - err_msg("Reserved size was not set properly " SIZE_FORMAT - " != " SIZE_FORMAT, reserved()->word_size(), - _rs.size() / BytesPerWord)); + "Reserved size was not set properly " SIZE_FORMAT + " != " SIZE_FORMAT, reserved()->word_size(), + _rs.size() / BytesPerWord); } return result; @@ -1016,11 +1016,11 @@ _reserved_words = _reserved_words - v; } -#define assert_committed_below_limit() \ - assert(MetaspaceAux::committed_bytes() <= MaxMetaspaceSize, \ - err_msg("Too much committed memory. Committed: " SIZE_FORMAT \ - " limit (MaxMetaspaceSize): " SIZE_FORMAT, \ - MetaspaceAux::committed_bytes(), MaxMetaspaceSize)); +#define assert_committed_below_limit() \ + assert(MetaspaceAux::committed_bytes() <= MaxMetaspaceSize, \ + "Too much committed memory. Committed: " SIZE_FORMAT \ + " limit (MaxMetaspaceSize): " SIZE_FORMAT, \ + MetaspaceAux::committed_bytes(), MaxMetaspaceSize); void VirtualSpaceList::inc_committed_words(size_t v) { assert_lock_strong(SpaceManager::expand_lock()); @@ -1461,8 +1461,8 @@ size_t capacity_until_gc = capacity_until_GC(); assert(capacity_until_gc >= committed_bytes, - err_msg("capacity_until_gc: " SIZE_FORMAT " < committed_bytes: " SIZE_FORMAT, - capacity_until_gc, committed_bytes)); + "capacity_until_gc: " SIZE_FORMAT " < committed_bytes: " SIZE_FORMAT, + capacity_until_gc, committed_bytes); size_t left_until_max = MaxMetaspaceSize - committed_bytes; size_t left_until_GC = capacity_until_gc - committed_bytes; @@ -1543,8 +1543,8 @@ // No expansion, now see if we want to shrink // We would never want to shrink more than this assert(capacity_until_GC >= minimum_desired_capacity, - err_msg(SIZE_FORMAT " >= " SIZE_FORMAT, - capacity_until_GC, minimum_desired_capacity)); + SIZE_FORMAT " >= " SIZE_FORMAT, + capacity_until_GC, minimum_desired_capacity); size_t max_shrink_bytes = capacity_until_GC - minimum_desired_capacity; // Should shrinking be considered? @@ -1585,8 +1585,8 @@ shrink_bytes = align_size_down(shrink_bytes, Metaspace::commit_alignment()); assert(shrink_bytes <= max_shrink_bytes, - err_msg("invalid shrink size " SIZE_FORMAT " not <= " SIZE_FORMAT, - shrink_bytes, max_shrink_bytes)); + "invalid shrink size " SIZE_FORMAT " not <= " SIZE_FORMAT, + shrink_bytes, max_shrink_bytes); if (current_shrink_factor == 0) { _shrink_factor = 10; } else { @@ -1676,9 +1676,9 @@ void ChunkManager::locked_verify_free_chunks_total() { assert_lock_strong(SpaceManager::expand_lock()); assert(sum_free_chunks() == _free_chunks_total, - err_msg("_free_chunks_total " SIZE_FORMAT " is not the" - " same as sum " SIZE_FORMAT, _free_chunks_total, - sum_free_chunks())); + "_free_chunks_total " SIZE_FORMAT " is not the" + " same as sum " SIZE_FORMAT, _free_chunks_total, + sum_free_chunks()); } void ChunkManager::verify_free_chunks_total() { @@ -1690,9 +1690,9 @@ void ChunkManager::locked_verify_free_chunks_count() { assert_lock_strong(SpaceManager::expand_lock()); assert(sum_free_chunks_count() == _free_chunks_count, - err_msg("_free_chunks_count " SIZE_FORMAT " is not the" - " same as sum " SIZE_FORMAT, _free_chunks_count, - sum_free_chunks_count())); + "_free_chunks_count " SIZE_FORMAT " is not the" + " same as sum " SIZE_FORMAT, _free_chunks_count, + sum_free_chunks_count()); } void ChunkManager::verify_free_chunks_count() { @@ -1891,9 +1891,9 @@ break; } assert(*chunk_word_size != 0 && *class_chunk_word_size != 0, - err_msg("Initial chunks sizes bad: data " SIZE_FORMAT - " class " SIZE_FORMAT, - *chunk_word_size, *class_chunk_word_size)); + "Initial chunks sizes bad: data " SIZE_FORMAT + " class " SIZE_FORMAT, + *chunk_word_size, *class_chunk_word_size); } size_t SpaceManager::sum_free_in_chunks_in_use() const { @@ -2036,9 +2036,9 @@ assert(!SpaceManager::is_humongous(word_size) || chunk_word_size == if_humongous_sized_chunk, - err_msg("Size calculation is wrong, word_size " SIZE_FORMAT - " chunk_word_size " SIZE_FORMAT, - word_size, chunk_word_size)); + "Size calculation is wrong, word_size " SIZE_FORMAT + " chunk_word_size " SIZE_FORMAT, + word_size, chunk_word_size); if (TraceMetadataHumongousAllocation && SpaceManager::is_humongous(word_size)) { gclog_or_tty->print_cr("Metadata humongous allocation:"); @@ -2202,9 +2202,9 @@ SpaceManager::~SpaceManager() { // This call this->_lock which can't be done while holding expand_lock() assert(sum_capacity_in_chunks_in_use() == allocated_chunks_words(), - err_msg("sum_capacity_in_chunks_in_use() " SIZE_FORMAT - " allocated_chunks_words() " SIZE_FORMAT, - sum_capacity_in_chunks_in_use(), allocated_chunks_words())); + "sum_capacity_in_chunks_in_use() " SIZE_FORMAT + " allocated_chunks_words() " SIZE_FORMAT, + sum_capacity_in_chunks_in_use(), allocated_chunks_words()); MutexLockerEx fcl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag); @@ -2275,9 +2275,9 @@ assert(humongous_chunks->word_size() == (size_t) align_size_up(humongous_chunks->word_size(), smallest_chunk_size()), - err_msg("Humongous chunk size is wrong: word size " SIZE_FORMAT - " granularity " SIZE_FORMAT, - humongous_chunks->word_size(), smallest_chunk_size())); + "Humongous chunk size is wrong: word size " SIZE_FORMAT + " granularity " SIZE_FORMAT, + humongous_chunks->word_size(), smallest_chunk_size()); Metachunk* next_humongous_chunks = humongous_chunks->next(); humongous_chunks->container()->dec_container_count(); chunk_manager()->humongous_dictionary()->return_chunk(humongous_chunks); @@ -2331,7 +2331,7 @@ size_t raw_word_size = get_raw_word_size(word_size); size_t min_size = TreeChunk >::min_size(); assert(raw_word_size >= min_size, - err_msg("Should not deallocate dark matter " SIZE_FORMAT "<" SIZE_FORMAT, word_size, min_size)); + "Should not deallocate dark matter " SIZE_FORMAT "<" SIZE_FORMAT, word_size, min_size); block_freelists()->return_block(p, raw_word_size); } @@ -2541,9 +2541,9 @@ assert(SafepointSynchronize::is_at_safepoint() || !Universe::is_fully_initialized(), "Verification can fail if the applications is running"); assert(allocated_blocks_words() == sum_used_in_chunks_in_use(), - err_msg("allocation total is not consistent " SIZE_FORMAT - " vs " SIZE_FORMAT, - allocated_blocks_words(), sum_used_in_chunks_in_use())); + "allocation total is not consistent " SIZE_FORMAT + " vs " SIZE_FORMAT, + allocated_blocks_words(), sum_used_in_chunks_in_use()); } #endif @@ -2616,9 +2616,9 @@ void MetaspaceAux::dec_capacity(Metaspace::MetadataType mdtype, size_t words) { assert_lock_strong(SpaceManager::expand_lock()); assert(words <= capacity_words(mdtype), - err_msg("About to decrement below 0: words " SIZE_FORMAT - " is greater than _capacity_words[%u] " SIZE_FORMAT, - words, mdtype, capacity_words(mdtype))); + "About to decrement below 0: words " SIZE_FORMAT + " is greater than _capacity_words[%u] " SIZE_FORMAT, + words, mdtype, capacity_words(mdtype)); _capacity_words[mdtype] -= words; } @@ -2630,9 +2630,9 @@ void MetaspaceAux::dec_used(Metaspace::MetadataType mdtype, size_t words) { assert(words <= used_words(mdtype), - err_msg("About to decrement below 0: words " SIZE_FORMAT - " is greater than _used_words[%u] " SIZE_FORMAT, - words, mdtype, used_words(mdtype))); + "About to decrement below 0: words " SIZE_FORMAT + " is greater than _used_words[%u] " SIZE_FORMAT, + words, mdtype, used_words(mdtype)); // For CMS deallocation of the Metaspaces occurs during the // sweep which is a concurrent phase. Protection by the expand_lock() // is not enough since allocation is on a per Metaspace basis @@ -2699,11 +2699,11 @@ size_t class_capacity = capacity_bytes_slow(Metaspace::ClassType); size_t non_class_capacity = capacity_bytes_slow(Metaspace::NonClassType); assert(capacity_bytes() == class_capacity + non_class_capacity, - err_msg("bad accounting: capacity_bytes() " SIZE_FORMAT - " class_capacity + non_class_capacity " SIZE_FORMAT - " class_capacity " SIZE_FORMAT " non_class_capacity " SIZE_FORMAT, - capacity_bytes(), class_capacity + non_class_capacity, - class_capacity, non_class_capacity)); + "bad accounting: capacity_bytes() " SIZE_FORMAT + " class_capacity + non_class_capacity " SIZE_FORMAT + " class_capacity " SIZE_FORMAT " non_class_capacity " SIZE_FORMAT, + capacity_bytes(), class_capacity + non_class_capacity, + class_capacity, non_class_capacity); return class_capacity + non_class_capacity; } @@ -2904,17 +2904,17 @@ // For purposes of the running sum of capacity, verify against capacity size_t capacity_in_use_bytes = capacity_bytes_slow(); assert(running_sum_capacity_bytes == capacity_in_use_bytes, - err_msg("capacity_words() * BytesPerWord " SIZE_FORMAT - " capacity_bytes_slow()" SIZE_FORMAT, - running_sum_capacity_bytes, capacity_in_use_bytes)); + "capacity_words() * BytesPerWord " SIZE_FORMAT + " capacity_bytes_slow()" SIZE_FORMAT, + running_sum_capacity_bytes, capacity_in_use_bytes); for (Metaspace::MetadataType i = Metaspace::ClassType; i < Metaspace:: MetadataTypeCount; i = (Metaspace::MetadataType)(i + 1)) { size_t capacity_in_use_bytes = capacity_bytes_slow(i); assert(capacity_bytes(i) == capacity_in_use_bytes, - err_msg("capacity_bytes(%u) " SIZE_FORMAT - " capacity_bytes_slow(%u)" SIZE_FORMAT, - i, capacity_bytes(i), i, capacity_in_use_bytes)); + "capacity_bytes(%u) " SIZE_FORMAT + " capacity_bytes_slow(%u)" SIZE_FORMAT, + i, capacity_bytes(i), i, capacity_in_use_bytes); } #endif } @@ -2925,17 +2925,17 @@ // For purposes of the running sum of used, verify against used size_t used_in_use_bytes = used_bytes_slow(); assert(used_bytes() == used_in_use_bytes, - err_msg("used_bytes() " SIZE_FORMAT - " used_bytes_slow()" SIZE_FORMAT, - used_bytes(), used_in_use_bytes)); + "used_bytes() " SIZE_FORMAT + " used_bytes_slow()" SIZE_FORMAT, + used_bytes(), used_in_use_bytes); for (Metaspace::MetadataType i = Metaspace::ClassType; i < Metaspace:: MetadataTypeCount; i = (Metaspace::MetadataType)(i + 1)) { size_t used_in_use_bytes = used_bytes_slow(i); assert(used_bytes(i) == used_in_use_bytes, - err_msg("used_bytes(%u) " SIZE_FORMAT - " used_bytes_slow(%u)" SIZE_FORMAT, - i, used_bytes(i), i, used_in_use_bytes)); + "used_bytes(%u) " SIZE_FORMAT + " used_bytes_slow(%u)" SIZE_FORMAT, + i, used_bytes(i), i, used_in_use_bytes); } #endif } @@ -3157,7 +3157,7 @@ void Metaspace::initialize_class_space(ReservedSpace rs) { // The reserved space size may be bigger because of alignment, esp with UseLargePages assert(rs.size() >= CompressedClassSpaceSize, - err_msg(SIZE_FORMAT " != " SIZE_FORMAT, rs.size(), CompressedClassSpaceSize)); + SIZE_FORMAT " != " SIZE_FORMAT, rs.size(), CompressedClassSpaceSize); assert(using_class_space(), "Must be using class space"); _class_space_list = new VirtualSpaceList(rs); _chunk_manager_class = new ChunkManager(SpecializedChunk, ClassSmallChunk, ClassMediumChunk); @@ -3688,7 +3688,7 @@ case Metaspace::ClassType: return "Class"; case Metaspace::NonClassType: return "Metadata"; default: - assert(false, err_msg("Got bad mdtype: %d", (int) mdtype)); + assert(false, "Got bad mdtype: %d", (int) mdtype); return NULL; } } @@ -3970,15 +3970,15 @@ #define assert_is_available_positive(word_size) \ assert(vsn.is_available(word_size), \ - err_msg(#word_size ": " PTR_FORMAT " bytes were not available in " \ - "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \ - (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end()))); + #word_size ": " PTR_FORMAT " bytes were not available in " \ + "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \ + (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end())); #define assert_is_available_negative(word_size) \ assert(!vsn.is_available(word_size), \ - err_msg(#word_size ": " PTR_FORMAT " bytes should not be available in " \ - "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \ - (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end()))); + #word_size ": " PTR_FORMAT " bytes should not be available in " \ + "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \ + (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end())); static void test_is_available_positive() { // Reserve some memory. diff --git a/src/share/vm/memory/metaspaceGCThresholdUpdater.hpp b/src/share/vm/memory/metaspaceGCThresholdUpdater.hpp --- a/src/share/vm/memory/metaspaceGCThresholdUpdater.hpp +++ b/src/share/vm/memory/metaspaceGCThresholdUpdater.hpp @@ -43,7 +43,7 @@ case ExpandAndAllocate: return "expand_and_allocate"; default: - assert(false, err_msg("Got bad updater: %d", (int) updater)); + assert(false, "Got bad updater: %d", (int) updater); return NULL; }; } diff --git a/src/share/vm/memory/universe.cpp b/src/share/vm/memory/universe.cpp --- a/src/share/vm/memory/universe.cpp +++ b/src/share/vm/memory/universe.cpp @@ -812,8 +812,8 @@ ReservedSpace Universe::reserve_heap(size_t heap_size, size_t alignment) { assert(alignment <= Arguments::conservative_max_heap_alignment(), - err_msg("actual alignment " SIZE_FORMAT " must be within maximum heap alignment " SIZE_FORMAT, - alignment, Arguments::conservative_max_heap_alignment())); + "actual alignment " SIZE_FORMAT " must be within maximum heap alignment " SIZE_FORMAT, + alignment, Arguments::conservative_max_heap_alignment()); size_t total_reserved = align_size_up(heap_size, alignment); assert(!UseCompressedOops || (total_reserved <= (OopEncodingHeapMax - os::vm_page_size())), diff --git a/src/share/vm/memory/universe.hpp b/src/share/vm/memory/universe.hpp --- a/src/share/vm/memory/universe.hpp +++ b/src/share/vm/memory/universe.hpp @@ -269,7 +269,7 @@ } static Klass* typeArrayKlassObj(BasicType t) { - assert((uint)t < T_VOID+1, err_msg("range check for type: %s", type2name(t))); + assert((uint)t < T_VOID+1, "range check for type: %s", type2name(t)); assert(_typeArrayKlassObjs[t] != NULL, "domain check"); return _typeArrayKlassObjs[t]; } diff --git a/src/share/vm/memory/virtualspace.cpp b/src/share/vm/memory/virtualspace.cpp --- a/src/share/vm/memory/virtualspace.cpp +++ b/src/share/vm/memory/virtualspace.cpp @@ -137,9 +137,9 @@ } // Check alignment constraints. assert((uintptr_t) base % alignment == 0, - err_msg("Large pages returned a non-aligned address, base: " - PTR_FORMAT " alignment: " PTR_FORMAT, - base, (void*)(uintptr_t)alignment)); + "Large pages returned a non-aligned address, base: " + PTR_FORMAT " alignment: " PTR_FORMAT, + base, (void*)(uintptr_t)alignment); _special = true; } else { // failed; try to reserve regular memory below @@ -334,9 +334,9 @@ if (base != NULL) { // Check alignment constraints. assert((uintptr_t) base % alignment == 0, - err_msg("Large pages returned a non-aligned address, base: " - PTR_FORMAT " alignment: " PTR_FORMAT, - base, (void*)(uintptr_t)alignment)); + "Large pages returned a non-aligned address, base: " + PTR_FORMAT " alignment: " PTR_FORMAT, + base, (void*)(uintptr_t)alignment); _special = true; } } @@ -1205,20 +1205,20 @@ TestReservedSpace::test_reserved_space(); } -#define assert_equals(actual, expected) \ - assert(actual == expected, \ - err_msg("Got " SIZE_FORMAT " expected " \ - SIZE_FORMAT, actual, expected)); +#define assert_equals(actual, expected) \ + assert(actual == expected, \ + "Got " SIZE_FORMAT " expected " \ + SIZE_FORMAT, actual, expected); #define assert_ge(value1, value2) \ assert(value1 >= value2, \ - err_msg("'" #value1 "': " SIZE_FORMAT " '" \ - #value2 "': " SIZE_FORMAT, value1, value2)); + "'" #value1 "': " SIZE_FORMAT " '" \ + #value2 "': " SIZE_FORMAT, value1, value2); #define assert_lt(value1, value2) \ assert(value1 < value2, \ - err_msg("'" #value1 "': " SIZE_FORMAT " '" \ - #value2 "': " SIZE_FORMAT, value1, value2)); + "'" #value1 "': " SIZE_FORMAT " '" \ + #value2 "': " SIZE_FORMAT, value1, value2); class TestVirtualSpace : AllStatic { diff --git a/src/share/vm/oops/constantPool.cpp b/src/share/vm/oops/constantPool.cpp --- a/src/share/vm/oops/constantPool.cpp +++ b/src/share/vm/oops/constantPool.cpp @@ -1826,9 +1826,9 @@ // Ensure that all the patches have been used. for (int index = 0; index < cp_patches->length(); index++) { assert(cp_patches->at(index).is_null(), - err_msg("Unused constant pool patch at %d in class file %s", - index, - pool_holder()->external_name())); + "Unused constant pool patch at %d in class file %s", + index, + pool_holder()->external_name()); } #endif // ASSERT } diff --git a/src/share/vm/oops/cpCache.cpp b/src/share/vm/oops/cpCache.cpp --- a/src/share/vm/oops/cpCache.cpp +++ b/src/share/vm/oops/cpCache.cpp @@ -126,7 +126,7 @@ // This routine is called only in corner cases where the CPCE is not yet initialized. // See AbstractInterpreter::deopt_continue_after_entry. assert(_flags == 0 || parameter_size() == 0 || parameter_size() == value, - err_msg("size must not change: parameter_size=%d, value=%d", parameter_size(), value)); + "size must not change: parameter_size=%d, value=%d", parameter_size(), value); // Setting the parameter size by itself is only safe if the // current value of _flags is 0, otherwise another thread may have // updated it and we don't want to overwrite that value. Don't @@ -136,7 +136,7 @@ Atomic::cmpxchg_ptr((value & parameter_size_mask), &_flags, 0); } guarantee(parameter_size() == value, - err_msg("size must not change: parameter_size=%d, value=%d", parameter_size(), value)); + "size must not change: parameter_size=%d, value=%d", parameter_size(), value); } void ConstantPoolCacheEntry::set_direct_or_vtable_call(Bytecodes::Code invoke_code, 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 @@ -1499,7 +1499,7 @@ // not found #ifdef ASSERT int index = (skipping_overpass || skipping_static || skipping_private) ? -1 : linear_search(methods, name, signature); - assert(index == -1, err_msg("binary search should have found entry %d", index)); + assert(index == -1, "binary search should have found entry %d", index); #endif } return -1; @@ -1915,7 +1915,7 @@ for (nmethodBucket* b = deps; b != NULL; b = b->next()) { if (nm == b->get_nmethod()) { int val = b->decrement(); - guarantee(val >= 0, err_msg("Underflow: %d", val)); + guarantee(val >= 0, "Underflow: %d", val); return (val == 0); } } @@ -1936,7 +1936,7 @@ nmethodBucket* b = first; while (b != NULL) { - assert(b->count() >= 0, err_msg("bucket count: %d", b->count())); + assert(b->count() >= 0, "bucket count: %d", b->count()); nmethodBucket* next = b->next(); if (b->count() == 0) { if (last == NULL) { @@ -1976,7 +1976,7 @@ if (nm == b->get_nmethod()) { #ifdef ASSERT int count = b->count(); - assert(count >= 0, err_msg("count shouldn't be negative: %d", count)); + assert(count >= 0, "count shouldn't be negative: %d", count); #endif return true; } @@ -2001,7 +2001,7 @@ else { // Verification for (nmethodBucket* b = _dependencies; b != NULL; b = b->next()) { - assert(b->count() >= 0, err_msg("bucket count: %d", b->count())); + assert(b->count() >= 0, "bucket count: %d", b->count()); assert(b->count() != 0, "empty buckets need to be cleaned"); } } @@ -3110,7 +3110,7 @@ Klass* sib = next_sibling(); if (sib != NULL) { if (sib == this) { - fatal(err_msg("subclass points to itself " PTR_FORMAT, sib)); + fatal("subclass points to itself " PTR_FORMAT, sib); } guarantee(sib->is_klass(), "should be klass"); diff --git a/src/share/vm/oops/klass.cpp b/src/share/vm/oops/klass.cpp --- a/src/share/vm/oops/klass.cpp +++ b/src/share/vm/oops/klass.cpp @@ -690,11 +690,11 @@ bool Klass::verify_vtable_index(int i) { if (oop_is_instance()) { int limit = ((InstanceKlass*)this)->vtable_length()/vtableEntry::size(); - assert(i >= 0 && i < limit, err_msg("index %d out of bounds %d", i, limit)); + assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit); } else { assert(oop_is_array(), "Must be"); int limit = ((ArrayKlass*)this)->vtable_length()/vtableEntry::size(); - assert(i >= 0 && i < limit, err_msg("index %d out of bounds %d", i, limit)); + assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit); } return true; } diff --git a/src/share/vm/oops/klass.hpp b/src/share/vm/oops/klass.hpp --- a/src/share/vm/oops/klass.hpp +++ b/src/share/vm/oops/klass.hpp @@ -341,7 +341,7 @@ assert(lh < (jint)_lh_neutral_value, "must be array"); int l2esz = (lh >> _lh_log2_element_size_shift) & _lh_log2_element_size_mask; assert(l2esz <= LogBitsPerLong, - err_msg("sanity. l2esz: 0x%x for lh: 0x%x", (uint)l2esz, (uint)lh)); + "sanity. l2esz: 0x%x for lh: 0x%x", (uint)l2esz, (uint)lh); return l2esz; } static jint array_layout_helper(jint tag, int hsize, BasicType etype, int log2_esize) { diff --git a/src/share/vm/oops/klass.inline.hpp b/src/share/vm/oops/klass.inline.hpp --- a/src/share/vm/oops/klass.inline.hpp +++ b/src/share/vm/oops/klass.inline.hpp @@ -63,7 +63,7 @@ assert(!is_null(v), "narrow klass value can never be zero"); int shift = Universe::narrow_klass_shift(); Klass* result = (Klass*)(void*)((uintptr_t)Universe::narrow_klass_base() + ((uintptr_t)v << shift)); - assert(check_klass_alignment(result), err_msg("address not aligned: " INTPTR_FORMAT, p2i((void*) result))); + assert(check_klass_alignment(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result)); return result; } 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 @@ -1461,8 +1461,8 @@ oop* end_of_obj = (oop*)_klass() + _klass()->size(); oop* end_of_vtable = (oop *)&table()[_length]; if (end_of_vtable > end_of_obj) { - fatal(err_msg("klass %s: klass object too short (vtable extends beyond " - "end)", _klass->internal_name())); + fatal("klass %s: klass object too short (vtable extends beyond " + "end)", _klass->internal_name()); } for (int i = 0; i < _length; i++) table()[i].verify(this, st); @@ -1505,7 +1505,7 @@ #ifndef PRODUCT print(); #endif - fatal(err_msg("vtableEntry " PTR_FORMAT ": method is from subclass", this)); + fatal("vtableEntry " PTR_FORMAT ": method is from subclass", this); } } diff --git a/src/share/vm/oops/method.cpp b/src/share/vm/oops/method.cpp --- a/src/share/vm/oops/method.cpp +++ b/src/share/vm/oops/method.cpp @@ -248,7 +248,7 @@ #ifdef ASSERT { ResourceMark rm; assert(is_native() && bcp == code_base() || contains(bcp) || is_error_reported(), - err_msg("bcp doesn't belong to this method: bcp: " INTPTR_FORMAT ", method: %s", bcp, name_and_sig_as_C_string())); + "bcp doesn't belong to this method: bcp: " INTPTR_FORMAT ", method: %s", bcp, name_and_sig_as_C_string()); } #endif return bcp - code_base(); @@ -279,7 +279,7 @@ } address Method::bcp_from(int bci) const { - assert((is_native() && bci == 0) || (!is_native() && 0 <= bci && bci < code_size()), err_msg("illegal bci: %d", bci)); + assert((is_native() && bci == 0) || (!is_native() && 0 <= bci && bci < code_size()), "illegal bci: %d", bci); address bcp = code_base() + bci; assert(is_native() && bcp == code_base() || contains(bcp), "bcp doesn't belong to this method"); return bcp; @@ -573,7 +573,7 @@ ResourceMark rm; bool is_nonv = (vtable_index() == nonvirtual_vtable_index); if (class_access_flags.is_interface()) { - assert(is_nonv == is_static(), err_msg("is_nonv=%s", name_and_sig_as_C_string())); + assert(is_nonv == is_static(), "is_nonv=%s", name_and_sig_as_C_string()); } #endif assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question"); @@ -1572,7 +1572,7 @@ } { ResourceMark rm; - fatal(err_msg("no original bytecode found in %s at bci %d", name_and_sig_as_C_string(), bci)); + fatal("no original bytecode found in %s at bci %d", name_and_sig_as_C_string(), bci); } return Bytecodes::_shouldnotreachhere; } diff --git a/src/share/vm/oops/methodData.cpp b/src/share/vm/oops/methodData.cpp --- a/src/share/vm/oops/methodData.cpp +++ b/src/share/vm/oops/methodData.cpp @@ -110,7 +110,7 @@ return ss.as_string(); break; default: - fatal(err_msg("unexpected tag %d", dp->tag())); + fatal("unexpected tag %d", dp->tag()); } } return NULL; @@ -1239,7 +1239,7 @@ nb_cells = SpeculativeTrapData::static_cell_count(); break; default: - fatal(err_msg("unexpected tag %d", dp->tag())); + fatal("unexpected tag %d", dp->tag()); } return (DataLayout*)((address)dp + DataLayout::compute_size_in_bytes(nb_cells)); } @@ -1279,7 +1279,7 @@ } break; default: - fatal(err_msg("unexpected tag %d", dp->tag())); + fatal("unexpected tag %d", dp->tag()); } } return NULL; @@ -1400,7 +1400,7 @@ dp = end; // ArgInfoData is at the end of extra data section. break; default: - fatal(err_msg("unexpected tag %d", dp->tag())); + fatal("unexpected tag %d", dp->tag()); } st->print("%d", dp_to_di(data->dp())); st->fill_to(6); @@ -1612,7 +1612,7 @@ clean_extra_data_helper(dp, shift, true); return; default: - fatal(err_msg("unexpected tag %d", dp->tag())); + fatal("unexpected tag %d", dp->tag()); } } } @@ -1638,7 +1638,7 @@ case DataLayout::arg_info_data_tag: return; default: - fatal(err_msg("unexpected tag %d", dp->tag())); + fatal("unexpected tag %d", dp->tag()); } } #endif diff --git a/src/share/vm/oops/oop.cpp b/src/share/vm/oops/oop.cpp --- a/src/share/vm/oops/oop.cpp +++ b/src/share/vm/oops/oop.cpp @@ -123,7 +123,7 @@ template void VerifyOopClosure::do_oop_work(T* p) { oop obj = oopDesc::load_decode_heap_oop(p); - guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, p2i((oopDesc*) obj))); + guarantee(obj->is_oop_or_null(), "invalid oop: " INTPTR_FORMAT, p2i((oopDesc*) obj)); } void VerifyOopClosure::do_oop(oop* p) { VerifyOopClosure::do_oop_work(p); } diff --git a/src/share/vm/oops/oop.inline.hpp b/src/share/vm/oops/oop.inline.hpp --- a/src/share/vm/oops/oop.inline.hpp +++ b/src/share/vm/oops/oop.inline.hpp @@ -189,7 +189,7 @@ address base = Universe::narrow_oop_base(); int shift = Universe::narrow_oop_shift(); oop result = (oop)(void*)((uintptr_t)base + ((uintptr_t)v << shift)); - assert(check_obj_alignment(result), err_msg("address not aligned: " INTPTR_FORMAT, p2i((void*) result))); + assert(check_obj_alignment(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result)); return result; } diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp --- a/src/share/vm/opto/graphKit.cpp +++ b/src/share/vm/opto/graphKit.cpp @@ -2509,7 +2509,7 @@ switch(bt) { case T_INT: cmp = new CmpINode(in1, in2); break; case T_ADDRESS: cmp = new CmpPNode(in1, in2); break; - default: fatal(err_msg("unexpected comparison type %s", type2name(bt))); + default: fatal("unexpected comparison type %s", type2name(bt)); } gvn->transform(cmp); Node* bol = gvn->transform(new BoolNode(cmp, test)); diff --git a/src/share/vm/prims/methodHandles.cpp b/src/share/vm/prims/methodHandles.cpp --- a/src/share/vm/prims/methodHandles.cpp +++ b/src/share/vm/prims/methodHandles.cpp @@ -228,8 +228,8 @@ { ResourceMark rm; Method* m2 = m_klass_non_interface->vtable()->method_at(vmindex); assert(m->name() == m2->name() && m->signature() == m2->signature(), - err_msg("at %d, %s != %s", vmindex, - m->name_and_sig_as_C_string(), m2->name_and_sig_as_C_string())); + "at %d, %s != %s", vmindex, + m->name_and_sig_as_C_string(), m2->name_and_sig_as_C_string()); } #endif //ASSERT } @@ -345,7 +345,7 @@ Symbol* MethodHandles::signature_polymorphic_intrinsic_name(vmIntrinsics::ID iid) { - assert(is_signature_polymorphic_intrinsic(iid), err_msg("iid=%d", iid)); + assert(is_signature_polymorphic_intrinsic(iid), "iid=%d", iid); switch (iid) { case vmIntrinsics::_invokeBasic: return vmSymbols::invokeBasic_name(); case vmIntrinsics::_linkToVirtual: return vmSymbols::linkToVirtual_name(); @@ -365,7 +365,7 @@ case vmIntrinsics::_linkToSpecial: return JVM_REF_invokeSpecial; case vmIntrinsics::_linkToInterface: return JVM_REF_invokeInterface; } - assert(false, err_msg("iid=%d", iid)); + assert(false, "iid=%d", iid); return 0; } @@ -698,7 +698,7 @@ LinkResolver::resolve_virtual_call(result, Handle(), defc, link_info, false, THREAD); } else { - assert(false, err_msg("ref_kind=%d", ref_kind)); + assert(false, "ref_kind=%d", ref_kind); } if (HAS_PENDING_EXCEPTION) { return empty; diff --git a/src/share/vm/prims/unsafe.cpp b/src/share/vm/prims/unsafe.cpp --- a/src/share/vm/prims/unsafe.cpp +++ b/src/share/vm/prims/unsafe.cpp @@ -126,7 +126,7 @@ "raw [ptr+disp] must be consistent with oop::field_base"); } jlong p_size = HeapWordSize * (jlong)(p->size()); - assert(byte_offset < p_size, err_msg("Unsafe access: offset " INT64_FORMAT " > object's size " INT64_FORMAT, byte_offset, p_size)); + assert(byte_offset < p_size, "Unsafe access: offset " INT64_FORMAT " > object's size " INT64_FORMAT, byte_offset, p_size); } #endif if (sizeof(char*) == sizeof(jint)) // (this constant folds!) 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 @@ -1022,7 +1022,7 @@ return NULL; } oop r = *oop_adr; - assert(Universe::heap()->is_in_or_null(r), err_msg("bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", (void *) r, (void *) r)); + assert(Universe::heap()->is_in_or_null(r), "bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", (void *) r, (void *) r); return r; } diff --git a/src/share/vm/runtime/globals.cpp b/src/share/vm/runtime/globals.cpp --- a/src/share/vm/runtime/globals.cpp +++ b/src/share/vm/runtime/globals.cpp @@ -93,7 +93,7 @@ void Flag::check_writable() { if (is_constant_in_binary()) { - fatal(err_msg("flag is constant: %s", _name)); + fatal("flag is constant: %s", _name); } } 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(), err_msg("not an oop: " INTPTR_FORMAT, (intptr_t*) obj)); + assert(obj->is_oop(), "not an oop: " INTPTR_FORMAT, (intptr_t*) obj); return real_allocate_handle(obj); } diff --git a/src/share/vm/runtime/memprofiler.cpp b/src/share/vm/runtime/memprofiler.cpp --- a/src/share/vm/runtime/memprofiler.cpp +++ b/src/share/vm/runtime/memprofiler.cpp @@ -75,7 +75,7 @@ // Create log file _log_fp = fopen(log_name , "w+"); if (_log_fp == NULL) { - fatal(err_msg("MemProfiler: Cannot create log file: %s", log_name)); + fatal("MemProfiler: Cannot create log file: %s", log_name); } fprintf(_log_fp, "MemProfiler: sizes are in Kb, time is in seconds since startup\n\n"); fprintf(_log_fp, " time, #thr, #cls, heap, heap, perm, perm, code, hndls, rescs, oopmp\n"); diff --git a/src/share/vm/runtime/mutex.cpp b/src/share/vm/runtime/mutex.cpp --- a/src/share/vm/runtime/mutex.cpp +++ b/src/share/vm/runtime/mutex.cpp @@ -897,8 +897,7 @@ void Monitor::lock(Thread * Self) { // Ensure that the Monitor requires/allows safepoint checks. assert(_safepoint_check_required != Monitor::_safepoint_check_never, - err_msg("This lock should never have a safepoint check: %s", - name())); + "This lock should never have a safepoint check: %s", name()); #ifdef CHECK_UNHANDLED_OOPS // Clear unhandled oops so we get a crash right away. Only clear for non-vm @@ -960,8 +959,7 @@ void Monitor::lock_without_safepoint_check(Thread * Self) { // Ensure that the Monitor does not require or allow safepoint checks. assert(_safepoint_check_required != Monitor::_safepoint_check_always, - err_msg("This lock should always have a safepoint check: %s", - name())); + "This lock should always have a safepoint check: %s", name()); assert(_owner != Self, "invariant"); ILock(Self); assert(_owner == NULL, "invariant"); @@ -1093,9 +1091,9 @@ bool as_suspend_equivalent) { // Make sure safepoint checking is used properly. assert(!(_safepoint_check_required == Monitor::_safepoint_check_never && no_safepoint_check == false), - err_msg("This lock should never have a safepoint check: %s", name())); + "This lock should never have a safepoint check: %s", name()); assert(!(_safepoint_check_required == Monitor::_safepoint_check_always && no_safepoint_check == true), - err_msg("This lock should always have a safepoint check: %s", name())); + "This lock should always have a safepoint check: %s", name()); Thread * const Self = Thread::current(); assert(_owner == Self, "invariant"); @@ -1335,9 +1333,9 @@ !(this == Safepoint_lock && contains(locks, Terminator_lock) && SafepointSynchronize::is_synchronizing())) { new_owner->print_owned_locks(); - fatal(err_msg("acquiring lock %s/%d out of order with lock %s/%d -- " - "possible deadlock", this->name(), this->rank(), - locks->name(), locks->rank())); + fatal("acquiring lock %s/%d out of order with lock %s/%d -- " + "possible deadlock", this->name(), this->rank(), + locks->name(), locks->rank()); } this->_next = new_owner->_owned_locks; @@ -1386,8 +1384,7 @@ || rank() == Mutex::special, "wrong thread state for using locks"); if (StrictSafepointChecks) { if (thread->is_VM_thread() && !allow_vm_block()) { - fatal(err_msg("VM thread using lock %s (not allowed to block on)", - name())); + fatal("VM thread using lock %s (not allowed to block on)", name()); } debug_only(if (rank() != Mutex::special) \ thread->check_for_valid_safepoint_state(false);) diff --git a/src/share/vm/runtime/mutexLocker.cpp b/src/share/vm/runtime/mutexLocker.cpp --- a/src/share/vm/runtime/mutexLocker.cpp +++ b/src/share/vm/runtime/mutexLocker.cpp @@ -155,7 +155,7 @@ // see if invoker of VM operation owns it VM_Operation* op = VMThread::vm_operation(); if (op != NULL && op->calling_thread() == lock->owner()) return; - fatal(err_msg("must own lock %s", lock->name())); + fatal("must own lock %s", lock->name()); } // a stronger assertion than the above @@ -163,7 +163,7 @@ if (IgnoreLockingAssertions) return; assert(lock != NULL, "Need non-NULL lock"); if (lock->owned_by_self()) return; - fatal(err_msg("must own lock %s", lock->name())); + fatal("must own lock %s", lock->name()); } #endif 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 @@ -1679,7 +1679,7 @@ #ifndef PRODUCT -#define assert_eq(a,b) assert(a == b, err_msg(SIZE_FORMAT " != " SIZE_FORMAT, a, b)) +#define assert_eq(a,b) assert(a == b, SIZE_FORMAT " != " SIZE_FORMAT, a, b) class TestOS : AllStatic { static size_t small_page_size() { 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 @@ -689,7 +689,7 @@ break; default: - fatal(err_msg("Illegal threadstate encountered: %d", state)); + fatal("Illegal threadstate encountered: %d", state); } // Check for pending. async. exceptions or suspends - except if the diff --git a/src/share/vm/runtime/sharedRuntime.cpp b/src/share/vm/runtime/sharedRuntime.cpp --- a/src/share/vm/runtime/sharedRuntime.cpp +++ b/src/share/vm/runtime/sharedRuntime.cpp @@ -455,7 +455,7 @@ // previous frame depending on the return address. address SharedRuntime::raw_exception_handler_for_return_address(JavaThread* thread, address return_address) { - assert(frame::verify_return_pc(return_address), err_msg("must be a return address: " INTPTR_FORMAT, return_address)); + assert(frame::verify_return_pc(return_address), "must be a return address: " INTPTR_FORMAT, return_address); assert(thread->frames_to_pop_failed_realloc() == 0 || Interpreter::contains(return_address), "missed frames to pop?"); // Reset method handle flag. @@ -807,7 +807,7 @@ bool is_in_blob = cb->is_adapter_blob() || cb->is_method_handles_adapter_blob(); if (!is_in_blob) { cb->print(); - fatal(err_msg("exception happened outside interpreter, nmethods and vtable stubs at pc " INTPTR_FORMAT, pc)); + fatal("exception happened outside interpreter, nmethods and vtable stubs at pc " INTPTR_FORMAT, pc); } Events::log_exception(thread, "NullPointerException in code blob at " INTPTR_FORMAT, pc); // There is no handler here, so we will simply unwind. 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 @@ -51,7 +51,7 @@ } void SignatureIterator::expect(char c) { - if (_signature->byte_at(_index) != c) fatal(err_msg("expecting %c", c)); + if (_signature->byte_at(_index) != c) fatal("expecting %c", c); _index++; } diff --git a/src/share/vm/runtime/synchronizer.cpp b/src/share/vm/runtime/synchronizer.cpp --- a/src/share/vm/runtime/synchronizer.cpp +++ b/src/share/vm/runtime/synchronizer.cpp @@ -1702,9 +1702,9 @@ Handle obj((oop) mid->object()); tty->print("INFO: unexpected locked object:"); javaVFrame::print_locked_object_class_name(tty, obj, "locked"); - fatal(err_msg("exiting JavaThread=" INTPTR_FORMAT - " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, - THREAD, mid)); + fatal("exiting JavaThread=" INTPTR_FORMAT + " unexpectedly owns ObjectMonitor=" INTPTR_FORMAT, + THREAD, mid); } (void)mid->complete_exit(CHECK); } diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp --- a/src/share/vm/runtime/thread.cpp +++ b/src/share/vm/runtime/thread.cpp @@ -879,7 +879,7 @@ cur != VMOperationRequest_lock && cur != VMOperationQueue_lock) || cur->rank() == Mutex::special) { - fatal(err_msg("Thread holding lock at safepoint that vm can block on: %s", cur->name())); + fatal("Thread holding lock at safepoint that vm can block on: %s", cur->name()); } } } @@ -4096,7 +4096,7 @@ ALL_JAVA_THREADS(p) { const int thread_parity = p->oops_do_parity(); assert((thread_parity == _thread_claim_parity), - err_msg("Thread " PTR_FORMAT " has incorrect parity %d != %d", p2i(p), thread_parity, _thread_claim_parity)); + "Thread " PTR_FORMAT " has incorrect parity %d != %d", p2i(p), thread_parity, _thread_claim_parity); } } #endif // ASSERT diff --git a/src/share/vm/runtime/vframe.cpp b/src/share/vm/runtime/vframe.cpp --- a/src/share/vm/runtime/vframe.cpp +++ b/src/share/vm/runtime/vframe.cpp @@ -493,7 +493,7 @@ // This function is used in Class.forName, Class.newInstance, Method.Invoke, // AccessController.doPrivileged. void vframeStreamCommon::security_get_caller_frame(int depth) { - assert(depth >= 0, err_msg("invalid depth: %d", depth)); + assert(depth >= 0, "invalid depth: %d", depth); for (int n = 0; !at_end(); security_next()) { if (!method()->is_ignored_by_security_stack_walk()) { if (n == depth) { diff --git a/src/share/vm/runtime/vmThread.cpp b/src/share/vm/runtime/vmThread.cpp --- a/src/share/vm/runtime/vmThread.cpp +++ b/src/share/vm/runtime/vmThread.cpp @@ -630,8 +630,8 @@ // Check the VM operation allows nested VM operation. This normally not the case, e.g., the compiler // does not allow nested scavenges or compiles. if (!prev_vm_operation->allow_nested_vm_operations()) { - fatal(err_msg("Nested VM operation %s requested by operation %s", - op->name(), vm_operation()->name())); + fatal("Nested VM operation %s requested by operation %s", + op->name(), vm_operation()->name()); } op->set_calling_thread(prev_vm_operation->calling_thread(), prev_vm_operation->priority()); } diff --git a/src/share/vm/runtime/vm_version.cpp b/src/share/vm/runtime/vm_version.cpp --- a/src/share/vm/runtime/vm_version.cpp +++ b/src/share/vm/runtime/vm_version.cpp @@ -155,8 +155,8 @@ } const char* Abstract_VM_Version::vm_info_string() { - vmassert2(false, "Apa %s %d", "björn", 5); - vmassert2(false, "banan"); + assert(false, "Apa %s %d", "björn", 5); + fatal("banan"); if (CodeCacheExtensions::use_pregenerated_interpreter()) { return "interpreted mode, pregenerated"; } diff --git a/src/share/vm/services/classLoadingService.cpp b/src/share/vm/services/classLoadingService.cpp --- a/src/share/vm/services/classLoadingService.cpp +++ b/src/share/vm/services/classLoadingService.cpp @@ -182,7 +182,7 @@ // verbose will be set to the previous value Flag::Error error = CommandLineFlags::boolAtPut("TraceClassLoading", &verbose, Flag::MANAGEMENT); - assert(error==Flag::SUCCESS, err_msg("Setting TraceClassLoading flag failed with error %s", Flag::flag_error_str(error))); + assert(error==Flag::SUCCESS, "Setting TraceClassLoading flag failed with error %s", Flag::flag_error_str(error)); reset_trace_class_unloading(); return verbose; @@ -193,7 +193,7 @@ assert(Management_lock->owned_by_self(), "Must own the Management_lock"); bool value = MemoryService::get_verbose() || ClassLoadingService::get_verbose(); Flag::Error error = CommandLineFlags::boolAtPut("TraceClassUnloading", &value, Flag::MANAGEMENT); - assert(error==Flag::SUCCESS, err_msg("Setting TraceClassUnLoading flag failed with error %s", Flag::flag_error_str(error))); + assert(error==Flag::SUCCESS, "Setting TraceClassUnLoading flag failed with error %s", Flag::flag_error_str(error)); } GrowableArray* LoadedClassesEnumerator::_loaded_classes = NULL; diff --git a/src/share/vm/services/heapDumper.cpp b/src/share/vm/services/heapDumper.cpp --- a/src/share/vm/services/heapDumper.cpp +++ b/src/share/vm/services/heapDumper.cpp @@ -724,7 +724,7 @@ // reflection and sun.misc.Unsafe classes may have a reference to a // Klass* so filter it out. - assert(o->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(o))); + assert(o->is_oop_or_null(), "Expected an oop or NULL at " PTR_FORMAT, p2i(o)); writer->write_objectID(o); break; } diff --git a/src/share/vm/services/memoryService.cpp b/src/share/vm/services/memoryService.cpp --- a/src/share/vm/services/memoryService.cpp +++ b/src/share/vm/services/memoryService.cpp @@ -518,7 +518,7 @@ MutexLocker m(Management_lock); // verbose will be set to the previous value Flag::Error error = CommandLineFlags::boolAtPut("PrintGC", &verbose, Flag::MANAGEMENT); - assert(error==Flag::SUCCESS, err_msg("Setting PrintGC flag failed with error %s", Flag::flag_error_str(error))); + assert(error==Flag::SUCCESS, "Setting PrintGC flag failed with error %s", Flag::flag_error_str(error)); ClassLoadingService::reset_trace_class_unloading(); return verbose; diff --git a/src/share/vm/utilities/array.hpp b/src/share/vm/utilities/array.hpp --- a/src/share/vm/utilities/array.hpp +++ b/src/share/vm/utilities/array.hpp @@ -341,13 +341,13 @@ assert(is_size_aligned(left, sizeof(T)), "Must be"); size_t elements = left / sizeof(T); - assert(elements <= (size_t)INT_MAX, err_msg("number of elements " SIZE_FORMAT "doesn't fit into an int.", elements)); + assert(elements <= (size_t)INT_MAX, "number of elements " SIZE_FORMAT "doesn't fit into an int.", elements); int length = (int)elements; assert((size_t)size(length) * BytesPerWord == bytes, - err_msg("Expected: " SIZE_FORMAT " got: " SIZE_FORMAT, - bytes, (size_t)size(length) * BytesPerWord)); + "Expected: " SIZE_FORMAT " got: " SIZE_FORMAT, + bytes, (size_t)size(length) * BytesPerWord); return length; } @@ -380,9 +380,9 @@ // sort the array. bool contains(const T& x) const { return index_of(x) >= 0; } - T at(int i) const { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); return _data[i]; } - void at_put(const int i, const T& x) { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); _data[i] = x; } - T* adr_at(const int i) { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); return &_data[i]; } + T at(int i) const { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return _data[i]; } + void at_put(const int i, const T& x) { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); _data[i] = x; } + T* adr_at(const int i) { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return &_data[i]; } int find(const T& x) { return index_of(x); } T at_acquire(const int which) { return OrderAccess::load_acquire(adr_at(which)); } diff --git a/src/share/vm/utilities/chunkedList.hpp b/src/share/vm/utilities/chunkedList.hpp --- a/src/share/vm/utilities/chunkedList.hpp +++ b/src/share/vm/utilities/chunkedList.hpp @@ -73,7 +73,7 @@ } T at(size_t i) { - assert(i < size(), err_msg("IOOBE i: " SIZE_FORMAT " size(): " SIZE_FORMAT, i, size())); + assert(i < size(), "IOOBE i: " SIZE_FORMAT " size(): " SIZE_FORMAT, i, size()); return _values[i]; } }; diff --git a/src/share/vm/utilities/debug.cpp b/src/share/vm/utilities/debug.cpp --- a/src/share/vm/utilities/debug.cpp +++ b/src/share/vm/utilities/debug.cpp @@ -208,39 +208,69 @@ #endif // !PRODUCT void report_vm_error(const char* file, int line, const char* error_msg, - const char* detail_msg) + const char* detail_msg = NULL) { if (Debugging || error_is_suppressed(file, line)) return; Thread* const thread = ThreadLocalStorage::get_thread_slow(); - VMError err(thread, file, line, error_msg, detail_msg); - err.report_and_die(); + VMError(thread, file, line, error_msg, detail_msg).report_and_die(); } -void report_vm_error2(const char* file, int line, const char* error_msg, ...) +void report_vm_error(const char* file, int line, const char* error_msg, int nargs, va_list args) { - char detail_msg[BUFSZ]; - va_list args; - char* format; + char* detail_msg; + char* format = va_arg(args, char*); - va_start(args, error_msg); - format = va_arg(args, char*); - jio_vsnprintf(detail_msg, BUFSZ, format, args); - va_end(args); + if (nargs == 1) { + detail_msg = format; + } else { + char detail_buf[BUFSZ]; + jio_vsnprintf(detail_buf, BUFSZ, format, args); + detail_msg = detail_buf; + } report_vm_error(file, line, error_msg, detail_msg); } -void report_fatal(const char* file, int line, const char* message) +void report_vm_error(const char* file, int line, const char* error_msg, int nargs, ...) { - report_vm_error(file, line, "fatal error", message); + va_list args; + + va_start(args, nargs); + report_vm_error(file, line, error_msg, nargs, args); + va_end(args); +} + +void report_fatal(const char* file, int line, int nargs, ...) +{ + va_list args; + + va_start(args, nargs); + report_vm_error(file, line, "fatal error", nargs, args); + va_end(args); } void report_vm_out_of_memory(const char* file, int line, size_t size, - VMErrorType vm_err_type, const char* message) { + VMErrorType vm_err_type, int nargs, ...) { if (Debugging) return; + va_list args; + char* detail_msg; + char* format; + + va_start(args, nargs); + format = va_arg(args, char*); + + if (nargs == 1) { + detail_msg = format; + } else { + char detail_buf[BUFSZ]; + jio_vsnprintf(detail_buf, BUFSZ, format, args); + detail_msg = detail_buf; + } + va_end(args); + Thread* thread = ThreadLocalStorage::get_thread_slow(); - VMError(thread, file, line, size, vm_err_type, message).report_and_die(); + VMError(thread, file, line, size, vm_err_type, detail_msg).report_and_die(); // The UseOSErrorReporting option in report_and_die() may allow a return // to here. If so then we'll have to figure out how to handle it. @@ -383,18 +413,18 @@ switch (how) { case 1: vmassert(str == NULL, "expected null"); case 2: vmassert(num == 1023 && *str == 'X', - err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str)); + "num=" SIZE_FORMAT " str=\"%s\"", num, str); case 3: guarantee(str == NULL, "expected null"); case 4: guarantee(num == 1023 && *str == 'X', - err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str)); + "num=" SIZE_FORMAT " str=\"%s\"", num, str); case 5: fatal("expected null"); - case 6: fatal(err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str)); - case 7: fatal(err_msg("%s%s# %s%s# %s%s# %s%s# %s%s# " - "%s%s# %s%s# %s%s# %s%s# %s%s# " - "%s%s# %s%s# %s%s# %s%s# %s", - msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, - msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, - msg, eol, msg, eol, msg, eol, msg, eol, msg)); + case 6: fatal("num=" SIZE_FORMAT " str=\"%s\"", num, str); + case 7: fatal("%s%s# %s%s# %s%s# %s%s# %s%s# " + "%s%s# %s%s# %s%s# %s%s# %s%s# " + "%s%s# %s%s# %s%s# %s%s# %s", + msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, + msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, + msg, eol, msg, eol, msg, eol, msg, eol, msg); case 8: vm_exit_out_of_memory(num, OOM_MALLOC_ERROR, "ChunkPool::allocate"); case 9: ShouldNotCallThis(); case 10: ShouldNotReachHere(); diff --git a/src/share/vm/utilities/debug.hpp b/src/share/vm/utilities/debug.hpp --- a/src/share/vm/utilities/debug.hpp +++ b/src/share/vm/utilities/debug.hpp @@ -109,34 +109,45 @@ typedef FormatBuffer<> err_msg; typedef FormatBufferResource err_msg_res; +#define PP_NARG(...) \ + PP_NARG_(__VA_ARGS__,PP_RSEQ_N()) +#define PP_NARG_(...) \ + PP_ARG_N(__VA_ARGS__) +#define PP_ARG_N( \ + _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \ + _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ + _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \ + _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ + _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \ + _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ + _61,_62,_63,N,...) N +#define PP_RSEQ_N() \ + 63,62,61,60, \ + 59,58,57,56,55,54,53,52,51,50, \ + 49,48,47,46,45,44,43,42,41,40, \ + 39,38,37,36,35,34,33,32,31,30, \ + 29,28,27,26,25,24,23,22,21,20, \ + 19,18,17,16,15,14,13,12,11,10, \ + 9,8,7,6,5,4,3,2,1,0 + // assertions #ifndef ASSERT -#define vmassert(p, msg) -#define vmassert2(p, ...) +#define vmassert(p, ...) #else // Note: message says "assert" rather than "vmassert" for backward // compatibility with tools that parse/match the message text. -#define vmassert(p, msg) \ -do { \ - if (!(p)) { \ - report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg); \ - BREAKPOINT; \ - } \ -} while (0) - -#define vmassert2(p, ...) \ -do { \ - if (!(p)) { \ - report_vm_error2(__FILE__, __LINE__, "assert(" #p ") failed", __VA_ARGS__); \ - BREAKPOINT; \ - } \ +#define vmassert(p, ...) \ +do { \ + if (!(p)) { \ + report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", PP_NARG(__VA_ARGS__), __VA_ARGS__); \ + BREAKPOINT; \ + } \ } while (0) #endif // For backward compatibility. -#define assert(p, msg) vmassert(p, msg) -#define assert2(p, ...) vmassert2(p, __VA_ARGS__) +#define assert(p, ...) vmassert(p, __VA_ARGS__) // This version of vmassert is for use with checking return status from // library calls that return actual error values eg. EINVAL, @@ -146,7 +157,7 @@ // an extra arg and use strerror to convert it to a meaningful string // like "Invalid argument", "out of memory" etc #define vmassert_status(p, status, msg) \ - vmassert(p, err_msg("error %s(%d), %s", strerror(status), status, msg)) + vmassert(p, "error %s(%d), %s", strerror(status), status, msg) // For backward compatibility. #define assert_status(p, status, msg) vmassert_status(p, status, msg) @@ -154,24 +165,24 @@ // guarantee is like vmassert except it's always executed -- use it for // cheap tests that catch errors that would otherwise be hard to find. // guarantee is also used for Verify options. -#define guarantee(p, msg) \ +#define guarantee(p, ...) \ do { \ if (!(p)) { \ - report_vm_error(__FILE__, __LINE__, "guarantee(" #p ") failed", msg); \ + report_vm_error(__FILE__, __LINE__, "guarantee(" #p ") failed", PP_NARG(__VA_ARGS__), __VA_ARGS__); \ BREAKPOINT; \ } \ } while (0) -#define fatal(msg) \ +#define fatal(...) \ do { \ - report_fatal(__FILE__, __LINE__, msg); \ + report_fatal(__FILE__, __LINE__, PP_NARG(__VA_ARGS__), __VA_ARGS__); \ BREAKPOINT; \ } while (0) // out of memory -#define vm_exit_out_of_memory(size, vm_err_type, msg) \ +#define vm_exit_out_of_memory(size, vm_err_type, ...) \ do { \ - report_vm_out_of_memory(__FILE__, __LINE__, size, vm_err_type, msg); \ + report_vm_out_of_memory(__FILE__, __LINE__, size, vm_err_type, PP_NARG(__VA_ARGS__), __VA_ARGS__); \ BREAKPOINT; \ } while (0) @@ -208,12 +219,10 @@ }; // error reporting helper functions -void report_vm_error(const char* file, int line, const char* error_msg, - const char* detail_msg = NULL); -void report_vm_error2(const char* file, int line, const char* error_msg, ...); -void report_fatal(const char* file, int line, const char* message); +void report_vm_error(const char* file, int line, const char* error_msg, int nargs, ...); +void report_fatal(const char* file, int line, int nargs, ...); void report_vm_out_of_memory(const char* file, int line, size_t size, - VMErrorType vm_err_type, const char* message); + VMErrorType vm_err_type, int nargs, ...); void report_should_not_call(const char* file, int line); void report_should_not_reach_here(const char* file, int line); void report_unimplemented(const char* file, int line); diff --git a/src/share/vm/utilities/exceptions.cpp b/src/share/vm/utilities/exceptions.cpp --- a/src/share/vm/utilities/exceptions.cpp +++ b/src/share/vm/utilities/exceptions.cpp @@ -486,7 +486,7 @@ strstr(value_string, AbortVMOnException)) { if (AbortVMOnExceptionMessage == NULL || message == NULL || strcmp(message, AbortVMOnExceptionMessage) == 0) { - fatal(err_msg("Saw %s, aborting", value_string)); + fatal("Saw %s, aborting", value_string); } } } diff --git a/src/share/vm/utilities/fakeRttiSupport.hpp b/src/share/vm/utilities/fakeRttiSupport.hpp --- a/src/share/vm/utilities/fakeRttiSupport.hpp +++ b/src/share/vm/utilities/fakeRttiSupport.hpp @@ -76,8 +76,8 @@ FakeRttiSupport add_tag(TagType tag) const { uintx tbit = tag_bit(tag); assert((_tag_set & tbit) == 0, - err_msg("Tag " UINTX_FORMAT " is already present in tag set: " UINTX_FORMAT, - (uintx)tag, _tag_set)); + "Tag " UINTX_FORMAT " is already present in tag set: " UINTX_FORMAT, + (uintx)tag, _tag_set); return FakeRttiSupport(_concrete_tag, _tag_set | tbit); } @@ -90,9 +90,9 @@ } static TagType validate_tag(TagType tag) { - assert(0 <= tag, err_msg("Tag " INTX_FORMAT " is negative", (intx)tag)); + assert(0 <= tag, "Tag " INTX_FORMAT " is negative", (intx)tag); assert(tag < BitsPerWord, - err_msg("Tag " UINTX_FORMAT " is too large", (uintx)tag)); + "Tag " UINTX_FORMAT " is too large", (uintx)tag); return tag; } }; diff --git a/src/share/vm/utilities/ostream.cpp b/src/share/vm/utilities/ostream.cpp --- a/src/share/vm/utilities/ostream.cpp +++ b/src/share/vm/utilities/ostream.cpp @@ -543,7 +543,7 @@ memset(longest_name, 'a', sizeof(longest_name)); longest_name[JVM_MAXPATHLEN - 1] = '\0'; o_result = make_log_name_internal((const char*)&longest_name, NULL, pid, tms); - assert(strcmp(longest_name, o_result) == 0, err_msg("longest name does not match. expected '%s' but got '%s'", longest_name, o_result)); + assert(strcmp(longest_name, o_result) == 0, "longest name does not match. expected '%s' but got '%s'", longest_name, o_result); FREE_C_HEAP_ARRAY(char, o_result); } @@ -554,7 +554,7 @@ memset(too_long_name, 'a', too_long_length); too_long_name[too_long_length - 1] = '\0'; o_result = make_log_name_internal((const char*)&too_long_name, NULL, pid, tms); - assert(o_result == NULL, err_msg("Too long file name should return NULL, but got '%s'", o_result)); + assert(o_result == NULL, "Too long file name should return NULL, but got '%s'", o_result); } { @@ -565,7 +565,7 @@ longest_name[JVM_MAXPATHLEN - 2] = 't'; longest_name[JVM_MAXPATHLEN - 1] = '\0'; o_result = make_log_name_internal((const char*)&longest_name, NULL, pid, tms); - assert(o_result == NULL, err_msg("Too long file name after timestamp expansion should return NULL, but got '%s'", o_result)); + assert(o_result == NULL, "Too long file name after timestamp expansion should return NULL, but got '%s'", o_result); } { @@ -576,7 +576,7 @@ longest_name[JVM_MAXPATHLEN - 2] = 'p'; longest_name[JVM_MAXPATHLEN - 1] = '\0'; o_result = make_log_name_internal((const char*)&longest_name, NULL, pid, tms); - assert(o_result == NULL, err_msg("Too long file name after pid expansion should return NULL, but got '%s'", o_result)); + assert(o_result == NULL, "Too long file name after pid expansion should return NULL, but got '%s'", o_result); } } #endif // PRODUCT # HG changeset patch # User david # Date 1442845363 -7200 # Mon Sep 21 16:22:43 2015 +0200 # Node ID 5d4e3f3309aadad2e7e5ec9fec53ffff8d0b3d77 # Parent 6bf67b4ae97f6cf13ced31814f951624870a8489 [mq]: vmerr_static diff --git a/make/linux/makefiles/gcc.make b/make/linux/makefiles/gcc.make --- a/make/linux/makefiles/gcc.make +++ b/make/linux/makefiles/gcc.make @@ -207,7 +207,7 @@ WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body endif -WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Woverloaded-virtual +WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Woverloaded-virtual -Wno-format-zero-length ifeq ($(USE_CLANG),) # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit diff --git a/src/cpu/aarch64/vm/methodHandles_aarch64.cpp b/src/cpu/aarch64/vm/methodHandles_aarch64.cpp --- a/src/cpu/aarch64/vm/methodHandles_aarch64.cpp +++ b/src/cpu/aarch64/vm/methodHandles_aarch64.cpp @@ -407,7 +407,7 @@ } default: - fatal(err_msg_res("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid))); + fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid)); break; } diff --git a/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp b/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp --- a/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp +++ b/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp @@ -1194,7 +1194,7 @@ } else if (iid == vmIntrinsics::_invokeBasic) { has_receiver = true; } else { - fatal(err_msg_res("unexpected intrinsic id %d", iid)); + fatal("unexpected intrinsic id %d", iid); } if (member_reg != noreg) { diff --git a/src/cpu/ppc/vm/methodHandles_ppc.cpp b/src/cpu/ppc/vm/methodHandles_ppc.cpp --- a/src/cpu/ppc/vm/methodHandles_ppc.cpp +++ b/src/cpu/ppc/vm/methodHandles_ppc.cpp @@ -434,7 +434,7 @@ } default: - fatal(err_msg_res("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid))); + fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid)); break; } diff --git a/src/cpu/ppc/vm/sharedRuntime_ppc.cpp b/src/cpu/ppc/vm/sharedRuntime_ppc.cpp --- a/src/cpu/ppc/vm/sharedRuntime_ppc.cpp +++ b/src/cpu/ppc/vm/sharedRuntime_ppc.cpp @@ -477,7 +477,7 @@ bool SharedRuntime::is_wide_vector(int size) { ResourceMark rm; // Note, MaxVectorSize == 8 on PPC64. - assert(size <= 8, err_msg_res("%d bytes vectors are not supported", size)); + assert(size <= 8, "%d bytes vectors are not supported", size); return size > 8; } #ifdef COMPILER2 @@ -1631,7 +1631,7 @@ } else if (iid == vmIntrinsics::_invokeBasic) { has_receiver = true; } else { - fatal(err_msg_res("unexpected intrinsic id %d", iid)); + fatal("unexpected intrinsic id %d", iid); } if (member_reg != noreg) { diff --git a/src/cpu/sparc/vm/methodHandles_sparc.cpp b/src/cpu/sparc/vm/methodHandles_sparc.cpp --- a/src/cpu/sparc/vm/methodHandles_sparc.cpp +++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp @@ -453,7 +453,7 @@ } default: - fatal(err_msg_res("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid))); + fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid)); break; } diff --git a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp --- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp +++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp @@ -316,7 +316,7 @@ // 8 bytes FP registers are saved by default on SPARC. bool SharedRuntime::is_wide_vector(int size) { // Note, MaxVectorSize == 8 on SPARC. - assert(size <= 8, err_msg_res("%d bytes vectors are not supported", size)); + assert(size <= 8, "%d bytes vectors are not supported", size); return size > 8; } @@ -464,7 +464,7 @@ break; default: - fatal(err_msg_res("unknown basic type %d", sig_bt[i])); + fatal("unknown basic type %d", sig_bt[i]); break; } } @@ -1859,7 +1859,7 @@ } else if (iid == vmIntrinsics::_invokeBasic) { has_receiver = true; } else { - fatal(err_msg_res("unexpected intrinsic id %d", iid)); + fatal("unexpected intrinsic id %d", iid); } if (member_reg != noreg) { diff --git a/src/cpu/x86/vm/methodHandles_x86.cpp b/src/cpu/x86/vm/methodHandles_x86.cpp --- a/src/cpu/x86/vm/methodHandles_x86.cpp +++ b/src/cpu/x86/vm/methodHandles_x86.cpp @@ -456,7 +456,7 @@ } default: - fatal(err_msg_res("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid))); + fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid)); break; } diff --git a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp --- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp +++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp @@ -1469,7 +1469,7 @@ } else if (iid == vmIntrinsics::_invokeBasic) { has_receiver = true; } else { - fatal(err_msg_res("unexpected intrinsic id %d", iid)); + fatal("unexpected intrinsic id %d", iid); } if (member_reg != noreg) { diff --git a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp @@ -1848,7 +1848,7 @@ } else if (iid == vmIntrinsics::_invokeBasic) { has_receiver = true; } else { - fatal(err_msg_res("unexpected intrinsic id %d", iid)); + fatal("unexpected intrinsic id %d", iid); } if (member_reg != noreg) { diff --git a/src/os/aix/vm/os_aix.cpp b/src/os/aix/vm/os_aix.cpp --- a/src/os/aix/vm/os_aix.cpp +++ b/src/os/aix/vm/os_aix.cpp @@ -2286,7 +2286,7 @@ if (!pd_commit_memory(addr, size, exec)) { // Add extra info in product mode for vm_exit_out_of_memory(): PRODUCT_ONLY(warn_fail_commit_memory(addr, size, exec, errno);) - vm_exit_out_of_memory(size, OOM_MMAP_ERROR, mesg); + vm_exit_out_of_memory(size, OOM_MMAP_ERROR, "%s", mesg); } } diff --git a/src/os/aix/vm/vmError_aix.cpp b/src/os/aix/vm/vmError_aix.cpp --- a/src/os/aix/vm/vmError_aix.cpp +++ b/src/os/aix/vm/vmError_aix.cpp @@ -33,10 +33,11 @@ #include #include -void VMError::show_message_box(char *buf, int buflen) { +void VMError::show_message_box(char *buf, int buflen, int id, const char* message, const char* detail_fmt, + va_list detail_args, address pc, const char* filename, int lineno) { bool yes; do { - error_string(buf, buflen); + error_string(buf, buflen, id, message, detail_fmt, detail_args, pc, filename, lineno); int len = (int)strlen(buf); char *p = &buf[len]; @@ -117,8 +118,7 @@ return; } - VMError err(NULL, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(NULL, sig, pc, info, ucVoid); } void VMError::reset_signal_handlers() { diff --git a/src/os/bsd/vm/os_bsd.cpp b/src/os/bsd/vm/os_bsd.cpp --- a/src/os/bsd/vm/os_bsd.cpp +++ b/src/os/bsd/vm/os_bsd.cpp @@ -2213,7 +2213,7 @@ if (!pd_commit_memory(addr, size, exec)) { // add extra info in product mode for vm_exit_out_of_memory(): PRODUCT_ONLY(warn_fail_commit_memory(addr, size, exec, errno);) - vm_exit_out_of_memory(size, OOM_MMAP_ERROR, mesg); + vm_exit_out_of_memory(size, OOM_MMAP_ERROR, "%s", mesg); } } diff --git a/src/os/bsd/vm/vmError_bsd.cpp b/src/os/bsd/vm/vmError_bsd.cpp --- a/src/os/bsd/vm/vmError_bsd.cpp +++ b/src/os/bsd/vm/vmError_bsd.cpp @@ -34,10 +34,11 @@ #include #include -void VMError::show_message_box(char *buf, int buflen) { +void VMError::show_message_box(char *buf, int buflen, int id, const char* message, const char* detail_fmt, + va_list detail_args, address pc, const char* filename, int lineno) { bool yes; do { - error_string(buf, buflen); + error_string(buf, buflen, id, message, detail_fmt, detail_args, pc, filename, lineno); int len = (int)strlen(buf); char *p = &buf[len]; @@ -121,8 +122,7 @@ return; } - VMError err(NULL, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(NULL, sig, pc, info, ucVoid); } void VMError::reset_signal_handlers() { 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 @@ -2680,7 +2680,7 @@ if (err != 0) { // the caller wants all commit errors to exit with the specified mesg: warn_fail_commit_memory(addr, size, exec, err); - vm_exit_out_of_memory(size, OOM_MMAP_ERROR, mesg); + vm_exit_out_of_memory(size, OOM_MMAP_ERROR, "%s", mesg); } } @@ -2716,7 +2716,7 @@ if (err != 0) { // the caller wants all commit errors to exit with the specified mesg: warn_fail_commit_memory(addr, size, alignment_hint, exec, err); - vm_exit_out_of_memory(size, OOM_MMAP_ERROR, mesg); + vm_exit_out_of_memory(size, OOM_MMAP_ERROR, "%s", mesg); } } diff --git a/src/os/linux/vm/vmError_linux.cpp b/src/os/linux/vm/vmError_linux.cpp --- a/src/os/linux/vm/vmError_linux.cpp +++ b/src/os/linux/vm/vmError_linux.cpp @@ -34,10 +34,11 @@ #include #include -void VMError::show_message_box(char *buf, int buflen) { +void VMError::show_message_box(char *buf, int buflen, int id, const char* message, const char* detail_fmt, + va_list detail_args, address pc, const char* filename, int lineno) { bool yes; do { - error_string(buf, buflen); + error_string(buf, buflen, id, message, detail_fmt, detail_args, pc, filename, lineno); int len = (int)strlen(buf); char *p = &buf[len]; @@ -121,8 +122,7 @@ return; } - VMError err(NULL, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(NULL, sig, pc, info, ucVoid); } void VMError::reset_signal_handlers() { diff --git a/src/os/solaris/vm/os_solaris.cpp b/src/os/solaris/vm/os_solaris.cpp --- a/src/os/solaris/vm/os_solaris.cpp +++ b/src/os/solaris/vm/os_solaris.cpp @@ -1118,8 +1118,7 @@ void _handle_uncaught_cxx_exception() { - VMError err("An uncaught C++ exception"); - err.report_and_die(); + VMError::report_and_die("An uncaught C++ exception"); } @@ -2392,7 +2391,7 @@ if (err != 0) { // the caller wants all commit errors to exit with the specified mesg: warn_fail_commit_memory(addr, bytes, exec, err); - vm_exit_out_of_memory(bytes, OOM_MMAP_ERROR, mesg); + vm_exit_out_of_memory(bytes, OOM_MMAP_ERROR, "%s", mesg); } } @@ -2439,7 +2438,7 @@ if (err != 0) { // the caller wants all commit errors to exit with the specified mesg: warn_fail_commit_memory(addr, bytes, alignment_hint, exec, err); - vm_exit_out_of_memory(bytes, OOM_MMAP_ERROR, mesg); + vm_exit_out_of_memory(bytes, OOM_MMAP_ERROR, "%s", mesg); } } diff --git a/src/os/solaris/vm/vmError_solaris.cpp b/src/os/solaris/vm/vmError_solaris.cpp --- a/src/os/solaris/vm/vmError_solaris.cpp +++ b/src/os/solaris/vm/vmError_solaris.cpp @@ -33,10 +33,11 @@ #include #include -void VMError::show_message_box(char *buf, int buflen) { +void VMError::show_message_box(char *buf, int buflen, int id, const char* message, const char* detail_fmt, + va_list detail_args, address pc, const char* filename, int lineno) { bool yes; do { - error_string(buf, buflen); + error_string(buf, buflen, id, message, detail_fmt, detail_args, pc, filename, lineno); int len = (int)strlen(buf); char *p = &buf[len]; @@ -117,8 +118,7 @@ return; } - VMError err(NULL, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(NULL, sig, pc, info, ucVoid); } void VMError::reset_signal_handlers() { diff --git a/src/os/windows/vm/os_windows.cpp b/src/os/windows/vm/os_windows.cpp --- a/src/os/windows/vm/os_windows.cpp +++ b/src/os/windows/vm/os_windows.cpp @@ -2344,8 +2344,7 @@ static inline void report_error(Thread* t, DWORD exception_code, address addr, void* siginfo, void* context) { - VMError err(t, exception_code, addr, siginfo, context); - err.report_and_die(); + VMError::report_and_die(t, exception_code, addr, siginfo, context); // If UseOsErrorReporting, this will return here and save the error file // somewhere where we can find it in the minidump. @@ -3325,7 +3324,7 @@ assert(mesg != NULL, "mesg must be specified"); if (!pd_commit_memory(addr, size, exec)) { warn_fail_commit_memory(addr, size, exec); - vm_exit_out_of_memory(size, OOM_MMAP_ERROR, mesg); + vm_exit_out_of_memory(size, OOM_MMAP_ERROR, "%s", mesg); } } diff --git a/src/os/windows/vm/vmError_windows.cpp b/src/os/windows/vm/vmError_windows.cpp --- a/src/os/windows/vm/vmError_windows.cpp +++ b/src/os/windows/vm/vmError_windows.cpp @@ -29,10 +29,11 @@ #include "utilities/vmError.hpp" -void VMError::show_message_box(char *buf, int buflen) { +void VMError::show_message_box(char *buf, int buflen, int id, const char* message, const char* detail_fmt, + va_list detail_args, address pc, const char* filename, int lineno) { bool yes; do { - error_string(buf, buflen); + error_string(buf, buflen, id, message, detail_fmt, detail_args, pc, filename, lineno); int len = (int)strlen(buf); char *p = &buf[len]; @@ -70,9 +71,8 @@ LONG WINAPI crash_handler(struct _EXCEPTION_POINTERS* exceptionInfo) { DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode; - VMError err(NULL, exception_code, NULL, + VMError::report_and_die(NULL, exception_code, NULL, exceptionInfo->ExceptionRecord, exceptionInfo->ContextRecord); - err.report_and_die(); return EXCEPTION_CONTINUE_SEARCH; } diff --git a/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp b/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp --- a/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp +++ b/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp @@ -468,8 +468,7 @@ sigaddset(&newset, sig); sigthreadmask(SIG_UNBLOCK, &newset, NULL); - VMError err(t, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(t, sig, pc, info, ucVoid); ShouldNotReachHere(); return 0; diff --git a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp --- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp +++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp @@ -731,8 +731,7 @@ sigaddset(&newset, sig); sigprocmask(SIG_UNBLOCK, &newset, NULL); - VMError err(t, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(t, sig, pc, info, ucVoid); ShouldNotReachHere(); return false; diff --git a/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp b/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp --- a/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +++ b/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp @@ -464,8 +464,7 @@ sigaddset(&newset, sig); sigprocmask(SIG_UNBLOCK, &newset, NULL); - VMError err(t, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(t, sig, pc, info, ucVoid); ShouldNotReachHere(); return true; // Mute compiler diff --git a/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp b/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp --- a/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp +++ b/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp @@ -439,8 +439,7 @@ sigaddset(&newset, sig); sigprocmask(SIG_UNBLOCK, &newset, NULL); - VMError err(t, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(t, sig, pc, info, ucVoid); ShouldNotReachHere(); return false; diff --git a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp --- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp +++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @@ -692,8 +692,7 @@ sigaddset(&newset, sig); sigprocmask(SIG_UNBLOCK, &newset, NULL); - VMError err(t, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(t, sig, pc, info, ucVoid); ShouldNotReachHere(); } diff --git a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp --- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -542,8 +542,7 @@ sigaddset(&newset, sig); sigprocmask(SIG_UNBLOCK, &newset, NULL); - VMError err(t, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(t, sig, pc, info, ucVoid); ShouldNotReachHere(); return true; // Mute compiler diff --git a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp --- a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp +++ b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @@ -549,8 +549,7 @@ vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "Out of swap space to map in thread stack."); } - VMError err(t, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(t, sig, pc, info, ucVoid); ShouldNotReachHere(); } diff --git a/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp --- a/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp +++ b/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp @@ -707,8 +707,7 @@ vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "Out of swap space to map in thread stack."); } - VMError err(t, sig, pc, info, ucVoid); - err.report_and_die(); + VMError::report_and_die(t, sig, pc, info, ucVoid); ShouldNotReachHere(); return false; diff --git a/src/share/vm/asm/register.hpp b/src/share/vm/asm/register.hpp --- a/src/share/vm/asm/register.hpp +++ b/src/share/vm/asm/register.hpp @@ -121,8 +121,7 @@ ) { assert( a != b, - err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT "", - p2i(a), p2i(b)) + "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT "", p2i(a), p2i(b) ); } @@ -135,9 +134,9 @@ assert( a != b && a != c && b != c, - err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT - ", c=" INTPTR_FORMAT "", - p2i(a), p2i(b), p2i(c)) + "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c) ); } @@ -152,9 +151,9 @@ a != b && a != c && a != d && b != c && b != d && c != d, - err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT - ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT "", - p2i(a), p2i(b), p2i(c), p2i(d)) + "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d) ); } @@ -171,9 +170,9 @@ && b != c && b != d && b != e && c != d && c != e && d != e, - err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT - ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT "", - p2i(a), p2i(b), p2i(c), p2i(d), p2i(e)) + "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e) ); } @@ -192,10 +191,10 @@ && c != d && c != e && c != f && d != e && d != f && e != f, - err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT - ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT - ", f=" INTPTR_FORMAT "", - p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f)) + "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f) ); } @@ -216,10 +215,10 @@ && d != e && d != f && d != g && e != f && e != g && f != g, - err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT - ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT - ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT "", - p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g)) + "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g) ); } @@ -242,10 +241,10 @@ && e != f && e != g && e != h && f != g && f != h && g != h, - err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT - ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT - ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT "", - p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h)) + "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h) ); } @@ -270,11 +269,11 @@ && f != g && f != h && f != i && g != h && g != i && h != i, - err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT - ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT - ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT - ", i=" INTPTR_FORMAT "", - p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i)) + "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT + ", i=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i) ); } @@ -300,11 +299,11 @@ && g != h && g != i && g != j && h != i && h != j && i != j, - err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT - ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT - ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT - ", i=" INTPTR_FORMAT ", j=" INTPTR_FORMAT "", - p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i), p2i(j)) + "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT + ", i=" INTPTR_FORMAT ", j=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i), p2i(j) ); } @@ -332,11 +331,11 @@ && h != i && h != j && h !=k && i != j && i !=k && j !=k, - err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT - ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT - ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT - ", i=" INTPTR_FORMAT ", j=" INTPTR_FORMAT ", k=" INTPTR_FORMAT "", - p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i), p2i(j), p2i(k)) + "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT + ", i=" INTPTR_FORMAT ", j=" INTPTR_FORMAT ", k=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i), p2i(j), p2i(k) ); } @@ -366,12 +365,12 @@ && i != j && i !=k && i !=l && j !=k && j !=l && k !=l, - err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT - ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT - ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT - ", i=" INTPTR_FORMAT ", j=" INTPTR_FORMAT ", k=" INTPTR_FORMAT - ", l=" INTPTR_FORMAT "", - p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i), p2i(j), p2i(k), p2i(l)) + "registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT + ", i=" INTPTR_FORMAT ", j=" INTPTR_FORMAT ", k=" INTPTR_FORMAT + ", l=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i), p2i(j), p2i(k), p2i(l) ); } diff --git a/src/share/vm/c1/c1_LIRAssembler.cpp b/src/share/vm/c1/c1_LIRAssembler.cpp --- a/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/src/share/vm/c1/c1_LIRAssembler.cpp @@ -462,7 +462,7 @@ vtable_call(op); break; default: - fatal(err_msg_res("unexpected op code: %s", op->name())); + fatal("unexpected op code: %s", op->name()); break; } diff --git a/src/share/vm/c1/c1_LIRGenerator.cpp b/src/share/vm/c1/c1_LIRGenerator.cpp --- a/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/src/share/vm/c1/c1_LIRGenerator.cpp @@ -920,7 +920,7 @@ LIR_Opr LIRGenerator::force_to_spill(LIR_Opr value, BasicType t) { assert(type2size[t] == type2size[value->type()], - err_msg_res("size mismatch: t=%s, value->type()=%s", type2name(t), type2name(value->type()))); + "size mismatch: t=%s, value->type()=%s", type2name(t), type2name(value->type())); if (!value->is_register()) { // force into a register LIR_Opr r = new_register(value->type()); @@ -2829,7 +2829,7 @@ void LIRGenerator::invoke_load_arguments(Invoke* x, LIRItemList* args, const LIR_OprList* arg_list) { assert(args->length() == arg_list->length(), - err_msg_res("args=%d, arg_list=%d", args->length(), arg_list->length())); + "args=%d, arg_list=%d", args->length(), arg_list->length()); for (int i = x->has_receiver() ? 1 : 0; i < args->length(); i++) { LIRItem* param = args->at(i); LIR_Opr loc = arg_list->at(i); diff --git a/src/share/vm/ci/ciReplay.cpp b/src/share/vm/ci/ciReplay.cpp --- a/src/share/vm/ci/ciReplay.cpp +++ b/src/share/vm/ci/ciReplay.cpp @@ -730,7 +730,7 @@ if (parsed_two_word == i) continue; default: - fatal(err_msg_res("Unexpected tag: %d", cp->tag_at(i).value())); + fatal("Unexpected tag: %d", cp->tag_at(i).value()); break; } diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp --- a/src/share/vm/classfile/systemDictionary.cpp +++ b/src/share/vm/classfile/systemDictionary.cpp @@ -2390,7 +2390,7 @@ if (klass->oop_is_typeArray()) { return true; // primitive array } - assert(klass->oop_is_instance(), klass->external_name()); + assert(klass->oop_is_instance(), "%s", klass->external_name()); return klass->is_public() && (InstanceKlass::cast(klass)->is_same_class_package(SystemDictionary::Object_klass()) || // java.lang InstanceKlass::cast(klass)->is_same_class_package(SystemDictionary::MethodHandle_klass())); // java.lang.invoke @@ -2443,7 +2443,7 @@ mirror = ss.as_java_mirror(class_loader, protection_domain, SignatureStream::NCDFError, CHECK_(empty)); } - assert(!oopDesc::is_null(mirror), ss.as_symbol(THREAD)->as_C_string()); + assert(!oopDesc::is_null(mirror), "%s", ss.as_symbol(THREAD)->as_C_string()); if (ss.at_return_type()) rt = Handle(THREAD, mirror); else diff --git a/src/share/vm/code/codeCache.cpp b/src/share/vm/code/codeCache.cpp --- a/src/share/vm/code/codeCache.cpp +++ b/src/share/vm/code/codeCache.cpp @@ -365,7 +365,7 @@ // Possibly wakes up the sweeper thread. NMethodSweeper::notify(code_blob_type); assert_locked_or_safepoint(CodeCache_lock); - assert(size > 0, err_msg_res("Code cache allocation request must be > 0 but is %d", size)); + assert(size > 0, "Code cache allocation request must be > 0 but is %d", size); if (size <= 0) { return NULL; } @@ -817,7 +817,7 @@ double max_capacity = (double)heap->max_capacity(); double result = max_capacity / unallocated_capacity; assert (max_capacity >= unallocated_capacity, "Must be"); - assert (result >= 1.0, err_msg_res("reverse_free_ratio must be at least 1. It is %f", result)); + assert (result >= 1.0, "reverse_free_ratio must be at least 1. It is %f", result); return result; } diff --git a/src/share/vm/compiler/compileBroker.cpp b/src/share/vm/compiler/compileBroker.cpp --- a/src/share/vm/compiler/compileBroker.cpp +++ b/src/share/vm/compiler/compileBroker.cpp @@ -1669,8 +1669,8 @@ } if (PrintCompilation) { FormatBufferResource msg = retry_message != NULL ? - err_msg_res("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) : - err_msg_res("COMPILE SKIPPED: %s", ci_env.failure_reason()); + FormatBufferResource("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) : + FormatBufferResource("COMPILE SKIPPED: %s", ci_env.failure_reason()); task->print(tty, msg); } } else { diff --git a/src/share/vm/gc/g1/g1AllocRegion.cpp b/src/share/vm/gc/g1/g1AllocRegion.cpp --- a/src/share/vm/gc/g1/g1AllocRegion.cpp +++ b/src/share/vm/gc/g1/g1AllocRegion.cpp @@ -91,7 +91,7 @@ } size_t G1AllocRegion::retire(bool fill_up) { - assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly").buffer()); + assert(_alloc_region != NULL, G1_ALLOC_REGION_MSG("not initialized properly")); size_t result = 0; @@ -102,14 +102,14 @@ // and potentially free it if it is, given that it's guaranteed that // it will never be empty. assert(!alloc_region->is_empty(), - ar_ext_msg(this, "the alloc region should never be empty").buffer()); + G1_ALLOC_REGION_MSG("the alloc region should never be empty")); if (fill_up) { result = fill_up_remaining_space(alloc_region, _bot_updates); } assert(alloc_region->used() >= _used_bytes_before, - ar_ext_msg(this, "invariant").buffer()); + G1_ALLOC_REGION_MSG("invariant")); size_t allocated_bytes = alloc_region->used() - _used_bytes_before; retire_region(alloc_region, allocated_bytes); _used_bytes_before = 0; @@ -122,8 +122,8 @@ HeapWord* G1AllocRegion::new_alloc_region_and_allocate(size_t word_size, bool force) { - assert(_alloc_region == _dummy_region, ar_ext_msg(this, "pre-condition").buffer()); - assert(_used_bytes_before == 0, ar_ext_msg(this, "pre-condition").buffer()); + assert(_alloc_region == _dummy_region, G1_ALLOC_REGION_MSG("pre-condition")); + assert(_used_bytes_before == 0, G1_ALLOC_REGION_MSG("pre-condition")); trace("attempting region allocation"); HeapRegion* new_alloc_region = allocate_new_region(word_size, force); @@ -132,7 +132,7 @@ // Need to do this before the allocation _used_bytes_before = new_alloc_region->used(); HeapWord* result = allocate(new_alloc_region, word_size, _bot_updates); - assert(result != NULL, ar_ext_msg(this, "the allocation should succeeded").buffer()); + assert(result != NULL, G1_ALLOC_REGION_MSG("the allocation should succeeded")); OrderAccess::storestore(); // Note that we first perform the allocation and then we store the @@ -148,17 +148,11 @@ ShouldNotReachHere(); } -void G1AllocRegion::fill_in_ext_msg(ar_ext_msg* msg, const char* message) { - msg->append("[%s] %s c: %u b: %s r: " PTR_FORMAT " u: " SIZE_FORMAT, - _name, message, _count, BOOL_TO_STR(_bot_updates), - p2i(_alloc_region), _used_bytes_before); -} - void G1AllocRegion::init() { trace("initializing"); assert(_alloc_region == NULL && _used_bytes_before == 0, - ar_ext_msg(this, "pre-condition").buffer()); - assert(_dummy_region != NULL, ar_ext_msg(this, "should have been set").buffer()); + G1_ALLOC_REGION_MSG("pre-condition")); + assert(_dummy_region != NULL, G1_ALLOC_REGION_MSG("should have been set")); _alloc_region = _dummy_region; _count = 0; trace("initialized"); @@ -169,10 +163,10 @@ // We explicitly check that the region is not empty to make sure we // maintain the "the alloc region cannot be empty" invariant. assert(alloc_region != NULL && !alloc_region->is_empty(), - ar_ext_msg(this, "pre-condition").buffer()); + G1_ALLOC_REGION_MSG("pre-condition")); assert(_alloc_region == _dummy_region && _used_bytes_before == 0 && _count == 0, - ar_ext_msg(this, "pre-condition").buffer()); + G1_ALLOC_REGION_MSG("pre-condition")); _used_bytes_before = alloc_region->used(); _alloc_region = alloc_region; @@ -185,7 +179,7 @@ // We explicitly check that the region is not empty to make sure we // maintain the "the alloc region cannot be empty" invariant. assert(alloc_region != NULL && !alloc_region->is_empty(), - ar_ext_msg(this, "pre-condition").buffer()); + G1_ALLOC_REGION_MSG("pre-condition")); _alloc_region = alloc_region; _alloc_region->set_allocation_context(allocation_context()); @@ -198,7 +192,7 @@ HeapRegion* alloc_region = _alloc_region; retire(false /* fill_up */); assert(_alloc_region == _dummy_region, - ar_ext_msg(this, "post-condition of retire()").buffer()); + G1_ALLOC_REGION_MSG("post-condition of retire()")); _alloc_region = NULL; trace("released"); return (alloc_region == _dummy_region) ? NULL : alloc_region; diff --git a/src/share/vm/gc/g1/g1AllocRegion.hpp b/src/share/vm/gc/g1/g1AllocRegion.hpp --- a/src/share/vm/gc/g1/g1AllocRegion.hpp +++ b/src/share/vm/gc/g1/g1AllocRegion.hpp @@ -34,7 +34,10 @@ // 0 -> no tracing, 1 -> basic tracing, 2 -> basic + allocation tracing #define G1_ALLOC_REGION_TRACING 0 -class ar_ext_msg; +#define G1_ALLOC_REGION_MSG(message) \ + "[%s] %s c: %u b: %s r: " PTR_FORMAT " u: " SIZE_FORMAT, \ + _name, message, _count, BOOL_TO_STR(_bot_updates), \ + p2i(_alloc_region), _used_bytes_before // A class that holds a region that is active in satisfying allocation // requests, potentially issued in parallel. When the active region is @@ -131,8 +134,6 @@ // to allocate a new region even if the max has been reached. HeapWord* new_alloc_region_and_allocate(size_t word_size, bool force); - void fill_in_ext_msg(ar_ext_msg* msg, const char* message); - protected: // Retire the active allocating region. If fill_up is true then make // sure that the region is full before we retire it so that no one @@ -278,11 +279,4 @@ virtual HeapRegion* release(); }; -class ar_ext_msg : public err_msg { -public: - ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("%s", "") { - alloc_region->fill_in_ext_msg(this, message); - } -}; - #endif // SHARE_VM_GC_G1_G1ALLOCREGION_HPP diff --git a/src/share/vm/gc/g1/g1AllocRegion.inline.hpp b/src/share/vm/gc/g1/g1AllocRegion.inline.hpp --- a/src/share/vm/gc/g1/g1AllocRegion.inline.hpp +++ b/src/share/vm/gc/g1/g1AllocRegion.inline.hpp @@ -69,10 +69,10 @@ size_t desired_word_size, size_t* actual_word_size, bool bot_updates) { - assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition").buffer()); + assert(bot_updates == _bot_updates, G1_ALLOC_REGION_MSG("pre-condition")); HeapRegion* alloc_region = _alloc_region; - assert(alloc_region != NULL, ar_ext_msg(this, "not initialized properly").buffer()); + assert(alloc_region != NULL, G1_ALLOC_REGION_MSG("not initialized properly")); HeapWord* result = par_allocate(alloc_region, min_word_size, desired_word_size, actual_word_size, bot_updates); if (result != NULL) { @@ -113,8 +113,8 @@ inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size, bool bot_updates) { - assert(bot_updates == _bot_updates, ar_ext_msg(this, "pre-condition").buffer()); - assert(_alloc_region != NULL, ar_ext_msg(this, "not initialized properly").buffer()); + assert(bot_updates == _bot_updates, G1_ALLOC_REGION_MSG("pre-condition")); + assert(_alloc_region != NULL, G1_ALLOC_REGION_MSG("not initialized properly")); trace("forcing alloc", word_size, word_size); HeapWord* result = new_alloc_region_and_allocate(word_size, true /* force */); diff --git a/src/share/vm/gc/g1/heapRegionSet.cpp b/src/share/vm/gc/g1/heapRegionSet.cpp --- a/src/share/vm/gc/g1/heapRegionSet.cpp +++ b/src/share/vm/gc/g1/heapRegionSet.cpp @@ -57,14 +57,14 @@ guarantee(( is_empty() && length() == 0 && total_capacity_bytes() == 0) || (!is_empty() && length() > 0 && total_capacity_bytes() > 0) , - hrs_ext_msg(this, "invariant").buffer()); + "%s", hrs_ext_msg(this, "invariant").buffer()); } void HeapRegionSetBase::verify_start() { // See comment in verify() about MT safety and verification. check_mt_safety(); assert(!_verify_in_progress, - hrs_ext_msg(this, "verification should not be in progress").buffer()); + "%s", hrs_ext_msg(this, "verification should not be in progress").buffer()); // Do the basic verification first before we do the checks over the regions. HeapRegionSetBase::verify(); @@ -76,7 +76,7 @@ // See comment in verify() about MT safety and verification. check_mt_safety(); assert(_verify_in_progress, - hrs_ext_msg(this, "verification should be in progress").buffer()); + "%s", hrs_ext_msg(this, "verification should be in progress").buffer()); _verify_in_progress = false; } @@ -151,7 +151,7 @@ #endif // ASSERT if (is_empty()) { - assert(length() == 0 && _tail == NULL, hrs_ext_msg(this, "invariant").buffer()); + assert(length() == 0 && _tail == NULL, "%s", hrs_ext_msg(this, "invariant").buffer()); _head = from_list->_head; _tail = from_list->_tail; } else { @@ -198,8 +198,8 @@ void FreeRegionList::remove_starting_at(HeapRegion* first, uint num_regions) { check_mt_safety(); - assert(num_regions >= 1, hrs_ext_msg(this, "pre-condition").buffer()); - assert(!is_empty(), hrs_ext_msg(this, "pre-condition").buffer()); + assert(num_regions >= 1, "%s", hrs_ext_msg(this, "pre-condition").buffer()); + assert(!is_empty(), "%s", hrs_ext_msg(this, "pre-condition").buffer()); verify_optional(); DEBUG_ONLY(uint old_length = length();) @@ -212,22 +212,22 @@ HeapRegion* prev = curr->prev(); assert(count < num_regions, - hrs_err_msg("[%s] should not come across more regions " - "pending for removal than num_regions: %u", - name(), num_regions).buffer()); + "%s", hrs_err_msg("[%s] should not come across more regions " + "pending for removal than num_regions: %u", + name(), num_regions).buffer()); if (prev == NULL) { - assert(_head == curr, hrs_ext_msg(this, "invariant").buffer()); + assert(_head == curr, "%s", hrs_ext_msg(this, "invariant").buffer()); _head = next; } else { - assert(_head != curr, hrs_ext_msg(this, "invariant").buffer()); + assert(_head != curr, "%s", hrs_ext_msg(this, "invariant").buffer()); prev->set_next(next); } if (next == NULL) { - assert(_tail == curr, hrs_ext_msg(this, "invariant").buffer()); + assert(_tail == curr, "%s", hrs_ext_msg(this, "invariant").buffer()); _tail = prev; } else { - assert(_tail != curr, hrs_ext_msg(this, "invariant").buffer()); + assert(_tail != curr, "%s", hrs_ext_msg(this, "invariant").buffer()); next->set_prev(prev); } if (_last = curr) { @@ -243,12 +243,12 @@ } assert(count == num_regions, - hrs_err_msg("[%s] count: %u should be == num_regions: %u", - name(), count, num_regions).buffer()); + "%s", hrs_err_msg("[%s] count: %u should be == num_regions: %u", + name(), count, num_regions).buffer()); assert(length() + num_regions == old_length, - hrs_err_msg("[%s] new length should be consistent " - "new length: %u old length: %u num_regions: %u", - name(), length(), old_length, num_regions).buffer()); + "%s", hrs_err_msg("[%s] new length should be consistent " + "new length: %u old length: %u num_regions: %u", + name(), length(), old_length, num_regions).buffer()); verify_optional(); } @@ -305,8 +305,8 @@ count++; guarantee(count < _unrealistically_long_length, - hrs_err_msg("[%s] the calculated length: %u seems very long, is there maybe a cycle? curr: " PTR_FORMAT " prev0: " PTR_FORMAT " " "prev1: " PTR_FORMAT " length: %u", - name(), count, p2i(curr), p2i(prev0), p2i(prev1), length()).buffer()); + "%s", hrs_err_msg("[%s] the calculated length: %u seems very long, is there maybe a cycle? curr: " PTR_FORMAT " prev0: " PTR_FORMAT " " "prev1: " PTR_FORMAT " length: %u", + name(), count, p2i(curr), p2i(prev0), p2i(prev1), length()).buffer()); if (curr->next() != NULL) { guarantee(curr->next()->prev() == curr, "Next or prev pointers messed up"); diff --git a/src/share/vm/gc/g1/heapRegionSet.inline.hpp b/src/share/vm/gc/g1/heapRegionSet.inline.hpp --- a/src/share/vm/gc/g1/heapRegionSet.inline.hpp +++ b/src/share/vm/gc/g1/heapRegionSet.inline.hpp @@ -29,9 +29,9 @@ inline void HeapRegionSetBase::add(HeapRegion* hr) { check_mt_safety(); - assert(hr->containing_set() == NULL, hrs_ext_msg(this, "should not already have a containing set %u").buffer()); - assert(hr->next() == NULL, hrs_ext_msg(this, "should not already be linked").buffer()); - assert(hr->prev() == NULL, hrs_ext_msg(this, "should not already be linked").buffer()); + assert(hr->containing_set() == NULL, "%s", hrs_ext_msg(this, "should not already have a containing set %u").buffer()); + assert(hr->next() == NULL, "%s", hrs_ext_msg(this, "should not already be linked").buffer()); + assert(hr->prev() == NULL, "%s", hrs_ext_msg(this, "should not already be linked").buffer()); _count.increment(1u, hr->capacity()); hr->set_containing_set(this); @@ -41,18 +41,18 @@ inline void HeapRegionSetBase::remove(HeapRegion* hr) { check_mt_safety(); verify_region(hr); - assert(hr->next() == NULL, hrs_ext_msg(this, "should already be unlinked").buffer()); - assert(hr->prev() == NULL, hrs_ext_msg(this, "should already be unlinked").buffer()); + assert(hr->next() == NULL, "%s", hrs_ext_msg(this, "should already be unlinked").buffer()); + assert(hr->prev() == NULL, "%s", hrs_ext_msg(this, "should already be unlinked").buffer()); hr->set_containing_set(NULL); - assert(_count.length() > 0, hrs_ext_msg(this, "pre-condition").buffer()); + assert(_count.length() > 0, "%s", hrs_ext_msg(this, "pre-condition").buffer()); _count.decrement(1u, hr->capacity()); } inline void FreeRegionList::add_ordered(HeapRegion* hr) { assert((length() == 0 && _head == NULL && _tail == NULL && _last == NULL) || (length() > 0 && _head != NULL && _tail != NULL), - hrs_ext_msg(this, "invariant").buffer()); + "%s", hrs_ext_msg(this, "invariant").buffer()); // add() will verify the region and check mt safety. add(hr); @@ -129,7 +129,7 @@ return NULL; } assert(length() > 0 && _head != NULL && _tail != NULL, - hrs_ext_msg(this, "invariant").buffer()); + "%s", hrs_ext_msg(this, "invariant").buffer()); HeapRegion* hr; diff --git a/src/share/vm/gc/shared/referenceProcessor.cpp b/src/share/vm/gc/shared/referenceProcessor.cpp --- a/src/share/vm/gc/shared/referenceProcessor.cpp +++ b/src/share/vm/gc/shared/referenceProcessor.cpp @@ -943,7 +943,7 @@ case REF_NONE: // we should not reach here if we are an InstanceRefKlass default: - guarantee(false, "rt should not be %d", rt); + ShouldNotReachHere(); } if (TraceReferenceGC && PrintGCDetails) { gclog_or_tty->print_cr("Thread %d gets list " INTPTR_FORMAT, id, p2i(list)); diff --git a/src/share/vm/interpreter/linkResolver.cpp b/src/share/vm/interpreter/linkResolver.cpp --- a/src/share/vm/interpreter/linkResolver.cpp +++ b/src/share/vm/interpreter/linkResolver.cpp @@ -215,7 +215,7 @@ assert(call_kind() != CallInfo::unknown_kind, "CallInfo must be set"); break; default: - fatal(err_msg_res("Unexpected call kind %d", call_kind())); + fatal("Unexpected call kind %d", call_kind()); } } #endif //ASSERT diff --git a/src/share/vm/memory/allocation.cpp b/src/share/vm/memory/allocation.cpp --- a/src/share/vm/memory/allocation.cpp +++ b/src/share/vm/memory/allocation.cpp @@ -533,7 +533,7 @@ } void Arena::signal_out_of_memory(size_t sz, const char* whence) const { - vm_exit_out_of_memory(sz, OOM_MALLOC_ERROR, whence); + vm_exit_out_of_memory(sz, OOM_MALLOC_ERROR, "%s", whence); } // Grow a new Chunk diff --git a/src/share/vm/oops/cpCache.cpp b/src/share/vm/oops/cpCache.cpp --- a/src/share/vm/oops/cpCache.cpp +++ b/src/share/vm/oops/cpCache.cpp @@ -593,7 +593,7 @@ // all point to the same constant pool cache entry. for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) { const int cpci_next = invokedynamic_references_map[ref + entry]; - assert(cpci == cpci_next, err_msg_res("%d == %d", cpci, cpci_next)); + assert(cpci == cpci_next, "%d == %d", cpci, cpci_next); } #endif entry_at(cpci)->initialize_resolved_reference_index(ref); diff --git a/src/share/vm/opto/callGenerator.cpp b/src/share/vm/opto/callGenerator.cpp --- a/src/share/vm/opto/callGenerator.cpp +++ b/src/share/vm/opto/callGenerator.cpp @@ -895,7 +895,7 @@ break; default: - fatal(err_msg_res("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid))); + fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid)); break; } return NULL; diff --git a/src/share/vm/opto/castnode.cpp b/src/share/vm/opto/castnode.cpp --- a/src/share/vm/opto/castnode.cpp +++ b/src/share/vm/opto/castnode.cpp @@ -129,7 +129,7 @@ } else { stringStream ss; test.dump_on(&ss); - fatal(err_msg_res("unexpected comparison %s", ss.as_string())); + fatal("unexpected comparison %s", ss.as_string()); } int lo_int = (int)lo_long; int hi_int = (int)hi_long; diff --git a/src/share/vm/opto/chaitin.cpp b/src/share/vm/opto/chaitin.cpp --- a/src/share/vm/opto/chaitin.cpp +++ b/src/share/vm/opto/chaitin.cpp @@ -1733,7 +1733,7 @@ // Check for AddP-related opcodes if (!derived->is_Phi()) { - assert(derived->as_Mach()->ideal_Opcode() == Op_AddP, err_msg_res("but is: %s", derived->Name())); + assert(derived->as_Mach()->ideal_Opcode() == Op_AddP, "but is: %s", derived->Name()); Node *base = derived->in(AddPNode::Base); derived_base_map[derived->_idx] = base; return base; diff --git a/src/share/vm/opto/compile.cpp b/src/share/vm/opto/compile.cpp --- a/src/share/vm/opto/compile.cpp +++ b/src/share/vm/opto/compile.cpp @@ -596,7 +596,7 @@ n->emit(buf, this->regalloc()); // Emitting into the scratch buffer should not fail - assert (!failing(), err_msg_res("Must not have pending failure. Reason is: %s", failure_reason())); + assert (!failing(), "Must not have pending failure. Reason is: %s", failure_reason()); if (is_branch) // Restore label. n->as_MachBranch()->label_set(saveL, save_bnum); @@ -1189,7 +1189,7 @@ * the ideal graph. */ StartNode* Compile::start() const { - assert (!failing(), err_msg_res("Must not have pending failure. Reason is: %s", failure_reason())); + assert (!failing(), "Must not have pending failure. Reason is: %s", failure_reason()); for (DUIterator_Fast imax, i = root()->fast_outs(imax); i < imax; i++) { Node* start = root()->fast_out(i); if (start->is_Start()) { @@ -3796,7 +3796,7 @@ } assert(constant_addr, "consts section too small"); assert((constant_addr - _masm.code()->consts()->start()) == con.offset(), - err_msg_res("must be: %d == %d", (int) (constant_addr - _masm.code()->consts()->start()), (int)(con.offset()))); + "must be: %d == %d", (int) (constant_addr - _masm.code()->consts()->start()), (int)(con.offset())); } } @@ -3842,7 +3842,7 @@ case T_OBJECT: case T_ADDRESS: value.l = (jobject) oper->constant(); break; case T_METADATA: return add((Metadata*)oper->constant()); break; - default: guarantee(false, err_msg_res("unhandled type: %s", type2name(type))); + default: guarantee(false, "unhandled type: %s", type2name(type)); } return add(n, type, value); } @@ -3864,7 +3864,7 @@ if (Compile::current()->in_scratch_emit_size()) return; assert(labels.is_nonempty(), "must be"); - assert((uint) labels.length() == n->outcnt(), err_msg_res("must be equal: %d == %d", labels.length(), n->outcnt())); + assert((uint) labels.length() == n->outcnt(), "must be equal: %d == %d", labels.length(), n->outcnt()); // Since MachConstantNode::constant_offset() also contains // table_base_offset() we need to subtract the table_base_offset() @@ -3876,7 +3876,7 @@ for (uint i = 0; i < n->outcnt(); i++) { address* constant_addr = &jump_table_base[i]; - assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, p2i(*constant_addr), p2i(((address) n) + i))); + assert(*constant_addr == (((address) n) + i), "all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, p2i(*constant_addr), p2i(((address) n) + i)); *constant_addr = cb.consts()->target(*labels.at(i), (address) constant_addr); cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type); } @@ -4135,7 +4135,7 @@ if (n1->Opcode() < n2->Opcode()) return -1; else if (n1->Opcode() > n2->Opcode()) return 1; - assert(n1->req() == n2->req(), err_msg_res("can't compare %s nodes: n1->req() = %d, n2->req() = %d", NodeClassNames[n1->Opcode()], n1->req(), n2->req())); + assert(n1->req() == n2->req(), "can't compare %s nodes: n1->req() = %d, n2->req() = %d", NodeClassNames[n1->Opcode()], n1->req(), n2->req()); for (uint i = 1; i < n1->req(); i++) { if (n1->in(i) < n2->in(i)) return -1; else if (n1->in(i) > n2->in(i)) return 1; diff --git a/src/share/vm/opto/compile.hpp b/src/share/vm/opto/compile.hpp --- a/src/share/vm/opto/compile.hpp +++ b/src/share/vm/opto/compile.hpp @@ -843,7 +843,7 @@ } uint live_nodes() const { int val = _unique - _dead_node_count; - assert (val >= 0, err_msg_res("number of tracked dead nodes %d more than created nodes %d", _unique, _dead_node_count)); + assert (val >= 0, "number of tracked dead nodes %d more than created nodes %d", _unique, _dead_node_count); return (uint) val; } #ifdef ASSERT diff --git a/src/share/vm/opto/doCall.cpp b/src/share/vm/opto/doCall.cpp --- a/src/share/vm/opto/doCall.cpp +++ b/src/share/vm/opto/doCall.cpp @@ -599,9 +599,9 @@ pop_node(rt); // whatever it was, pop it } else if (rt == T_INT || is_subword_type(rt)) { // Nothing. These cases are handled in lambda form bytecode. - assert(ct == T_INT || is_subword_type(ct), err_msg_res("must match: rt=%s, ct=%s", type2name(rt), type2name(ct))); + assert(ct == T_INT || is_subword_type(ct), "must match: rt=%s, ct=%s", type2name(rt), type2name(ct)); } else if (rt == T_OBJECT || rt == T_ARRAY) { - assert(ct == T_OBJECT || ct == T_ARRAY, err_msg_res("rt=%s, ct=%s", type2name(rt), type2name(ct))); + assert(ct == T_OBJECT || ct == T_ARRAY, "rt=%s, ct=%s", type2name(rt), type2name(ct)); if (ctype->is_loaded()) { const TypeOopPtr* arg_type = TypeOopPtr::make_from_klass(rtype->as_klass()); const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); @@ -612,7 +612,7 @@ } } } else { - assert(rt == ct, err_msg_res("unexpected mismatch: rt=%s, ct=%s", type2name(rt), type2name(ct))); + assert(rt == ct, "unexpected mismatch: rt=%s, ct=%s", type2name(rt), type2name(ct)); // push a zero; it's better than getting an oop/int mismatch pop_node(rt); Node* retnode = zerocon(ct); @@ -628,7 +628,7 @@ // can appear to be "loaded" by different loaders (depending on // the accessing class). assert(!rtype->is_loaded() || !ctype->is_loaded() || rtype == ctype, - err_msg_res("mismatched return types: rtype=%s, ctype=%s", rtype->name(), ctype->name())); + "mismatched return types: rtype=%s, ctype=%s", rtype->name(), ctype->name()); } // If the return type of the method is not loaded, assert that the diff --git a/src/share/vm/opto/escape.cpp b/src/share/vm/opto/escape.cpp --- a/src/share/vm/opto/escape.cpp +++ b/src/share/vm/opto/escape.cpp @@ -982,7 +982,7 @@ strcmp(call->as_CallLeaf()->_name, "montgomery_square") == 0) ))) { call->dump(); - fatal(err_msg_res("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name)); + fatal("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name); } #endif // Always process arraycopy's destination object since @@ -1201,8 +1201,8 @@ C->log()->text("%s", timeout ? "time" : "iterations"); C->log()->end_elem(" limit'"); } - assert(ExitEscapeAnalysisOnTimeout, err_msg_res("infinite EA connection graph build (%f sec, %d iterations) with %d nodes and worklist size %d", - time.seconds(), iterations, nodes_size(), ptnodes_worklist.length())); + assert(ExitEscapeAnalysisOnTimeout, "infinite EA connection graph build (%f sec, %d iterations) with %d nodes and worklist size %d", + time.seconds(), iterations, nodes_size(), ptnodes_worklist.length()); // Possible infinite build_connection_graph loop, // bailout (no changes to ideal graph were made). return false; diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp --- a/src/share/vm/opto/graphKit.cpp +++ b/src/share/vm/opto/graphKit.cpp @@ -1251,7 +1251,7 @@ } default: - fatal(err_msg_res("unexpected type: %s", type2name(type))); + fatal("unexpected type: %s", type2name(type)); } assert(chk != NULL, "sanity check"); chk = _gvn.transform(chk); @@ -1950,8 +1950,8 @@ // the current bytecode. int inputs, ignored_depth; if (compute_stack_effects(inputs, ignored_depth)) { - assert(sp() >= inputs, err_msg_res("must have enough JVMS stack to execute %s: sp=%d, inputs=%d", - Bytecodes::name(java_bc()), sp(), inputs)); + assert(sp() >= inputs, "must have enough JVMS stack to execute %s: sp=%d, inputs=%d", + Bytecodes::name(java_bc()), sp(), inputs); } } #endif @@ -1987,7 +1987,7 @@ case Deoptimization::Action_make_not_compilable: break; default: - fatal(err_msg_res("unknown action %d: %s", action, Deoptimization::trap_action_name(action))); + fatal("unknown action %d: %s", action, Deoptimization::trap_action_name(action)); break; #endif } diff --git a/src/share/vm/opto/graphKit.hpp b/src/share/vm/opto/graphKit.hpp --- a/src/share/vm/opto/graphKit.hpp +++ b/src/share/vm/opto/graphKit.hpp @@ -136,7 +136,7 @@ _bci = jvms->bci(); _method = jvms->has_method() ? jvms->method() : NULL; } void set_map(SafePointNode* m) { _map = m; debug_only(verify_map()); } - void set_sp(int sp) { assert(sp >= 0, err_msg_res("sp must be non-negative: %d", sp)); _sp = sp; } + void set_sp(int sp) { assert(sp >= 0, "sp must be non-negative: %d", sp); _sp = sp; } void clean_stack(int from_sp); // clear garbage beyond from_sp to top void inc_sp(int i) { set_sp(sp() + i); } @@ -354,12 +354,12 @@ } Node* zero_check_int(Node* value) { assert(value->bottom_type()->basic_type() == T_INT, - err_msg_res("wrong type: %s", type2name(value->bottom_type()->basic_type()))); + "wrong type: %s", type2name(value->bottom_type()->basic_type())); return null_check_common(value, T_INT); } Node* zero_check_long(Node* value) { assert(value->bottom_type()->basic_type() == T_LONG, - err_msg_res("wrong type: %s", type2name(value->bottom_type()->basic_type()))); + "wrong type: %s", type2name(value->bottom_type()->basic_type())); return null_check_common(value, T_LONG); } // Throw an uncommon trap if a given value is __not__ null. diff --git a/src/share/vm/opto/idealGraphPrinter.cpp b/src/share/vm/opto/idealGraphPrinter.cpp --- a/src/share/vm/opto/idealGraphPrinter.cpp +++ b/src/share/vm/opto/idealGraphPrinter.cpp @@ -157,8 +157,8 @@ } else { // It would be nice if we could shut down cleanly but it should // be an error if we can't connect to the visualizer. - fatal(err_msg_res("Couldn't connect to visualizer at %s:" INTX_FORMAT, - PrintIdealGraphAddress, PrintIdealGraphPort)); + fatal("Couldn't connect to visualizer at %s:" INTX_FORMAT, + PrintIdealGraphAddress, PrintIdealGraphPort); } } diff --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp --- a/src/share/vm/opto/library_call.cpp +++ b/src/share/vm/opto/library_call.cpp @@ -133,7 +133,7 @@ private: void fatal_unexpected_iid(vmIntrinsics::ID iid) { - fatal(err_msg_res("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid))); + fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid)); } void set_result(Node* n) { assert(_result == NULL, "only set once"); _result = n; } @@ -2466,7 +2466,7 @@ p = ConvX2UL(p); break; default: - fatal(err_msg_res("unexpected type %d: %s", type, type2name(type))); + fatal("unexpected type %d: %s", type, type2name(type)); break; } } @@ -2755,7 +2755,7 @@ } break; default: - fatal(err_msg_res("unexpected type %d: %s", type, type2name(type))); + fatal("unexpected type %d: %s", type, type2name(type)); break; } @@ -3807,7 +3807,7 @@ ciMethod* method = callee(); int vtable_index = method->vtable_index(); assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index, - err_msg_res("bad index %d", vtable_index)); + "bad index %d", vtable_index); // Get the Method* out of the appropriate vtable entry. int entry_offset = (InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size()) * wordSize + @@ -3859,7 +3859,7 @@ // No need to use the linkResolver to get it. vtable_index = method->vtable_index(); assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index, - err_msg_res("bad index %d", vtable_index)); + "bad index %d", vtable_index); } slow_call = new CallDynamicJavaNode(tf, SharedRuntime::get_resolve_virtual_call_stub(), @@ -6131,7 +6131,7 @@ } break; default: - fatal(err_msg_res("unknown SHA intrinsic predicate: %d", predicate)); + fatal("unknown SHA intrinsic predicate: %d", predicate); } if (klass_SHA_name != NULL) { // get DigestBase klass to lookup for SHA klass @@ -6236,7 +6236,7 @@ } break; default: - fatal(err_msg_res("unknown SHA intrinsic predicate: %d", predicate)); + fatal("unknown SHA intrinsic predicate: %d", predicate); } ciKlass* klass_SHA = NULL; diff --git a/src/share/vm/opto/mathexactnode.cpp b/src/share/vm/opto/mathexactnode.cpp --- a/src/share/vm/opto/mathexactnode.cpp +++ b/src/share/vm/opto/mathexactnode.cpp @@ -167,7 +167,7 @@ } const Type* OverflowNode::sub(const Type* t1, const Type* t2) const { - fatal(err_msg_res("sub() should not be called for '%s'", NodeClassNames[this->Opcode()])); + fatal("sub() should not be called for '%s'", NodeClassNames[this->Opcode()]); return TypeInt::CC; } diff --git a/src/share/vm/opto/memnode.cpp b/src/share/vm/opto/memnode.cpp --- a/src/share/vm/opto/memnode.cpp +++ b/src/share/vm/opto/memnode.cpp @@ -1139,7 +1139,7 @@ // Only integer types have boxing cache. assert(bt == T_BOOLEAN || bt == T_CHAR || bt == T_BYTE || bt == T_SHORT || - bt == T_INT || bt == T_LONG, err_msg_res("wrong type = %s", type2name(bt))); + bt == T_INT || bt == T_LONG, "wrong type = %s", type2name(bt)); jlong cache_low = (bt == T_LONG) ? c.as_long() : c.as_int(); if (cache_low != (int)cache_low) { return NULL; // should not happen since cache is array indexed by value @@ -2394,7 +2394,7 @@ Opcode() == Op_StoreVector || phase->C->get_alias_index(adr_type()) == Compile::AliasIdxRaw || (Opcode() == Op_StoreL && st->Opcode() == Op_StoreI), // expanded ClearArrayNode - err_msg_res("no mismatched stores, except on raw memory: %s %s", NodeClassNames[Opcode()], NodeClassNames[st->Opcode()])); + "no mismatched stores, except on raw memory: %s %s", NodeClassNames[Opcode()], NodeClassNames[st->Opcode()]); if (st->in(MemNode::Address)->eqv_uncast(address) && st->as_Store()->memory_size() <= this->memory_size()) { @@ -3289,7 +3289,7 @@ // the store control then we cannot capture the store. assert(!n->is_Store(), "2 stores to same slice on same control?"); Node* base = other_adr; - assert(base->is_AddP(), err_msg_res("should be addp but is %s", base->Name())); + assert(base->is_AddP(), "should be addp but is %s", base->Name()); base = base->in(AddPNode::Base); if (base != NULL) { base = base->uncast(); diff --git a/src/share/vm/opto/node.hpp b/src/share/vm/opto/node.hpp --- a/src/share/vm/opto/node.hpp +++ b/src/share/vm/opto/node.hpp @@ -353,7 +353,7 @@ #endif // Reference to the i'th input Node. Error if out of bounds. - Node* in(uint i) const { assert(i < _max, err_msg_res("oob: i=%d, _max=%d", i, _max)); return _in[i]; } + Node* in(uint i) const { assert(i < _max, "oob: i=%d, _max=%d", i, _max); return _in[i]; } // Reference to the i'th input Node. NULL if out of bounds. Node* lookup(uint i) const { return ((i < _max) ? _in[i] : NULL); } // Reference to the i'th output Node. Error if out of bounds. @@ -393,7 +393,7 @@ void ins_req( uint i, Node *n ); // Insert a NEW required input void set_req( uint i, Node *n ) { assert( is_not_dead(n), "can not use dead node"); - assert( i < _cnt, err_msg_res("oob: i=%d, _cnt=%d", i, _cnt)); + assert( i < _cnt, "oob: i=%d, _cnt=%d", i, _cnt); assert( !VerifyHashTableKeys || _hash_lock == 0, "remove node from hash table before modifying it"); Node** p = &_in[i]; // cache this._in, across the del_out call diff --git a/src/share/vm/opto/output.cpp b/src/share/vm/opto/output.cpp --- a/src/share/vm/opto/output.cpp +++ b/src/share/vm/opto/output.cpp @@ -2611,7 +2611,7 @@ n->dump(); tty->print_cr("..."); prior_use->dump(); - assert(edge_from_to(prior_use,n),msg); + assert(edge_from_to(prior_use,n), "%s", msg); } _reg_node.map(def,NULL); // Kill live USEs } @@ -2649,11 +2649,11 @@ OptoReg::Name reg_lo = _regalloc->get_reg_first(def); OptoReg::Name reg_hi = _regalloc->get_reg_second(def); if( OptoReg::is_valid(reg_lo) ) { - assert(!_reg_node[reg_lo] || edge_from_to(_reg_node[reg_lo],def), msg); + assert(!_reg_node[reg_lo] || edge_from_to(_reg_node[reg_lo],def), "%s", msg); _reg_node.map(reg_lo,n); } if( OptoReg::is_valid(reg_hi) ) { - assert(!_reg_node[reg_hi] || edge_from_to(_reg_node[reg_hi],def), msg); + assert(!_reg_node[reg_hi] || edge_from_to(_reg_node[reg_hi],def), "%s", msg); _reg_node.map(reg_hi,n); } } diff --git a/src/share/vm/opto/parse1.cpp b/src/share/vm/opto/parse1.cpp --- a/src/share/vm/opto/parse1.cpp +++ b/src/share/vm/opto/parse1.cpp @@ -1476,13 +1476,13 @@ int pre_bc_sp = sp(); int inputs, depth; bool have_se = !stopped() && compute_stack_effects(inputs, depth); - assert(!have_se || pre_bc_sp >= inputs, err_msg_res("have enough stack to execute this BC: pre_bc_sp=%d, inputs=%d", pre_bc_sp, inputs)); + assert(!have_se || pre_bc_sp >= inputs, "have enough stack to execute this BC: pre_bc_sp=%d, inputs=%d", pre_bc_sp, inputs); #endif //ASSERT do_one_bytecode(); assert(!have_se || stopped() || failing() || (sp() - pre_bc_sp) == depth, - err_msg_res("incorrect depth prediction: sp=%d, pre_bc_sp=%d, depth=%d", sp(), pre_bc_sp, depth)); + "incorrect depth prediction: sp=%d, pre_bc_sp=%d, depth=%d", sp(), pre_bc_sp, depth); do_exceptions(); diff --git a/src/share/vm/opto/stringopts.cpp b/src/share/vm/opto/stringopts.cpp --- a/src/share/vm/opto/stringopts.cpp +++ b/src/share/vm/opto/stringopts.cpp @@ -773,7 +773,7 @@ return false; } } else { - assert(mem->is_Store() || mem->is_LoadStore(), err_msg_res("unexpected node type: %s", mem->Name())); + assert(mem->is_Store() || mem->is_LoadStore(), "unexpected node type: %s", mem->Name()); #ifndef PRODUCT if (PrintOptimizeStringConcat) { tty->print("fusion has incorrect memory flow (unexpected source) for "); @@ -814,7 +814,7 @@ for (SimpleDUIterator i(true_proj); i.has_next(); i.next()) { Node* use = i.get(); assert(use == ctrl || use->is_ConstraintCast(), - err_msg_res("unexpected user: %s", use->Name())); + "unexpected user: %s", use->Name()); } iff = ctrl->in(1)->in(0)->as_If(); @@ -838,7 +838,7 @@ for (SimpleDUIterator i(ctrl); i.has_next(); i.next()) { Node* use = i.get(); assert(use == copy || use == iff || use == curr || use->is_CheckCastPP() || use->is_Load(), - err_msg_res("unexpected user: %s", use->Name())); + "unexpected user: %s", use->Name()); } #endif // ASSERT } diff --git a/src/share/vm/opto/superword.cpp b/src/share/vm/opto/superword.cpp --- a/src/share/vm/opto/superword.cpp +++ b/src/share/vm/opto/superword.cpp @@ -769,7 +769,7 @@ // if offset is 0. int iv_adjustment_in_bytes = (stride_sign * vw - (offset % vw)); assert(((ABS(iv_adjustment_in_bytes) % elt_size) == 0), - err_msg_res("(%d) should be divisible by (%d)", iv_adjustment_in_bytes, elt_size)); + "(%d) should be divisible by (%d)", iv_adjustment_in_bytes, elt_size); iv_adjustment = iv_adjustment_in_bytes/elt_size; } else { // This memory op is not dependent on iv (scale == 0) @@ -914,7 +914,7 @@ preds.push(n); NOT_PRODUCT(if (TraceSuperWord && Verbose) tty->print_cr("SuperWord::mem_slice_preds: added pred(%d)", n->_idx);) prev = n; - assert(n->is_Mem(), err_msg_res("unexpected node %s", n->Name())); + assert(n->is_Mem(), "unexpected node %s", n->Name()); n = n->in(MemNode::Memory); } } @@ -2105,7 +2105,7 @@ Node* n_tail = n->in(LoopNode::LoopBackControl); if (n_tail != n->in(LoopNode::EntryControl)) { if (!n_tail->is_Mem()) { - assert(n_tail->is_Mem(), err_msg_res("unexpected node for memory slice: %s", n_tail->Name())); + assert(n_tail->is_Mem(), "unexpected node for memory slice: %s", n_tail->Name()); return false; // Bailout } _mem_slice_head.push(n); diff --git a/src/share/vm/opto/type.cpp b/src/share/vm/opto/type.cpp --- a/src/share/vm/opto/type.cpp +++ b/src/share/vm/opto/type.cpp @@ -3358,7 +3358,7 @@ case T_LONG: return TypeLong::make(constant.as_long()); default: break; } - fatal(err_msg_res("Invalid boxed value type '%s'", type2name(bt))); + fatal("Invalid boxed value type '%s'", type2name(bt)); return NULL; } diff --git a/src/share/vm/opto/vectornode.cpp b/src/share/vm/opto/vectornode.cpp --- a/src/share/vm/opto/vectornode.cpp +++ b/src/share/vm/opto/vectornode.cpp @@ -252,7 +252,7 @@ const TypeVect* vt = TypeVect::make(bt, vlen); int vopc = VectorNode::opcode(opc, bt); // This method should not be called for unimplemented vectors. - guarantee(vopc > 0, err_msg_res("Vector for '%s' is not implemented", NodeClassNames[opc])); + guarantee(vopc > 0, "Vector for '%s' is not implemented", NodeClassNames[opc]); switch (vopc) { case Op_AddVB: return new AddVBNode(n1, n2, vt); case Op_AddVS: return new AddVSNode(n1, n2, vt); @@ -296,7 +296,7 @@ case Op_OrV: return new OrVNode (n1, n2, vt); case Op_XorV: return new XorVNode(n1, n2, vt); } - fatal(err_msg_res("Missed vector creation for '%s'", NodeClassNames[vopc])); + fatal("Missed vector creation for '%s'", NodeClassNames[vopc]); return NULL; } @@ -322,7 +322,7 @@ case T_DOUBLE: return new ReplicateDNode(s, vt); } - fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); + fatal("Type '%s' is not supported for vectors", type2name(bt)); return NULL; } @@ -340,7 +340,7 @@ case Op_URShiftL: return new RShiftCntVNode(cnt, vt); } - fatal(err_msg_res("Missed vector creation for '%s'", NodeClassNames[shift->Opcode()])); + fatal("Missed vector creation for '%s'", NodeClassNames[shift->Opcode()]); return NULL; } @@ -363,7 +363,7 @@ case T_DOUBLE: return new PackDNode(s, vt); } - fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); + fatal("Type '%s' is not supported for vectors", type2name(bt)); return NULL; } @@ -399,7 +399,7 @@ case T_DOUBLE: return new Pack2DNode(n1, n2, TypeVect::make(T_DOUBLE, 2)); } - fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); + fatal("Type '%s' is not supported for vectors", type2name(bt)); } return NULL; } @@ -442,7 +442,7 @@ case T_DOUBLE: return new ExtractDNode(v, pos); } - fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); + fatal("Type '%s' is not supported for vectors", type2name(bt)); return NULL; } @@ -494,7 +494,7 @@ int vopc = opcode(opc, bt); // This method should not be called for unimplemented vectors. - guarantee(vopc != opc, err_msg_res("Vector for '%s' is not implemented", NodeClassNames[opc])); + guarantee(vopc != opc, "Vector for '%s' is not implemented", NodeClassNames[opc]); switch (vopc) { case Op_AddReductionVI: return new AddReductionVINode(ctrl, n1, n2); @@ -506,7 +506,7 @@ case Op_MulReductionVF: return new MulReductionVFNode(ctrl, n1, n2); case Op_MulReductionVD: return new MulReductionVDNode(ctrl, n1, n2); } - fatal(err_msg_res("Missed vector creation for '%s'", NodeClassNames[vopc])); + fatal("Missed vector creation for '%s'", NodeClassNames[vopc]); return NULL; } 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 @@ -773,12 +773,10 @@ // To debug the long safepoint, specify both DieOnSafepointTimeout & // ShowMessageBoxOnError. if (DieOnSafepointTimeout) { - char msg[1024]; VM_Operation *op = VMThread::vm_operation(); - sprintf(msg, "Safepoint sync time longer than " INTX_FORMAT "ms detected when executing %s.", - SafepointTimeoutDelay, - op != NULL ? op->name() : "no vm operation"); - fatal(msg); + fatal("Safepoint sync time longer than " INTX_FORMAT "ms detected when executing %s.", + SafepointTimeoutDelay, + op != NULL ? op->name() : "no vm operation"); } } diff --git a/src/share/vm/runtime/sharedRuntime.cpp b/src/share/vm/runtime/sharedRuntime.cpp --- a/src/share/vm/runtime/sharedRuntime.cpp +++ b/src/share/vm/runtime/sharedRuntime.cpp @@ -1630,7 +1630,7 @@ for (int i = 0; i < member_arg_pos; i++) { VMReg a = regs_with_member_name[i].first(); VMReg b = regs_without_member_name[i].first(); - assert(a->value() == b->value(), err_msg_res("register allocation mismatch: a=%d, b=%d", a->value(), b->value())); + assert(a->value() == b->value(), "register allocation mismatch: a=%d, b=%d", a->value(), b->value()); } assert(regs_with_member_name[member_arg_pos].first()->is_valid(), "bad member arg"); } diff --git a/src/share/vm/runtime/vm_version.cpp b/src/share/vm/runtime/vm_version.cpp --- a/src/share/vm/runtime/vm_version.cpp +++ b/src/share/vm/runtime/vm_version.cpp @@ -85,7 +85,7 @@ #ifdef ASSERT static void assert_digits(const char * s, const char * message) { for (int i = 0; s[i] != '\0'; i++) { - assert(isdigit(s[i]), message); + assert(isdigit(s[i]), "%s", message); } } #endif @@ -155,8 +155,6 @@ } const char* Abstract_VM_Version::vm_info_string() { - assert(false, "Apa %s %d", "björn", 5); - fatal("banan"); if (CodeCacheExtensions::use_pregenerated_interpreter()) { return "interpreted mode, pregenerated"; } diff --git a/src/share/vm/utilities/debug.cpp b/src/share/vm/utilities/debug.cpp --- a/src/share/vm/utilities/debug.cpp +++ b/src/share/vm/utilities/debug.cpp @@ -207,70 +207,36 @@ #endif // !PRODUCT -void report_vm_error(const char* file, int line, const char* error_msg, - const char* detail_msg = NULL) +void report_vm_error(const char* file, int line, const char* error_msg) +{ + report_vm_error(file, line, error_msg, "%s", ""); +} + +void report_vm_error(const char* file, int line, const char* error_msg, const char* detail_fmt, ...) { if (Debugging || error_is_suppressed(file, line)) return; - Thread* const thread = ThreadLocalStorage::get_thread_slow(); - VMError(thread, file, line, error_msg, detail_msg).report_and_die(); + va_list detail_args; + va_start(detail_args, detail_fmt); + VMError::report_and_die(ThreadLocalStorage::get_thread_slow(), file, line, error_msg, detail_fmt, detail_args); + va_end(detail_args); } -void report_vm_error(const char* file, int line, const char* error_msg, int nargs, va_list args) +void report_fatal(const char* file, int line, const char* detail_fmt, ...) { - char* detail_msg; - char* format = va_arg(args, char*); - - if (nargs == 1) { - detail_msg = format; - } else { - char detail_buf[BUFSZ]; - jio_vsnprintf(detail_buf, BUFSZ, format, args); - detail_msg = detail_buf; - } - - report_vm_error(file, line, error_msg, detail_msg); -} - -void report_vm_error(const char* file, int line, const char* error_msg, int nargs, ...) -{ - va_list args; - - va_start(args, nargs); - report_vm_error(file, line, error_msg, nargs, args); - va_end(args); -} - -void report_fatal(const char* file, int line, int nargs, ...) -{ - va_list args; - - va_start(args, nargs); - report_vm_error(file, line, "fatal error", nargs, args); - va_end(args); + if (Debugging || error_is_suppressed(file, line)) return; + va_list detail_args; + va_start(detail_args, detail_fmt); + VMError::report_and_die(ThreadLocalStorage::get_thread_slow(), file, line, "fatal error", detail_fmt, detail_args); + va_end(detail_args); } void report_vm_out_of_memory(const char* file, int line, size_t size, - VMErrorType vm_err_type, int nargs, ...) { + VMErrorType vm_err_type, const char* detail_fmt, ...) { if (Debugging) return; - - va_list args; - char* detail_msg; - char* format; - - va_start(args, nargs); - format = va_arg(args, char*); - - if (nargs == 1) { - detail_msg = format; - } else { - char detail_buf[BUFSZ]; - jio_vsnprintf(detail_buf, BUFSZ, format, args); - detail_msg = detail_buf; - } - va_end(args); - - Thread* thread = ThreadLocalStorage::get_thread_slow(); - VMError(thread, file, line, size, vm_err_type, detail_msg).report_and_die(); + va_list detail_args; + va_start(detail_args, detail_fmt); + VMError::report_and_die(ThreadLocalStorage::get_thread_slow(), file, line, size, vm_err_type, detail_fmt, detail_args); + va_end(detail_args); // The UseOSErrorReporting option in report_and_die() may allow a return // to here. If so then we'll have to figure out how to handle it. @@ -339,8 +305,7 @@ } if (OnOutOfMemoryError && OnOutOfMemoryError[0]) { - VMError err(message); - err.report_java_out_of_memory(); + VMError::report_java_out_of_memory(message); } } } diff --git a/src/share/vm/utilities/debug.hpp b/src/share/vm/utilities/debug.hpp --- a/src/share/vm/utilities/debug.hpp +++ b/src/share/vm/utilities/debug.hpp @@ -105,30 +105,8 @@ va_end(argp); } -// Used to format messages for vmassert(), guarantee(), fatal(), etc. +// Used to format messages typedef FormatBuffer<> err_msg; -typedef FormatBufferResource err_msg_res; - -#define PP_NARG(...) \ - PP_NARG_(__VA_ARGS__,PP_RSEQ_N()) -#define PP_NARG_(...) \ - PP_ARG_N(__VA_ARGS__) -#define PP_ARG_N( \ - _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \ - _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ - _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \ - _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ - _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \ - _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ - _61,_62,_63,N,...) N -#define PP_RSEQ_N() \ - 63,62,61,60, \ - 59,58,57,56,55,54,53,52,51,50, \ - 49,48,47,46,45,44,43,42,41,40, \ - 39,38,37,36,35,34,33,32,31,30, \ - 29,28,27,26,25,24,23,22,21,20, \ - 19,18,17,16,15,14,13,12,11,10, \ - 9,8,7,6,5,4,3,2,1,0 // assertions #ifndef ASSERT @@ -136,12 +114,12 @@ #else // Note: message says "assert" rather than "vmassert" for backward // compatibility with tools that parse/match the message text. -#define vmassert(p, ...) \ -do { \ - if (!(p)) { \ - report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", PP_NARG(__VA_ARGS__), __VA_ARGS__); \ - BREAKPOINT; \ - } \ +#define vmassert(p, ...) \ +do { \ + if (!(p)) { \ + report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", __VA_ARGS__); \ + BREAKPOINT; \ + } \ } while (0) #endif @@ -165,49 +143,49 @@ // guarantee is like vmassert except it's always executed -- use it for // cheap tests that catch errors that would otherwise be hard to find. // guarantee is also used for Verify options. -#define guarantee(p, ...) \ -do { \ - if (!(p)) { \ - report_vm_error(__FILE__, __LINE__, "guarantee(" #p ") failed", PP_NARG(__VA_ARGS__), __VA_ARGS__); \ - BREAKPOINT; \ - } \ +#define guarantee(p, ...) \ +do { \ + if (!(p)) { \ + report_vm_error(__FILE__, __LINE__, "guarantee(" #p ") failed", __VA_ARGS__); \ + BREAKPOINT; \ + } \ } while (0) -#define fatal(...) \ -do { \ - report_fatal(__FILE__, __LINE__, PP_NARG(__VA_ARGS__), __VA_ARGS__); \ - BREAKPOINT; \ +#define fatal(...) \ +do { \ + report_fatal(__FILE__, __LINE__, __VA_ARGS__); \ + BREAKPOINT; \ } while (0) // out of memory -#define vm_exit_out_of_memory(size, vm_err_type, ...) \ -do { \ - report_vm_out_of_memory(__FILE__, __LINE__, size, vm_err_type, PP_NARG(__VA_ARGS__), __VA_ARGS__); \ - BREAKPOINT; \ +#define vm_exit_out_of_memory(size, vm_err_type, ...) \ +do { \ + report_vm_out_of_memory(__FILE__, __LINE__, size, vm_err_type, __VA_ARGS__); \ + BREAKPOINT; \ } while (0) -#define ShouldNotCallThis() \ -do { \ - report_should_not_call(__FILE__, __LINE__); \ - BREAKPOINT; \ +#define ShouldNotCallThis() \ +do { \ + report_should_not_call(__FILE__, __LINE__); \ + BREAKPOINT; \ } while (0) -#define ShouldNotReachHere() \ -do { \ - report_should_not_reach_here(__FILE__, __LINE__); \ - BREAKPOINT; \ +#define ShouldNotReachHere() \ +do { \ + report_should_not_reach_here(__FILE__, __LINE__); \ + BREAKPOINT; \ } while (0) -#define Unimplemented() \ -do { \ - report_unimplemented(__FILE__, __LINE__); \ - BREAKPOINT; \ +#define Unimplemented() \ +do { \ + report_unimplemented(__FILE__, __LINE__); \ + BREAKPOINT; \ } while (0) -#define Untested(msg) \ -do { \ - report_untested(__FILE__, __LINE__, msg); \ - BREAKPOINT; \ +#define Untested(msg) \ +do { \ + report_untested(__FILE__, __LINE__, msg); \ + BREAKPOINT; \ } while (0); @@ -219,10 +197,12 @@ }; // error reporting helper functions -void report_vm_error(const char* file, int line, const char* error_msg, int nargs, ...); -void report_fatal(const char* file, int line, int nargs, ...); -void report_vm_out_of_memory(const char* file, int line, size_t size, - VMErrorType vm_err_type, int nargs, ...); +void report_vm_error(const char* file, int line, const char* error_msg); +void report_vm_error(const char* file, int line, const char* error_msg, + const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5); +void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4); +void report_vm_out_of_memory(const char* file, int line, size_t size, VMErrorType vm_err_type, + const char* detail_fmt, ...) ATTRIBUTE_PRINTF(5, 6); void report_should_not_call(const char* file, int line); void report_should_not_reach_here(const char* file, int line); void report_unimplemented(const char* file, int line); diff --git a/src/share/vm/utilities/globalDefinitions.cpp b/src/share/vm/utilities/globalDefinitions.cpp --- a/src/share/vm/utilities/globalDefinitions.cpp +++ b/src/share/vm/utilities/globalDefinitions.cpp @@ -50,7 +50,7 @@ uint64_t OopEncodingHeapMax = 0; void basic_fatal(const char* msg) { - fatal(msg); + fatal("%s", msg); } // Something to help porters sleep at night 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 @@ -71,108 +71,6 @@ (const char *)0 }; -// Fatal error handler for internal errors and crashes. -// -// The default behavior of fatal error handler is to print a brief message -// to standard out (defaultStream::output_fd()), then save detailed information -// into an error report file (hs_err_pid.log) and abort VM. If multiple -// threads are having troubles at the same time, only one error is reported. -// The thread that is reporting error will abort VM when it is done, all other -// threads are blocked forever inside report_and_die(). - -// Constructor for crashes -VMError::VMError(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context) { - _thread = thread; - _id = sig; - _pc = pc; - _siginfo = siginfo; - _context = context; - - _verbose = false; - _current_step = 0; - _current_step_info = NULL; - - _message = NULL; - _detail_msg = NULL; - _filename = NULL; - _lineno = 0; - - _size = 0; -} - -// Constructor for internal errors -VMError::VMError(Thread* thread, const char* filename, int lineno, - const char* message, const char * detail_msg) -{ - _thread = thread; - _id = INTERNAL_ERROR; // Value that's not an OS exception/signal - _filename = filename; - _lineno = lineno; - _message = message; - _detail_msg = detail_msg; - - _verbose = false; - _current_step = 0; - _current_step_info = NULL; - - _pc = NULL; - _siginfo = NULL; - _context = NULL; - - _size = 0; -} - -// Constructor for OOM errors -VMError::VMError(Thread* thread, const char* filename, int lineno, size_t size, - VMErrorType vm_err_type, const char* message) { - _thread = thread; - _id = vm_err_type; // Value that's not an OS exception/signal - _filename = filename; - _lineno = lineno; - _message = message; - _detail_msg = NULL; - - _verbose = false; - _current_step = 0; - _current_step_info = NULL; - - _pc = NULL; - _siginfo = NULL; - _context = NULL; - - _size = size; -} - - -// Constructor for non-fatal errors -VMError::VMError(const char* message) { - _thread = NULL; - _id = INTERNAL_ERROR; // Value that's not an OS exception/signal - _filename = NULL; - _lineno = 0; - _message = message; - _detail_msg = NULL; - - _verbose = false; - _current_step = 0; - _current_step_info = NULL; - - _pc = NULL; - _siginfo = NULL; - _context = NULL; - - _size = 0; -} - -// -XX:OnError=, where can be a list of commands, separated -// by ';'. "%p" is replaced by current process id (pid); "%%" is replaced by -// a single "%". Some examples: -// -// -XX:OnError="pmap %p" // show memory map -// -XX:OnError="gcore %p; dbx - %p" // dump core and launch debugger -// -XX:OnError="cat hs_err_pid%p.log | mail my_email@sun.com" -// -XX:OnError="kill -9 %p" // ?#!@# - // A simple parser for -XX:OnError, usage: // ptr = OnError; // while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr) != NULL) @@ -196,7 +94,6 @@ return buf; } - static void print_bug_submit_message(outputStream *out, Thread *thread) { if (out == NULL) return; out->print_raw_cr("# If you would like to submit a bug report, please visit:"); @@ -223,38 +120,44 @@ coredump_message[sizeof(coredump_message)-1] = 0; } - // Return a string to describe the error -char* VMError::error_string(char* buf, int buflen) { +char* VMError::error_string(char* buf, int buflen, int id, const char* message, const char* detail_fmt, + va_list detail_args, address pc, const char* filename, int lineno) +{ char signame_buf[64]; - const char *signame = os::exception_name(_id, signame_buf, sizeof(signame_buf)); + const char *signame = os::exception_name(id, signame_buf, sizeof(signame_buf)); if (signame) { jio_snprintf(buf, buflen, "%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=" UINTX_FORMAT, - signame, _id, _pc, + signame, id, pc, os::current_process_id(), os::current_thread_id()); - } else if (_filename != NULL && _lineno > 0) { + } else if (filename != NULL && lineno > 0) { // skip directory names char separator = os::file_separator()[0]; - const char *p = strrchr(_filename, separator); + const char *p = strrchr(filename, separator); int n = jio_snprintf(buf, buflen, "Internal Error at %s:%d, pid=%d, tid=" UINTX_FORMAT, - p ? p + 1 : _filename, _lineno, + p ? p + 1 : filename, lineno, os::current_process_id(), os::current_thread_id()); - if (n >= 0 && n < buflen && _message) { - if (_detail_msg) { - jio_snprintf(buf + n, buflen - n, "%s%s: %s", - os::line_separator(), _message, _detail_msg); + if (n >= 0 && n < buflen && message) { + if (detail_fmt) { + int d = jio_snprintf(buf + n, buflen - n, "%s%s: ", os::line_separator(), message); + if (d >= 0) { + n += d; + if (n < buflen) { + jio_vsnprintf(buf + n, buflen - n, detail_fmt, detail_args); + } + } } else { jio_snprintf(buf + n, buflen - n, "%sError: %s", - os::line_separator(), _message); + os::line_separator(), message); } } } else { jio_snprintf(buf, buflen, "Internal Error (0x%x), pid=%d, tid=" UINTX_FORMAT, - _id, os::current_process_id(), os::current_thread_id()); + id, os::current_process_id(), os::current_thread_id()); } return buf; @@ -357,7 +260,13 @@ // thread can report error, so large buffers are statically allocated in data // segment. -void VMError::report(outputStream* st) { +int VMError::_current_step; +const char* VMError::_current_step_info; +int VMError::_verbose; + +void VMError::report(outputStream* st, int id, const char* message, const char* detail_fmt, + va_list detail_args, Thread* thread, address pc, void* siginfo, void* context, + const char* filename, int lineno, size_t size) { # define BEGIN if (_current_step == 0) { _current_step = 1; # define STEP(n, s) } if (_current_step < n) { _current_step = n; _current_step_info = s; # define END } @@ -370,7 +279,7 @@ STEP(10, "(printing fatal error message)") st->print_cr("#"); - if (should_report_bug(_id)) { + if (should_report_bug(id)) { st->print_cr("# A fatal error has been detected by the Java Runtime Environment:"); } else { st->print_cr("# There is insufficient memory for the Java " @@ -419,25 +328,25 @@ STEP(50, "(printing type of error)") - switch(_id) { + switch(id) { case OOM_MALLOC_ERROR: case OOM_MMAP_ERROR: - if (_size) { + if (size) { st->print("# Native memory allocation "); - st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " : + st->print((id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " : "(mmap) failed to map "); - jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); + jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, size); st->print("%s", buf); st->print(" bytes"); - if (_message != NULL) { + if (detail_fmt != NULL) { st->print(" for "); - st->print("%s", _message); + st->vprint(detail_fmt, detail_args); } st->cr(); } else { - if (_message != NULL) { + if (detail_fmt != NULL) { st->print("# "); - st->print_cr("%s", _message); + st->vprint_cr(detail_fmt, detail_args); } } // In error file give some solutions @@ -457,28 +366,28 @@ st->print_cr("#"); st->print("# "); // Is it an OS exception/signal? - if (os::exception_name(_id, buf, sizeof(buf))) { + 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(" (0x%x)", id); // signal number + st->print(" at pc=" PTR_FORMAT, pc); } else { - if (should_report_bug(_id)) { + if (should_report_bug(id)) { st->print("Internal Error"); } else { st->print("Out of Memory Error"); } - if (_filename != NULL && _lineno > 0) { + if (filename != NULL && lineno > 0) { #ifdef PRODUCT // In product mode chop off pathname? char separator = os::file_separator()[0]; - const char *p = strrchr(_filename, separator); - const char *file = p ? p+1 : _filename; + const char *p = strrchr(filename, separator); + const char *file = p ? p+1 : filename; #else - const char *file = _filename; + const char *file = filename; #endif - st->print(" (%s:%d)", file, _lineno); + st->print(" (%s:%d)", file, lineno); } else { - st->print(" (0x%x)", _id); + st->print(" (0x%x)", id); } } @@ -491,12 +400,13 @@ STEP(80, "(printing error message)") - if (should_report_bug(_id)) { // already printed the message. + if (should_report_bug(id)) { // already printed the message. // error message - if (_detail_msg) { - st->print_cr("# %s: %s", _message ? _message : "Error", _detail_msg); - } else if (_message) { - st->print_cr("# Error: %s", _message); + if (detail_fmt) { + st->print("# %s: ", message ? message : "Error"); + st->vprint_cr(detail_fmt, detail_args); + } else if (message) { + st->print_cr("# Error: %s", message); } } @@ -524,10 +434,10 @@ STEP(100, "(printing problematic frame)") // Print current frame if we have a context (i.e. it's a crash) - if (_context) { + if (context) { st->print_cr("# Problematic frame:"); st->print("# "); - frame fr = os::fetch_frame_from_context(_context); + frame fr = os::fetch_frame_from_context(context); fr.print_on_error(st, buf, sizeof(buf)); st->cr(); st->print_cr("#"); @@ -549,8 +459,8 @@ STEP(120, "(printing bug submit message)") - if (should_report_bug(_id) && _verbose) { - print_bug_submit_message(st, _thread); + if (should_report_bug(id) && _verbose) { + print_bug_submit_message(st, thread); } STEP(130, "(printing summary)" ) @@ -594,9 +504,9 @@ // current thread if (_verbose) { - if (_thread) { - st->print("Current thread (" PTR_FORMAT "): ", _thread); - _thread->print_on_error(st, buf, sizeof(buf)); + if (thread) { + st->print("Current thread (" PTR_FORMAT "): ", thread); + thread->print_on_error(st, buf, sizeof(buf)); st->cr(); } else { st->print_cr("Current thread is native thread"); @@ -606,8 +516,8 @@ STEP(190, "(printing current compile task)" ) - if (_verbose && _thread && _thread->is_Compiler_thread()) { - CompilerThread* t = (CompilerThread*)_thread; + if (_verbose && thread && thread->is_Compiler_thread()) { + CompilerThread* t = (CompilerThread*)thread; if (t->task()) { st->cr(); st->print_cr("Current CompileTask:"); @@ -625,9 +535,9 @@ address stack_top; size_t stack_size; - if (_thread) { - stack_top = _thread->stack_base(); - stack_size = _thread->stack_size(); + if (thread) { + stack_top = thread->stack_base(); + stack_size = thread->stack_size(); } else { stack_top = os::current_stack_base(); stack_size = os::current_stack_size(); @@ -636,7 +546,7 @@ address stack_bottom = stack_top - stack_size; st->print("[" PTR_FORMAT "," PTR_FORMAT "]", stack_bottom, stack_top); - frame fr = _context ? os::fetch_frame_from_context(_context) + frame fr = context ? os::fetch_frame_from_context(context) : os::current_frame(); if (fr.sp()) { @@ -651,28 +561,28 @@ STEP(210, "(printing native stack)" ) if (_verbose) { - if (os::platform_print_native_stack(st, _context, buf, sizeof(buf))) { + if (os::platform_print_native_stack(st, context, buf, sizeof(buf))) { // We have printed the native stack in platform-specific code // Windows/x64 needs special handling. } else { - frame fr = _context ? os::fetch_frame_from_context(_context) - : os::current_frame(); + frame fr = context ? os::fetch_frame_from_context(context) + : os::current_frame(); - print_native_stack(st, fr, _thread, buf, sizeof(buf)); + print_native_stack(st, fr, thread, buf, sizeof(buf)); } } STEP(220, "(printing Java stack)" ) - if (_verbose && _thread && _thread->is_Java_thread()) { - print_stack_trace(st, (JavaThread*)_thread, buf, sizeof(buf)); + if (_verbose && thread && thread->is_Java_thread()) { + print_stack_trace(st, (JavaThread*)thread, buf, sizeof(buf)); } STEP(230, "(printing target Java thread stack)" ) // printing Java thread stack trace if it is involved in GC crash - if (_verbose && _thread && (_thread->is_Named_thread())) { - JavaThread* jt = ((NamedThread *)_thread)->processed_thread(); + 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()); print_stack_trace(st, jt, buf, sizeof(buf), true); @@ -682,32 +592,32 @@ STEP(240, "(printing siginfo)" ) // signal no, signal code, address that caused the fault - if (_verbose && _siginfo) { + if (_verbose && siginfo) { st->cr(); - os::print_siginfo(st, _siginfo); + os::print_siginfo(st, siginfo); st->cr(); } STEP(250, "(printing register info)") // decode register contents if possible - if (_verbose && _context && Universe::is_fully_initialized()) { - os::print_register_info(st, _context); + if (_verbose && context && Universe::is_fully_initialized()) { + os::print_register_info(st, context); st->cr(); } STEP(260, "(printing registers, top of stack, instructions near pc)") // registers, top of stack, instructions near pc - if (_verbose && _context) { - os::print_context(st, _context); + if (_verbose && context) { + os::print_context(st, context); st->cr(); } STEP(270, "(printing VM operation)" ) - if (_verbose && _thread && _thread->is_VM_thread()) { - VMThread* t = (VMThread*)_thread; + if (_verbose && thread && thread->is_VM_thread()) { + VMThread* t = (VMThread*)thread; VM_Operation* op = t->vm_operation(); if (op) { op->print_on_error(st); @@ -727,8 +637,8 @@ STEP(290, "(printing all threads)" ) // all threads - if (_verbose && _thread) { - Threads::print_on_error(st, _thread, buf, sizeof(buf)); + if (_verbose && thread) { + Threads::print_on_error(st, thread, buf, sizeof(buf)); st->cr(); } @@ -896,7 +806,6 @@ # undef END } -VMError* volatile VMError::first_error = NULL; volatile jlong VMError::first_error_tid = -1; // An error could happen before tty is initialized or after it has been @@ -958,7 +867,48 @@ return fd; } -void VMError::report_and_die() { +void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, + void* context, const char* detail_fmt, ...) +{ + va_list detail_args; + va_start(detail_args, detail_fmt); + report_and_die(sig, NULL, detail_fmt, detail_args, thread, pc, siginfo, context, NULL, 0, 0); + va_end(detail_args); +} + +void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context) +{ + report_and_die(thread, sig, pc, siginfo, context, "%s", ""); +} + +void VMError::report_and_die(const char* message, const char* detail_fmt, ...) +{ + va_list detail_args; + va_start(detail_args, detail_fmt); + report_and_die(INTERNAL_ERROR, message, detail_fmt, detail_args, NULL, NULL, NULL, NULL, NULL, 0, 0); + va_end(detail_args); +} + +void VMError::report_and_die(const char* message) +{ + report_and_die(message, "%s", ""); +} + +void VMError::report_and_die(Thread* thread, const char* filename, int lineno, const char* message, + const char* detail_fmt, va_list detail_args) +{ + report_and_die(INTERNAL_ERROR, message, detail_fmt, detail_args, thread, NULL, NULL, NULL, filename, lineno, 0); +} + +void VMError::report_and_die(Thread* thread, const char* filename, int lineno, size_t size, + VMErrorType vm_err_type, const char* detail_fmt, va_list detail_args) { + report_and_die(vm_err_type, NULL, detail_fmt, detail_args, thread, NULL, NULL, NULL, filename, lineno, size); +} + +void VMError::report_and_die(int id, const char* message, const char* detail_fmt, va_list detail_args, + Thread* thread, address pc, void* siginfo, void* context, const char* filename, + int lineno, size_t size) +{ // Don't allocate large buffer on stack static char buffer[O_BUFLEN]; @@ -975,15 +925,17 @@ os::abort(CreateCoredumpOnCrash); } jlong mytid = os::current_thread_id(); - if (first_error == NULL && - Atomic::cmpxchg_ptr(this, &first_error, NULL) == NULL) { + if (first_error_tid == -1 && + Atomic::cmpxchg(mytid, &first_error_tid, -1) == -1) { // first time - first_error_tid = mytid; set_error_reported(); if (ShowMessageBoxOnError || PauseAtExit) { - show_message_box(buffer, sizeof(buffer)); + va_list tmp_args; + va_copy(tmp_args, detail_args); + show_message_box(buffer, sizeof(buffer), id, message, detail_fmt, tmp_args, pc, filename, lineno); + va_end(tmp_args); // User has asked JVM to abort. Reset ShowMessageBoxOnError so the // WatcherThread can kill JVM if the error handler hangs. @@ -1022,8 +974,7 @@ jio_snprintf(buffer, sizeof(buffer), "[error occurred during error reporting %s, id 0x%x]", - first_error ? first_error->_current_step_info : "", - _id); + _current_step_info, id); if (log.is_open()) { log.cr(); log.print_raw_cr(buffer); @@ -1038,20 +989,23 @@ // print to screen if (!out_done) { - first_error->_verbose = false; + _verbose = false; staticBufferStream sbs(buffer, sizeof(buffer), &out); - first_error->report(&sbs); + va_list tmp_args; + va_copy(tmp_args, detail_args); + report(&sbs, id, message, detail_fmt, tmp_args, thread, pc, siginfo, context, filename, lineno, size); + va_end(tmp_args); out_done = true; - first_error->_current_step = 0; // reset current_step - first_error->_current_step_info = ""; // reset current_step string + _current_step = 0; // reset current_step + _current_step_info = ""; // reset current_step string } // print to error log file if (!log_done) { - first_error->_verbose = true; + _verbose = true; // see if log file is already open if (!log.is_open()) { @@ -1072,12 +1026,15 @@ } staticBufferStream sbs(buffer, O_BUFLEN, &log); - first_error->report(&sbs); - first_error->_current_step = 0; // reset current_step - first_error->_current_step_info = ""; // reset current_step string + va_list tmp_args; + va_copy(tmp_args, detail_args); + report(&sbs, id, message, detail_fmt, tmp_args, thread, pc, siginfo, context, filename, lineno, size); + va_end(tmp_args); + _current_step = 0; // reset current_step + _current_step_info = ""; // reset current_step string // Run error reporting to determine whether or not to report the crash. - if (!transmit_report_done && should_report_bug(first_error->_id)) { + if (!transmit_report_done && should_report_bug(id)) { transmit_report_done = true; const int fd2 = ::dup(log.fd()); FILE* const hs_err = ::fdopen(fd2, "r"); @@ -1129,7 +1086,7 @@ } static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay - if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) { + if (DumpReplayDataOnError && thread && thread->is_Compiler_thread() && !skip_replay) { skip_replay = true; ciEnv* env = ciEnv::current(); if (env != NULL) { @@ -1149,12 +1106,12 @@ } } - static bool skip_bug_url = !should_report_bug(first_error->_id); + static bool skip_bug_url = !should_report_bug(id); if (!skip_bug_url) { skip_bug_url = true; out.print_raw_cr("#"); - print_bug_submit_message(&out, _thread); + print_bug_submit_message(&out, thread); } if (!UseOSErrorReporting) { @@ -1162,8 +1119,8 @@ static bool skip_os_abort = false; if (!skip_os_abort) { skip_os_abort = true; - bool dump_core = should_report_bug(first_error->_id); - os::abort(dump_core && CreateCoredumpOnCrash, _siginfo, _context); + bool dump_core = should_report_bug(id); + os::abort(dump_core && CreateCoredumpOnCrash, siginfo, context); } // if os::abort() doesn't abort, try os::die(); @@ -1177,10 +1134,10 @@ */ class VM_ReportJavaOutOfMemory : public VM_Operation { private: - VMError *_err; + const char* _message; public: - VM_ReportJavaOutOfMemory(VMError *err) { _err = err; } - VMOp_Type type() const { return VMOp_ReportJavaOutOfMemory; } + VM_ReportJavaOutOfMemory(const char* message) { _message = message; } + VMOp_Type type() const { return VMOp_ReportJavaOutOfMemory; } void doit(); }; @@ -1189,7 +1146,7 @@ static char buffer[O_BUFLEN]; tty->print_cr("#"); - tty->print_cr("# java.lang.OutOfMemoryError: %s", _err->message()); + tty->print_cr("# java.lang.OutOfMemoryError: %s", _message); tty->print_cr("# -XX:OnOutOfMemoryError=\"%s\"", OnOutOfMemoryError); // make heap parsability @@ -1212,10 +1169,10 @@ } } -void VMError::report_java_out_of_memory() { +void VMError::report_java_out_of_memory(const char* message) { if (OnOutOfMemoryError && OnOutOfMemoryError[0]) { MutexLocker ml(Heap_lock); - VM_ReportJavaOutOfMemory op(this); + VM_ReportJavaOutOfMemory op(message); VMThread::execute(&op); } } diff --git a/src/share/vm/utilities/vmError.hpp b/src/share/vm/utilities/vmError.hpp --- a/src/share/vm/utilities/vmError.hpp +++ b/src/share/vm/utilities/vmError.hpp @@ -30,38 +30,16 @@ class Decoder; class VM_ReportJavaOutOfMemory; -class VMError : public StackObj { +class VMError : public AllStatic { friend class VM_ReportJavaOutOfMemory; friend class Decoder; - int _id; // Solaris/Linux signals: 0 - SIGRTMAX - // Windows exceptions: 0xCxxxxxxx system errors - // 0x8xxxxxxx system warnings - - const char * _message; - const char * _detail_msg; - - Thread * _thread; // NULL if it's native thread - - - // additional info for crashes - address _pc; // faulting PC - void * _siginfo; // ExceptionRecord on Windows, - // siginfo_t on Solaris/Linux - void * _context; // ContextRecord on Windows, - // ucontext_t on Solaris/Linux - - // additional info for VM internal errors - const char * _filename; - int _lineno; - // used by fatal error handler - int _current_step; - const char * _current_step_info; - int _verbose; - // First error, and its thread id. We must be able to handle native thread, + static int _current_step; + static const char * _current_step_info; + static int _verbose; + // Thread id of the first error. We must be able to handle native thread, // so use thread id instead of Thread* to identify thread. - static VMError* volatile first_error; static volatile jlong first_error_tid; // Core dump status, false if we have been unable to write a core/minidump for some reason @@ -72,18 +50,20 @@ // no core/minidump has been written to disk static char coredump_message[O_BUFLEN]; - // used by reporting about OOM - size_t _size; // set signal handlers on Solaris/Linux or the default exception filter // on Windows, to handle recursive crashes. - void reset_signal_handlers(); + static void reset_signal_handlers(); // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string - void show_message_box(char* buf, int buflen); + static void show_message_box(char* buf, int buflen, int id, const char* message, + const char* detail_fmt, va_list detail_args, address pc, + const char* filename, int lineno) ATTRIBUTE_PRINTF(5, 0); // generate an error report - void report(outputStream* st); + static void report(outputStream* st, int id, const char* message, const char* detail_fmt, + va_list detail_msg_args, Thread* thread, address pc, void* siginfo, + void* context, const char* filename, int lineno, size_t size) ATTRIBUTE_PRINTF(4, 0); // generate a stack trace static void print_stack_trace(outputStream* st, JavaThread* jt, @@ -92,42 +72,73 @@ static const char* gc_mode(); static void print_oom_reasons(outputStream* st); - // accessor - const char* message() const { return _message; } - const char* detail_msg() const { return _detail_msg; } - bool should_report_bug(unsigned int id) { + static bool should_report_bug(unsigned int id) { return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR); } + static void report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, + void* context, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(6, 7); + static void report_and_die(const char* message, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(2, 3); + static fdStream out; static fdStream log; // error log used by VMError::report_and_die() public: - // Constructor for crashes - VMError(Thread* thread, unsigned int sig, address pc, void* siginfo, - void* context); - // Constructor for VM internal errors - VMError(Thread* thread, const char* filename, int lineno, - const char* message, const char * detail_msg); - - // Constructor for VM OOM errors - VMError(Thread* thread, const char* filename, int lineno, size_t size, - VMErrorType vm_err_type, const char* message); - // Constructor for non-fatal errors - VMError(const char* message); - // return a string to describe the error - char *error_string(char* buf, int buflen); + static char* error_string(char* buf, int buflen, int id, const char* message, + const char* detail_fmt, va_list detail_args, address pc, + const char* filename, int lineno) ATTRIBUTE_PRINTF(5, 0); // Record status of core/minidump static void record_coredump_status(const char* message, bool status); - // main error reporting function - void report_and_die(); + /** + * main error reporting function + * + * int id; // Solaris/Linux signals: 0 - SIGRTMAX + * // Windows exceptions: 0xCxxxxxxx system errors + * // 0x8xxxxxxx system warnings + * const char* message; + * const char* detail_fmt; + * va_list detail_args; + * Thread* thread; // NULL if it's native thread + * + * additional info for crashes + * + * address pc; // faulting PC + * void* siginfo; // ExceptionRecord on Windows, + * // siginfo_t on Solaris/Linux + * void* context; // ContextRecord on Windows, + * // ucontext_t on Solaris/Linux + * + * additional info for VM internal errors + * + * const char* filename; + * int lineno; + * + * used by reporting about OOM + * + * size_t size; + */ + static void report_and_die(int id, const char* message, const char* detail_fmt, va_list detail_args, + Thread* thread, address pc, void* siginfo, void* context, + const char* filename, int lineno, size_t size) ATTRIBUTE_PRINTF(3, 0); + + static void report_and_die(Thread* thread, unsigned int sig, address pc, + void* siginfo, void* context); + + static void report_and_die(Thread* thread,const char* filename, int lineno, const char* message, + const char* detail_fmt, va_list detail_args) ATTRIBUTE_PRINTF(5, 0); + + static void report_and_die(Thread* thread, const char* filename, int lineno, size_t size, + VMErrorType vm_err_type, const char* detail_fmt, + va_list detail_args) ATTRIBUTE_PRINTF(6, 0); + + static void report_and_die(const char* message); // reporting OutOfMemoryError - void report_java_out_of_memory(); + static void report_java_out_of_memory(const char* message); // returns original flags for signal, if it was resetted, or -1 if // signal was not changed by error reporter @@ -138,7 +149,7 @@ static address get_resetted_sighandler(int sig); // check to see if fatal error reporting is in progress - static bool fatal_error_in_progress() { return first_error != NULL; } + static bool fatal_error_in_progress() { return first_error_tid != -1; } static jlong get_first_error_tid() { return first_error_tid;