hotspot/src/os/windows/vm/os_windows.cpp
changeset 22487 97a29d87282f
parent 20006 9dc2add3103b
child 22533 76088853a2eb
equal deleted inserted replaced
22486:5de5916f2485 22487:97a29d87282f
   164 // For Windows at the moment does nothing
   164 // For Windows at the moment does nothing
   165 void os::run_periodic_checks() {
   165 void os::run_periodic_checks() {
   166   return;
   166   return;
   167 }
   167 }
   168 
   168 
   169 #ifndef _WIN64
       
   170 // previous UnhandledExceptionFilter, if there is one
   169 // previous UnhandledExceptionFilter, if there is one
   171 static LPTOP_LEVEL_EXCEPTION_FILTER prev_uef_handler = NULL;
   170 static LPTOP_LEVEL_EXCEPTION_FILTER prev_uef_handler = NULL;
   172 
   171 
   173 LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo);
   172 LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo);
   174 #endif
       
   175 void os::init_system_properties_values() {
   173 void os::init_system_properties_values() {
   176   /* sysclasspath, java_home, dll_dir */
   174   /* sysclasspath, java_home, dll_dir */
   177   {
   175   {
   178       char *home_path;
   176       char *home_path;
   179       char *dll_path;
   177       char *dll_path;
  2238   // Continue the execution
  2236   // Continue the execution
  2239 #endif
  2237 #endif
  2240   return EXCEPTION_CONTINUE_EXECUTION;
  2238   return EXCEPTION_CONTINUE_EXECUTION;
  2241 }
  2239 }
  2242 
  2240 
  2243 #ifndef  _WIN64
       
  2244 //-----------------------------------------------------------------------------
  2241 //-----------------------------------------------------------------------------
  2245 LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
  2242 LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
       
  2243   PCONTEXT ctx = exceptionInfo->ContextRecord;
       
  2244 #ifndef  _WIN64
  2246   // handle exception caused by native method modifying control word
  2245   // handle exception caused by native method modifying control word
  2247   PCONTEXT ctx = exceptionInfo->ContextRecord;
       
  2248   DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode;
  2246   DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode;
  2249 
  2247 
  2250   switch (exception_code) {
  2248   switch (exception_code) {
  2251     case EXCEPTION_FLT_DENORMAL_OPERAND:
  2249     case EXCEPTION_FLT_DENORMAL_OPERAND:
  2252     case EXCEPTION_FLT_DIVIDE_BY_ZERO:
  2250     case EXCEPTION_FLT_DIVIDE_BY_ZERO:
  2268   if (prev_uef_handler != NULL) {
  2266   if (prev_uef_handler != NULL) {
  2269     // We didn't handle this exception so pass it to the previous
  2267     // We didn't handle this exception so pass it to the previous
  2270     // UnhandledExceptionFilter.
  2268     // UnhandledExceptionFilter.
  2271     return (prev_uef_handler)(exceptionInfo);
  2269     return (prev_uef_handler)(exceptionInfo);
  2272   }
  2270   }
  2273 
  2271 #else // !_WIN64
  2274   return EXCEPTION_CONTINUE_SEARCH;
       
  2275 }
       
  2276 #else //_WIN64
       
  2277 /*
  2272 /*
  2278   On Windows, the mxcsr control bits are non-volatile across calls
  2273   On Windows, the mxcsr control bits are non-volatile across calls
  2279   See also CR 6192333
  2274   See also CR 6192333
  2280   If EXCEPTION_FLT_* happened after some native method modified
  2275   */
  2281   mxcsr - it is not a jvm fault.
       
  2282   However should we decide to restore of mxcsr after a faulty
       
  2283   native method we can uncomment following code
       
  2284       jint MxCsr = INITIAL_MXCSR;
  2276       jint MxCsr = INITIAL_MXCSR;
  2285         // we can't use StubRoutines::addr_mxcsr_std()
  2277         // we can't use StubRoutines::addr_mxcsr_std()
  2286         // because in Win64 mxcsr is not saved there
  2278         // because in Win64 mxcsr is not saved there
  2287       if (MxCsr != ctx->MxCsr) {
  2279       if (MxCsr != ctx->MxCsr) {
  2288         ctx->MxCsr = MxCsr;
  2280         ctx->MxCsr = MxCsr;
  2289         return EXCEPTION_CONTINUE_EXECUTION;
  2281         return EXCEPTION_CONTINUE_EXECUTION;
  2290       }
  2282       }
  2291 
  2283 #endif // !_WIN64
  2292 */
  2284 
  2293 #endif //_WIN64
  2285   return EXCEPTION_CONTINUE_SEARCH;
  2294 
  2286 }
  2295 
  2287 
  2296 // Fatal error reporting is single threaded so we can make this a
  2288 // Fatal error reporting is single threaded so we can make this a
  2297 // static and preallocated.  If it's more than MAX_PATH silently ignore
  2289 // static and preallocated.  If it's more than MAX_PATH silently ignore
  2298 // it.
  2290 // it.
  2299 static char saved_error_file[MAX_PATH] = {0};
  2291 static char saved_error_file[MAX_PATH] = {0};
  2638       case EXCEPTION_INT_OVERFLOW:
  2630       case EXCEPTION_INT_OVERFLOW:
  2639         return Handle_IDiv_Exception(exceptionInfo);
  2631         return Handle_IDiv_Exception(exceptionInfo);
  2640 
  2632 
  2641       } // switch
  2633       } // switch
  2642     }
  2634     }
  2643 #ifndef _WIN64
       
  2644     if (((thread->thread_state() == _thread_in_Java) ||
  2635     if (((thread->thread_state() == _thread_in_Java) ||
  2645         (thread->thread_state() == _thread_in_native)) &&
  2636         (thread->thread_state() == _thread_in_native)) &&
  2646         exception_code != EXCEPTION_UNCAUGHT_CXX_EXCEPTION)
  2637         exception_code != EXCEPTION_UNCAUGHT_CXX_EXCEPTION)
  2647     {
  2638     {
  2648       LONG result=Handle_FLT_Exception(exceptionInfo);
  2639       LONG result=Handle_FLT_Exception(exceptionInfo);
  2649       if (result==EXCEPTION_CONTINUE_EXECUTION) return result;
  2640       if (result==EXCEPTION_CONTINUE_EXECUTION) return result;
  2650     }
  2641     }
  2651 #endif //_WIN64
       
  2652   }
  2642   }
  2653 
  2643 
  2654   if (exception_code != EXCEPTION_BREAKPOINT) {
  2644   if (exception_code != EXCEPTION_BREAKPOINT) {
  2655     report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
  2645     report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
  2656                  exceptionInfo->ContextRecord);
  2646                  exceptionInfo->ContextRecord);