971 |
971 |
972 if (HAS_PENDING_EXCEPTION) { |
972 if (HAS_PENDING_EXCEPTION) { |
973 return; |
973 return; |
974 } |
974 } |
975 |
975 |
976 KlassHandle group(this, SystemDictionary::threadGroup_klass()); |
976 KlassHandle group(this, SystemDictionary::ThreadGroup_klass()); |
977 Handle threadObj(this, this->threadObj()); |
977 Handle threadObj(this, this->threadObj()); |
978 |
978 |
979 JavaCalls::call_special(&result, |
979 JavaCalls::call_special(&result, |
980 thread_group, |
980 thread_group, |
981 group, |
981 group, |
1466 // Check if the method Thread.dispatchUncaughtException() exists. If so |
1466 // Check if the method Thread.dispatchUncaughtException() exists. If so |
1467 // call it. Otherwise we have an older library without the JSR-166 changes, |
1467 // call it. Otherwise we have an older library without the JSR-166 changes, |
1468 // so call ThreadGroup.uncaughtException() |
1468 // so call ThreadGroup.uncaughtException() |
1469 KlassHandle recvrKlass(THREAD, threadObj->klass()); |
1469 KlassHandle recvrKlass(THREAD, threadObj->klass()); |
1470 CallInfo callinfo; |
1470 CallInfo callinfo; |
1471 KlassHandle thread_klass(THREAD, SystemDictionary::thread_klass()); |
1471 KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass()); |
1472 LinkResolver::resolve_virtual_call(callinfo, threadObj, recvrKlass, thread_klass, |
1472 LinkResolver::resolve_virtual_call(callinfo, threadObj, recvrKlass, thread_klass, |
1473 vmSymbolHandles::dispatchUncaughtException_name(), |
1473 vmSymbolHandles::dispatchUncaughtException_name(), |
1474 vmSymbolHandles::throwable_void_signature(), |
1474 vmSymbolHandles::throwable_void_signature(), |
1475 KlassHandle(), false, false, THREAD); |
1475 KlassHandle(), false, false, THREAD); |
1476 CLEAR_PENDING_EXCEPTION; |
1476 CLEAR_PENDING_EXCEPTION; |
1482 vmSymbolHandles::dispatchUncaughtException_name(), |
1482 vmSymbolHandles::dispatchUncaughtException_name(), |
1483 vmSymbolHandles::throwable_void_signature(), |
1483 vmSymbolHandles::throwable_void_signature(), |
1484 uncaught_exception, |
1484 uncaught_exception, |
1485 THREAD); |
1485 THREAD); |
1486 } else { |
1486 } else { |
1487 KlassHandle thread_group(THREAD, SystemDictionary::threadGroup_klass()); |
1487 KlassHandle thread_group(THREAD, SystemDictionary::ThreadGroup_klass()); |
1488 JavaValue result(T_VOID); |
1488 JavaValue result(T_VOID); |
1489 JavaCalls::call_virtual(&result, |
1489 JavaCalls::call_virtual(&result, |
1490 group, thread_group, |
1490 group, thread_group, |
1491 vmSymbolHandles::uncaughtException_name(), |
1491 vmSymbolHandles::uncaughtException_name(), |
1492 vmSymbolHandles::thread_throwable_void_signature(), |
1492 vmSymbolHandles::thread_throwable_void_signature(), |
1503 // is deprecated anyhow. |
1503 // is deprecated anyhow. |
1504 { int count = 3; |
1504 { int count = 3; |
1505 while (java_lang_Thread::threadGroup(threadObj()) != NULL && (count-- > 0)) { |
1505 while (java_lang_Thread::threadGroup(threadObj()) != NULL && (count-- > 0)) { |
1506 EXCEPTION_MARK; |
1506 EXCEPTION_MARK; |
1507 JavaValue result(T_VOID); |
1507 JavaValue result(T_VOID); |
1508 KlassHandle thread_klass(THREAD, SystemDictionary::thread_klass()); |
1508 KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass()); |
1509 JavaCalls::call_virtual(&result, |
1509 JavaCalls::call_virtual(&result, |
1510 threadObj, thread_klass, |
1510 threadObj, thread_klass, |
1511 vmSymbolHandles::exit_method_name(), |
1511 vmSymbolHandles::exit_method_name(), |
1512 vmSymbolHandles::void_method_signature(), |
1512 vmSymbolHandles::void_method_signature(), |
1513 THREAD); |
1513 THREAD); |
1741 } |
1741 } |
1742 |
1742 |
1743 // Check for pending async. exception |
1743 // Check for pending async. exception |
1744 if (_pending_async_exception != NULL) { |
1744 if (_pending_async_exception != NULL) { |
1745 // Only overwrite an already pending exception, if it is not a threadDeath. |
1745 // Only overwrite an already pending exception, if it is not a threadDeath. |
1746 if (!has_pending_exception() || !pending_exception()->is_a(SystemDictionary::threaddeath_klass())) { |
1746 if (!has_pending_exception() || !pending_exception()->is_a(SystemDictionary::ThreadDeath_klass())) { |
1747 |
1747 |
1748 // We cannot call Exceptions::_throw(...) here because we cannot block |
1748 // We cannot call Exceptions::_throw(...) here because we cannot block |
1749 set_pending_exception(_pending_async_exception, __FILE__, __LINE__); |
1749 set_pending_exception(_pending_async_exception, __FILE__, __LINE__); |
1750 |
1750 |
1751 if (TraceExceptions) { |
1751 if (TraceExceptions) { |
1850 // Do not throw asynchronous exceptions against the compiler thread |
1850 // Do not throw asynchronous exceptions against the compiler thread |
1851 // (the compiler thread should not be a Java thread -- fix in 1.4.2) |
1851 // (the compiler thread should not be a Java thread -- fix in 1.4.2) |
1852 if (is_Compiler_thread()) return; |
1852 if (is_Compiler_thread()) return; |
1853 |
1853 |
1854 // This is a change from JDK 1.1, but JDK 1.2 will also do it: |
1854 // This is a change from JDK 1.1, but JDK 1.2 will also do it: |
1855 if (java_throwable->is_a(SystemDictionary::threaddeath_klass())) { |
1855 if (java_throwable->is_a(SystemDictionary::ThreadDeath_klass())) { |
1856 java_lang_Thread::set_stillborn(threadObj()); |
1856 java_lang_Thread::set_stillborn(threadObj()); |
1857 } |
1857 } |
1858 |
1858 |
1859 { |
1859 { |
1860 // Actually throw the Throwable against the target Thread - however |
1860 // Actually throw the Throwable against the target Thread - however |
1861 // only if there is no thread death exception installed already. |
1861 // only if there is no thread death exception installed already. |
1862 if (_pending_async_exception == NULL || !_pending_async_exception->is_a(SystemDictionary::threaddeath_klass())) { |
1862 if (_pending_async_exception == NULL || !_pending_async_exception->is_a(SystemDictionary::ThreadDeath_klass())) { |
1863 // If the topmost frame is a runtime stub, then we are calling into |
1863 // If the topmost frame is a runtime stub, then we are calling into |
1864 // OptoRuntime from compiled code. Some runtime stubs (new, monitor_exit..) |
1864 // OptoRuntime from compiled code. Some runtime stubs (new, monitor_exit..) |
1865 // must deoptimize the caller before continuing, as the compiled exception handler table |
1865 // must deoptimize the caller before continuing, as the compiled exception handler table |
1866 // may not be valid |
1866 // may not be valid |
1867 if (has_last_Java_frame()) { |
1867 if (has_last_Java_frame()) { |
3092 warning("java.lang.NullPointerException has not been initialized"); |
3092 warning("java.lang.NullPointerException has not been initialized"); |
3093 warning("java.lang.ClassCastException has not been initialized"); |
3093 warning("java.lang.ClassCastException has not been initialized"); |
3094 warning("java.lang.ArrayStoreException has not been initialized"); |
3094 warning("java.lang.ArrayStoreException has not been initialized"); |
3095 warning("java.lang.ArithmeticException has not been initialized"); |
3095 warning("java.lang.ArithmeticException has not been initialized"); |
3096 warning("java.lang.StackOverflowError has not been initialized"); |
3096 warning("java.lang.StackOverflowError has not been initialized"); |
|
3097 } |
|
3098 |
|
3099 if (EnableInvokeDynamic) { |
|
3100 // JSR 292: An intialized java.dyn.InvokeDynamic is required in |
|
3101 // the compiler. |
|
3102 initialize_class(vmSymbolHandles::java_dyn_InvokeDynamic(), CHECK_0); |
3097 } |
3103 } |
3098 } |
3104 } |
3099 |
3105 |
3100 // See : bugid 4211085. |
3106 // See : bugid 4211085. |
3101 // Background : the static initializer of java.lang.Compiler tries to read |
3107 // Background : the static initializer of java.lang.Compiler tries to read |