425 }
426
427 // Otherwise wrap the exception in a BootstrapMethodError
428 if (TraceMethodHandles) {
429 tty->print_cr("[constant/invoke]dynamic throws BSME for " INTPTR_FORMAT, p2i((void *)exception));
430 exception->print();
431 }
432 Handle nested_exception(THREAD, exception);
433 THREAD->clear_pending_exception();
434 THROW_CAUSE(vmSymbols::java_lang_BootstrapMethodError(), nested_exception)
435 }
436 }
437
438 // Exception counting for hs_err file
439 volatile int Exceptions::_stack_overflow_errors = 0;
440 volatile int Exceptions::_out_of_memory_error_java_heap_errors = 0;
441 volatile int Exceptions::_out_of_memory_error_metaspace_errors = 0;
442 volatile int Exceptions::_out_of_memory_error_class_metaspace_errors = 0;
443
444 void Exceptions::count_out_of_memory_exceptions(Handle exception) {
445 if (exception() == Universe::out_of_memory_error_metaspace()) {
446 Atomic::inc(&_out_of_memory_error_metaspace_errors);
447 } else if (exception() == Universe::out_of_memory_error_class_metaspace()) {
448 Atomic::inc(&_out_of_memory_error_class_metaspace_errors);
449 } else {
450 // everything else reported as java heap OOM
451 Atomic::inc(&_out_of_memory_error_java_heap_errors);
452 }
453 }
454
455 void print_oom_count(outputStream* st, const char *err, int count) {
456 if (count > 0) {
457 st->print_cr("OutOfMemoryError %s=%d", err, count);
458 }
459 }
460
461 bool Exceptions::has_exception_counts() {
462 return (_stack_overflow_errors + _out_of_memory_error_java_heap_errors +
463 _out_of_memory_error_metaspace_errors + _out_of_memory_error_class_metaspace_errors) > 0;
464 }
465
466 void Exceptions::print_exception_counts_on_error(outputStream* st) {
|
425 }
426
427 // Otherwise wrap the exception in a BootstrapMethodError
428 if (TraceMethodHandles) {
429 tty->print_cr("[constant/invoke]dynamic throws BSME for " INTPTR_FORMAT, p2i((void *)exception));
430 exception->print();
431 }
432 Handle nested_exception(THREAD, exception);
433 THREAD->clear_pending_exception();
434 THROW_CAUSE(vmSymbols::java_lang_BootstrapMethodError(), nested_exception)
435 }
436 }
437
438 // Exception counting for hs_err file
439 volatile int Exceptions::_stack_overflow_errors = 0;
440 volatile int Exceptions::_out_of_memory_error_java_heap_errors = 0;
441 volatile int Exceptions::_out_of_memory_error_metaspace_errors = 0;
442 volatile int Exceptions::_out_of_memory_error_class_metaspace_errors = 0;
443
444 void Exceptions::count_out_of_memory_exceptions(Handle exception) {
445 if (oopDesc::equals(exception(), Universe::out_of_memory_error_metaspace())) {
446 Atomic::inc(&_out_of_memory_error_metaspace_errors);
447 } else if (oopDesc::equals(exception(), Universe::out_of_memory_error_class_metaspace())) {
448 Atomic::inc(&_out_of_memory_error_class_metaspace_errors);
449 } else {
450 // everything else reported as java heap OOM
451 Atomic::inc(&_out_of_memory_error_java_heap_errors);
452 }
453 }
454
455 void print_oom_count(outputStream* st, const char *err, int count) {
456 if (count > 0) {
457 st->print_cr("OutOfMemoryError %s=%d", err, count);
458 }
459 }
460
461 bool Exceptions::has_exception_counts() {
462 return (_stack_overflow_errors + _out_of_memory_error_java_heap_errors +
463 _out_of_memory_error_metaspace_errors + _out_of_memory_error_class_metaspace_errors) > 0;
464 }
465
466 void Exceptions::print_exception_counts_on_error(outputStream* st) {
|