Merge
authorcoleenp
Tue, 12 Jan 2016 19:11:39 +0000
changeset 35478 017a7cab2a55
parent 35476 de7e65f21c6c (current diff)
parent 35477 7a00b08d27bc (diff)
child 35480 6ed8e1b70803
child 35481 53825bdb41a0
Merge
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Tue Jan 12 17:02:10 2016 +0000
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Tue Jan 12 19:11:39 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -551,12 +551,11 @@
     // tracing
     if (log_is_enabled(Info, exceptions)) {
       ResourceMark rm;
-      log_info(exceptions)("Exception <%s> (" INTPTR_FORMAT
-                           ") thrown in compiled method <%s> at PC " INTPTR_FORMAT
-                           " for thread " INTPTR_FORMAT,
-                           exception->print_value_string(),
-                           p2i((address)exception()),
-                           nm->method()->print_value_string(), p2i(pc), p2i(thread));
+      stringStream tempst;
+      tempst.print("compiled method <%s>\n"
+                   " at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT,
+                   nm->method()->print_value_string(), p2i(pc), p2i(thread));
+      Exceptions::log_exception(exception, tempst);
     }
     // for AbortVMOnException flag
     Exceptions::debug_check_abort(exception);
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Tue Jan 12 17:02:10 2016 +0000
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Tue Jan 12 19:11:39 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2780,14 +2780,14 @@
       MORE_STACK(1);
       pc = METHOD->code_base() + continuation_bci;
       if (log_is_enabled(Info, exceptions)) {
-        ResourceMark rm;
-        log_info(exceptions)("Exception <%s> (" INTPTR_FORMAT ")\n"
-                             " thrown in interpreter method <%s>\n"
-                             " at bci %d, continuing at %d for thread " INTPTR_FORMAT,
-                             except_oop->print_value_string(), p2i(except_oop()),
-                             METHOD->print_value_string(),
-                             (int)(istate->bcp() - METHOD->code_base()),
-                             (int)continuation_bci, p2i(THREAD));
+        ResourceMark rm(thread);
+        stringStream tempst;
+        tempst.print("interpreter method <%s>\n"
+                     " at bci %d, continuing at %d for thread " INTPTR_FORMAT,
+                     METHOD->print_value_string(),
+                     (int)(istate->bcp() - METHOD->code_base()),
+                     (int)continuation_bci, p2i(THREAD));
+        Exceptions::log_exception(except_oop, tempst);
       }
       // for AbortVMOnException flag
       Exceptions::debug_check_abort(except_oop);
@@ -2798,13 +2798,13 @@
     }
     if (log_is_enabled(Info, exceptions)) {
       ResourceMark rm;
-      log_info(exceptions)("Exception <%s> (" INTPTR_FORMAT ")\n"
-                           " thrown in interpreter method <%s>\n"
-                           " at bci %d, unwinding for thread " INTPTR_FORMAT,
-                           except_oop->print_value_string(), p2i(except_oop()),
-                           METHOD->print_value_string(),
-                           (int)(istate->bcp() - METHOD->code_base()),
-                           p2i(THREAD));
+      stringStream tempst;
+      tempst.print("interpreter method <%s>\n"
+             " at bci %d, unwinding for thread " INTPTR_FORMAT,
+             METHOD->print_value_string(),
+             (int)(istate->bcp() - METHOD->code_base()),
+             p2i(THREAD));
+      Exceptions::log_exception(except_oop, tempst);
     }
     // for AbortVMOnException flag
     Exceptions::debug_check_abort(except_oop);
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Tue Jan 12 17:02:10 2016 +0000
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Tue Jan 12 19:11:39 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -459,21 +459,11 @@
     // tracing
     if (log_is_enabled(Info, exceptions)) {
       ResourceMark rm(thread);
-      Symbol* message = java_lang_Throwable::detail_message(h_exception());
       stringStream tempst;
-      if (message != NULL) {
-        tempst.print("Exception <%s: %s> (" INTPTR_FORMAT ")\n",
-                     h_exception->print_value_string(), message->as_C_string(),
-                     p2i(h_exception()));
-      } else {
-        tempst.print("Exception <%s> (" INTPTR_FORMAT ")\n",
-                     h_exception->print_value_string(),
-                     p2i(h_exception()));
-      }
-      tempst.print(" thrown in interpreter method <%s>\n"
+      tempst.print("interpreter method <%s>\n"
                    " at bci %d for thread " INTPTR_FORMAT,
                    h_method->print_value_string(), current_bci, p2i(thread));
-      LogHandle(exceptions)::info_stream()->print_raw_cr(tempst.as_string());
+      Exceptions::log_exception(h_exception, tempst);
     }
 // Don't go paging in something which won't be used.
 //     else if (extable->length() == 0) {
--- a/hotspot/src/share/vm/utilities/exceptions.cpp	Tue Jan 12 17:02:10 2016 +0000
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp	Tue Jan 12 19:11:39 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -502,3 +502,18 @@
   }
   debug_check_abort(exception()->klass()->external_name(), message);
 }
+
+// for logging exceptions
+void Exceptions::log_exception(Handle exception, stringStream tempst) {
+  ResourceMark rm;
+  Symbol* message = java_lang_Throwable::detail_message(exception());
+  if (message != NULL) {
+    log_info(exceptions)("Exception <%s: %s> (" INTPTR_FORMAT ")\n thrown in %s",
+                         exception->print_value_string(),
+                         message->as_C_string(), p2i(exception()), tempst.as_string());
+  } else {
+    log_info(exceptions)("Exception <%s> (" INTPTR_FORMAT ")\n thrown in %s",
+                         exception->print_value_string(),
+                         p2i(exception()), tempst.as_string());
+  }
+}
--- a/hotspot/src/share/vm/utilities/exceptions.hpp	Tue Jan 12 17:02:10 2016 +0000
+++ b/hotspot/src/share/vm/utilities/exceptions.hpp	Tue Jan 12 19:11:39 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 #include "memory/allocation.hpp"
 #include "oops/oopsHierarchy.hpp"
+#include "utilities/ostream.hpp"
 #include "utilities/sizes.hpp"
 
 // This file provides the basic support for exception handling in the VM.
@@ -177,6 +178,9 @@
   static void debug_check_abort(Handle exception, const char* message = NULL);
   static void debug_check_abort_helper(Handle exception, const char* message = NULL);
   static void debug_check_abort(const char *value_string, const char* message = NULL);
+
+  // for logging exceptions
+  static void log_exception(Handle exception, stringStream tempst);
 };
 
 
--- a/hotspot/test/runtime/logging/ExceptionsTest.java	Tue Jan 12 17:02:10 2016 +0000
+++ b/hotspot/test/runtime/logging/ExceptionsTest.java	Tue Jan 12 19:11:39 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
         output.shouldContain("<a 'java/lang/RuntimeException': Test exception 1 for logging>");
         output.shouldContain(" thrown in interpreter method ");
-        output.shouldContain(") thrown in compiled method ");
+        output.shouldContain(" thrown in compiled method ");
         output.shouldContain("Exception 2 caught.");
         output.shouldHaveExitValue(0);
     }