# HG changeset patch # User trims # Date 1273270348 25200 # Node ID 80ccc94456b2ca63a1532e4fe87eab0b7418aa2a # Parent fd3de71345741706fdc2f64c20f37a8da432cd8d# Parent 5dabb4e733801cd8c5e37b4ed9aef1b3084630ce Merge diff -r fd3de7134574 -r 80ccc94456b2 make/jprt.properties --- a/make/jprt.properties Thu May 06 18:25:58 2010 -0700 +++ b/make/jprt.properties Fri May 07 15:12:28 2010 -0700 @@ -51,6 +51,8 @@ jprt.my.solaris.sparc.jdk6perf=solaris_sparc_5.8 jprt.my.solaris.sparc.jdk6u10=solaris_sparc_5.8 jprt.my.solaris.sparc.jdk6u14=solaris_sparc_5.8 +jprt.my.solaris.sparc.jdk6u18=solaris_sparc_5.8 +jprt.my.solaris.sparc.jdk6u20=solaris_sparc_5.8 jprt.my.solaris.sparc=${jprt.my.solaris.sparc.${jprt.tools.default.release}} jprt.my.solaris.sparcv9.jdk7=solaris_sparcv9_5.10 @@ -58,6 +60,8 @@ jprt.my.solaris.sparcv9.jdk6perf=solaris_sparcv9_5.8 jprt.my.solaris.sparcv9.jdk6u10=solaris_sparcv9_5.8 jprt.my.solaris.sparcv9.jdk6u14=solaris_sparcv9_5.8 +jprt.my.solaris.sparcv9.jdk6u18=solaris_sparcv9_5.8 +jprt.my.solaris.sparcv9.jdk6u20=solaris_sparcv9_5.8 jprt.my.solaris.sparcv9=${jprt.my.solaris.sparcv9.${jprt.tools.default.release}} jprt.my.solaris.i586.jdk7=solaris_i586_5.10 @@ -65,6 +69,8 @@ jprt.my.solaris.i586.jdk6perf=solaris_i586_5.8 jprt.my.solaris.i586.jdk6u10=solaris_i586_5.8 jprt.my.solaris.i586.jdk6u14=solaris_i586_5.8 +jprt.my.solaris.i586.jdk6u18=solaris_i586_5.8 +jprt.my.solaris.i586.jdk6u20=solaris_i586_5.8 jprt.my.solaris.i586=${jprt.my.solaris.i586.${jprt.tools.default.release}} jprt.my.solaris.x64.jdk7=solaris_x64_5.10 @@ -72,6 +78,8 @@ jprt.my.solaris.x64.jdk6perf=solaris_x64_5.10 jprt.my.solaris.x64.jdk6u10=solaris_x64_5.10 jprt.my.solaris.x64.jdk6u14=solaris_x64_5.10 +jprt.my.solaris.x64.jdk6u18=solaris_x64_5.10 +jprt.my.solaris.x64.jdk6u20=solaris_x64_5.10 jprt.my.solaris.x64=${jprt.my.solaris.x64.${jprt.tools.default.release}} jprt.my.linux.i586.jdk7=linux_i586_2.6 @@ -79,6 +87,8 @@ jprt.my.linux.i586.jdk6perf=linux_i586_2.4 jprt.my.linux.i586.jdk6u10=linux_i586_2.4 jprt.my.linux.i586.jdk6u14=linux_i586_2.4 +jprt.my.linux.i586.jdk6u18=linux_i586_2.4 +jprt.my.linux.i586.jdk6u20=linux_i586_2.4 jprt.my.linux.i586=${jprt.my.linux.i586.${jprt.tools.default.release}} jprt.my.linux.x64.jdk7=linux_x64_2.6 @@ -86,6 +96,8 @@ jprt.my.linux.x64.jdk6perf=linux_x64_2.4 jprt.my.linux.x64.jdk6u10=linux_x64_2.4 jprt.my.linux.x64.jdk6u14=linux_x64_2.4 +jprt.my.linux.x64.jdk6u18=linux_x64_2.4 +jprt.my.linux.x64.jdk6u20=linux_x64_2.4 jprt.my.linux.x64=${jprt.my.linux.x64.${jprt.tools.default.release}} jprt.my.windows.i586.jdk7=windows_i586_5.0 @@ -93,6 +105,8 @@ jprt.my.windows.i586.jdk6perf=windows_i586_5.0 jprt.my.windows.i586.jdk6u10=windows_i586_5.0 jprt.my.windows.i586.jdk6u14=windows_i586_5.0 +jprt.my.windows.i586.jdk6u18=windows_i586_5.0 +jprt.my.windows.i586.jdk6u20=windows_i586_5.0 jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}} jprt.my.windows.x64.jdk7=windows_x64_5.2 @@ -100,6 +114,8 @@ jprt.my.windows.x64.jdk6perf=windows_x64_5.2 jprt.my.windows.x64.jdk6u10=windows_x64_5.2 jprt.my.windows.x64.jdk6u14=windows_x64_5.2 +jprt.my.windows.x64.jdk6u18=windows_x64_5.2 +jprt.my.windows.x64.jdk6u20=windows_x64_5.2 jprt.my.windows.x64=${jprt.my.windows.x64.${jprt.tools.default.release}} # Standard list of jprt build targets for this source tree diff -r fd3de7134574 -r 80ccc94456b2 src/cpu/sparc/vm/assembler_sparc.cpp --- a/src/cpu/sparc/vm/assembler_sparc.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/cpu/sparc/vm/assembler_sparc.cpp Fri May 07 15:12:28 2010 -0700 @@ -4082,7 +4082,7 @@ // make it work. static void check_index(int ind) { assert(0 <= ind && ind <= 64*K && ((ind % oopSize) == 0), - "Invariants.") + "Invariants."); } static void generate_satb_log_enqueue(bool with_frame) { diff -r fd3de7134574 -r 80ccc94456b2 src/cpu/sparc/vm/assembler_sparc.hpp --- a/src/cpu/sparc/vm/assembler_sparc.hpp Thu May 06 18:25:58 2010 -0700 +++ b/src/cpu/sparc/vm/assembler_sparc.hpp Fri May 07 15:12:28 2010 -0700 @@ -1062,7 +1062,7 @@ } void assert_not_delayed(const char* msg) { #ifdef CHECK_DELAY - assert_msg ( delay_state == no_delay, msg); + assert(delay_state == no_delay, msg); #endif } diff -r fd3de7134574 -r 80ccc94456b2 src/cpu/x86/vm/assembler_x86.cpp --- a/src/cpu/x86/vm/assembler_x86.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/cpu/x86/vm/assembler_x86.cpp Fri May 07 15:12:28 2010 -0700 @@ -7975,7 +7975,7 @@ case 2: return "special"; case 3: return "empty"; } - ShouldNotReachHere() + ShouldNotReachHere(); return NULL; } diff -r fd3de7134574 -r 80ccc94456b2 src/cpu/x86/vm/c1_LIRAssembler_x86.cpp --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Fri May 07 15:12:28 2010 -0700 @@ -2838,7 +2838,7 @@ // On 64bit this will die since it will take a movq & jmp, must be only a jmp __ jump(RuntimeAddress(__ pc())); - assert(__ offset() - start <= call_stub_size, "stub too big") + assert(__ offset() - start <= call_stub_size, "stub too big"); __ end_a_stub(); } diff -r fd3de7134574 -r 80ccc94456b2 src/cpu/x86/vm/frame_x86.cpp --- a/src/cpu/x86/vm/frame_x86.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/cpu/x86/vm/frame_x86.cpp Fri May 07 15:12:28 2010 -0700 @@ -291,8 +291,8 @@ BasicObjectLock* frame::interpreter_frame_monitor_end() const { BasicObjectLock* result = (BasicObjectLock*) *addr_at(interpreter_frame_monitor_block_top_offset); // make sure the pointer points inside the frame - assert((intptr_t) fp() > (intptr_t) result, "result must < than frame pointer"); - assert((intptr_t) sp() <= (intptr_t) result, "result must >= than stack pointer"); + assert(sp() <= (intptr_t*) result, "monitor end should be above the stack pointer"); + assert((intptr_t*) result < fp(), "monitor end should be strictly below the frame pointer"); return result; } diff -r fd3de7134574 -r 80ccc94456b2 src/os/linux/vm/os_linux.cpp --- a/src/os/linux/vm/os_linux.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/os/linux/vm/os_linux.cpp Fri May 07 15:12:28 2010 -0700 @@ -3495,7 +3495,8 @@ // libjsig also interposes the sigaction() call below and saves the // old sigaction on it own. } else { - fatal2("Encountered unexpected pre-existing sigaction handler %#lx for signal %d.", (long)oldhand, sig); + fatal(err_msg("Encountered unexpected pre-existing sigaction handler " + "%#lx for signal %d.", (long)oldhand, sig)); } } @@ -3817,7 +3818,8 @@ Linux::set_page_size(sysconf(_SC_PAGESIZE)); if (Linux::page_size() == -1) { - fatal1("os_linux.cpp: os::init: sysconf failed (%s)", strerror(errno)); + fatal(err_msg("os_linux.cpp: os::init: sysconf failed (%s)", + strerror(errno))); } init_page_sizes((size_t) Linux::page_size()); diff -r fd3de7134574 -r 80ccc94456b2 src/os/solaris/vm/os_solaris.cpp --- a/src/os/solaris/vm/os_solaris.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/os/solaris/vm/os_solaris.cpp Fri May 07 15:12:28 2010 -0700 @@ -1567,7 +1567,8 @@ // treat %g2 as a caller-save register, preserving it in a %lN. thread_key_t tk; if (thr_keycreate( &tk, NULL ) ) - fatal1("os::allocate_thread_local_storage: thr_keycreate failed (%s)", strerror(errno)); + fatal(err_msg("os::allocate_thread_local_storage: thr_keycreate failed " + "(%s)", strerror(errno))); return int(tk); } @@ -1585,7 +1586,8 @@ if (errno == ENOMEM) { vm_exit_out_of_memory(SMALLINT, "thr_setspecific: out of swap space"); } else { - fatal1("os::thread_local_storage_at_put: thr_setspecific failed (%s)", strerror(errno)); + fatal(err_msg("os::thread_local_storage_at_put: thr_setspecific failed " + "(%s)", strerror(errno))); } } else { ThreadLocalStorage::set_thread_in_slot ((Thread *) value) ; @@ -1738,7 +1740,7 @@ jlong os::javaTimeMillis() { timeval t; if (gettimeofday( &t, NULL) == -1) - fatal1("os::javaTimeMillis: gettimeofday (%s)", strerror(errno)); + fatal(err_msg("os::javaTimeMillis: gettimeofday (%s)", strerror(errno))); return jlong(t.tv_sec) * 1000 + jlong(t.tv_usec) / 1000; } @@ -4233,7 +4235,8 @@ // libjsig also interposes the sigaction() call below and saves the // old sigaction on it own. } else { - fatal2("Encountered unexpected pre-existing sigaction handler %#lx for signal %d.", (long)oldhand, sig); + fatal(err_msg("Encountered unexpected pre-existing sigaction handler " + "%#lx for signal %d.", (long)oldhand, sig)); } } @@ -4764,7 +4767,8 @@ page_size = sysconf(_SC_PAGESIZE); if (page_size == -1) - fatal1("os_solaris.cpp: os::init: sysconf failed (%s)", strerror(errno)); + fatal(err_msg("os_solaris.cpp: os::init: sysconf failed (%s)", + strerror(errno))); init_page_sizes((size_t) page_size); Solaris::initialize_system_info(); @@ -4775,7 +4779,7 @@ int fd = open("/dev/zero", O_RDWR); if (fd < 0) { - fatal1("os::init: cannot open /dev/zero (%s)", strerror(errno)); + fatal(err_msg("os::init: cannot open /dev/zero (%s)", strerror(errno))); } else { Solaris::set_dev_zero_fd(fd); diff -r fd3de7134574 -r 80ccc94456b2 src/os/solaris/vm/threadCritical_solaris.cpp --- a/src/os/solaris/vm/threadCritical_solaris.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/os/solaris/vm/threadCritical_solaris.cpp Fri May 07 15:12:28 2010 -0700 @@ -47,7 +47,8 @@ thread_t owner = thr_self(); if (global_mut_owner != owner) { if (os::Solaris::mutex_lock(&global_mut)) - fatal1("ThreadCritical::ThreadCritical: mutex_lock failed (%s)", strerror(errno)); + fatal(err_msg("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"); } @@ -66,7 +67,8 @@ if (global_mut_count == 0) { global_mut_owner = -1; if (os::Solaris::mutex_unlock(&global_mut)) - fatal1("ThreadCritical::~ThreadCritical: mutex_unlock failed (%s)", strerror(errno)); + fatal(err_msg("ThreadCritical::~ThreadCritical: mutex_unlock failed " + "(%s)", strerror(errno))); } } else { assert (Threads::number_of_threads() == 0, "valid only during initialization"); diff -r fd3de7134574 -r 80ccc94456b2 src/os/windows/vm/os_windows.cpp --- a/src/os/windows/vm/os_windows.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/os/windows/vm/os_windows.cpp Fri May 07 15:12:28 2010 -0700 @@ -724,7 +724,7 @@ java_origin.wMilliseconds = 0; FILETIME jot; if (!SystemTimeToFileTime(&java_origin, &jot)) { - fatal1("Error = %d\nWindows error", GetLastError()); + fatal(err_msg("Error = %d\nWindows error", GetLastError())); } _calculated_offset = jlong_from(jot.dwHighDateTime, jot.dwLowDateTime); _has_calculated_offset = 1; @@ -4095,7 +4095,7 @@ } int err = GetLastError(); if (err != ERROR_NO_MORE_ITEMS && err != ERROR_CALL_NOT_IMPLEMENTED) { - fatal1("heap walk aborted with error %d", err); + fatal(err_msg("heap walk aborted with error %d", err)); } HeapUnlock(heap); } diff -r fd3de7134574 -r 80ccc94456b2 src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp --- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Fri May 07 15:12:28 2010 -0700 @@ -153,7 +153,7 @@ if (rslt == ENOMEM) { vm_exit_out_of_memory(0, "pthread_getattr_np"); } else { - fatal1("pthread_getattr_np failed with errno = %d", rslt); + fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt)); } } diff -r fd3de7134574 -r 80ccc94456b2 src/os_cpu/linux_x86/vm/os_linux_x86.cpp --- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Fri May 07 15:12:28 2010 -0700 @@ -680,7 +680,7 @@ if (rslt == ENOMEM) { vm_exit_out_of_memory(0, "pthread_getattr_np"); } else { - fatal1("pthread_getattr_np failed with errno = %d", rslt); + fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt)); } } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/adlc/output_c.cpp --- a/src/share/vm/adlc/output_c.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/adlc/output_c.cpp Fri May 07 15:12:28 2010 -0700 @@ -721,8 +721,8 @@ fprintf(fp_cpp, " }\n"); fprintf(fp_cpp, "#endif\n\n"); #endif - fprintf(fp_cpp, " assert(this, \"NULL pipeline info\")\n"); - fprintf(fp_cpp, " assert(pred, \"NULL predecessor pipline info\")\n\n"); + fprintf(fp_cpp, " assert(this, \"NULL pipeline info\");\n"); + fprintf(fp_cpp, " assert(pred, \"NULL predecessor pipline info\");\n\n"); fprintf(fp_cpp, " if (pred->hasFixedLatency())\n return (pred->fixedLatency());\n\n"); fprintf(fp_cpp, " // If this is not an operand, then assume a dependence with 0 latency\n"); fprintf(fp_cpp, " if (opnd > _read_stage_count)\n return (0);\n\n"); diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/asm/assembler.cpp --- a/src/share/vm/asm/assembler.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/asm/assembler.cpp Fri May 07 15:12:28 2010 -0700 @@ -43,7 +43,8 @@ _code_pos = cs->end(); _oop_recorder= code->oop_recorder(); if (_code_begin == NULL) { - vm_exit_out_of_memory1(0, "CodeCache: no room for %s", code->name()); + vm_exit_out_of_memory(0, err_msg("CodeCache: no room for %s", + code->name())); } } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/classfile/classFileParser.cpp --- a/src/share/vm/classfile/classFileParser.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/classfile/classFileParser.cpp Fri May 07 15:12:28 2010 -0700 @@ -334,7 +334,8 @@ } break; default: - fatal1("bad constant pool tag value %u", cp->tag_at(index).value()); + fatal(err_msg("bad constant pool tag value %u", + cp->tag_at(index).value())); ShouldNotReachHere(); break; } // end of switch diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/classfile/dictionary.cpp --- a/src/share/vm/classfile/dictionary.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/classfile/dictionary.cpp Fri May 07 15:12:28 2010 -0700 @@ -127,7 +127,7 @@ bool Dictionary::do_unloading(BoolObjectClosure* is_alive) { - assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint") + assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); bool class_was_unloaded = false; int index = 0; // Defined here for portability! Do not move diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/classfile/loaderConstraints.cpp --- a/src/share/vm/classfile/loaderConstraints.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/classfile/loaderConstraints.cpp Fri May 07 15:12:28 2010 -0700 @@ -103,7 +103,7 @@ void LoaderConstraintTable::purge_loader_constraints(BoolObjectClosure* is_alive) { - assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint") + assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); // Remove unloaded entries from constraint table for (int index = 0; index < table_size(); index++) { LoaderConstraintEntry** p = bucket_addr(index); diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/classfile/resolutionErrors.cpp --- a/src/share/vm/classfile/resolutionErrors.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/classfile/resolutionErrors.cpp Fri May 07 15:12:28 2010 -0700 @@ -102,7 +102,7 @@ // Remove unloaded entries from the table void ResolutionErrorTable::purge_resolution_errors(BoolObjectClosure* is_alive) { - assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint") + assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); for (int i = 0; i < table_size(); i++) { for (ResolutionErrorEntry** p = bucket_addr(i); *p != NULL; ) { ResolutionErrorEntry* entry = *p; diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/code/exceptionHandlerTable.cpp --- a/src/share/vm/code/exceptionHandlerTable.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/code/exceptionHandlerTable.cpp Fri May 07 15:12:28 2010 -0700 @@ -221,6 +221,6 @@ for (uint i = 0; i < len(); i++) { if ((*adr(i) > (unsigned int)nm->code_size()) || (*(adr(i)+1) > (unsigned int)nm->code_size())) - fatal1("Invalid offset in ImplicitExceptionTable at %lx", _data); + fatal(err_msg("Invalid offset in ImplicitExceptionTable at " PTR_FORMAT, _data)); } } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/code/nmethod.cpp --- a/src/share/vm/code/nmethod.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/code/nmethod.cpp Fri May 07 15:12:28 2010 -0700 @@ -1534,7 +1534,8 @@ } } ic->set_to_clean(); - assert(ic->cached_oop() == NULL, "cached oop in IC should be cleared") + assert(ic->cached_oop() == NULL, + "cached oop in IC should be cleared"); } } } @@ -2123,7 +2124,7 @@ ResourceMark rm; if (!CodeCache::contains(this)) { - fatal1("nmethod at " INTPTR_FORMAT " not in zone", this); + fatal(err_msg("nmethod at " INTPTR_FORMAT " not in zone", this)); } if(is_native_method() ) @@ -2131,7 +2132,8 @@ nmethod* nm = CodeCache::find_nmethod(verified_entry_point()); if (nm != this) { - fatal1("findNMethod did not find this nmethod (" INTPTR_FORMAT ")", this); + fatal(err_msg("findNMethod did not find this nmethod (" INTPTR_FORMAT ")", + this)); } for (PcDesc* p = scopes_pcs_begin(); p < scopes_pcs_end(); p++) { diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/code/stubs.cpp --- a/src/share/vm/code/stubs.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/code/stubs.cpp Fri May 07 15:12:28 2010 -0700 @@ -62,7 +62,9 @@ Mutex* lock, const char* name) : _mutex(lock) { intptr_t size = round_to(buffer_size, 2*BytesPerWord); BufferBlob* blob = BufferBlob::create(name, size); - if( blob == NULL ) vm_exit_out_of_memory1(size, "CodeCache: no room for %s", name); + if( blob == NULL) { + vm_exit_out_of_memory(size, err_msg("CodeCache: no room for %s", name)); + } _stub_interface = stub_interface; _buffer_size = blob->instructions_size(); _buffer_limit = blob->instructions_size(); diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/code/vtableStubs.cpp --- a/src/share/vm/code/vtableStubs.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/code/vtableStubs.cpp Fri May 07 15:12:28 2010 -0700 @@ -45,7 +45,9 @@ if (_chunk == NULL || _chunk + real_size > _chunk_end) { const int bytes = chunk_factor * real_size + pd_code_alignment(); BufferBlob* blob = BufferBlob::create("vtable chunks", bytes); - if( blob == NULL ) vm_exit_out_of_memory1(bytes, "CodeCache: no room for %s", "vtable chunks"); + if (blob == NULL) { + vm_exit_out_of_memory(bytes, "CodeCache: no room for vtable chunks"); + } _chunk = blob->instructions_begin(); _chunk_end = _chunk + bytes; VTune::register_stub("vtable stub", _chunk, _chunk_end); @@ -189,7 +191,9 @@ instanceKlass* ik = instanceKlass::cast(klass); klassVtable* vt = ik->vtable(); klass->print(); - fatal3("bad compiled vtable dispatch: receiver " INTPTR_FORMAT ", index %d (vtable length %d)", (address)receiver, index, vt->length()); + fatal(err_msg("bad compiled vtable dispatch: receiver " INTPTR_FORMAT ", " + "index %d (vtable length %d)", + (address)receiver, index, vt->length())); } #endif // Product diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/compiler/compileBroker.hpp --- a/src/share/vm/compiler/compileBroker.hpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/compiler/compileBroker.hpp Fri May 07 15:12:28 2010 -0700 @@ -310,7 +310,7 @@ static AbstractCompiler* compiler(int level ) { if (level == CompLevel_fast_compile) return _compilers[0]; - assert(level == CompLevel_highest_tier, "what level?") + assert(level == CompLevel_highest_tier, "what level?"); return _compilers[1]; } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/compiler/compileLog.cpp --- a/src/share/vm/compiler/compileLog.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/compiler/compileLog.cpp Fri May 07 15:12:28 2010 -0700 @@ -68,7 +68,7 @@ return attrs; } else { // park it in the buffer, so we can put a null on the end - assert(!(kind >= buffer && kind < buffer+100), "not obviously in buffer") + assert(!(kind >= buffer && kind < buffer+100), "not obviously in buffer"); int klen = attrs - kind; strncpy(buffer, kind, klen); buffer[klen] = 0; diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/gc_implementation/concurrentMarkSweep/binaryTreeDictionary.cpp --- a/src/share/vm/gc_implementation/concurrentMarkSweep/binaryTreeDictionary.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/binaryTreeDictionary.cpp Fri May 07 15:12:28 2010 -0700 @@ -118,7 +118,7 @@ // TreeList from the first chunk to the next chunk and update all // the TreeList pointers in the chunks in the list. if (nextTC == NULL) { - assert(prevFC == NULL, "Not last chunk in the list") + assert(prevFC == NULL, "Not last chunk in the list"); set_tail(NULL); set_head(NULL); } else { diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp --- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp Fri May 07 15:12:28 2010 -0700 @@ -517,7 +517,7 @@ assert(blk_start != NULL && blk_end > blk_start, "phantom block"); assert(blk_end > threshold, "should be past threshold"); - assert(blk_start <= threshold, "blk_start should be at or before threshold") + assert(blk_start <= threshold, "blk_start should be at or before threshold"); assert(pointer_delta(threshold, blk_start) <= N_words, "offset should be <= BlockOffsetSharedArray::N"); assert(Universe::heap()->is_in_reserved(blk_start), diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri May 07 15:12:28 2010 -0700 @@ -4965,7 +4965,7 @@ MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); while (pop_unclean_region_list_locked() != NULL) ; assert(_unclean_region_list.hd() == NULL && _unclean_region_list.sz() == 0, - "Postconditions of loop.") + "Postconditions of loop."); while (pop_free_region_list_locked() != NULL) ; assert(_free_region_list == NULL, "Postcondition of loop."); if (_free_region_list_size != 0) { diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp --- a/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp Fri May 07 15:12:28 2010 -0700 @@ -325,7 +325,7 @@ eden_size = align_size_down(eden_size, alignment); eden_end = eden_start + eden_size; - assert(eden_end >= eden_start, "addition overflowed") + assert(eden_end >= eden_start, "addition overflowed"); // To may resize into from space as long as it is clear of live data. // From space must remain page aligned, though, so we need to do some diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp --- a/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp Fri May 07 15:12:28 2010 -0700 @@ -326,7 +326,7 @@ } eden_end = eden_start + eden_size; - assert(eden_end >= eden_start, "addition overflowed") + assert(eden_end >= eden_start, "addition overflowed"); // To may resize into from space as long as it is clear of live data. // From space must remain page aligned, though, so we need to do some @@ -413,7 +413,7 @@ pointer_delta(to_start, eden_start, sizeof(char))); } eden_end = eden_start + eden_size; - assert(eden_end >= eden_start, "addition overflowed") + assert(eden_end >= eden_start, "addition overflowed"); // Don't let eden shrink down to 0 or less. eden_end = MAX2(eden_end, eden_start + alignment); diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp --- a/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp Fri May 07 15:12:28 2010 -0700 @@ -65,7 +65,7 @@ // and releasing the heap lock, which is held during gc's anyway. This method is not // safe for use at the same time as allocate_noexpand()! HeapWord* cas_allocate_noexpand(size_t word_size) { - assert(SafepointSynchronize::is_at_safepoint(), "Must only be called at safepoint") + assert(SafepointSynchronize::is_at_safepoint(), "Must only be called at safepoint"); HeapWord* res = object_space()->cas_allocate(word_size); if (res != NULL) { _start_array.allocate_block(res); diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp --- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Fri May 07 15:12:28 2010 -0700 @@ -3277,7 +3277,7 @@ if (status == ParMarkBitMap::incomplete) { // The last obj that starts in the source region does not end in the // region. - assert(closure.source() < end_addr, "sanity") + assert(closure.source() < end_addr, "sanity"); HeapWord* const obj_beg = closure.source(); HeapWord* const range_end = MIN2(obj_beg + closure.words_remaining(), src_space_top); diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp --- a/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp Fri May 07 15:12:28 2010 -0700 @@ -521,7 +521,7 @@ } eden_end = eden_start + eden_size; - assert(eden_end >= eden_start, "addition overflowed") + assert(eden_end >= eden_start, "addition overflowed"); // To may resize into from space as long as it is clear of live data. // From space must remain page aligned, though, so we need to do some @@ -605,7 +605,7 @@ pointer_delta(to_start, eden_start, sizeof(char))); } eden_end = eden_start + eden_size; - assert(eden_end >= eden_start, "addition overflowed") + assert(eden_end >= eden_start, "addition overflowed"); // Could choose to not let eden shrink // to_start = MAX2(to_start, eden_end); diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/interpreter/bytecodeInterpreter.cpp --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp Fri May 07 15:12:28 2010 -0700 @@ -2339,8 +2339,8 @@ goto opcode_switch; } #endif - fatal2("\t*** Unimplemented opcode: %d = %s\n", - opcode, Bytecodes::name((Bytecodes::Code)opcode)); + fatal(err_msg("Unimplemented opcode %d = %s", opcode, + Bytecodes::name((Bytecodes::Code)opcode))); goto finish; } /* switch(opc) */ diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/interpreter/bytecodes.cpp --- a/src/share/vm/interpreter/bytecodes.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/interpreter/bytecodes.cpp Fri May 07 15:12:28 2010 -0700 @@ -426,7 +426,9 @@ if (is_defined(i)) { Code code = cast(i); Code java = java_code(code); - if (can_trap(code) && !can_trap(java)) fatal2("%s can trap => %s can trap, too", name(code), name(java)); + if (can_trap(code) && !can_trap(java)) + fatal(err_msg("%s can trap => %s can trap, too", name(code), + name(java))); } } } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/interpreter/oopMapCache.cpp --- a/src/share/vm/interpreter/oopMapCache.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/interpreter/oopMapCache.cpp Fri May 07 15:12:28 2010 -0700 @@ -224,8 +224,8 @@ // If we are doing mark sweep _method may not have a valid header // $$$ This used to happen only for m/s collections; we might want to // think of an appropriate generalization of this distinction. - guarantee(Universe::heap()->is_gc_active() || - _method->is_oop_or_null(), "invalid oop in oopMapCache") + guarantee(Universe::heap()->is_gc_active() || _method->is_oop_or_null(), + "invalid oop in oopMapCache"); } #ifdef ENABLE_ZAP_DEAD_LOCALS diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/interpreter/templateInterpreter.cpp --- a/src/share/vm/interpreter/templateInterpreter.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/interpreter/templateInterpreter.cpp Fri May 07 15:12:28 2010 -0700 @@ -457,7 +457,7 @@ void TemplateInterpreterGenerator::set_wide_entry_point(Template* t, address& wep) { assert(t->is_valid(), "template must exist"); - assert(t->tos_in() == vtos, "only vtos tos_in supported for wide instructions") + assert(t->tos_in() == vtos, "only vtos tos_in supported for wide instructions"); wep = __ pc(); generate_and_dispatch(t); } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/memory/blockOffsetTable.cpp --- a/src/share/vm/memory/blockOffsetTable.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/memory/blockOffsetTable.cpp Fri May 07 15:12:28 2010 -0700 @@ -689,7 +689,7 @@ assert(blk_end > _next_offset_threshold, "should be past threshold"); assert(blk_start <= _next_offset_threshold, - "blk_start should be at or before threshold") + "blk_start should be at or before threshold"); assert(pointer_delta(_next_offset_threshold, blk_start) <= N_words, "offset should be <= BlockOffsetSharedArray::N"); assert(Universe::heap()->is_in_reserved(blk_start), diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/memory/heapInspection.cpp --- a/src/share/vm/memory/heapInspection.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/memory/heapInspection.cpp Fri May 07 15:12:28 2010 -0700 @@ -315,7 +315,7 @@ void HeapInspection::find_instances_at_safepoint(klassOop k, GrowableArray* result) { assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped"); - assert(Heap_lock->is_locked(), "should have the Heap_lock") + assert(Heap_lock->is_locked(), "should have the Heap_lock"); // Ensure that the heap is parsable Universe::heap()->ensure_parsability(false); // no need to retire TALBs diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/oops/generateOopMap.cpp --- a/src/share/vm/oops/generateOopMap.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/oops/generateOopMap.cpp Fri May 07 15:12:28 2010 -0700 @@ -807,7 +807,7 @@ } CellTypeState GenerateOopMap::get_var(int localNo) { - assert(localNo < _max_locals + _nof_refval_conflicts, "variable read error") + assert(localNo < _max_locals + _nof_refval_conflicts, "variable read error"); if (localNo < 0 || localNo > _max_locals) { verify_error("variable read error: r%d", localNo); return valCTS; // just to pick something; diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/oops/instanceKlass.cpp --- a/src/share/vm/oops/instanceKlass.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/oops/instanceKlass.cpp Fri May 07 15:12:28 2010 -0700 @@ -966,7 +966,7 @@ // not found #ifdef ASSERT int index = linear_search(methods, name, signature); - if (index != -1) fatal1("binary search bug: should have found entry %d", index); + assert(index == -1, err_msg("binary search should have found entry %d", index)); #endif return NULL; } else if (res < 0) { @@ -977,7 +977,7 @@ } #ifdef ASSERT int index = linear_search(methods, name, signature); - if (index != -1) fatal1("binary search bug: should have found entry %d", index); + assert(index == -1, err_msg("binary search should have found entry %d", index)); #endif return NULL; } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/oops/instanceKlassKlass.cpp --- a/src/share/vm/oops/instanceKlassKlass.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/oops/instanceKlassKlass.cpp Fri May 07 15:12:28 2010 -0700 @@ -712,10 +712,10 @@ int sib_count = 0; while (sib != NULL) { if (sib == ik) { - fatal1("subclass cycle of length %d", sib_count); + fatal(err_msg("subclass cycle of length %d", sib_count)); } if (sib_count >= 100000) { - fatal1("suspiciously long subclass list %d", sib_count); + fatal(err_msg("suspiciously long subclass list %d", sib_count)); } guarantee(sib->as_klassOop()->is_klass(), "should be klass"); guarantee(sib->as_klassOop()->is_perm(), "should be in permspace"); diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/oops/klassVtable.cpp --- a/src/share/vm/oops/klassVtable.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/oops/klassVtable.cpp Fri May 07 15:12:28 2010 -0700 @@ -899,7 +899,7 @@ int nof_methods = methods()->length(); HandleMark hm; KlassHandle klass = _klass; - assert(nof_methods > 0, "at least one method must exist for interface to be in vtable") + assert(nof_methods > 0, "at least one method must exist for interface to be in vtable"); Handle interface_loader (THREAD, instanceKlass::cast(interf_h())->class_loader()); int ime_num = 0; @@ -1180,8 +1180,8 @@ oop* end_of_obj = (oop*)_klass() + _klass()->size(); oop* end_of_vtable = (oop *)&table()[_length]; if (end_of_vtable > end_of_obj) { - fatal1("klass %s: klass object too short (vtable extends beyond end)", - _klass->internal_name()); + fatal(err_msg("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); @@ -1224,7 +1224,7 @@ #ifndef PRODUCT print(); #endif - fatal1("vtableEntry %#lx: method is from subclass", this); + fatal(err_msg("vtableEntry " PTR_FORMAT ": method is from subclass", this)); } } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/opto/idealGraphPrinter.cpp --- a/src/share/vm/opto/idealGraphPrinter.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/opto/idealGraphPrinter.cpp Fri May 07 15:12:28 2010 -0700 @@ -151,7 +151,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. - fatal2("Couldn't connect to visualizer at %s:%d", PrintIdealGraphAddress, PrintIdealGraphPort); + fatal(err_msg("Couldn't connect to visualizer at %s:%d", + PrintIdealGraphAddress, PrintIdealGraphPort)); } } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/opto/node.cpp --- a/src/share/vm/opto/node.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/opto/node.cpp Fri May 07 15:12:28 2010 -0700 @@ -1188,7 +1188,7 @@ Node* use = dead->last_out(k); igvn->hash_delete(use); // Yank from hash table prior to mod if (use->in(0) == dead) { // Found another dead node - assert (!use->is_Con(), "Control for Con node should be Root node.") + assert (!use->is_Con(), "Control for Con node should be Root node."); use->set_req(0, top); // Cut dead edge to prevent processing nstack.push(use); // the dead node again. } else { // Else found a not-dead user diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/opto/output.cpp --- a/src/share/vm/opto/output.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/opto/output.cpp Fri May 07 15:12:28 2010 -0700 @@ -1231,7 +1231,7 @@ if (is_sfn && !is_mcall && padding == 0 && current_offset == last_call_offset ) { padding = nop_size; } - assert( labels_not_set || padding == 0, "instruction should already be aligned") + assert( labels_not_set || padding == 0, "instruction should already be aligned"); if(padding > 0) { assert((padding % nop_size) == 0, "padding is not a multiple of NOP size"); @@ -2407,7 +2407,7 @@ n->dump(); tty->print_cr("..."); prior_use->dump(); - assert_msg(edge_from_to(prior_use,n),msg); + assert(edge_from_to(prior_use,n),msg); } _reg_node.map(def,NULL); // Kill live USEs } @@ -2446,11 +2446,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_msg(!_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), msg); _reg_node.map(reg_lo,n); } if( OptoReg::is_valid(reg_hi) ) { - assert_msg(!_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), msg); _reg_node.map(reg_hi,n); } } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/opto/phaseX.hpp --- a/src/share/vm/opto/phaseX.hpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/opto/phaseX.hpp Fri May 07 15:12:28 2010 -0700 @@ -310,7 +310,7 @@ void dump_nodes_and_types_recur( const Node *n, uint depth, bool only_ctrl, VectorSet &visited); uint _count_progress; // For profiling, count transforms that make progress - void set_progress() { ++_count_progress; assert( allow_progress(),"No progress allowed during verification") } + void set_progress() { ++_count_progress; assert( allow_progress(),"No progress allowed during verification"); } void clear_progress() { _count_progress = 0; } uint made_progress() const { return _count_progress; } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/prims/forte.cpp --- a/src/share/vm/prims/forte.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/prims/forte.cpp Fri May 07 15:12:28 2010 -0700 @@ -647,7 +647,7 @@ void Forte::register_stub(const char* name, address start, address end) { #if !defined(_WINDOWS) && !defined(IA64) assert(pointer_delta(end, start, sizeof(jbyte)) < INT_MAX, - "Code size exceeds maximum range") + "Code size exceeds maximum range"); collector_func_load((char*)name, NULL, NULL, start, pointer_delta(end, start, sizeof(jbyte)), 0, NULL); diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/prims/jni.cpp --- a/src/share/vm/prims/jni.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/prims/jni.cpp Fri May 07 15:12:28 2010 -0700 @@ -3311,6 +3311,7 @@ OrderAccess::release_store(&vm_created, 0); } + NOT_PRODUCT(test_error_handler(ErrorHandlerTest)); return result; } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/runtime/frame.cpp --- a/src/share/vm/runtime/frame.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/runtime/frame.cpp Fri May 07 15:12:28 2010 -0700 @@ -844,7 +844,7 @@ } void oop_at_offset_do(int offset) { - assert (offset >= 0, "illegal offset") + assert (offset >= 0, "illegal offset"); oop* addr = (oop*) _fr->entry_frame_argument_at(offset); _f->do_oop(addr); } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/runtime/globals.hpp Fri May 07 15:12:28 2010 -0700 @@ -652,6 +652,11 @@ product(bool, PrintGCApplicationStoppedTime, false, \ "Print the time the application has been stopped") \ \ + notproduct(uintx, ErrorHandlerTest, 0, \ + "If > 0, provokes an error after VM initialization; the value" \ + "determines which error to provoke. See test_error_handler()" \ + "in debug.cpp.") \ + \ develop(bool, Verbose, false, \ "Prints additional debugging information from other modes") \ \ diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/runtime/memprofiler.cpp --- a/src/share/vm/runtime/memprofiler.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/runtime/memprofiler.cpp Fri May 07 15:12:28 2010 -0700 @@ -62,7 +62,7 @@ // Create log file _log_fp = fopen(log_name , "w+"); if (_log_fp == NULL) { - fatal1("MemProfiler: Cannot create log file: %s", log_name); + fatal(err_msg("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 -r fd3de7134574 -r 80ccc94456b2 src/share/vm/runtime/mutex.cpp --- a/src/share/vm/runtime/mutex.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/runtime/mutex.cpp Fri May 07 15:12:28 2010 -0700 @@ -1288,8 +1288,9 @@ !(this == Safepoint_lock && contains(locks, Terminator_lock) && SafepointSynchronize::is_synchronizing())) { new_owner->print_owned_locks(); - fatal4("acquiring lock %s/%d out of order with lock %s/%d -- possible deadlock", - this->name(), this->rank(), locks->name(), locks->rank()); + fatal(err_msg("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; @@ -1342,7 +1343,8 @@ || rank() == Mutex::special, "wrong thread state for using locks"); if (StrictSafepointChecks) { if (thread->is_VM_thread() && !allow_vm_block()) { - fatal1("VM thread using lock %s (not allowed to block on)", name()); + fatal(err_msg("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 -r fd3de7134574 -r 80ccc94456b2 src/share/vm/runtime/mutexLocker.cpp --- a/src/share/vm/runtime/mutexLocker.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/runtime/mutexLocker.cpp Fri May 07 15:12:28 2010 -0700 @@ -136,7 +136,7 @@ // see if invoker of VM operation owns it VM_Operation* op = VMThread::vm_operation(); if (op != NULL && op->calling_thread() == lock->owner()) return; - fatal1("must own lock %s", lock->name()); + fatal(err_msg("must own lock %s", lock->name())); } // a stronger assertion than the above @@ -144,7 +144,7 @@ if (IgnoreLockingAssertions) return; assert(lock != NULL, "Need non-NULL lock"); if (lock->owned_by_self()) return; - fatal1("must own lock %s", lock->name()); + fatal(err_msg("must own lock %s", lock->name())); } #endif diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/runtime/os.cpp --- a/src/share/vm/runtime/os.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/runtime/os.cpp Fri May 07 15:12:28 2010 -0700 @@ -406,8 +406,10 @@ #ifdef ASSERT inline size_t get_size(void* obj) { size_t size = *size_addr_from_obj(obj); - if (size < 0 ) - fatal2("free: size field of object #%p was overwritten (%lu)", obj, size); + if (size < 0) { + fatal(err_msg("free: size field of object #" PTR_FORMAT " was overwritten (" + SIZE_FORMAT ")", obj, size)); + } return size; } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/runtime/safepoint.cpp --- a/src/share/vm/runtime/safepoint.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/runtime/safepoint.cpp Fri May 07 15:12:28 2010 -0700 @@ -594,7 +594,7 @@ break; default: - fatal1("Illegal threadstate encountered: %d", state); + fatal(err_msg("Illegal threadstate encountered: %d", state)); } // Check for pending. async. exceptions or suspends - except if the diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/runtime/signature.cpp --- a/src/share/vm/runtime/signature.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/runtime/signature.cpp Fri May 07 15:12:28 2010 -0700 @@ -57,7 +57,7 @@ } void SignatureIterator::expect(char c) { - if (_signature->byte_at(_index) != c) fatal1("expecting %c", c); + if (_signature->byte_at(_index) != c) fatal(err_msg("expecting %c", c)); _index++; } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/runtime/stubRoutines.cpp --- a/src/share/vm/runtime/stubRoutines.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/runtime/stubRoutines.cpp Fri May 07 15:12:28 2010 -0700 @@ -118,7 +118,10 @@ ResourceMark rm; TraceTime timer("StubRoutines generation 1", TraceStartupTime); _code1 = BufferBlob::create("StubRoutines (1)", code_size1); - if( _code1 == NULL) vm_exit_out_of_memory1(code_size1, "CodeCache: no room for %s", "StubRoutines (1)"); + if (_code1 == NULL) { + vm_exit_out_of_memory(code_size1, + "CodeCache: no room for StubRoutines (1)"); + } CodeBuffer buffer(_code1->instructions_begin(), _code1->instructions_size()); StubGenerator_generate(&buffer, false); } @@ -164,7 +167,10 @@ ResourceMark rm; TraceTime timer("StubRoutines generation 2", TraceStartupTime); _code2 = BufferBlob::create("StubRoutines (2)", code_size2); - if( _code2 == NULL) vm_exit_out_of_memory1(code_size2, "CodeCache: no room for %s", "StubRoutines (2)"); + if (_code2 == NULL) { + vm_exit_out_of_memory(code_size2, + "CodeCache: no room for StubRoutines (2)"); + } CodeBuffer buffer(_code2->instructions_begin(), _code2->instructions_size()); StubGenerator_generate(&buffer, true); } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/runtime/vmThread.cpp --- a/src/share/vm/runtime/vmThread.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/runtime/vmThread.cpp Fri May 07 15:12:28 2010 -0700 @@ -106,7 +106,7 @@ // restore queue to empty state _queue[prio]->set_next(_queue[prio]); _queue[prio]->set_prev(_queue[prio]); - assert(queue_empty(prio), "drain corrupted queue") + assert(queue_empty(prio), "drain corrupted queue"); #ifdef DEBUG int len = 0; VM_Operation* cur; @@ -593,7 +593,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()) { - fatal2("Nested VM operation %s requested by operation %s", op->name(), vm_operation()->name()); + fatal(err_msg("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 -r fd3de7134574 -r 80ccc94456b2 src/share/vm/utilities/debug.cpp --- a/src/share/vm/utilities/debug.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/utilities/debug.cpp Fri May 07 15:12:28 2010 -0700 @@ -72,7 +72,7 @@ // assert/guarantee/... may happen very early during VM initialization. // Don't rely on anything that is initialized by Threads::create_vm(). For // example, don't use tty. -bool assert_is_suppressed(const char* file_name, int line_no) { +bool error_is_suppressed(const char* file_name, int line_no) { // The following 1-element cache requires that passed-in // file names are always only constant literals. if (file_name == last_file_name && line_no == last_line_no) return true; @@ -163,38 +163,30 @@ #else // Place-holder for non-existent suppression check: -#define assert_is_suppressed(file_name, line_no) (false) +#define error_is_suppressed(file_name, line_no) (false) #endif //PRODUCT -void report_assertion_failure(const char* file_name, int line_no, const char* message) { - if (Debugging || assert_is_suppressed(file_name, line_no)) return; - VMError err(ThreadLocalStorage::get_thread_slow(), message, file_name, line_no); +void report_vm_error(const char* file, int line, const char* error_msg, + const char* detail_msg) +{ + 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(); } -void report_fatal(const char* file_name, int line_no, const char* message) { - if (Debugging || assert_is_suppressed(file_name, line_no)) return; - VMError err(ThreadLocalStorage::get_thread_slow(), message, file_name, line_no); - err.report_and_die(); +void report_fatal(const char* file, int line, const char* message) +{ + report_vm_error(file, line, "fatal error", message); } -void report_fatal_vararg(const char* file_name, int line_no, const char* format, ...) { - char buffer[256]; - va_list ap; - va_start(ap, format); - jio_vsnprintf(buffer, sizeof(buffer), format, ap); - va_end(ap); - report_fatal(file_name, line_no, buffer); -} - - // Used by report_vm_out_of_memory to detect recursion. static jint _exiting_out_of_mem = 0; -// Just passing the flow to VMError to handle error -void report_vm_out_of_memory(const char* file_name, int line_no, size_t size, const char* message) { - if (Debugging || assert_is_suppressed(file_name, line_no)) return; +void report_vm_out_of_memory(const char* file, int line, size_t size, + const char* message) { + if (Debugging || error_is_suppressed(file, line)) return; // We try to gather additional information for the first out of memory // error only; gathering additional data might cause an allocation and a @@ -206,46 +198,28 @@ if (first_time_here) { Thread* thread = ThreadLocalStorage::get_thread_slow(); - VMError(thread, size, message, file_name, line_no).report_and_die(); + VMError(thread, file, line, size, message).report_and_die(); } // Dump core and abort vm_abort(true); } -void report_vm_out_of_memory_vararg(const char* file_name, int line_no, size_t size, const char* format, ...) { - char buffer[256]; - va_list ap; - va_start(ap, format); - jio_vsnprintf(buffer, sizeof(buffer), format, ap); - va_end(ap); - report_vm_out_of_memory(file_name, line_no, size, buffer); +void report_should_not_call(const char* file, int line) { + report_vm_error(file, line, "ShouldNotCall()"); } -void report_should_not_call(const char* file_name, int line_no) { - if (Debugging || assert_is_suppressed(file_name, line_no)) return; - VMError err(ThreadLocalStorage::get_thread_slow(), "ShouldNotCall()", file_name, line_no); - err.report_and_die(); +void report_should_not_reach_here(const char* file, int line) { + report_vm_error(file, line, "ShouldNotReachHere()"); } - -void report_should_not_reach_here(const char* file_name, int line_no) { - if (Debugging || assert_is_suppressed(file_name, line_no)) return; - VMError err(ThreadLocalStorage::get_thread_slow(), "ShouldNotReachHere()", file_name, line_no); - err.report_and_die(); +void report_unimplemented(const char* file, int line) { + report_vm_error(file, line, "Unimplemented()"); } - -void report_unimplemented(const char* file_name, int line_no) { - if (Debugging || assert_is_suppressed(file_name, line_no)) return; - VMError err(ThreadLocalStorage::get_thread_slow(), "Unimplemented()", file_name, line_no); - err.report_and_die(); -} - - -void report_untested(const char* file_name, int line_no, const char* msg) { +void report_untested(const char* file, int line, const char* message) { #ifndef PRODUCT - warning("Untested: %s in %s: %d\n", msg, file_name, line_no); + warning("Untested: %s in %s: %d\n", message, file, line); #endif // PRODUCT } @@ -284,6 +258,51 @@ return error_reported; } +#ifndef PRODUCT +#include + +void test_error_handler(size_t test_num) +{ + if (test_num == 0) return; + + // If asserts are disabled, use the corresponding guarantee instead. + size_t n = test_num; + NOT_DEBUG(if (n <= 2) n += 2); + + const char* const str = "hello"; + const size_t num = (size_t)os::vm_page_size(); + + const char* const eol = os::line_separator(); + const char* const msg = "this message should be truncated during formatting"; + + // Keep this in sync with test/runtime/6888954/vmerrors.sh. + switch (n) { + case 1: assert(str == NULL, "expected null"); + case 2: assert(num == 1023 && *str == 'X', + err_msg("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)); + 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 8: vm_exit_out_of_memory(num, "ChunkPool::allocate"); + case 9: ShouldNotCallThis(); + case 10: ShouldNotReachHere(); + case 11: Unimplemented(); + // This is last because it does not generate an hs_err* file on Windows. + case 12: os::signal_raise(SIGSEGV); + + default: ShouldNotReachHere(); + } +} +#endif // #ifndef PRODUCT + // ------ helper functions for debugging go here ------------ #ifndef PRODUCT diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/utilities/debug.hpp --- a/src/share/vm/utilities/debug.hpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/utilities/debug.hpp Fri May 07 15:12:28 2010 -0700 @@ -22,28 +22,54 @@ * */ +#include + +// Simple class to format the ctor arguments into a fixed-sized buffer. +template +class FormatBuffer { +public: + inline FormatBuffer(const char * format, ...); + operator const char *() const { return _buf; } + +private: + FormatBuffer(const FormatBuffer &); // prevent copies + +private: + char _buf[bufsz]; +}; + +template +FormatBuffer::FormatBuffer(const char * format, ...) { + va_list argp; + va_start(argp, format); + vsnprintf(_buf, bufsz, format, argp); + va_end(argp); +} + +// Used to format messages for assert(), guarantee(), fatal(), etc. +typedef FormatBuffer<> err_msg; + // assertions #ifdef ASSERT -// Turn this off by default: -//#define USE_REPEATED_ASSERTS -#ifdef USE_REPEATED_ASSERTS - #define assert(p,msg) \ - { for (int __i = 0; __i < AssertRepeat; __i++) { \ - if (!(p)) { \ - report_assertion_failure(__FILE__, __LINE__, \ - "assert(" XSTR(p) ",\"" msg "\")");\ - BREAKPOINT; \ - } \ - } \ - } -#else - #define assert(p,msg) \ - if (!(p)) { \ - report_assertion_failure(__FILE__, __LINE__, \ - "assert(" XSTR(p) ",\"" msg "\")");\ - BREAKPOINT; \ - } -#endif +#ifndef USE_REPEATED_ASSERTS +#define assert(p, msg) \ +do { \ + if (!(p)) { \ + report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg); \ + BREAKPOINT; \ + } \ +} while (0) +#else // #ifndef USE_REPEATED_ASSERTS +#define assert(p, msg) +do { \ + for (int __i = 0; __i < AssertRepeat; __i++) { \ + if (!(p)) { \ + report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg); \ + BREAKPOINT; \ + } \ + } \ +} while (0) +#endif // #ifndef USE_REPEATED_ASSERTS // This version of assert is for use with checking return status from // library calls that return actual error values eg. EINVAL, @@ -52,70 +78,83 @@ // what status was actually returned, so we pass the status variable as // an extra arg and use strerror to convert it to a meaningful string // like "Invalid argument", "out of memory" etc -#define assert_status(p, status, msg) \ - do { \ - if (!(p)) { \ - char buf[128]; \ - snprintf(buf, 127, \ - "assert_status(" XSTR(p) ", error: %s(%d), \"" msg "\")" , \ - strerror((status)), (status)); \ - report_assertion_failure(__FILE__, __LINE__, buf); \ - BREAKPOINT; \ - } \ - } while (0) - -// Another version of assert where the message is not a string literal -// The boolean condition is not printed out because cpp doesn't like it. -#define assert_msg(p, msg) \ - if (!(p)) { \ - report_assertion_failure(__FILE__, __LINE__, msg); \ - BREAKPOINT; \ - } +#define assert_status(p, status, msg) \ +do { \ + if (!(p)) { \ + report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", \ + err_msg("error %s(%d) %s", strerror(status), \ + status, msg)); \ + BREAKPOINT; \ + } \ +} while (0) // Do not assert this condition if there's already another error reported. #define assert_if_no_error(cond,msg) assert((cond) || is_error_reported(), msg) -#else +#else // #ifdef ASSERT #define assert(p,msg) #define assert_status(p,status,msg) #define assert_if_no_error(cond,msg) - #define assert_msg(cond,msg) -#endif - - -// fatals -#define fatal(m) { report_fatal(__FILE__, __LINE__, m ); BREAKPOINT; } -#define fatal1(m,x1) { report_fatal_vararg(__FILE__, __LINE__, m, x1 ); BREAKPOINT; } -#define fatal2(m,x1,x2) { report_fatal_vararg(__FILE__, __LINE__, m, x1, x2 ); BREAKPOINT; } -#define fatal3(m,x1,x2,x3) { report_fatal_vararg(__FILE__, __LINE__, m, x1, x2, x3 ); BREAKPOINT; } -#define fatal4(m,x1,x2,x3,x4) { report_fatal_vararg(__FILE__, __LINE__, m, x1, x2, x3, x4 ); BREAKPOINT; } - -// out of memory -#define vm_exit_out_of_memory(s,m) { report_vm_out_of_memory(__FILE__, __LINE__, s, m ); BREAKPOINT; } -#define vm_exit_out_of_memory1(s,m,x1) { report_vm_out_of_memory_vararg(__FILE__, __LINE__, s, m, x1 ); BREAKPOINT; } -#define vm_exit_out_of_memory2(s,m,x1,x2) { report_vm_out_of_memory_vararg(__FILE__, __LINE__, s, m, x1, x2 ); BREAKPOINT; } -#define vm_exit_out_of_memory3(s,m,x1,x2,x3) { report_vm_out_of_memory_vararg(__FILE__, __LINE__, s, m, x1, x2, x3 ); BREAKPOINT; } -#define vm_exit_out_of_memory4(s,m,x1,x2,x3,x4) { report_vm_out_of_memory_vararg(__FILE__, __LINE__, s, m, x1, x2, x3, x4); BREAKPOINT; } +#endif // #ifdef ASSERT // guarantee is like assert except it's always executed -- use it for -// cheap tests that catch errors that would otherwise be hard to find +// cheap tests that catch errors that would otherwise be hard to find. // guarantee is also used for Verify options. -#define guarantee(b,msg) { if (!(b)) fatal("guarantee(" XSTR(b) ",\"" msg "\")"); } +#define guarantee(p, msg) \ +do { \ + if (!(p)) { \ + report_vm_error(__FILE__, __LINE__, "guarantee(" #p ") failed", msg); \ + BREAKPOINT; \ + } \ +} while (0) + +#define fatal(msg) \ +do { \ + report_fatal(__FILE__, __LINE__, msg); \ + BREAKPOINT; \ +} while (0) + +// out of memory +#define vm_exit_out_of_memory(size, msg) \ +do { \ + report_vm_out_of_memory(__FILE__, __LINE__, size, msg); \ + BREAKPOINT; \ +} while (0) -#define ShouldNotCallThis() { report_should_not_call (__FILE__, __LINE__); BREAKPOINT; } -#define ShouldNotReachHere() { report_should_not_reach_here (__FILE__, __LINE__); BREAKPOINT; } -#define Unimplemented() { report_unimplemented (__FILE__, __LINE__); BREAKPOINT; } -#define Untested(msg) { report_untested (__FILE__, __LINE__, msg); BREAKPOINT; } +#define ShouldNotCallThis() \ +do { \ + report_should_not_call(__FILE__, __LINE__); \ + BREAKPOINT; \ +} while (0) + +#define ShouldNotReachHere() \ +do { \ + report_should_not_reach_here(__FILE__, __LINE__); \ + BREAKPOINT; \ +} while (0) + +#define Unimplemented() \ +do { \ + report_unimplemented(__FILE__, __LINE__); \ + BREAKPOINT; \ +} while (0) + +#define Untested(msg) \ +do { \ + report_untested(__FILE__, __LINE__, msg); \ + BREAKPOINT; \ +} while (0); // error reporting helper functions -void report_assertion_failure(const char* file_name, int line_no, const char* message); -void report_fatal_vararg(const char* file_name, int line_no, const char* format, ...); -void report_fatal(const char* file_name, int line_no, const char* message); -void report_vm_out_of_memory_vararg(const char* file_name, int line_no, size_t size, const char* format, ...); -void report_vm_out_of_memory(const char* file_name, int line_no, size_t size, const char* message); -void report_should_not_call(const char* file_name, int line_no); -void report_should_not_reach_here(const char* file_name, int line_no); -void report_unimplemented(const char* file_name, int line_no); -void report_untested(const char* file_name, int line_no, const char* msg); +void report_vm_error(const char* file, int line, const char* error_msg, + const char* detail_msg = NULL); +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, + const char* message); +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); +void report_untested(const char* file, int line, const char* message); + void warning(const char* format, ...); // out of memory reporting @@ -125,5 +164,8 @@ bool is_error_reported(); void set_error_reported(); +/* Test assert(), fatal(), guarantee(), etc. */ +NOT_PRODUCT(void test_error_handler(size_t test_num);) + void pd_ps(frame f); void pd_obfuscate_location(char *buf, size_t buflen); diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/utilities/exceptions.cpp --- a/src/share/vm/utilities/exceptions.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/utilities/exceptions.cpp Fri May 07 15:12:28 2010 -0700 @@ -378,7 +378,7 @@ void Exceptions::debug_check_abort(const char *value_string) { if (AbortVMOnException != NULL && value_string != NULL && strstr(value_string, AbortVMOnException)) { - fatal1("Saw %s, aborting", value_string); + fatal(err_msg("Saw %s, aborting", value_string)); } } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/utilities/macros.hpp --- a/src/share/vm/utilities/macros.hpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/utilities/macros.hpp Fri May 07 15:12:28 2010 -0700 @@ -188,6 +188,4 @@ #define NOT_SPARC(code) code #endif -#define FIX_THIS(code) report_assertion_failure("FIX_THIS",__FILE__, __LINE__, "") - #define define_pd_global(type, name, value) const type pd_##name = value; diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/utilities/vmError.cpp --- a/src/share/vm/utilities/vmError.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/utilities/vmError.cpp Fri May 07 15:12:28 2010 -0700 @@ -65,7 +65,8 @@ _current_step = 0; _current_step_info = NULL; - _message = ""; + _message = NULL; + _detail_msg = NULL; _filename = NULL; _lineno = 0; @@ -73,31 +74,36 @@ } // Constructor for internal errors -VMError::VMError(Thread* thread, const char* message, const char* filename, int lineno) { +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, + const char* message) { _thread = thread; - _id = internal_error; // set it to a value that's not an OS exception/signal + _id = oom_error; // Value that's not an OS exception/signal _filename = filename; _lineno = lineno; _message = message; - - _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, size_t size, const char* message, const char* filename, int lineno) { - _thread = thread; - _id = oom_error; // set it to a value that's not an OS exception/signal - _filename = filename; - _lineno = lineno; - _message = message; + _detail_msg = NULL; _verbose = false; _current_step = 0; @@ -114,10 +120,11 @@ // Constructor for non-fatal errors VMError::VMError(const char* message) { _thread = NULL; - _id = internal_error; // set it to a value that's not an OS exception/signal + _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; @@ -191,22 +198,27 @@ "%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=" UINTX_FORMAT, signame, _id, _pc, os::current_process_id(), os::current_thread_id()); + } else if (_filename != NULL && _lineno > 0) { + // skip directory names + char separator = os::file_separator()[0]; + 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, + 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); + } else { + jio_snprintf(buf + n, buflen - n, "%sError: %s", + os::line_separator(), _message); + } + } } else { - if (_filename != NULL && _lineno > 0) { - // skip directory names - char separator = os::file_separator()[0]; - const char *p = strrchr(_filename, separator); - - jio_snprintf(buf, buflen, - "Internal Error at %s:%d, pid=%d, tid=" UINTX_FORMAT " \nError: %s", - p ? p + 1 : _filename, _lineno, - os::current_process_id(), os::current_thread_id(), - _message ? _message : ""); - } else { - jio_snprintf(buf, buflen, - "Internal Error (0x%x), pid=%d, tid=" UINTX_FORMAT, - _id, os::current_process_id(), os::current_thread_id()); - } + jio_snprintf(buf, buflen, + "Internal Error (0x%x), pid=%d, tid=" UINTX_FORMAT, + _id, os::current_process_id(), os::current_thread_id()); } return buf; @@ -369,7 +381,9 @@ STEP(40, "(printing error message)") // error message - if (_message && _message[0] != '\0') { + if (_detail_msg) { + st->print_cr("# %s: %s", _message ? _message : "Error", _detail_msg); + } else if (_message) { st->print_cr("# Error: %s", _message); } diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/utilities/vmError.hpp --- a/src/share/vm/utilities/vmError.hpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/utilities/vmError.hpp Fri May 07 15:12:28 2010 -0700 @@ -37,6 +37,7 @@ // 0x8xxxxxxx system warnings const char * _message; + const char * _detail_msg; Thread * _thread; // NULL if it's native thread @@ -75,16 +76,19 @@ char* buf, int buflen, bool verbose = false); // accessor - const char* message() { return _message; } + const char* message() const { return _message; } + const char* detail_msg() const { return _detail_msg; } public: // Constructor for crashes VMError(Thread* thread, int sig, address pc, void* siginfo, void* context); // Constructor for VM internal errors - VMError(Thread* thread, const char* message, const char* filename, int lineno); + VMError(Thread* thread, const char* filename, int lineno, + const char* message, const char * detail_msg); - // Constructors for VM OOM errors - VMError(Thread* thread, size_t size, const char* message, const char* filename, int lineno); + // Constructor for VM OOM errors + VMError(Thread* thread, const char* filename, int lineno, size_t size, + const char* message); // Constructor for non-fatal errors VMError(const char* message); diff -r fd3de7134574 -r 80ccc94456b2 src/share/vm/utilities/xmlstream.cpp --- a/src/share/vm/utilities/xmlstream.cpp Thu May 06 18:25:58 2010 -0700 +++ b/src/share/vm/utilities/xmlstream.cpp Fri May 07 15:12:28 2010 -0700 @@ -328,7 +328,7 @@ // ------------------------------------------------------------------ void xmlStream::va_done(const char* format, va_list ap) { char buffer[200]; - guarantee(strlen(format) + 10 < sizeof(buffer), "bigger format buffer") + guarantee(strlen(format) + 10 < sizeof(buffer), "bigger format buffer"); const char* kind = format; const char* kind_end = strchr(kind, ' '); size_t kind_len = (kind_end != NULL) ? (kind_end - kind) : strlen(kind); diff -r fd3de7134574 -r 80ccc94456b2 test/runtime/6888954/vmerrors.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/runtime/6888954/vmerrors.sh Fri May 07 15:12:28 2010 -0700 @@ -0,0 +1,71 @@ +# @test +# @bug 6888954 +# @summary exercise HotSpot error handling code +# @author John Coomes +# @run shell vmerrors.sh + +# Repeatedly invoke java with a command-line option that causes HotSpot to +# produce an error report and terminate just after initialization. Each +# invocation is identified by a small integer, , which provokes a different +# error (assertion failure, guarantee failure, fatal error, etc.). The output +# from stdout/stderr is written to .out and the hs_err_pidXXX.log file is +# renamed to .log. +# +# The automated checking done by this script is minimal. When updating the +# fatal error handler it is more useful to run it manually or to use the -retain +# option with the jtreg so that test directories are not removed automatically. +# To run stand-alone: +# +# TESTJAVA=/java/home/dir +# TESTVMOPTS=... +# export TESTJAVA TESTVMOPTS +# sh test/runtime/6888954/vmerrors.sh + +ulimit -c 0 # no core files + +i=1 +rc=0 + +assert_re='(assert|guarantee)[(](str|num).*failed: *' +guarantee_re='guarantee[(](str|num).*failed: *' +fatal_re='fatal error: *' +signal_re='(SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=' +tail_1='.*expected null' +tail_2='.*num=' + +for re in \ + "${assert_re}${tail_1}" "${assert_re}${tail_2}" \ + "${guarantee_re}${tail_1}" "${guarantee_re}${tail_2}" \ + "${fatal_re}${tail_1}" "${fatal_re}${tail_2}" \ + "${fatal_re}.*truncated" "ChunkPool::allocate" \ + "ShouldNotCall" "ShouldNotReachHere" \ + "Unimplemented" "$signal_re" + +do + i2=$i + [ $i -lt 10 ] && i2=0$i + + "$TESTJAVA/bin/java" $TESTVMOPTS -XX:+IgnoreUnrecognizedVMOptions \ + -XX:ErrorHandlerTest=${i} -version > ${i2}.out 2>&1 + + # If ErrorHandlerTest is ignored (product build), stop. + # + # Using the built-in variable $! to get the pid does not work reliably on + # windows; use a wildcard instead. + mv hs_err_pid*.log ${i2}.log || exit $rc + + for f in ${i2}.log ${i2}.out + do + egrep -- "$re" $f > $$ + if [ $? -ne 0 ] + then + echo "ErrorHandlerTest=$i failed ($f)" + rc=1 + fi + done + rm -f $$ + + i=$(expr $i + 1) +done + +exit $rc