8136577: Make AbortVMOnException available in product builds
Reviewed-by: coleenp
This commit is contained in:
parent
df9b5759f7
commit
a25ce80e78
@ -553,7 +553,7 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t
|
||||
exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
|
||||
}
|
||||
// for AbortVMOnException flag
|
||||
NOT_PRODUCT(Exceptions::debug_check_abort(exception));
|
||||
Exceptions::debug_check_abort(exception);
|
||||
|
||||
// Clear out the exception oop and pc since looking up an
|
||||
// exception handler can cause class loading, which might throw an
|
||||
|
@ -2791,7 +2791,7 @@ run:
|
||||
(int)continuation_bci, p2i(THREAD));
|
||||
}
|
||||
// for AbortVMOnException flag
|
||||
NOT_PRODUCT(Exceptions::debug_check_abort(except_oop));
|
||||
Exceptions::debug_check_abort(except_oop);
|
||||
|
||||
// Update profiling data.
|
||||
BI_PROFILE_ALIGN_TO_CURRENT_BCI();
|
||||
@ -2807,7 +2807,8 @@ run:
|
||||
p2i(THREAD));
|
||||
}
|
||||
// for AbortVMOnException flag
|
||||
NOT_PRODUCT(Exceptions::debug_check_abort(except_oop));
|
||||
Exceptions::debug_check_abort(except_oop);
|
||||
|
||||
// No handler in this activation, unwind and try again
|
||||
THREAD->set_pending_exception(except_oop(), NULL, 0);
|
||||
goto handle_return;
|
||||
|
@ -458,7 +458,7 @@ IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThrea
|
||||
// // warning("performance bug: should not call runtime if method has no exception handlers");
|
||||
// }
|
||||
// for AbortVMOnException flag
|
||||
NOT_PRODUCT(Exceptions::debug_check_abort(h_exception));
|
||||
Exceptions::debug_check_abort(h_exception);
|
||||
|
||||
// exception handler lookup
|
||||
KlassHandle h_klass(THREAD, h_exception->klass());
|
||||
|
@ -1235,7 +1235,7 @@ JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* t
|
||||
}
|
||||
|
||||
// for AbortVMOnException flag
|
||||
NOT_PRODUCT(Exceptions::debug_check_abort(exception));
|
||||
Exceptions::debug_check_abort(exception);
|
||||
|
||||
#ifdef ASSERT
|
||||
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
|
||||
|
@ -2807,11 +2807,11 @@ public:
|
||||
"standard exit from VM if bytecode verify error " \
|
||||
"(only in debug mode)") \
|
||||
\
|
||||
notproduct(ccstr, AbortVMOnException, NULL, \
|
||||
diagnostic(ccstr, AbortVMOnException, NULL, \
|
||||
"Call fatal if this exception is thrown. Example: " \
|
||||
"java -XX:AbortVMOnException=java.lang.NullPointerException Foo") \
|
||||
\
|
||||
notproduct(ccstr, AbortVMOnExceptionMessage, NULL, \
|
||||
diagnostic(ccstr, AbortVMOnExceptionMessage, NULL, \
|
||||
"Call fatal if the exception pointed by AbortVMOnException " \
|
||||
"has this message") \
|
||||
\
|
||||
|
@ -861,7 +861,8 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread,
|
||||
assert(exception_kind == IMPLICIT_NULL || exception_kind == IMPLICIT_DIVIDE_BY_ZERO, "wrong implicit exception kind");
|
||||
|
||||
// for AbortVMOnException flag
|
||||
NOT_PRODUCT(Exceptions::debug_check_abort("java.lang.NullPointerException"));
|
||||
Exceptions::debug_check_abort("java.lang.NullPointerException");
|
||||
|
||||
if (exception_kind == IMPLICIT_NULL) {
|
||||
Events::log_exception(thread, "Implicit null exception at " INTPTR_FORMAT " to " INTPTR_FORMAT, p2i(pc), p2i(target_pc));
|
||||
} else {
|
||||
|
@ -2166,7 +2166,7 @@ void JavaThread::send_thread_stop(oop java_throwable) {
|
||||
tty->print_cr("Pending Async. exception installed of type: %s", InstanceKlass::cast(_pending_async_exception->klass())->external_name());
|
||||
}
|
||||
// for AbortVMOnException flag
|
||||
NOT_PRODUCT(Exceptions::debug_check_abort(InstanceKlass::cast(_pending_async_exception->klass())->external_name()));
|
||||
Exceptions::debug_check_abort(InstanceKlass::cast(_pending_async_exception->klass())->external_name());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exc
|
||||
p2i(h_exception()), file, line, p2i(thread));
|
||||
}
|
||||
// for AbortVMOnException flag
|
||||
NOT_PRODUCT(Exceptions::debug_check_abort(h_exception, message));
|
||||
Exceptions::debug_check_abort(h_exception, message);
|
||||
|
||||
// Check for special boot-strapping/vm-thread handling
|
||||
if (special_exception(thread, file, line, h_exception)) {
|
||||
@ -477,13 +477,12 @@ ExceptionMark::~ExceptionMark() {
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef PRODUCT
|
||||
// caller frees value_string if necessary
|
||||
void Exceptions::debug_check_abort(const char *value_string, const char* message) {
|
||||
if (AbortVMOnException != NULL && value_string != NULL &&
|
||||
strstr(value_string, AbortVMOnException)) {
|
||||
if (AbortVMOnExceptionMessage == NULL || message == NULL ||
|
||||
strcmp(message, AbortVMOnExceptionMessage) == 0) {
|
||||
if (AbortVMOnExceptionMessage == NULL || (message != NULL &&
|
||||
strstr(message, AbortVMOnExceptionMessage))) {
|
||||
fatal("Saw %s, aborting", value_string);
|
||||
}
|
||||
}
|
||||
@ -491,14 +490,17 @@ void Exceptions::debug_check_abort(const char *value_string, const char* message
|
||||
|
||||
void Exceptions::debug_check_abort(Handle exception, const char* message) {
|
||||
if (AbortVMOnException != NULL) {
|
||||
ResourceMark rm;
|
||||
if (message == NULL && exception->is_a(SystemDictionary::Throwable_klass())) {
|
||||
oop msg = java_lang_Throwable::message(exception);
|
||||
if (msg != NULL) {
|
||||
message = java_lang_String::as_utf8_string(msg);
|
||||
}
|
||||
}
|
||||
debug_check_abort(InstanceKlass::cast(exception()->klass())->external_name(), message);
|
||||
debug_check_abort_helper(exception, message);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Exceptions::debug_check_abort_helper(Handle exception, const char* message) {
|
||||
ResourceMark rm;
|
||||
if (message == NULL && exception->is_a(SystemDictionary::Throwable_klass())) {
|
||||
oop msg = java_lang_Throwable::message(exception);
|
||||
if (msg != NULL) {
|
||||
message = java_lang_String::as_utf8_string(msg);
|
||||
}
|
||||
}
|
||||
debug_check_abort(InstanceKlass::cast(exception()->klass())->external_name(), message);
|
||||
}
|
||||
|
@ -174,8 +174,9 @@ class Exceptions {
|
||||
static void print_exception_counts_on_error(outputStream* st);
|
||||
|
||||
// for AbortVMOnException flag
|
||||
NOT_PRODUCT(static void debug_check_abort(Handle exception, const char* message = NULL);)
|
||||
NOT_PRODUCT(static void debug_check_abort(const char *value_string, const char* message = NULL);)
|
||||
static void debug_check_abort(Handle exception, const char* message = NULL);
|
||||
static void debug_check_abort_helper(Handle exception, const char* message = NULL);
|
||||
static void debug_check_abort(const char *value_string, const char* message = NULL);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user