changeset 35557:029dcb9bfa8b

8146246: JVMCICompiler::abort_on_pending_exception: assert(!thread->owns_locks()) failed: must release all locks when leaving VM Reviewed-by: coleenp, kvn
author twisti
date Tue, 12 Jan 2016 10:44:41 -1000
parents a5fe2691c0e5
children 9b3b2740c3ec
files hotspot/src/share/vm/classfile/javaClasses.cpp hotspot/src/share/vm/classfile/javaClasses.hpp hotspot/src/share/vm/jvmci/jvmciCompiler.cpp hotspot/src/share/vm/runtime/java.cpp
diffstat 4 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Tue Jan 12 16:00:04 2016 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Tue Jan 12 10:44:41 2016 -1000
@@ -1784,6 +1784,20 @@
   }
 }
 
+/**
+ * Print the throwable stack trace by calling the Java method java.lang.Throwable.printStackTrace().
+ */
+void java_lang_Throwable::java_printStackTrace(Handle throwable, TRAPS) {
+  assert(throwable->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected");
+  JavaValue result(T_VOID);
+  JavaCalls::call_virtual(&result,
+                          throwable,
+                          KlassHandle(THREAD, SystemDictionary::Throwable_klass()),
+                          vmSymbols::printStackTrace_name(),
+                          vmSymbols::void_method_signature(),
+                          THREAD);
+}
+
 void java_lang_Throwable::fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS) {
   if (!StackTraceInThrowable) return;
   ResourceMark rm(THREAD);
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Tue Jan 12 16:00:04 2016 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Tue Jan 12 10:44:41 2016 -1000
@@ -554,6 +554,7 @@
   // Printing
   static void print(Handle throwable, outputStream* st);
   static void print_stack_trace(Handle throwable, outputStream* st);
+  static void java_printStackTrace(Handle throwable, TRAPS);
   // Debugging
   friend class JavaClasses;
 };
--- a/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp	Tue Jan 12 16:00:04 2016 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp	Tue Jan 12 10:44:41 2016 -1000
@@ -162,10 +162,7 @@
     Handle exception(THREAD, PENDING_EXCEPTION);
     CLEAR_PENDING_EXCEPTION;
 
-    {
-      ttyLocker ttyl;
-      java_lang_Throwable::print_stack_trace(exception, tty);
-    }
+    java_lang_Throwable::java_printStackTrace(exception, THREAD);
 
     // Something went wrong so disable compilation at this level
     method->set_not_compilable(CompLevel_full_optimization);
@@ -181,11 +178,7 @@
   Thread* THREAD = Thread::current();
   CLEAR_PENDING_EXCEPTION;
 
-  {
-    ttyLocker ttyl;
-    tty->print_raw_cr(message);
-    java_lang_Throwable::print_stack_trace(exception, tty);
-  }
+  java_lang_Throwable::java_printStackTrace(exception, THREAD);
 
   // Give other aborting threads to also print their stack traces.
   // This can be very useful when debugging class initialization
--- a/hotspot/src/share/vm/runtime/java.cpp	Tue Jan 12 16:00:04 2016 +0100
+++ b/hotspot/src/share/vm/runtime/java.cpp	Tue Jan 12 10:44:41 2016 -1000
@@ -432,8 +432,7 @@
   if (HAS_PENDING_EXCEPTION) {
     Handle exception(THREAD, PENDING_EXCEPTION);
     CLEAR_PENDING_EXCEPTION;
-    ttyLocker ttyl;
-    java_lang_Throwable::print_stack_trace(exception, tty);
+    java_lang_Throwable::java_printStackTrace(exception, THREAD);
   }
 #endif