2349 #endif // !_WIN64 2350 2351 return EXCEPTION_CONTINUE_SEARCH; 2352 } 2353 2354 static inline void report_error(Thread* t, DWORD exception_code, 2355 address addr, void* siginfo, void* context) { 2356 VMError::report_and_die(t, exception_code, addr, siginfo, context); 2357 2358 // If UseOsErrorReporting, this will return here and save the error file 2359 // somewhere where we can find it in the minidump. 2360 } 2361 2362 bool os::win32::get_frame_at_stack_banging_point(JavaThread* thread, 2363 struct _EXCEPTION_POINTERS* exceptionInfo, address pc, frame* fr) { 2364 PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord; 2365 address addr = (address) exceptionRecord->ExceptionInformation[1]; 2366 if (Interpreter::contains(pc)) { 2367 *fr = os::fetch_frame_from_context((void*)exceptionInfo->ContextRecord); 2368 if (!fr->is_first_java_frame()) { 2369 assert(fr->safe_for_sender(thread), "Safety check"); 2370 *fr = fr->java_sender(); 2371 } 2372 } else { 2373 // more complex code with compiled code 2374 assert(!Interpreter::contains(pc), "Interpreted methods should have been handled above"); 2375 CodeBlob* cb = CodeCache::find_blob(pc); 2376 if (cb == NULL || !cb->is_nmethod() || cb->is_frame_complete_at(pc)) { 2377 // Not sure where the pc points to, fallback to default 2378 // stack overflow handling 2379 return false; 2380 } else { 2381 *fr = os::fetch_frame_from_context((void*)exceptionInfo->ContextRecord); 2382 // in compiled code, the stack banging is performed just after the return pc 2383 // has been pushed on the stack 2384 *fr = frame(fr->sp() + 1, fr->fp(), (address)*(fr->sp())); 2385 if (!fr->is_java_frame()) { 2386 assert(fr->safe_for_sender(thread), "Safety check"); 2387 *fr = fr->java_sender(); 2388 } 2389 } 2390 } 2391 assert(fr->is_java_frame(), "Safety check"); 2392 return true; 2393 } 2394 2395 //----------------------------------------------------------------------------- 2396 LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { 2397 if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH; 2398 DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode; 2399 #ifdef _M_IA64 2400 // On Itanium, we need the "precise pc", which has the slot number coded 2401 // into the least 4 bits: 0000=slot0, 0100=slot1, 1000=slot2 (Windows format). 2402 address pc = (address) exceptionInfo->ExceptionRecord->ExceptionAddress; 2403 // Convert the pc to "Unix format", which has the slot number coded 2404 // into the least 2 bits: 0000=slot0, 0001=slot1, 0010=slot2 2405 // This is needed for IA64 because "relocation" / "implicit null check" / "poll instruction" 2406 // information is saved in the Unix format. | 2349 #endif // !_WIN64 2350 2351 return EXCEPTION_CONTINUE_SEARCH; 2352 } 2353 2354 static inline void report_error(Thread* t, DWORD exception_code, 2355 address addr, void* siginfo, void* context) { 2356 VMError::report_and_die(t, exception_code, addr, siginfo, context); 2357 2358 // If UseOsErrorReporting, this will return here and save the error file 2359 // somewhere where we can find it in the minidump. 2360 } 2361 2362 bool os::win32::get_frame_at_stack_banging_point(JavaThread* thread, 2363 struct _EXCEPTION_POINTERS* exceptionInfo, address pc, frame* fr) { 2364 PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord; 2365 address addr = (address) exceptionRecord->ExceptionInformation[1]; 2366 if (Interpreter::contains(pc)) { 2367 *fr = os::fetch_frame_from_context((void*)exceptionInfo->ContextRecord); 2368 if (!fr->is_first_java_frame()) { 2369 *fr = fr->java_sender(); 2370 } 2371 } else { 2372 // more complex code with compiled code 2373 assert(!Interpreter::contains(pc), "Interpreted methods should have been handled above"); 2374 CodeBlob* cb = CodeCache::find_blob(pc); 2375 if (cb == NULL || !cb->is_nmethod() || cb->is_frame_complete_at(pc)) { 2376 // Not sure where the pc points to, fallback to default 2377 // stack overflow handling 2378 return false; 2379 } else { 2380 *fr = os::fetch_frame_from_context((void*)exceptionInfo->ContextRecord); 2381 // in compiled code, the stack banging is performed just after the return pc 2382 // has been pushed on the stack 2383 *fr = frame(fr->sp() + 1, fr->fp(), (address)*(fr->sp())); 2384 if (!fr->is_java_frame()) { 2385 *fr = fr->java_sender(); 2386 } 2387 } 2388 } 2389 assert(fr->is_java_frame(), "Safety check"); 2390 return true; 2391 } 2392 2393 //----------------------------------------------------------------------------- 2394 LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { 2395 if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH; 2396 DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode; 2397 #ifdef _M_IA64 2398 // On Itanium, we need the "precise pc", which has the slot number coded 2399 // into the least 4 bits: 0000=slot0, 0100=slot1, 1000=slot2 (Windows format). 2400 address pc = (address) exceptionInfo->ExceptionRecord->ExceptionAddress; 2401 // Convert the pc to "Unix format", which has the slot number coded 2402 // into the least 2 bits: 0000=slot0, 0001=slot1, 0010=slot2 2403 // This is needed for IA64 because "relocation" / "implicit null check" / "poll instruction" 2404 // information is saved in the Unix format. |