hotspot/src/os/windows/vm/os_windows.cpp
changeset 46529 e473f49d42a7
parent 46476 8ead62daaa47
child 46587 6c97f34cb194
equal deleted inserted replaced
46528:cf0da758e7b5 46529:e473f49d42a7
   112 static FILETIME process_creation_time;
   112 static FILETIME process_creation_time;
   113 static FILETIME process_exit_time;
   113 static FILETIME process_exit_time;
   114 static FILETIME process_user_time;
   114 static FILETIME process_user_time;
   115 static FILETIME process_kernel_time;
   115 static FILETIME process_kernel_time;
   116 
   116 
   117 #ifdef _M_IA64
   117 #ifdef _M_AMD64
   118   #define __CPU__ ia64
   118   #define __CPU__ amd64
   119 #else
   119 #else
   120   #ifdef _M_AMD64
   120   #define __CPU__ i486
   121     #define __CPU__ amd64
       
   122   #else
       
   123     #define __CPU__ i486
       
   124   #endif
       
   125 #endif
   121 #endif
   126 
   122 
   127 // save DLL module handle, used by GetModuleFileName
   123 // save DLL module handle, used by GetModuleFileName
   128 
   124 
   129 HINSTANCE vm_lib_handle;
   125 HINSTANCE vm_lib_handle;
   349       stack_size += minfo.RegionSize;
   345       stack_size += minfo.RegionSize;
   350     } else {
   346     } else {
   351       break;
   347       break;
   352     }
   348     }
   353   }
   349   }
   354 
       
   355 #ifdef _M_IA64
       
   356   // IA64 has memory and register stacks
       
   357   //
       
   358   // This is the stack layout you get on NT/IA64 if you specify 1MB stack limit
       
   359   // at thread creation (1MB backing store growing upwards, 1MB memory stack
       
   360   // growing downwards, 2MB summed up)
       
   361   //
       
   362   // ...
       
   363   // ------- top of stack (high address) -----
       
   364   // |
       
   365   // |      1MB
       
   366   // |      Backing Store (Register Stack)
       
   367   // |
       
   368   // |         / \
       
   369   // |          |
       
   370   // |          |
       
   371   // |          |
       
   372   // ------------------------ stack base -----
       
   373   // |      1MB
       
   374   // |      Memory Stack
       
   375   // |
       
   376   // |          |
       
   377   // |          |
       
   378   // |          |
       
   379   // |         \ /
       
   380   // |
       
   381   // ----- bottom of stack (low address) -----
       
   382   // ...
       
   383 
       
   384   stack_size = stack_size / 2;
       
   385 #endif
       
   386   return stack_bottom + stack_size;
   350   return stack_bottom + stack_size;
   387 }
   351 }
   388 
   352 
   389 size_t os::current_stack_size() {
   353 size_t os::current_stack_size() {
   390   size_t sz;
   354   size_t sz;
  1495     char* arch_name;
  1459     char* arch_name;
  1496   } arch_t;
  1460   } arch_t;
  1497 
  1461 
  1498   static const arch_t arch_array[] = {
  1462   static const arch_t arch_array[] = {
  1499     {IMAGE_FILE_MACHINE_I386,      (char*)"IA 32"},
  1463     {IMAGE_FILE_MACHINE_I386,      (char*)"IA 32"},
  1500     {IMAGE_FILE_MACHINE_AMD64,     (char*)"AMD 64"},
  1464     {IMAGE_FILE_MACHINE_AMD64,     (char*)"AMD 64"}
  1501     {IMAGE_FILE_MACHINE_IA64,      (char*)"IA 64"}
       
  1502   };
  1465   };
  1503 #if   (defined _M_IA64)
  1466 #if (defined _M_AMD64)
  1504   static const uint16_t running_arch = IMAGE_FILE_MACHINE_IA64;
       
  1505 #elif (defined _M_AMD64)
       
  1506   static const uint16_t running_arch = IMAGE_FILE_MACHINE_AMD64;
  1467   static const uint16_t running_arch = IMAGE_FILE_MACHINE_AMD64;
  1507 #elif (defined _M_IX86)
  1468 #elif (defined _M_IX86)
  1508   static const uint16_t running_arch = IMAGE_FILE_MACHINE_I386;
  1469   static const uint16_t running_arch = IMAGE_FILE_MACHINE_I386;
  1509 #else
  1470 #else
  1510   #error Method os::dll_load requires that one of following \
  1471   #error Method os::dll_load requires that one of following \
  1511          is defined :_M_IA64,_M_AMD64 or _M_IX86
  1472          is defined :_M_AMD64 or _M_IX86
  1512 #endif
  1473 #endif
  1513 
  1474 
  1514 
  1475 
  1515   // Obtain a string for printf operation
  1476   // Obtain a string for printf operation
  1516   // lib_arch_str shall contain string what platform this .dll was built for
  1477   // lib_arch_str shall contain string what platform this .dll was built for
  2157 
  2118 
  2158 // Implicit OS exception handling
  2119 // Implicit OS exception handling
  2159 
  2120 
  2160 LONG Handle_Exception(struct _EXCEPTION_POINTERS* exceptionInfo,
  2121 LONG Handle_Exception(struct _EXCEPTION_POINTERS* exceptionInfo,
  2161                       address handler) {
  2122                       address handler) {
  2162     JavaThread* thread = (JavaThread*) Thread::current_or_null();
  2123   JavaThread* thread = (JavaThread*) Thread::current_or_null();
  2163   // Save pc in thread
  2124   // Save pc in thread
  2164 #ifdef _M_IA64
  2125 #ifdef _M_AMD64
  2165   // Do not blow up if no thread info available.
       
  2166   if (thread) {
       
  2167     // Saving PRECISE pc (with slot information) in thread.
       
  2168     uint64_t precise_pc = (uint64_t) exceptionInfo->ExceptionRecord->ExceptionAddress;
       
  2169     // Convert precise PC into "Unix" format
       
  2170     precise_pc = (precise_pc & 0xFFFFFFFFFFFFFFF0) | ((precise_pc & 0xF) >> 2);
       
  2171     thread->set_saved_exception_pc((address)precise_pc);
       
  2172   }
       
  2173   // Set pc to handler
       
  2174   exceptionInfo->ContextRecord->StIIP = (DWORD64)handler;
       
  2175   // Clear out psr.ri (= Restart Instruction) in order to continue
       
  2176   // at the beginning of the target bundle.
       
  2177   exceptionInfo->ContextRecord->StIPSR &= 0xFFFFF9FFFFFFFFFF;
       
  2178   assert(((DWORD64)handler & 0xF) == 0, "Target address must point to the beginning of a bundle!");
       
  2179 #else
       
  2180   #ifdef _M_AMD64
       
  2181   // Do not blow up if no thread info available.
  2126   // Do not blow up if no thread info available.
  2182   if (thread) {
  2127   if (thread) {
  2183     thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Rip);
  2128     thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Rip);
  2184   }
  2129   }
  2185   // Set pc to handler
  2130   // Set pc to handler
  2186   exceptionInfo->ContextRecord->Rip = (DWORD64)handler;
  2131   exceptionInfo->ContextRecord->Rip = (DWORD64)handler;
  2187   #else
  2132 #else
  2188   // Do not blow up if no thread info available.
  2133   // Do not blow up if no thread info available.
  2189   if (thread) {
  2134   if (thread) {
  2190     thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Eip);
  2135     thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Eip);
  2191   }
  2136   }
  2192   // Set pc to handler
  2137   // Set pc to handler
  2193   exceptionInfo->ContextRecord->Eip = (DWORD)(DWORD_PTR)handler;
  2138   exceptionInfo->ContextRecord->Eip = (DWORD)(DWORD_PTR)handler;
  2194   #endif
       
  2195 #endif
  2139 #endif
  2196 
  2140 
  2197   // Continue the execution
  2141   // Continue the execution
  2198   return EXCEPTION_CONTINUE_EXECUTION;
  2142   return EXCEPTION_CONTINUE_EXECUTION;
  2199 }
  2143 }
  2213 
  2157 
  2214 // From "Execution Protection in the Windows Operating System" draft 0.35
  2158 // From "Execution Protection in the Windows Operating System" draft 0.35
  2215 // Once a system header becomes available, the "real" define should be
  2159 // Once a system header becomes available, the "real" define should be
  2216 // included or copied here.
  2160 // included or copied here.
  2217 #define EXCEPTION_INFO_EXEC_VIOLATION 0x08
  2161 #define EXCEPTION_INFO_EXEC_VIOLATION 0x08
  2218 
       
  2219 // Handle NAT Bit consumption on IA64.
       
  2220 #ifdef _M_IA64
       
  2221   #define EXCEPTION_REG_NAT_CONSUMPTION    STATUS_REG_NAT_CONSUMPTION
       
  2222 #endif
       
  2223 
  2162 
  2224 // Windows Vista/2008 heap corruption check
  2163 // Windows Vista/2008 heap corruption check
  2225 #define EXCEPTION_HEAP_CORRUPTION        0xC0000374
  2164 #define EXCEPTION_HEAP_CORRUPTION        0xC0000374
  2226 
  2165 
  2227 // All Visual C++ exceptions thrown from code generated by the Microsoft Visual
  2166 // All Visual C++ exceptions thrown from code generated by the Microsoft Visual
  2259     def_excpt(EXCEPTION_INVALID_DISPOSITION),
  2198     def_excpt(EXCEPTION_INVALID_DISPOSITION),
  2260     def_excpt(EXCEPTION_GUARD_PAGE),
  2199     def_excpt(EXCEPTION_GUARD_PAGE),
  2261     def_excpt(EXCEPTION_INVALID_HANDLE),
  2200     def_excpt(EXCEPTION_INVALID_HANDLE),
  2262     def_excpt(EXCEPTION_UNCAUGHT_CXX_EXCEPTION),
  2201     def_excpt(EXCEPTION_UNCAUGHT_CXX_EXCEPTION),
  2263     def_excpt(EXCEPTION_HEAP_CORRUPTION)
  2202     def_excpt(EXCEPTION_HEAP_CORRUPTION)
  2264 #ifdef _M_IA64
       
  2265     , def_excpt(EXCEPTION_REG_NAT_CONSUMPTION)
       
  2266 #endif
       
  2267 };
  2203 };
  2268 
  2204 
  2269 #undef def_excpt
  2205 #undef def_excpt
  2270 
  2206 
  2271 const char* os::exception_name(int exception_code, char *buf, size_t size) {
  2207 const char* os::exception_name(int exception_code, char *buf, size_t size) {
  2282 
  2218 
  2283 //-----------------------------------------------------------------------------
  2219 //-----------------------------------------------------------------------------
  2284 LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
  2220 LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
  2285   // handle exception caused by idiv; should only happen for -MinInt/-1
  2221   // handle exception caused by idiv; should only happen for -MinInt/-1
  2286   // (division by zero is handled explicitly)
  2222   // (division by zero is handled explicitly)
  2287 #ifdef _M_IA64
  2223 #ifdef  _M_AMD64
  2288   assert(0, "Fix Handle_IDiv_Exception");
       
  2289 #else
       
  2290   #ifdef  _M_AMD64
       
  2291   PCONTEXT ctx = exceptionInfo->ContextRecord;
  2224   PCONTEXT ctx = exceptionInfo->ContextRecord;
  2292   address pc = (address)ctx->Rip;
  2225   address pc = (address)ctx->Rip;
  2293   assert(pc[0] >= Assembler::REX && pc[0] <= Assembler::REX_WRXB && pc[1] == 0xF7 || pc[0] == 0xF7, "not an idiv opcode");
  2226   assert(pc[0] >= Assembler::REX && pc[0] <= Assembler::REX_WRXB && pc[1] == 0xF7 || pc[0] == 0xF7, "not an idiv opcode");
  2294   assert(pc[0] >= Assembler::REX && pc[0] <= Assembler::REX_WRXB && (pc[2] & ~0x7) == 0xF8 || (pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands");
  2227   assert(pc[0] >= Assembler::REX && pc[0] <= Assembler::REX_WRXB && (pc[2] & ~0x7) == 0xF8 || (pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands");
  2295   if (pc[0] == 0xF7) {
  2228   if (pc[0] == 0xF7) {
  2301   // Do not set ctx->Rax as it already contains the correct value (either 32 or 64 bit, depending on the operation)
  2234   // Do not set ctx->Rax as it already contains the correct value (either 32 or 64 bit, depending on the operation)
  2302   // this is the case because the exception only happens for -MinValue/-1 and -MinValue is always in rax because of the
  2235   // this is the case because the exception only happens for -MinValue/-1 and -MinValue is always in rax because of the
  2303   // idiv opcode (0xF7).
  2236   // idiv opcode (0xF7).
  2304   ctx->Rdx = (DWORD)0;             // remainder
  2237   ctx->Rdx = (DWORD)0;             // remainder
  2305   // Continue the execution
  2238   // Continue the execution
  2306   #else
  2239 #else
  2307   PCONTEXT ctx = exceptionInfo->ContextRecord;
  2240   PCONTEXT ctx = exceptionInfo->ContextRecord;
  2308   address pc = (address)ctx->Eip;
  2241   address pc = (address)ctx->Eip;
  2309   assert(pc[0] == 0xF7, "not an idiv opcode");
  2242   assert(pc[0] == 0xF7, "not an idiv opcode");
  2310   assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands");
  2243   assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands");
  2311   assert(ctx->Eax == min_jint, "unexpected idiv exception");
  2244   assert(ctx->Eax == min_jint, "unexpected idiv exception");
  2312   // set correct result values and continue after idiv instruction
  2245   // set correct result values and continue after idiv instruction
  2313   ctx->Eip = (DWORD)pc + 2;        // idiv reg, reg  is 2 bytes
  2246   ctx->Eip = (DWORD)pc + 2;        // idiv reg, reg  is 2 bytes
  2314   ctx->Eax = (DWORD)min_jint;      // result
  2247   ctx->Eax = (DWORD)min_jint;      // result
  2315   ctx->Edx = (DWORD)0;             // remainder
  2248   ctx->Edx = (DWORD)0;             // remainder
  2316   // Continue the execution
  2249   // Continue the execution
  2317   #endif
       
  2318 #endif
  2250 #endif
  2319   return EXCEPTION_CONTINUE_EXECUTION;
  2251   return EXCEPTION_CONTINUE_EXECUTION;
  2320 }
  2252 }
  2321 
  2253 
  2322 //-----------------------------------------------------------------------------
  2254 //-----------------------------------------------------------------------------
  2410 
  2342 
  2411 //-----------------------------------------------------------------------------
  2343 //-----------------------------------------------------------------------------
  2412 LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
  2344 LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
  2413   if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH;
  2345   if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH;
  2414   DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode;
  2346   DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode;
  2415 #ifdef _M_IA64
  2347 #ifdef _M_AMD64
  2416   // On Itanium, we need the "precise pc", which has the slot number coded
  2348   address pc = (address) exceptionInfo->ContextRecord->Rip;
  2417   // into the least 4 bits: 0000=slot0, 0100=slot1, 1000=slot2 (Windows format).
       
  2418   address pc = (address) exceptionInfo->ExceptionRecord->ExceptionAddress;
       
  2419   // Convert the pc to "Unix format", which has the slot number coded
       
  2420   // into the least 2 bits: 0000=slot0, 0001=slot1, 0010=slot2
       
  2421   // This is needed for IA64 because "relocation" / "implicit null check" / "poll instruction"
       
  2422   // information is saved in the Unix format.
       
  2423   address pc_unix_format = (address) ((((uint64_t)pc) & 0xFFFFFFFFFFFFFFF0) | ((((uint64_t)pc) & 0xF) >> 2));
       
  2424 #else
  2349 #else
  2425   #ifdef _M_AMD64
       
  2426   address pc = (address) exceptionInfo->ContextRecord->Rip;
       
  2427   #else
       
  2428   address pc = (address) exceptionInfo->ContextRecord->Eip;
  2350   address pc = (address) exceptionInfo->ContextRecord->Eip;
  2429   #endif
       
  2430 #endif
  2351 #endif
  2431   Thread* t = Thread::current_or_null_safe();
  2352   Thread* t = Thread::current_or_null_safe();
  2432 
  2353 
  2433   // Handle SafeFetch32 and SafeFetchN exceptions.
  2354   // Handle SafeFetch32 and SafeFetchN exceptions.
  2434   if (StubRoutines::is_safefetch_fault(pc)) {
  2355   if (StubRoutines::is_safefetch_fault(pc)) {
  2542     JavaThread* thread = (JavaThread*) t;
  2463     JavaThread* thread = (JavaThread*) t;
  2543     bool in_java = thread->thread_state() == _thread_in_Java;
  2464     bool in_java = thread->thread_state() == _thread_in_Java;
  2544 
  2465 
  2545     // Handle potential stack overflows up front.
  2466     // Handle potential stack overflows up front.
  2546     if (exception_code == EXCEPTION_STACK_OVERFLOW) {
  2467     if (exception_code == EXCEPTION_STACK_OVERFLOW) {
  2547 #ifdef _M_IA64
       
  2548       // Use guard page for register stack.
       
  2549       PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
       
  2550       address addr = (address) exceptionRecord->ExceptionInformation[1];
       
  2551       // Check for a register stack overflow on Itanium
       
  2552       if (thread->addr_inside_register_stack_red_zone(addr)) {
       
  2553         // Fatal red zone violation happens if the Java program
       
  2554         // catches a StackOverflow error and does so much processing
       
  2555         // that it runs beyond the unprotected yellow guard zone. As
       
  2556         // a result, we are out of here.
       
  2557         fatal("ERROR: Unrecoverable stack overflow happened. JVM will exit.");
       
  2558       } else if(thread->addr_inside_register_stack(addr)) {
       
  2559         // Disable the yellow zone which sets the state that
       
  2560         // we've got a stack overflow problem.
       
  2561         if (thread->stack_yellow_reserved_zone_enabled()) {
       
  2562           thread->disable_stack_yellow_reserved_zone();
       
  2563         }
       
  2564         // Give us some room to process the exception.
       
  2565         thread->disable_register_stack_guard();
       
  2566         // Tracing with +Verbose.
       
  2567         if (Verbose) {
       
  2568           tty->print_cr("SOF Compiled Register Stack overflow at " INTPTR_FORMAT " (SIGSEGV)", pc);
       
  2569           tty->print_cr("Register Stack access at " INTPTR_FORMAT, addr);
       
  2570           tty->print_cr("Register Stack base " INTPTR_FORMAT, thread->register_stack_base());
       
  2571           tty->print_cr("Register Stack [" INTPTR_FORMAT "," INTPTR_FORMAT "]",
       
  2572                         thread->register_stack_base(),
       
  2573                         thread->register_stack_base() + thread->stack_size());
       
  2574         }
       
  2575 
       
  2576         // Reguard the permanent register stack red zone just to be sure.
       
  2577         // We saw Windows silently disabling this without telling us.
       
  2578         thread->enable_register_stack_red_zone();
       
  2579 
       
  2580         return Handle_Exception(exceptionInfo,
       
  2581                                 SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW));
       
  2582       }
       
  2583 #endif
       
  2584       if (thread->stack_guards_enabled()) {
  2468       if (thread->stack_guards_enabled()) {
  2585         if (in_java) {
  2469         if (in_java) {
  2586           frame fr;
  2470           frame fr;
  2587           PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
  2471           PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
  2588           address addr = (address) exceptionRecord->ExceptionInformation[1];
  2472           address addr = (address) exceptionRecord->ExceptionInformation[1];
  2645             return EXCEPTION_CONTINUE_EXECUTION;
  2529             return EXCEPTION_CONTINUE_EXECUTION;
  2646           } else
  2530           } else
  2647 #endif
  2531 #endif
  2648           {
  2532           {
  2649             // Null pointer exception.
  2533             // Null pointer exception.
  2650 #ifdef _M_IA64
       
  2651             // Process implicit null checks in compiled code. Note: Implicit null checks
       
  2652             // can happen even if "ImplicitNullChecks" is disabled, e.g. in vtable stubs.
       
  2653             if (CodeCache::contains((void*) pc_unix_format) && !MacroAssembler::needs_explicit_null_check((intptr_t) addr)) {
       
  2654               CodeBlob *cb = CodeCache::find_blob_unsafe(pc_unix_format);
       
  2655               // Handle implicit null check in UEP method entry
       
  2656               if (cb && (cb->is_frame_complete_at(pc) ||
       
  2657                          (cb->is_nmethod() && ((nmethod *)cb)->inlinecache_check_contains(pc)))) {
       
  2658                 if (Verbose) {
       
  2659                   intptr_t *bundle_start = (intptr_t*) ((intptr_t) pc_unix_format & 0xFFFFFFFFFFFFFFF0);
       
  2660                   tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGSEGV)", pc_unix_format);
       
  2661                   tty->print_cr("      to addr " INTPTR_FORMAT, addr);
       
  2662                   tty->print_cr("      bundle is " INTPTR_FORMAT " (high), " INTPTR_FORMAT " (low)",
       
  2663                                 *(bundle_start + 1), *bundle_start);
       
  2664                 }
       
  2665                 return Handle_Exception(exceptionInfo,
       
  2666                                         SharedRuntime::continuation_for_implicit_exception(thread, pc_unix_format, SharedRuntime::IMPLICIT_NULL));
       
  2667               }
       
  2668             }
       
  2669 
       
  2670             // Implicit null checks were processed above.  Hence, we should not reach
       
  2671             // here in the usual case => die!
       
  2672             if (Verbose) tty->print_raw_cr("Access violation, possible null pointer exception");
       
  2673             report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
       
  2674                          exceptionInfo->ContextRecord);
       
  2675             return EXCEPTION_CONTINUE_SEARCH;
       
  2676 
       
  2677 #else // !IA64
       
  2678 
       
  2679             if (!MacroAssembler::needs_explicit_null_check((intptr_t)addr)) {
  2534             if (!MacroAssembler::needs_explicit_null_check((intptr_t)addr)) {
  2680               address stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
  2535               address stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
  2681               if (stub != NULL) return Handle_Exception(exceptionInfo, stub);
  2536               if (stub != NULL) return Handle_Exception(exceptionInfo, stub);
  2682             }
  2537             }
  2683             report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
  2538             report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
  2684                          exceptionInfo->ContextRecord);
  2539                          exceptionInfo->ContextRecord);
  2685             return EXCEPTION_CONTINUE_SEARCH;
  2540             return EXCEPTION_CONTINUE_SEARCH;
  2686 #endif
       
  2687           }
  2541           }
  2688         }
  2542         }
  2689       }
  2543       }
  2690 
  2544 
  2691 #ifdef _WIN64
  2545 #ifdef _WIN64
  2704       report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
  2558       report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
  2705                    exceptionInfo->ContextRecord);
  2559                    exceptionInfo->ContextRecord);
  2706       return EXCEPTION_CONTINUE_SEARCH;
  2560       return EXCEPTION_CONTINUE_SEARCH;
  2707     } // /EXCEPTION_ACCESS_VIOLATION
  2561     } // /EXCEPTION_ACCESS_VIOLATION
  2708     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2562     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2709 #if defined _M_IA64
       
  2710     else if ((exception_code == EXCEPTION_ILLEGAL_INSTRUCTION ||
       
  2711               exception_code == EXCEPTION_ILLEGAL_INSTRUCTION_2)) {
       
  2712       M37 handle_wrong_method_break(0, NativeJump::HANDLE_WRONG_METHOD, PR0);
       
  2713 
       
  2714       // Compiled method patched to be non entrant? Following conditions must apply:
       
  2715       // 1. must be first instruction in bundle
       
  2716       // 2. must be a break instruction with appropriate code
       
  2717       if ((((uint64_t) pc & 0x0F) == 0) &&
       
  2718           (((IPF_Bundle*) pc)->get_slot0() == handle_wrong_method_break.bits())) {
       
  2719         return Handle_Exception(exceptionInfo,
       
  2720                                 (address)SharedRuntime::get_handle_wrong_method_stub());
       
  2721       }
       
  2722     } // /EXCEPTION_ILLEGAL_INSTRUCTION
       
  2723 #endif
       
  2724 
       
  2725 
  2563 
  2726     if (in_java) {
  2564     if (in_java) {
  2727       switch (exception_code) {
  2565       switch (exception_code) {
  2728       case EXCEPTION_INT_DIVIDE_BY_ZERO:
  2566       case EXCEPTION_INT_DIVIDE_BY_ZERO:
  2729         return Handle_Exception(exceptionInfo, SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO));
  2567         return Handle_Exception(exceptionInfo, SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO));
  3750 // Get's a pc (hint) for a running thread. Currently used only for profiling.
  3588 // Get's a pc (hint) for a running thread. Currently used only for profiling.
  3751 ExtendedPC os::get_thread_pc(Thread* thread) {
  3589 ExtendedPC os::get_thread_pc(Thread* thread) {
  3752   CONTEXT context;
  3590   CONTEXT context;
  3753   context.ContextFlags = CONTEXT_CONTROL;
  3591   context.ContextFlags = CONTEXT_CONTROL;
  3754   HANDLE handle = thread->osthread()->thread_handle();
  3592   HANDLE handle = thread->osthread()->thread_handle();
  3755 #ifdef _M_IA64
       
  3756   assert(0, "Fix get_thread_pc");
       
  3757   return ExtendedPC(NULL);
       
  3758 #else
       
  3759   if (GetThreadContext(handle, &context)) {
  3593   if (GetThreadContext(handle, &context)) {
  3760 #ifdef _M_AMD64
  3594 #ifdef _M_AMD64
  3761     return ExtendedPC((address) context.Rip);
  3595     return ExtendedPC((address) context.Rip);
  3762 #else
  3596 #else
  3763     return ExtendedPC((address) context.Eip);
  3597     return ExtendedPC((address) context.Eip);
  3764 #endif
  3598 #endif
  3765   } else {
  3599   } else {
  3766     return ExtendedPC(NULL);
  3600     return ExtendedPC(NULL);
  3767   }
  3601   }
  3768 #endif
       
  3769 }
  3602 }
  3770 
  3603 
  3771 // GetCurrentThreadId() returns DWORD
  3604 // GetCurrentThreadId() returns DWORD
  3772 intx os::current_thread_id()  { return GetCurrentThreadId(); }
  3605 intx os::current_thread_id()  { return GetCurrentThreadId(); }
  3773 
  3606