changeset 16724:300fffc06b55

Merge.
author Doug Simon <doug.simon@oracle.com>
date Fri, 08 Aug 2014 12:33:38 +0200
parents c880fb576c97 (current diff) b1911c1e44c8 (diff)
children 22b2950a0613
files
diffstat 8 files changed, 60 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/bsd/vm/os_bsd.cpp	Fri Aug 08 12:33:22 2014 +0200
+++ b/src/os/bsd/vm/os_bsd.cpp	Fri Aug 08 12:33:38 2014 +0200
@@ -3805,6 +3805,11 @@
   return fetcher.result();
 }
 
+address os::get_pc(void* context) {
+  ucontext_t *uc = (ucontext_t*)context;
+  return os::Bsd::ucontext_get_pc(uc);
+}
+
 int os::Bsd::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime)
 {
   return pthread_cond_timedwait(_cond, _mutex, _abstime);
--- a/src/os/linux/vm/os_linux.cpp	Fri Aug 08 12:33:22 2014 +0200
+++ b/src/os/linux/vm/os_linux.cpp	Fri Aug 08 12:33:38 2014 +0200
@@ -5035,6 +5035,11 @@
   return fetcher.result();
 }
 
+address os::get_pc(void* context) {
+  ucontext_t *uc = (ucontext_t*)context;
+  return os::Linux::ucontext_get_pc(uc);
+}
+
 int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime)
 {
    if (is_NPTL()) {
--- a/src/os/solaris/vm/os_solaris.cpp	Fri Aug 08 12:33:22 2014 +0200
+++ b/src/os/solaris/vm/os_solaris.cpp	Fri Aug 08 12:33:38 2014 +0200
@@ -4379,6 +4379,10 @@
   return fetcher.result();
 }
 
+address os::get_pc(void* context) {
+  ucontext_t *uc = (ucontext_t*)context;
+  return os::Solaris::ucontext_get_pc(uc);
+}
 
 // This does not do anything on Solaris. This is basically a hook for being
 // able to use structured exception handling (thread-local exception filters) on, e.g., Win32.
--- a/src/os/windows/vm/os_windows.cpp	Fri Aug 08 12:33:22 2014 +0200
+++ b/src/os/windows/vm/os_windows.cpp	Fri Aug 08 12:33:38 2014 +0200
@@ -3672,6 +3672,16 @@
 #endif
 }
 
+address os::get_pc(void* context) {
+  CONTEXT* uc = (CONTEXT*)context;
+#ifdef _M_AMD64
+  return (address) context.Rip;
+#else
+  return (address) context.Eip;
+#endif
+}
+
+
 // GetCurrentThreadId() returns DWORD
 intx os::current_thread_id()          { return GetCurrentThreadId(); }
 
--- a/src/share/vm/compiler/disassembler.cpp	Fri Aug 08 12:33:22 2014 +0200
+++ b/src/share/vm/compiler/disassembler.cpp	Fri Aug 08 12:33:38 2014 +0200
@@ -493,6 +493,10 @@
 
 void Disassembler::decode(CodeBlob* cb, outputStream* st) {
   if (!load_library())  return;
+  if (cb->is_nmethod()) {
+    decode((nmethod*)cb, st);
+    return;
+  }
   decode_env env(cb, st);
   env.output()->print_cr("----------------------------------------------------------------------");
   env.output()->print_cr("%s at  [" PTR_FORMAT ", " PTR_FORMAT "]  %d bytes", cb->name(), cb->code_begin(), cb->code_end(), ((jlong)(cb->code_end() - cb->code_begin())) * sizeof(unsigned char*));
--- a/src/share/vm/runtime/os.hpp	Fri Aug 08 12:33:22 2014 +0200
+++ b/src/share/vm/runtime/os.hpp	Fri Aug 08 12:33:38 2014 +0200
@@ -563,6 +563,9 @@
   static void *find_agent_function(AgentLibrary *agent_lib, bool check_lib,
                                    const char *syms[], size_t syms_len);
 
+
+  static address get_pc(void* context);
+
   // Print out system information; they are called by fatal error handler.
   // Output format may be different on different platforms.
   static void print_os_info(outputStream* st);
--- a/src/share/vm/runtime/sharedRuntime.cpp	Fri Aug 08 12:33:22 2014 +0200
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Fri Aug 08 12:33:38 2014 +0200
@@ -853,8 +853,8 @@
           if (!cb->is_nmethod()) {
             bool is_in_blob = cb->is_adapter_blob() || cb->is_method_handles_adapter_blob();
             if (!is_in_blob) {
-              cb->print();
-              fatal(err_msg("exception happened outside interpreter, nmethods and vtable stubs at pc " INTPTR_FORMAT, pc));
+              // Allow normal crash reporting to handle this
+              return NULL;
             }
             Events::log_exception(thread, "NullPointerException in code blob at " INTPTR_FORMAT, pc);
             // There is no handler here, so we will simply unwind.
--- a/src/share/vm/utilities/vmError.cpp	Fri Aug 08 12:33:22 2014 +0200
+++ b/src/share/vm/utilities/vmError.cpp	Fri Aug 08 12:33:38 2014 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "compiler/compileBroker.hpp"
+#include "compiler/disassembler.hpp"
 #include "gc_interface/collectedHeap.hpp"
 #include "prims/whitebox.hpp"
 #include "runtime/arguments.hpp"
@@ -532,6 +533,32 @@
        st->cr();
      }
 
+  STEP(102, "(printing code blob if possible)")
+
+     if (_verbose && _context) {
+       address pc = os::get_pc(_context);
+       CodeBlob* cb = CodeCache::find_blob(pc);
+       if (cb != NULL) {
+         if (Interpreter::contains(pc)) {
+           // The interpreter CodeBlob is very large so try to print the codelet instead.
+           InterpreterCodelet* codelet = Interpreter::codelet_containing(pc);
+           if (codelet != NULL) {
+             codelet->print_on(st);
+             Disassembler::decode(codelet->code_begin(), codelet->code_end(), st);
+           }
+         } else {
+           StubCodeDesc* desc = StubCodeDesc::desc_for(pc);
+           if (desc != NULL) {
+             desc->print_on(st);
+             Disassembler::decode(desc->begin(), desc->end(), st);
+           } else {
+             Disassembler::decode(cb, st);
+             st->cr();
+           }
+         }
+       }
+     }
+
   STEP(105, "(printing register info)")
 
      // decode register contents if possible