hotspot/src/os/windows/vm/os_windows.cpp
changeset 7692 02c573fae027
parent 7448 11b630d174d5
child 7693 83e7f7a7c59b
equal deleted inserted replaced
7450:e44c68293be8 7692:02c573fae027
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * CopyrighT (c) 1997, 2010, Oracle and/or its affiliates. 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.
  2005 struct siglabel {
  2005 struct siglabel {
  2006   char *name;
  2006   char *name;
  2007   int   number;
  2007   int   number;
  2008 };
  2008 };
  2009 
  2009 
       
  2010 // All Visual C++ exceptions thrown from code generated by the Microsoft Visual
       
  2011 // C++ compiler contain this error code. Because this is a compiler-generated
       
  2012 // error, the code is not listed in the Win32 API header files.
       
  2013 // The code is actually a cryptic mnemonic device, with the initial "E"
       
  2014 // standing for "exception" and the final 3 bytes (0x6D7363) representing the
       
  2015 // ASCII values of "msc".
       
  2016 
       
  2017 #define EXCEPTION_UNCAUGHT_CXX_EXCEPTION    0xE06D7363
       
  2018 
       
  2019 
  2010 struct siglabel exceptlabels[] = {
  2020 struct siglabel exceptlabels[] = {
  2011     def_excpt(EXCEPTION_ACCESS_VIOLATION),
  2021     def_excpt(EXCEPTION_ACCESS_VIOLATION),
  2012     def_excpt(EXCEPTION_DATATYPE_MISALIGNMENT),
  2022     def_excpt(EXCEPTION_DATATYPE_MISALIGNMENT),
  2013     def_excpt(EXCEPTION_BREAKPOINT),
  2023     def_excpt(EXCEPTION_BREAKPOINT),
  2014     def_excpt(EXCEPTION_SINGLE_STEP),
  2024     def_excpt(EXCEPTION_SINGLE_STEP),
  2029     def_excpt(EXCEPTION_NONCONTINUABLE_EXCEPTION),
  2039     def_excpt(EXCEPTION_NONCONTINUABLE_EXCEPTION),
  2030     def_excpt(EXCEPTION_STACK_OVERFLOW),
  2040     def_excpt(EXCEPTION_STACK_OVERFLOW),
  2031     def_excpt(EXCEPTION_INVALID_DISPOSITION),
  2041     def_excpt(EXCEPTION_INVALID_DISPOSITION),
  2032     def_excpt(EXCEPTION_GUARD_PAGE),
  2042     def_excpt(EXCEPTION_GUARD_PAGE),
  2033     def_excpt(EXCEPTION_INVALID_HANDLE),
  2043     def_excpt(EXCEPTION_INVALID_HANDLE),
       
  2044     def_excpt(EXCEPTION_UNCAUGHT_CXX_EXCEPTION),
  2034     NULL, 0
  2045     NULL, 0
  2035 };
  2046 };
  2036 
  2047 
  2037 const char* os::exception_name(int exception_code, char *buf, size_t size) {
  2048 const char* os::exception_name(int exception_code, char *buf, size_t size) {
  2038   for (int i = 0; exceptlabels[i].name != NULL; i++) {
  2049   for (int i = 0; exceptlabels[i].name != NULL; i++) {
  2261       // Block current thread until the memory serialize page permission restored.
  2272       // Block current thread until the memory serialize page permission restored.
  2262       os::block_on_serialize_page_trap();
  2273       os::block_on_serialize_page_trap();
  2263       return EXCEPTION_CONTINUE_EXECUTION;
  2274       return EXCEPTION_CONTINUE_EXECUTION;
  2264     }
  2275     }
  2265   }
  2276   }
  2266 
       
  2267 
  2277 
  2268   if (t != NULL && t->is_Java_thread()) {
  2278   if (t != NULL && t->is_Java_thread()) {
  2269     JavaThread* thread = (JavaThread*) t;
  2279     JavaThread* thread = (JavaThread*) t;
  2270     bool in_java = thread->thread_state() == _thread_in_Java;
  2280     bool in_java = thread->thread_state() == _thread_in_Java;
  2271 
  2281 
  2466         return Handle_IDiv_Exception(exceptionInfo);
  2476         return Handle_IDiv_Exception(exceptionInfo);
  2467 
  2477 
  2468       } // switch
  2478       } // switch
  2469     }
  2479     }
  2470 #ifndef _WIN64
  2480 #ifndef _WIN64
  2471     if ((thread->thread_state() == _thread_in_Java) ||
  2481     if (((thread->thread_state() == _thread_in_Java) ||
  2472         (thread->thread_state() == _thread_in_native) )
  2482         (thread->thread_state() == _thread_in_native)) &&
       
  2483         exception_code != EXCEPTION_UNCAUGHT_CXX_EXCEPTION)
  2473     {
  2484     {
  2474       LONG result=Handle_FLT_Exception(exceptionInfo);
  2485       LONG result=Handle_FLT_Exception(exceptionInfo);
  2475       if (result==EXCEPTION_CONTINUE_EXECUTION) return result;
  2486       if (result==EXCEPTION_CONTINUE_EXECUTION) return result;
  2476     }
  2487     }
  2477 #endif //_WIN64
  2488 #endif //_WIN64
  2491       case EXCEPTION_STACK_OVERFLOW:
  2502       case EXCEPTION_STACK_OVERFLOW:
  2492       case EXCEPTION_ILLEGAL_INSTRUCTION:
  2503       case EXCEPTION_ILLEGAL_INSTRUCTION:
  2493       case EXCEPTION_ILLEGAL_INSTRUCTION_2:
  2504       case EXCEPTION_ILLEGAL_INSTRUCTION_2:
  2494       case EXCEPTION_INT_OVERFLOW:
  2505       case EXCEPTION_INT_OVERFLOW:
  2495       case EXCEPTION_INT_DIVIDE_BY_ZERO:
  2506       case EXCEPTION_INT_DIVIDE_BY_ZERO:
       
  2507       case EXCEPTION_UNCAUGHT_CXX_EXCEPTION:
  2496       {  report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
  2508       {  report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
  2497                        exceptionInfo->ContextRecord);
  2509                        exceptionInfo->ContextRecord);
  2498       }
  2510       }
  2499         break;
  2511         break;
  2500       default:
  2512       default: