src/hotspot/os/windows/os_windows.cpp
changeset 53687 e439ec989141
parent 53646 043ae846819f
child 53882 ca682d9d8db5
equal deleted inserted replaced
53686:3047cf8c3bc2 53687:e439ec989141
   123   #define __CPU__ amd64
   123   #define __CPU__ amd64
   124 #else
   124 #else
   125   #define __CPU__ i486
   125   #define __CPU__ i486
   126 #endif
   126 #endif
   127 
   127 
       
   128 #if INCLUDE_AOT
       
   129 PVOID  topLevelVectoredExceptionHandler = NULL;
       
   130 LONG WINAPI topLevelVectoredExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo);
       
   131 #endif
       
   132 
   128 // save DLL module handle, used by GetModuleFileName
   133 // save DLL module handle, used by GetModuleFileName
   129 
   134 
   130 HINSTANCE vm_lib_handle;
   135 HINSTANCE vm_lib_handle;
   131 
   136 
   132 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
   137 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
   141     break;
   146     break;
   142   case DLL_PROCESS_DETACH:
   147   case DLL_PROCESS_DETACH:
   143     if (ForceTimeHighResolution) {
   148     if (ForceTimeHighResolution) {
   144       timeEndPeriod(1L);
   149       timeEndPeriod(1L);
   145     }
   150     }
       
   151 #if INCLUDE_AOT
       
   152     if (topLevelVectoredExceptionHandler != NULL) {
       
   153       RemoveVectoredExceptionHandler(topLevelVectoredExceptionHandler);
       
   154       topLevelVectoredExceptionHandler = NULL;
       
   155     }
       
   156 #endif
   146     break;
   157     break;
   147   default:
   158   default:
   148     break;
   159     break;
   149   }
   160   }
   150   return true;
   161   return true;
  2322     }
  2333     }
  2323   }
  2334   }
  2324   assert(fr->is_java_frame(), "Safety check");
  2335   assert(fr->is_java_frame(), "Safety check");
  2325   return true;
  2336   return true;
  2326 }
  2337 }
       
  2338 
       
  2339 #if INCLUDE_AOT
       
  2340 LONG WINAPI topLevelVectoredExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
       
  2341   PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
       
  2342   address addr = (address) exceptionRecord->ExceptionInformation[1];
       
  2343   address pc = (address) exceptionInfo->ContextRecord->Rip;
       
  2344 
       
  2345   // Handle the case where we get an implicit exception in AOT generated
       
  2346   // code.  AOT DLL's loaded are not registered for structured exceptions.
       
  2347   // If the exception occurred in the codeCache or AOT code, pass control
       
  2348   // to our normal exception handler.
       
  2349   CodeBlob* cb = CodeCache::find_blob(pc);
       
  2350   if (cb != NULL) {
       
  2351     return topLevelExceptionFilter(exceptionInfo);
       
  2352   }
       
  2353 
       
  2354   return EXCEPTION_CONTINUE_SEARCH;
       
  2355 }
       
  2356 #endif
  2327 
  2357 
  2328 //-----------------------------------------------------------------------------
  2358 //-----------------------------------------------------------------------------
  2329 LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
  2359 LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
  2330   if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH;
  2360   if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH;
  2331   DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode;
  2361   DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode;
  4078   // have to set it the same so we have to mirror Solaris.
  4108   // have to set it the same so we have to mirror Solaris.
  4079   DEBUG_ONLY(os::set_mutex_init_done();)
  4109   DEBUG_ONLY(os::set_mutex_init_done();)
  4080 
  4110 
  4081   // Setup Windows Exceptions
  4111   // Setup Windows Exceptions
  4082 
  4112 
       
  4113 #if INCLUDE_AOT
       
  4114   // If AOT is enabled we need to install a vectored exception handler
       
  4115   // in order to forward implicit exceptions from code in AOT
       
  4116   // generated DLLs.  This is necessary since these DLLs are not
       
  4117   // registered for structured exceptions like codecache methods are.
       
  4118   if (UseAOT) {
       
  4119     topLevelVectoredExceptionHandler = AddVectoredExceptionHandler( 1, topLevelVectoredExceptionFilter);
       
  4120   }
       
  4121 #endif
       
  4122 
  4083   // for debugging float code generation bugs
  4123   // for debugging float code generation bugs
  4084   if (ForceFloatExceptions) {
  4124   if (ForceFloatExceptions) {
  4085 #ifndef  _WIN64
  4125 #ifndef  _WIN64
  4086     static long fp_control_word = 0;
  4126     static long fp_control_word = 0;
  4087     __asm { fstcw fp_control_word }
  4127     __asm { fstcw fp_control_word }