# HG changeset patch # User Rene Schuenemann # Date 1527684377 -7200 # Wed May 30 14:46:17 2018 +0200 # Node ID 1a1a8a53c137928dffbe4e14e2bb3df5aeb0b286 # Parent 48d4abe945f186e371633fcabee5aeb20d44cd4b 8204477: Count linkage errors and print in Exceptions::print_exception_counts_on_error diff --git a/src/hotspot/share/utilities/exceptions.cpp b/src/hotspot/share/utilities/exceptions.cpp --- a/src/hotspot/share/utilities/exceptions.cpp +++ b/src/hotspot/share/utilities/exceptions.cpp @@ -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 diff --git a/src/hotspot/share/utilities/exceptions.hpp b/src/hotspot/share/utilities/exceptions.hpp --- a/src/hotspot/share/utilities/exceptions.hpp +++ b/src/hotspot/share/utilities/exceptions.hpp @@ -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.