changeset 2605:98fa88528319

Deopt on implicit null pointer exception.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Fri, 06 May 2011 16:20:56 +0200
parents c9b17ac5c06b
children f21f430a6ef2
files doc/design/graal_compiler.pdf src/cpu/x86/vm/sharedRuntime_x86_64.cpp src/share/vm/code/codeBlob.hpp src/share/vm/runtime/sharedRuntime.cpp
diffstat 4 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
Binary file doc/design/graal_compiler.pdf has changed
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Thu May 05 17:03:43 2011 +0200
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Fri May 06 16:20:56 2011 +0200
@@ -2653,6 +2653,9 @@
   // (tw) Start of C1X uncommon trap code.
   __ jmp(cont);
 
+  int jmp_uncommon_trap_offset = __ pc() - start;
+  __ pushptr(Address(r15_thread, in_bytes(JavaThread::ScratchA_offset())));
+
   int uncommon_trap_offset = __ pc() - start;
 
   // Warning: Duplicate code
@@ -2877,6 +2880,7 @@
   _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_in_words);
   _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset);
   _deopt_blob->set_uncommon_trap_offset(uncommon_trap_offset);
+  _deopt_blob->set_jmp_uncommon_trap_offset(jmp_uncommon_trap_offset);
 }
 
 #ifdef COMPILER2
--- a/src/share/vm/code/codeBlob.hpp	Thu May 05 17:03:43 2011 +0200
+++ b/src/share/vm/code/codeBlob.hpp	Fri May 06 16:20:56 2011 +0200
@@ -354,6 +354,7 @@
 
   // (tw) Offset when C1X calls uncommon_trap.
   int _uncommon_trap_offset;
+  int _jmp_uncommon_trap_offset;
 
 
   // Creation support
@@ -418,6 +419,11 @@
     assert(contains(code_begin() + _uncommon_trap_offset), "must be PC inside codeblob");
   }
   address uncommon_trap() const                  { return code_begin() + _uncommon_trap_offset;     }
+  void set_jmp_uncommon_trap_offset(int offset) {
+    _jmp_uncommon_trap_offset = offset;
+    assert(contains(code_begin() + _jmp_uncommon_trap_offset), "must be PC inside codeblob");
+  }
+  address jmp_uncommon_trap() const                  { return code_begin() + _jmp_uncommon_trap_offset;     }
 
 };
 
--- a/src/share/vm/runtime/sharedRuntime.cpp	Thu May 05 17:03:43 2011 +0200
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Fri May 06 16:20:56 2011 +0200
@@ -699,7 +699,7 @@
   address target_pc = NULL;
 
   if (TraceSignals) {
-    tty->print_cr("Searching for continuation for implicit exception at %d", pc);
+    tty->print_cr("Searching for continuation for implicit exception at %d!", pc);
   }
 
   if (Interpreter::contains(pc)) {
@@ -780,7 +780,8 @@
             if (TraceSignals) {
               tty->print_cr(err_msg("calling implicit call stub relative pc=%d method name = %s", pc - nm->entry_point(), nm->method()->name()->as_C_string()));
             }
-            target_pc = Runtime1::entry_for(Runtime1::c1x_global_implicit_null_id);
+            thread->_ScratchA = (intptr_t)pc;
+            target_pc = (SharedRuntime::deopt_blob()->jmp_uncommon_trap());//Runtime1::entry_for(Runtime1::c1x_global_implicit_null_id);
           } else {
             target_pc = nm->continuation_for_implicit_exception(pc);
           }