diff a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -122,14 +122,11 @@ #define __CPU__ amd64 #else #define __CPU__ i486 #endif -#if INCLUDE_AOT PVOID topLevelVectoredExceptionHandler = NULL; -LONG WINAPI topLevelVectoredExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo); -#endif // save DLL module handle, used by GetModuleFileName HINSTANCE vm_lib_handle; @@ -145,16 +142,14 @@ break; case DLL_PROCESS_DETACH: if (ForceTimeHighResolution) { timeEndPeriod(1L); } -#if INCLUDE_AOT if (topLevelVectoredExceptionHandler != NULL) { RemoveVectoredExceptionHandler(topLevelVectoredExceptionHandler); topLevelVectoredExceptionHandler = NULL; } -#endif break; default: break; } return true; @@ -418,12 +413,10 @@ return res; } return NULL; } -LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo); - // Thread start routine for all newly created threads static unsigned __stdcall thread_native_entry(Thread* thread) { thread->record_stack_base_and_size(); @@ -454,19 +447,14 @@ res = 20115; // java thread } log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ").", os::current_thread_id()); - // Install a win32 structured exception handler around every thread created - // by VM, so VM can generate error dump when an exception occurred in non- - // Java thread (e.g. VM thread). - __try { - thread->call_run(); - } __except(topLevelExceptionFilter( - (_EXCEPTION_POINTERS*)_exception_info())) { - // Nothing to do. - } + // Any exception is caught by the Vectored Exception Handler, so VM can + // generate error dump when an exception occurred in non-Java thread + // (e.g. VM thread). + thread->call_run(); // Note: at this point the thread object may already have deleted itself. // Do not dereference it from here on out. log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ").", os::current_thread_id()); @@ -2356,29 +2344,10 @@ } assert(fr->is_java_frame(), "Safety check"); return true; } -#if INCLUDE_AOT -LONG WINAPI topLevelVectoredExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { - PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord; - address addr = (address) exceptionRecord->ExceptionInformation[1]; - address pc = (address) exceptionInfo->ContextRecord->Rip; - - // Handle the case where we get an implicit exception in AOT generated - // code. AOT DLL's loaded are not registered for structured exceptions. - // If the exception occurred in the codeCache or AOT code, pass control - // to our normal exception handler. - CodeBlob* cb = CodeCache::find_blob(pc); - if (cb != NULL) { - return topLevelExceptionFilter(exceptionInfo); - } - - return EXCEPTION_CONTINUE_SEARCH; -} -#endif - //----------------------------------------------------------------------------- LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH; DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode; #ifdef _M_AMD64 @@ -2392,12 +2361,10 @@ if (StubRoutines::is_safefetch_fault(pc)) { return Handle_Exception(exceptionInfo, StubRoutines::continuation_for_safefetch_fault(pc)); } #ifndef _WIN64 - // Execution protection violation - win32 running on AMD64 only - // Handled first to avoid misdiagnosis as a "normal" access violation; // This is safe to do because we have a new/unique ExceptionInformation // code for this condition. if (exception_code == EXCEPTION_ACCESS_VIOLATION) { PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord; int exception_subcode = (int) exceptionRecord->ExceptionInformation[0]; @@ -4146,20 +4113,11 @@ // This could be set any time but all platforms // have to set it the same so we have to mirror Solaris. DEBUG_ONLY(os::set_mutex_init_done();) // Setup Windows Exceptions - -#if INCLUDE_AOT - // If AOT is enabled we need to install a vectored exception handler - // in order to forward implicit exceptions from code in AOT - // generated DLLs. This is necessary since these DLLs are not - // registered for structured exceptions like codecache methods are. - if (AOTLibrary != NULL && (UseAOT || FLAG_IS_DEFAULT(UseAOT))) { - topLevelVectoredExceptionHandler = AddVectoredExceptionHandler( 1, topLevelVectoredExceptionFilter); - } -#endif + topLevelVectoredExceptionHandler = AddVectoredExceptionHandler(1, topLevelExceptionFilter); // for debugging float code generation bugs if (ForceFloatExceptions) { #ifndef _WIN64 static long fp_control_word = 0;