2372 |
2372 |
2373 // If UseOsErrorReporting, this will return here and save the error file |
2373 // If UseOsErrorReporting, this will return here and save the error file |
2374 // somewhere where we can find it in the minidump. |
2374 // somewhere where we can find it in the minidump. |
2375 } |
2375 } |
2376 |
2376 |
|
2377 bool os::win32::get_frame_at_stack_banging_point(JavaThread* thread, |
|
2378 struct _EXCEPTION_POINTERS* exceptionInfo, address pc, frame* fr) { |
|
2379 PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord; |
|
2380 address addr = (address) exceptionRecord->ExceptionInformation[1]; |
|
2381 if (Interpreter::contains(pc)) { |
|
2382 *fr = os::fetch_frame_from_context((void*)exceptionInfo->ContextRecord); |
|
2383 if (!fr->is_first_java_frame()) { |
|
2384 assert(fr->safe_for_sender(thread), "Safety check"); |
|
2385 *fr = fr->java_sender(); |
|
2386 } |
|
2387 } else { |
|
2388 // more complex code with compiled code |
|
2389 assert(!Interpreter::contains(pc), "Interpreted methods should have been handled above"); |
|
2390 CodeBlob* cb = CodeCache::find_blob(pc); |
|
2391 if (cb == NULL || !cb->is_nmethod() || cb->is_frame_complete_at(pc)) { |
|
2392 // Not sure where the pc points to, fallback to default |
|
2393 // stack overflow handling |
|
2394 return false; |
|
2395 } else { |
|
2396 *fr = os::fetch_frame_from_context((void*)exceptionInfo->ContextRecord); |
|
2397 // in compiled code, the stack banging is performed just after the return pc |
|
2398 // has been pushed on the stack |
|
2399 *fr = frame(fr->sp() + 1, fr->fp(), (address)*(fr->sp())); |
|
2400 if (!fr->is_java_frame()) { |
|
2401 assert(fr->safe_for_sender(thread), "Safety check"); |
|
2402 *fr = fr->java_sender(); |
|
2403 } |
|
2404 } |
|
2405 } |
|
2406 assert(fr->is_java_frame(), "Safety check"); |
|
2407 return true; |
|
2408 } |
|
2409 |
2377 //----------------------------------------------------------------------------- |
2410 //----------------------------------------------------------------------------- |
2378 LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { |
2411 LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { |
2379 if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH; |
2412 if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH; |
2380 DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode; |
2413 DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode; |
2381 #ifdef _M_IA64 |
2414 #ifdef _M_IA64 |
2548 |
2581 |
2549 return Handle_Exception(exceptionInfo, |
2582 return Handle_Exception(exceptionInfo, |
2550 SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)); |
2583 SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)); |
2551 } |
2584 } |
2552 #endif |
2585 #endif |
2553 if (thread->stack_yellow_zone_enabled()) { |
2586 if (thread->stack_guards_enabled()) { |
|
2587 if (_thread_in_Java) { |
|
2588 frame fr; |
|
2589 PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord; |
|
2590 address addr = (address) exceptionRecord->ExceptionInformation[1]; |
|
2591 if (os::win32::get_frame_at_stack_banging_point(thread, exceptionInfo, pc, &fr)) { |
|
2592 assert(fr.is_java_frame(), "Must be a Java frame"); |
|
2593 SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr); |
|
2594 } |
|
2595 } |
2554 // Yellow zone violation. The o/s has unprotected the first yellow |
2596 // Yellow zone violation. The o/s has unprotected the first yellow |
2555 // zone page for us. Note: must call disable_stack_yellow_zone to |
2597 // zone page for us. Note: must call disable_stack_yellow_zone to |
2556 // update the enabled status, even if the zone contains only one page. |
2598 // update the enabled status, even if the zone contains only one page. |
2557 thread->disable_stack_yellow_zone(); |
2599 thread->disable_stack_yellow_zone(); |
2558 // If not in java code, return and hope for the best. |
2600 // If not in java code, return and hope for the best. |