# HG changeset patch # User zgu # Date 1389294413 18000 # Node ID 97a29d87282f06815a336cc63abc3acbac9082b0 # Parent 5de5916f2485d5bf2103b4fdc216b7a7b8389baf 7012961: runtime/jni/WindowsExceptionFilter/WindowsExceptionFilter01 crashes on windows-amd64 Summary: VM needs to handle EXCEPTION_FLT_* exceptions on Win64 Reviewed-by: coleenp, ccheung diff -r 5de5916f2485 -r 97a29d87282f hotspot/src/os/windows/vm/os_windows.cpp --- a/hotspot/src/os/windows/vm/os_windows.cpp Wed Jan 08 13:20:33 2014 +0100 +++ b/hotspot/src/os/windows/vm/os_windows.cpp Thu Jan 09 14:06:53 2014 -0500 @@ -166,12 +166,10 @@ return; } -#ifndef _WIN64 // previous UnhandledExceptionFilter, if there is one static LPTOP_LEVEL_EXCEPTION_FILTER prev_uef_handler = NULL; LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo); -#endif void os::init_system_properties_values() { /* sysclasspath, java_home, dll_dir */ { @@ -2240,11 +2238,11 @@ return EXCEPTION_CONTINUE_EXECUTION; } -#ifndef _WIN64 //----------------------------------------------------------------------------- LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) { + PCONTEXT ctx = exceptionInfo->ContextRecord; +#ifndef _WIN64 // handle exception caused by native method modifying control word - PCONTEXT ctx = exceptionInfo->ContextRecord; DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode; switch (exception_code) { @@ -2270,17 +2268,11 @@ // UnhandledExceptionFilter. return (prev_uef_handler)(exceptionInfo); } - - return EXCEPTION_CONTINUE_SEARCH; -} -#else //_WIN64 +#else // !_WIN64 /* On Windows, the mxcsr control bits are non-volatile across calls See also CR 6192333 - If EXCEPTION_FLT_* happened after some native method modified - mxcsr - it is not a jvm fault. - However should we decide to restore of mxcsr after a faulty - native method we can uncomment following code + */ jint MxCsr = INITIAL_MXCSR; // we can't use StubRoutines::addr_mxcsr_std() // because in Win64 mxcsr is not saved there @@ -2288,10 +2280,10 @@ ctx->MxCsr = MxCsr; return EXCEPTION_CONTINUE_EXECUTION; } - -*/ -#endif //_WIN64 - +#endif // !_WIN64 + + return EXCEPTION_CONTINUE_SEARCH; +} // Fatal error reporting is single threaded so we can make this a // static and preallocated. If it's more than MAX_PATH silently ignore @@ -2640,7 +2632,6 @@ } // switch } -#ifndef _WIN64 if (((thread->thread_state() == _thread_in_Java) || (thread->thread_state() == _thread_in_native)) && exception_code != EXCEPTION_UNCAUGHT_CXX_EXCEPTION) @@ -2648,7 +2639,6 @@ LONG result=Handle_FLT_Exception(exceptionInfo); if (result==EXCEPTION_CONTINUE_EXECUTION) return result; } -#endif //_WIN64 } if (exception_code != EXCEPTION_BREAKPOINT) {