8204477: Count linkage errors and print in Exceptions::print_exception_counts_on_error
Reviewed-by: stuefe, coleenp
Contributed-by: Rene Schuenemann <rene.schuenemann@gmail.com>
--- a/src/hotspot/share/utilities/exceptions.cpp Wed May 30 14:46:17 2018 +0200
+++ b/src/hotspot/share/utilities/exceptions.cpp Wed May 30 14:46:17 2018 +0200
@@ -37,6 +37,7 @@
#include "runtime/os.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/threadCritical.hpp"
+#include "runtime/atomic.hpp"
#include "utilities/events.hpp"
#include "utilities/exceptions.hpp"
@@ -151,6 +152,10 @@
count_out_of_memory_exceptions(h_exception);
}
+ if (h_exception->is_a(SystemDictionary::LinkageError_klass())) {
+ Atomic::inc(&_linkage_errors);
+ }
+
assert(h_exception->is_a(SystemDictionary::Throwable_klass()), "exception is not a subclass of java/lang/Throwable");
// set the pending exception
@@ -425,6 +430,7 @@
// Exception counting for hs_err file
volatile int Exceptions::_stack_overflow_errors = 0;
+volatile int Exceptions::_linkage_errors = 0;
volatile int Exceptions::_out_of_memory_error_java_heap_errors = 0;
volatile int Exceptions::_out_of_memory_error_metaspace_errors = 0;
volatile int Exceptions::_out_of_memory_error_class_metaspace_errors = 0;
@@ -458,6 +464,9 @@
if (_stack_overflow_errors > 0) {
st->print_cr("StackOverflowErrors=%d", _stack_overflow_errors);
}
+ if (_linkage_errors > 0) {
+ st->print_cr("LinkageErrors=%d", _linkage_errors);
+ }
}
// Implementation of ExceptionMark
--- a/src/hotspot/share/utilities/exceptions.hpp Wed May 30 14:46:17 2018 +0200
+++ b/src/hotspot/share/utilities/exceptions.hpp Wed May 30 14:46:17 2018 +0200
@@ -108,6 +108,9 @@
static volatile int _out_of_memory_error_java_heap_errors;
static volatile int _out_of_memory_error_metaspace_errors;
static volatile int _out_of_memory_error_class_metaspace_errors;
+
+ // Count linkage errors
+ static volatile int _linkage_errors;
public:
// this enum is defined to indicate whether it is safe to
// ignore the encoding scheme of the original message string.