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));
|
exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
|
||||||
}
|
}
|
||||||
// for AbortVMOnException flag
|
// 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
|
// Clear out the exception oop and pc since looking up an
|
||||||
// exception handler can cause class loading, which might throw an
|
// exception handler can cause class loading, which might throw an
|
||||||
|
@ -2791,7 +2791,7 @@ run:
|
|||||||
(int)continuation_bci, p2i(THREAD));
|
(int)continuation_bci, p2i(THREAD));
|
||||||
}
|
}
|
||||||
// for AbortVMOnException flag
|
// for AbortVMOnException flag
|
||||||
NOT_PRODUCT(Exceptions::debug_check_abort(except_oop));
|
Exceptions::debug_check_abort(except_oop);
|
||||||
|
|
||||||
// Update profiling data.
|
// Update profiling data.
|
||||||
BI_PROFILE_ALIGN_TO_CURRENT_BCI();
|
BI_PROFILE_ALIGN_TO_CURRENT_BCI();
|
||||||
@ -2807,7 +2807,8 @@ run:
|
|||||||
p2i(THREAD));
|
p2i(THREAD));
|
||||||
}
|
}
|
||||||
// for AbortVMOnException flag
|
// 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
|
// No handler in this activation, unwind and try again
|
||||||
THREAD->set_pending_exception(except_oop(), NULL, 0);
|
THREAD->set_pending_exception(except_oop(), NULL, 0);
|
||||||
goto handle_return;
|
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");
|
// // warning("performance bug: should not call runtime if method has no exception handlers");
|
||||||
// }
|
// }
|
||||||
// for AbortVMOnException flag
|
// for AbortVMOnException flag
|
||||||
NOT_PRODUCT(Exceptions::debug_check_abort(h_exception));
|
Exceptions::debug_check_abort(h_exception);
|
||||||
|
|
||||||
// exception handler lookup
|
// exception handler lookup
|
||||||
KlassHandle h_klass(THREAD, h_exception->klass());
|
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
|
// for AbortVMOnException flag
|
||||||
NOT_PRODUCT(Exceptions::debug_check_abort(exception));
|
Exceptions::debug_check_abort(exception);
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
|
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
|
||||||
|
@ -2807,11 +2807,11 @@ public:
|
|||||||
"standard exit from VM if bytecode verify error " \
|
"standard exit from VM if bytecode verify error " \
|
||||||
"(only in debug mode)") \
|
"(only in debug mode)") \
|
||||||
\
|
\
|
||||||
notproduct(ccstr, AbortVMOnException, NULL, \
|
diagnostic(ccstr, AbortVMOnException, NULL, \
|
||||||
"Call fatal if this exception is thrown. Example: " \
|
"Call fatal if this exception is thrown. Example: " \
|
||||||
"java -XX:AbortVMOnException=java.lang.NullPointerException Foo") \
|
"java -XX:AbortVMOnException=java.lang.NullPointerException Foo") \
|
||||||
\
|
\
|
||||||
notproduct(ccstr, AbortVMOnExceptionMessage, NULL, \
|
diagnostic(ccstr, AbortVMOnExceptionMessage, NULL, \
|
||||||
"Call fatal if the exception pointed by AbortVMOnException " \
|
"Call fatal if the exception pointed by AbortVMOnException " \
|
||||||
"has this message") \
|
"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");
|
assert(exception_kind == IMPLICIT_NULL || exception_kind == IMPLICIT_DIVIDE_BY_ZERO, "wrong implicit exception kind");
|
||||||
|
|
||||||
// for AbortVMOnException flag
|
// for AbortVMOnException flag
|
||||||
NOT_PRODUCT(Exceptions::debug_check_abort("java.lang.NullPointerException"));
|
Exceptions::debug_check_abort("java.lang.NullPointerException");
|
||||||
|
|
||||||
if (exception_kind == IMPLICIT_NULL) {
|
if (exception_kind == IMPLICIT_NULL) {
|
||||||
Events::log_exception(thread, "Implicit null exception at " INTPTR_FORMAT " to " INTPTR_FORMAT, p2i(pc), p2i(target_pc));
|
Events::log_exception(thread, "Implicit null exception at " INTPTR_FORMAT " to " INTPTR_FORMAT, p2i(pc), p2i(target_pc));
|
||||||
} else {
|
} 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());
|
tty->print_cr("Pending Async. exception installed of type: %s", InstanceKlass::cast(_pending_async_exception->klass())->external_name());
|
||||||
}
|
}
|
||||||
// for AbortVMOnException flag
|
// 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));
|
p2i(h_exception()), file, line, p2i(thread));
|
||||||
}
|
}
|
||||||
// for AbortVMOnException flag
|
// 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
|
// Check for special boot-strapping/vm-thread handling
|
||||||
if (special_exception(thread, file, line, h_exception)) {
|
if (special_exception(thread, file, line, h_exception)) {
|
||||||
@ -477,13 +477,12 @@ ExceptionMark::~ExceptionMark() {
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef PRODUCT
|
|
||||||
// caller frees value_string if necessary
|
// caller frees value_string if necessary
|
||||||
void Exceptions::debug_check_abort(const char *value_string, const char* message) {
|
void Exceptions::debug_check_abort(const char *value_string, const char* message) {
|
||||||
if (AbortVMOnException != NULL && value_string != NULL &&
|
if (AbortVMOnException != NULL && value_string != NULL &&
|
||||||
strstr(value_string, AbortVMOnException)) {
|
strstr(value_string, AbortVMOnException)) {
|
||||||
if (AbortVMOnExceptionMessage == NULL || message == NULL ||
|
if (AbortVMOnExceptionMessage == NULL || (message != NULL &&
|
||||||
strcmp(message, AbortVMOnExceptionMessage) == 0) {
|
strstr(message, AbortVMOnExceptionMessage))) {
|
||||||
fatal("Saw %s, aborting", value_string);
|
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) {
|
void Exceptions::debug_check_abort(Handle exception, const char* message) {
|
||||||
if (AbortVMOnException != NULL) {
|
if (AbortVMOnException != NULL) {
|
||||||
ResourceMark rm;
|
debug_check_abort_helper(exception, message);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#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);
|
static void print_exception_counts_on_error(outputStream* st);
|
||||||
|
|
||||||
// for AbortVMOnException flag
|
// for AbortVMOnException flag
|
||||||
NOT_PRODUCT(static void debug_check_abort(Handle exception, const char* message = NULL);)
|
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_helper(Handle exception, const char* message = NULL);
|
||||||
|
static void debug_check_abort(const char *value_string, const char* message = NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user