changeset 9112:6c33b2076d7c

minor HotSpot deoptimization cleanups
author Christian Haeubl <haeubl@ssw.jku.at>
date Mon, 08 Apr 2013 17:48:46 +0200
parents 2c0c708a0ad6
children 01958088b87d
files src/cpu/x86/vm/sharedRuntime_x86_64.cpp src/share/vm/code/codeBlob.hpp
diffstat 2 files changed, 34 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Mon Apr 08 09:26:06 2013 +0200
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Mon Apr 08 17:48:46 2013 +0200
@@ -3330,6 +3330,10 @@
   __ jmp(cont);
 
   int reexecute_offset = __ pc() - start;
+#ifdef GRAALVM
+  // Graal does not use this kind of deoptimization
+  __ should_not_reach_here();
+#endif
 
   // Reexecute case
   // return address is the pc describes what bci to do re-execute at
@@ -3340,6 +3344,32 @@
   __ movl(r14, Deoptimization::Unpack_reexecute); // callee-saved
   __ jmp(cont);
 
+#ifdef GRAAL
+  int implicit_exception_uncommon_trap_offset = __ pc() - start;
+  // pc where the exception happened is in ScratchA
+  __ pushptr(Address(r15_thread, in_bytes(JavaThread::ScratchA_offset())));
+
+  int uncommon_trap_offset = __ pc() - start;
+
+  // Save everything in sight.
+  RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words);
+  // fetch_unroll_info needs to call last_java_frame()
+  __ set_last_Java_frame(noreg, noreg, NULL);
+
+  __ movl(c_rarg1, Address(r15_thread, in_bytes(ThreadShadow::pending_deoptimization_offset())));
+  __ movl(Address(r15_thread, in_bytes(ThreadShadow::pending_deoptimization_offset())), -1);
+
+  __ movl(r14, (int32_t)Deoptimization::Unpack_reexecute);
+  __ mov(c_rarg0, r15_thread);
+  __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
+  oop_maps->add_gc_map( __ pc()-start, map->deep_copy());
+
+  __ reset_last_Java_frame(false, false);
+
+  Label after_fetch_unroll_info_call;
+  __ jmp(after_fetch_unroll_info_call);
+#endif // GRAAL
+
   int exception_offset = __ pc() - start;
 
   // Prolog for exception case
@@ -3396,34 +3426,6 @@
   __ bind(no_pending_exception);
 #endif
 
-#ifdef GRAAL
-  __ jmp(cont);
-
-  int implicit_exception_uncommon_trap_offset = __ pc() - start;
-  // pc where the exception happened is in ScratchA
-  __ pushptr(Address(r15_thread, in_bytes(JavaThread::ScratchA_offset())));
-
-  int uncommon_trap_offset = __ pc() - start;
-
-  // Save everything in sight.
-  RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words);
-  // fetch_unroll_info needs to call last_java_frame()
-  __ set_last_Java_frame(noreg, noreg, NULL);
-
-  __ movl(c_rarg1, Address(r15_thread, in_bytes(ThreadShadow::pending_deoptimization_offset())));
-  __ movl(Address(r15_thread, in_bytes(ThreadShadow::pending_deoptimization_offset())), -1);
-
-  __ movl(r14, (int32_t)Deoptimization::Unpack_reexecute);
-  __ mov(c_rarg0, r15_thread);
-  __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
-  oop_maps->add_gc_map( __ pc()-start, map->deep_copy());
-
-  __ reset_last_Java_frame(false, false);
-
-  Label after_fetch_unroll_info_call;
-  __ jmp(after_fetch_unroll_info_call);
-#endif // GRAAL
-
   __ bind(cont);
 
   // Call C code.  Need thread and this frame, but NOT official VM entry
--- a/src/share/vm/code/codeBlob.hpp	Mon Apr 08 09:26:06 2013 +0200
+++ b/src/share/vm/code/codeBlob.hpp	Mon Apr 08 17:48:46 2013 +0200
@@ -358,10 +358,11 @@
 
   int _unpack_with_exception_in_tls;
 
+#ifdef GRAAL
   // (thomaswue) Offset when Graal calls uncommon_trap.
   int _uncommon_trap_offset;
   int _implicit_exception_uncommon_trap_offset;
-
+#endif
 
   // Creation support
   DeoptimizationBlob(
@@ -416,6 +417,7 @@
   }
   address unpack_with_exception_in_tls() const   { return code_begin() + _unpack_with_exception_in_tls; }
 
+#ifdef GRAAL
   // (thomaswue) Offset when Graal calls uncommon_trap.
   void set_uncommon_trap_offset(int offset) {
     _uncommon_trap_offset = offset;
@@ -427,7 +429,7 @@
     assert(contains(code_begin() + _implicit_exception_uncommon_trap_offset), "must be PC inside codeblob");
   }
   address implicit_exception_uncommon_trap() const                  { return code_begin() + _implicit_exception_uncommon_trap_offset;     }
-
+#endif
 };