hotspot/src/os/windows/vm/os_windows.cpp
changeset 4763 b69c4532c561
parent 4493 9204129f065e
parent 4762 c75b48e6b250
child 5085 4f0c435f8c3c
equal deleted inserted replaced
4761:bdb7375a1fee 4763:b69c4532c561
     1 /*
     1 /*
     2  * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 1997-2010 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   140 void os::run_periodic_checks() {
   140 void os::run_periodic_checks() {
   141   return;
   141   return;
   142 }
   142 }
   143 
   143 
   144 #ifndef _WIN64
   144 #ifndef _WIN64
       
   145 // previous UnhandledExceptionFilter, if there is one
       
   146 static LPTOP_LEVEL_EXCEPTION_FILTER prev_uef_handler = NULL;
       
   147 
   145 LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo);
   148 LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo);
   146 #endif
   149 #endif
   147 void os::init_system_properties_values() {
   150 void os::init_system_properties_values() {
   148   /* sysclasspath, java_home, dll_dir */
   151   /* sysclasspath, java_home, dll_dir */
   149   {
   152   {
   258     Arguments::set_endorsed_dirs(buf);
   261     Arguments::set_endorsed_dirs(buf);
   259     #undef ENDORSED_DIR
   262     #undef ENDORSED_DIR
   260   }
   263   }
   261 
   264 
   262 #ifndef _WIN64
   265 #ifndef _WIN64
   263   SetUnhandledExceptionFilter(Handle_FLT_Exception);
   266   // set our UnhandledExceptionFilter and save any previous one
       
   267   prev_uef_handler = SetUnhandledExceptionFilter(Handle_FLT_Exception);
   264 #endif
   268 #endif
   265 
   269 
   266   // Done
   270   // Done
   267   return;
   271   return;
   268 }
   272 }
  1967 }
  1971 }
  1968 
  1972 
  1969 #ifndef  _WIN64
  1973 #ifndef  _WIN64
  1970 //-----------------------------------------------------------------------------
  1974 //-----------------------------------------------------------------------------
  1971 LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
  1975 LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
  1972   // handle exception caused by native mothod modifying control word
  1976   // handle exception caused by native method modifying control word
  1973   PCONTEXT ctx = exceptionInfo->ContextRecord;
  1977   PCONTEXT ctx = exceptionInfo->ContextRecord;
  1974   DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode;
  1978   DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode;
  1975 
  1979 
  1976   switch (exception_code) {
  1980   switch (exception_code) {
  1977     case EXCEPTION_FLT_DENORMAL_OPERAND:
  1981     case EXCEPTION_FLT_DENORMAL_OPERAND:
  1988         // Mask out pending FLT exceptions
  1992         // Mask out pending FLT exceptions
  1989         ctx->FloatSave.StatusWord &=  0xffffff00;
  1993         ctx->FloatSave.StatusWord &=  0xffffff00;
  1990         return EXCEPTION_CONTINUE_EXECUTION;
  1994         return EXCEPTION_CONTINUE_EXECUTION;
  1991       }
  1995       }
  1992   }
  1996   }
       
  1997 
       
  1998   if (prev_uef_handler != NULL) {
       
  1999     // We didn't handle this exception so pass it to the previous
       
  2000     // UnhandledExceptionFilter.
       
  2001     return (prev_uef_handler)(exceptionInfo);
       
  2002   }
       
  2003 
  1993   return EXCEPTION_CONTINUE_SEARCH;
  2004   return EXCEPTION_CONTINUE_SEARCH;
  1994 }
  2005 }
  1995 #else //_WIN64
  2006 #else //_WIN64
  1996 /*
  2007 /*
  1997   On Windows, the mxcsr control bits are non-volatile across calls
  2008   On Windows, the mxcsr control bits are non-volatile across calls