955 |
955 |
956 if (HAS_PENDING_EXCEPTION) { |
956 if (HAS_PENDING_EXCEPTION) { |
957 return; |
957 return; |
958 } |
958 } |
959 |
959 |
960 KlassHandle group(this, SystemDictionary::threadGroup_klass()); |
960 KlassHandle group(this, SystemDictionary::ThreadGroup_klass()); |
961 Handle threadObj(this, this->threadObj()); |
961 Handle threadObj(this, this->threadObj()); |
962 |
962 |
963 JavaCalls::call_special(&result, |
963 JavaCalls::call_special(&result, |
964 thread_group, |
964 thread_group, |
965 group, |
965 group, |
1449 // Check if the method Thread.dispatchUncaughtException() exists. If so |
1449 // Check if the method Thread.dispatchUncaughtException() exists. If so |
1450 // call it. Otherwise we have an older library without the JSR-166 changes, |
1450 // call it. Otherwise we have an older library without the JSR-166 changes, |
1451 // so call ThreadGroup.uncaughtException() |
1451 // so call ThreadGroup.uncaughtException() |
1452 KlassHandle recvrKlass(THREAD, threadObj->klass()); |
1452 KlassHandle recvrKlass(THREAD, threadObj->klass()); |
1453 CallInfo callinfo; |
1453 CallInfo callinfo; |
1454 KlassHandle thread_klass(THREAD, SystemDictionary::thread_klass()); |
1454 KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass()); |
1455 LinkResolver::resolve_virtual_call(callinfo, threadObj, recvrKlass, thread_klass, |
1455 LinkResolver::resolve_virtual_call(callinfo, threadObj, recvrKlass, thread_klass, |
1456 vmSymbolHandles::dispatchUncaughtException_name(), |
1456 vmSymbolHandles::dispatchUncaughtException_name(), |
1457 vmSymbolHandles::throwable_void_signature(), |
1457 vmSymbolHandles::throwable_void_signature(), |
1458 KlassHandle(), false, false, THREAD); |
1458 KlassHandle(), false, false, THREAD); |
1459 CLEAR_PENDING_EXCEPTION; |
1459 CLEAR_PENDING_EXCEPTION; |
1465 vmSymbolHandles::dispatchUncaughtException_name(), |
1465 vmSymbolHandles::dispatchUncaughtException_name(), |
1466 vmSymbolHandles::throwable_void_signature(), |
1466 vmSymbolHandles::throwable_void_signature(), |
1467 uncaught_exception, |
1467 uncaught_exception, |
1468 THREAD); |
1468 THREAD); |
1469 } else { |
1469 } else { |
1470 KlassHandle thread_group(THREAD, SystemDictionary::threadGroup_klass()); |
1470 KlassHandle thread_group(THREAD, SystemDictionary::ThreadGroup_klass()); |
1471 JavaValue result(T_VOID); |
1471 JavaValue result(T_VOID); |
1472 JavaCalls::call_virtual(&result, |
1472 JavaCalls::call_virtual(&result, |
1473 group, thread_group, |
1473 group, thread_group, |
1474 vmSymbolHandles::uncaughtException_name(), |
1474 vmSymbolHandles::uncaughtException_name(), |
1475 vmSymbolHandles::thread_throwable_void_signature(), |
1475 vmSymbolHandles::thread_throwable_void_signature(), |
1486 // is deprecated anyhow. |
1486 // is deprecated anyhow. |
1487 { int count = 3; |
1487 { int count = 3; |
1488 while (java_lang_Thread::threadGroup(threadObj()) != NULL && (count-- > 0)) { |
1488 while (java_lang_Thread::threadGroup(threadObj()) != NULL && (count-- > 0)) { |
1489 EXCEPTION_MARK; |
1489 EXCEPTION_MARK; |
1490 JavaValue result(T_VOID); |
1490 JavaValue result(T_VOID); |
1491 KlassHandle thread_klass(THREAD, SystemDictionary::thread_klass()); |
1491 KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass()); |
1492 JavaCalls::call_virtual(&result, |
1492 JavaCalls::call_virtual(&result, |
1493 threadObj, thread_klass, |
1493 threadObj, thread_klass, |
1494 vmSymbolHandles::exit_method_name(), |
1494 vmSymbolHandles::exit_method_name(), |
1495 vmSymbolHandles::void_method_signature(), |
1495 vmSymbolHandles::void_method_signature(), |
1496 THREAD); |
1496 THREAD); |
1724 } |
1724 } |
1725 |
1725 |
1726 // Check for pending async. exception |
1726 // Check for pending async. exception |
1727 if (_pending_async_exception != NULL) { |
1727 if (_pending_async_exception != NULL) { |
1728 // Only overwrite an already pending exception, if it is not a threadDeath. |
1728 // Only overwrite an already pending exception, if it is not a threadDeath. |
1729 if (!has_pending_exception() || !pending_exception()->is_a(SystemDictionary::threaddeath_klass())) { |
1729 if (!has_pending_exception() || !pending_exception()->is_a(SystemDictionary::ThreadDeath_klass())) { |
1730 |
1730 |
1731 // We cannot call Exceptions::_throw(...) here because we cannot block |
1731 // We cannot call Exceptions::_throw(...) here because we cannot block |
1732 set_pending_exception(_pending_async_exception, __FILE__, __LINE__); |
1732 set_pending_exception(_pending_async_exception, __FILE__, __LINE__); |
1733 |
1733 |
1734 if (TraceExceptions) { |
1734 if (TraceExceptions) { |
1833 // Do not throw asynchronous exceptions against the compiler thread |
1833 // Do not throw asynchronous exceptions against the compiler thread |
1834 // (the compiler thread should not be a Java thread -- fix in 1.4.2) |
1834 // (the compiler thread should not be a Java thread -- fix in 1.4.2) |
1835 if (is_Compiler_thread()) return; |
1835 if (is_Compiler_thread()) return; |
1836 |
1836 |
1837 // This is a change from JDK 1.1, but JDK 1.2 will also do it: |
1837 // This is a change from JDK 1.1, but JDK 1.2 will also do it: |
1838 if (java_throwable->is_a(SystemDictionary::threaddeath_klass())) { |
1838 if (java_throwable->is_a(SystemDictionary::ThreadDeath_klass())) { |
1839 java_lang_Thread::set_stillborn(threadObj()); |
1839 java_lang_Thread::set_stillborn(threadObj()); |
1840 } |
1840 } |
1841 |
1841 |
1842 { |
1842 { |
1843 // Actually throw the Throwable against the target Thread - however |
1843 // Actually throw the Throwable against the target Thread - however |
1844 // only if there is no thread death exception installed already. |
1844 // only if there is no thread death exception installed already. |
1845 if (_pending_async_exception == NULL || !_pending_async_exception->is_a(SystemDictionary::threaddeath_klass())) { |
1845 if (_pending_async_exception == NULL || !_pending_async_exception->is_a(SystemDictionary::ThreadDeath_klass())) { |
1846 // If the topmost frame is a runtime stub, then we are calling into |
1846 // If the topmost frame is a runtime stub, then we are calling into |
1847 // OptoRuntime from compiled code. Some runtime stubs (new, monitor_exit..) |
1847 // OptoRuntime from compiled code. Some runtime stubs (new, monitor_exit..) |
1848 // must deoptimize the caller before continuing, as the compiled exception handler table |
1848 // must deoptimize the caller before continuing, as the compiled exception handler table |
1849 // may not be valid |
1849 // may not be valid |
1850 if (has_last_Java_frame()) { |
1850 if (has_last_Java_frame()) { |