changeset 22241:7ca4c8c37ca9

nmethod::is_deopt_entry should use NativeCall::instruction_size
author twisti
date Fri, 17 Jul 2015 08:45:25 -0700
parents 67b20ea8496c
children aebb7c58725d
files src/share/vm/code/nmethod.cpp src/share/vm/code/nmethod.hpp
diffstat 2 files changed, 24 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/code/nmethod.cpp	Fri Jul 17 11:41:55 2015 +0200
+++ b/src/share/vm/code/nmethod.cpp	Fri Jul 17 08:45:25 2015 -0700
@@ -43,6 +43,21 @@
 #include "utilities/dtrace.hpp"
 #include "utilities/events.hpp"
 #include "utilities/xmlstream.hpp"
+#ifdef TARGET_ARCH_x86
+# include "nativeInst_x86.hpp"
+#endif
+#ifdef TARGET_ARCH_sparc
+# include "nativeInst_sparc.hpp"
+#endif
+#ifdef TARGET_ARCH_zero
+# include "nativeInst_zero.hpp"
+#endif
+#ifdef TARGET_ARCH_arm
+# include "nativeInst_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "nativeInst_ppc.hpp"
+#endif
 #ifdef SHARK
 #include "shark/sharkCompiler.hpp"
 #endif
@@ -2610,6 +2625,14 @@
   memcpy(scopes_data_begin(), buffer, size);
 }
 
+// When using JVMCI the address might be off by the size of a call instruction.
+bool nmethod::is_deopt_entry(address pc) {
+  return pc == deopt_handler_begin()
+#ifdef JVMCI
+    || pc == (deopt_handler_begin() + NativeCall::instruction_size)
+#endif // JVMCI
+    ;
+}
 
 #ifdef ASSERT
 static PcDesc* linear_search(nmethod* nm, int pc_offset, bool approximate) {
--- a/src/share/vm/code/nmethod.hpp	Fri Jul 17 11:41:55 2015 +0200
+++ b/src/share/vm/code/nmethod.hpp	Fri Jul 17 08:45:25 2015 -0700
@@ -694,24 +694,7 @@
   // Deopt
   // Return true is the PC is one would expect if the frame is being deopted.
   bool is_deopt_pc      (address pc) { return is_deopt_entry(pc) || is_deopt_mh_entry(pc); }
-
-  // (thomaswue) When using jvmci, the address might be off by 5 (because this is the size of the call instruction.
-  // (thomaswue) TODO: Replace this by a more general mechanism.
-  // (sanzinger) SPARC has another offset, looked for some variable existing in HotSpot which describes this offset, but i have not
-  // found anything.
-  bool is_deopt_entry   (address pc) {
-    return pc == deopt_handler_begin()
-#ifdef JVMCI
-      || pc == deopt_handler_begin() +
-#ifdef TARGET_ARCH_sparc
-  8
-#endif // sparc
-#ifdef TARGET_ARCH_x86
-  5
-#endif // x86
-#endif // JVMCI
-      ;
-  }
+  bool is_deopt_entry(address pc);
   bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); }
   // Accessor/mutator for the original pc of a frame before a frame was deopted.
   address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); }