8136577: Make AbortVMOnException available in product builds
Reviewed-by: coleenp
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp Wed Oct 14 13:30:47 2015 -0400
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp Wed Oct 14 15:36:41 2015 -0700
@@ -553,7 +553,7 @@
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
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp Wed Oct 14 13:30:47 2015 -0400
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp Wed Oct 14 15:36:41 2015 -0700
@@ -2791,7 +2791,7 @@
(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 @@
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;
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Wed Oct 14 13:30:47 2015 -0400
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Wed Oct 14 15:36:41 2015 -0700
@@ -458,7 +458,7 @@
// // 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());
--- a/hotspot/src/share/vm/opto/runtime.cpp Wed Oct 14 13:30:47 2015 -0400
+++ b/hotspot/src/share/vm/opto/runtime.cpp Wed Oct 14 15:36:41 2015 -0700
@@ -1235,7 +1235,7 @@
}
// for AbortVMOnException flag
- NOT_PRODUCT(Exceptions::debug_check_abort(exception));
+ Exceptions::debug_check_abort(exception);
#ifdef ASSERT
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
--- a/hotspot/src/share/vm/runtime/globals.hpp Wed Oct 14 13:30:47 2015 -0400
+++ b/hotspot/src/share/vm/runtime/globals.hpp Wed Oct 14 15:36:41 2015 -0700
@@ -2807,11 +2807,11 @@
"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") \
\
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp Wed Oct 14 13:30:47 2015 -0400
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp Wed Oct 14 15:36:41 2015 -0700
@@ -861,7 +861,8 @@
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 {
--- a/hotspot/src/share/vm/runtime/thread.cpp Wed Oct 14 13:30:47 2015 -0400
+++ b/hotspot/src/share/vm/runtime/thread.cpp Wed Oct 14 15:36:41 2015 -0700
@@ -2166,7 +2166,7 @@
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());
}
}
--- a/hotspot/src/share/vm/utilities/exceptions.cpp Wed Oct 14 13:30:47 2015 -0400
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp Wed Oct 14 15:36:41 2015 -0700
@@ -145,7 +145,7 @@
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 @@
// ----------------------------------------------------------------------------------------
-#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(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);
+}
--- a/hotspot/src/share/vm/utilities/exceptions.hpp Wed Oct 14 13:30:47 2015 -0400
+++ b/hotspot/src/share/vm/utilities/exceptions.hpp Wed Oct 14 15:36:41 2015 -0700
@@ -174,8 +174,9 @@
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);
};