8204477: Count linkage errors and print in Exceptions::print_exception_counts_on_error

Reviewed-by: stuefe, coleenp
This commit is contained in:
Rene Schuenemann 2018-05-30 14:46:17 +02:00 committed by Goetz Lindenmaier
parent 83ece1407f
commit 673a629875
2 changed files with 12 additions and 0 deletions

View File

@ -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 @@ void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exc
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 @@ void Exceptions::wrap_dynamic_exception(Thread* THREAD) {
// 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 @@ void Exceptions::print_exception_counts_on_error(outputStream* st) {
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

View File

@ -108,6 +108,9 @@ class Exceptions {
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.