From 835c7b1be56316d6468335dffd2bd897f9519760 Mon Sep 17 00:00:00 2001 From: Sorna Sarathi N Date: Fri, 31 Jul 2026 12:49:29 +0000 Subject: [PATCH] 8354489: Some callers of VMError::report_and_die think it can return Reviewed-by: amitkumar, dholmes --- src/hotspot/os/windows/os_windows.cpp | 31 +++++++++------------------ src/hotspot/share/utilities/debug.cpp | 4 ---- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index f62e9c298e8..7c7e61098f5 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -2671,14 +2671,6 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) { return EXCEPTION_CONTINUE_EXECUTION; } -static inline void report_error(Thread* t, DWORD exception_code, - address addr, void* siginfo, void* context) { - VMError::report_and_die(t, exception_code, addr, siginfo, context); - - // If UseOSErrorReporting, this will return here and save the error file - // somewhere where we can find it in the minidump. -} - //----------------------------------------------------------------------------- JNIEXPORT LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { @@ -2750,9 +2742,8 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { // Fatal red zone violation. overflow_state->disable_stack_red_zone(); tty->print_raw_cr("An unrecoverable stack overflow has occurred."); - report_error(t, exception_code, pc, exception_record, - exceptionInfo->ContextRecord); - return EXCEPTION_CONTINUE_SEARCH; + VMError::report_and_die(t, exception_code, pc, exception_record, + exceptionInfo->ContextRecord); } } else if (exception_code == EXCEPTION_ACCESS_VIOLATION) { if (in_java) { @@ -2789,9 +2780,8 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { address stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); if (stub != nullptr) return Handle_Exception(exceptionInfo, stub); } - report_error(t, exception_code, pc, exception_record, - exceptionInfo->ContextRecord); - return EXCEPTION_CONTINUE_SEARCH; + VMError::report_and_die(t, exception_code, pc, exception_record, + exceptionInfo->ContextRecord); } // Special care for fast JNI field accessors. @@ -2803,9 +2793,8 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { } // Stack overflow or null pointer exception in native code. - report_error(t, exception_code, pc, exception_record, - exceptionInfo->ContextRecord); - return EXCEPTION_CONTINUE_SEARCH; + VMError::report_and_die(t, exception_code, pc, exception_record, + exceptionInfo->ContextRecord); } // /EXCEPTION_ACCESS_VIOLATION // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2873,8 +2862,8 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { #endif if (should_report_error) { - report_error(t, exception_code, pc, exception_record, - exceptionInfo->ContextRecord); + VMError::report_and_die(t, exception_code, pc, exception_record, + exceptionInfo->ContextRecord); } return EXCEPTION_CONTINUE_SEARCH; @@ -2894,8 +2883,8 @@ LONG WINAPI topLevelUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* excepti Thread* thread = Thread::current_or_null_safe(); if (exceptionCode != EXCEPTION_BREAKPOINT) { - report_error(thread, exceptionCode, pc, exceptionInfo->ExceptionRecord, - exceptionInfo->ContextRecord); + VMError::report_and_die(thread, exceptionCode, pc, exceptionInfo->ExceptionRecord, + exceptionInfo->ContextRecord); } } diff --git a/src/hotspot/share/utilities/debug.cpp b/src/hotspot/share/utilities/debug.cpp index 23e8281f000..27479acd68b 100644 --- a/src/hotspot/share/utilities/debug.cpp +++ b/src/hotspot/share/utilities/debug.cpp @@ -240,10 +240,6 @@ void report_vm_out_of_memory(const char* file, int line, size_t size, VMError::report_and_die(Thread::current_or_null(), file, line, size, vm_err_type, detail_fmt, detail_args); va_end(detail_args); - - // The UseOSErrorReporting option in report_and_die() may allow a return - // to here. If so then we'll have to figure out how to handle it. - guarantee(false, "report_and_die() should not return here"); } void report_should_not_call(const char* file, int line) {