hotspot/src/share/vm/runtime/thread.cpp
changeset 25057 f38210f84f8c
parent 24849 20b9d8928c43
child 25058 4542f853c2ac
--- a/hotspot/src/share/vm/runtime/thread.cpp	Wed Jun 11 12:09:12 2014 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Jun 11 09:58:23 2014 -0400
@@ -1738,55 +1738,26 @@
 
     CLEAR_PENDING_EXCEPTION;
   }
-  // FIXIT: The is_null check is only so it works better on JDK1.2 VM's. This
-  // has to be fixed by a runtime query method
-  if (!destroy_vm || JDK_Version::is_jdk12x_version()) {
-    // JSR-166: change call from from ThreadGroup.uncaughtException to
-    // java.lang.Thread.dispatchUncaughtException
+  if (!destroy_vm) {
     if (uncaught_exception.not_null()) {
-      Handle group(this, java_lang_Thread::threadGroup(threadObj()));
-      {
-        EXCEPTION_MARK;
-        // Check if the method Thread.dispatchUncaughtException() exists. If so
-        // call it.  Otherwise we have an older library without the JSR-166 changes,
-        // so call ThreadGroup.uncaughtException()
-        KlassHandle recvrKlass(THREAD, threadObj->klass());
-        CallInfo callinfo;
-        KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass());
-        LinkResolver::resolve_virtual_call(callinfo, threadObj, recvrKlass, thread_klass,
-                                           vmSymbols::dispatchUncaughtException_name(),
-                                           vmSymbols::throwable_void_signature(),
-                                           KlassHandle(), false, false, THREAD);
+      EXCEPTION_MARK;
+      // Call method Thread.dispatchUncaughtException().
+      KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass());
+      JavaValue result(T_VOID);
+      JavaCalls::call_virtual(&result,
+                              threadObj, thread_klass,
+                              vmSymbols::dispatchUncaughtException_name(),
+                              vmSymbols::throwable_void_signature(),
+                              uncaught_exception,
+                              THREAD);
+      if (HAS_PENDING_EXCEPTION) {
+        ResourceMark rm(this);
+        jio_fprintf(defaultStream::error_stream(),
+              "\nException: %s thrown from the UncaughtExceptionHandler"
+              " in thread \"%s\"\n",
+              pending_exception()->klass()->external_name(),
+              get_thread_name());
         CLEAR_PENDING_EXCEPTION;
-        methodHandle method = callinfo.selected_method();
-        if (method.not_null()) {
-          JavaValue result(T_VOID);
-          JavaCalls::call_virtual(&result,
-                                  threadObj, thread_klass,
-                                  vmSymbols::dispatchUncaughtException_name(),
-                                  vmSymbols::throwable_void_signature(),
-                                  uncaught_exception,
-                                  THREAD);
-        } else {
-          KlassHandle thread_group(THREAD, SystemDictionary::ThreadGroup_klass());
-          JavaValue result(T_VOID);
-          JavaCalls::call_virtual(&result,
-                                  group, thread_group,
-                                  vmSymbols::uncaughtException_name(),
-                                  vmSymbols::thread_throwable_void_signature(),
-                                  threadObj,           // Arg 1
-                                  uncaught_exception,  // Arg 2
-                                  THREAD);
-        }
-        if (HAS_PENDING_EXCEPTION) {
-          ResourceMark rm(this);
-          jio_fprintf(defaultStream::error_stream(),
-                "\nException: %s thrown from the UncaughtExceptionHandler"
-                " in thread \"%s\"\n",
-                pending_exception()->klass()->external_name(),
-                get_thread_name());
-          CLEAR_PENDING_EXCEPTION;
-        }
       }
     }
 
@@ -2848,7 +2819,7 @@
   Thread::print_on(st);
   // print guess for valid stack memory region (assume 4K pages); helps lock debugging
   st->print_cr("[" INTPTR_FORMAT "]", (intptr_t)last_Java_sp() & ~right_n_bits(12));
-  if (thread_oop != NULL && JDK_Version::is_gte_jdk15x_version()) {
+  if (thread_oop != NULL) {
     st->print_cr("   java.lang.Thread.State: %s", java_lang_Thread::thread_status_name(thread_oop));
   }
 #ifndef PRODUCT
@@ -3948,15 +3919,8 @@
   }
   os::wait_for_keypress_at_exit();
 
-  if (JDK_Version::is_jdk12x_version()) {
-    // We are the last thread running, so check if finalizers should be run.
-    // For 1.3 or later this is done in thread->invoke_shutdown_hooks()
-    HandleMark rm(thread);
-    Universe::run_finalizers_on_exit();
-  } else {
-    // run Java level shutdown hooks
-    thread->invoke_shutdown_hooks();
-  }
+  // run Java level shutdown hooks
+  thread->invoke_shutdown_hooks();
 
   before_exit(thread);