8172844: Assert fails in deoptimization due to original PC at the end of code section
authorzmajo
Mon, 23 Jan 2017 09:53:27 +0100
changeset 43474 8fbf946045f6
parent 43473 3beee3e324cf
child 43475 24f19a48e8c0
child 43476 b7404901db14
8172844: Assert fails in deoptimization due to original PC at the end of code section Summary: Change assert to accept end of code section as well. Reviewed-by: rbackman, kvn, dlong
hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp
hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp
hotspot/src/cpu/arm/vm/frame_arm.cpp
hotspot/src/cpu/arm/vm/frame_arm.inline.hpp
hotspot/src/cpu/x86/vm/frame_x86.cpp
hotspot/src/cpu/x86/vm/frame_x86.inline.hpp
hotspot/src/share/vm/code/compiledMethod.hpp
--- a/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp	Mon Jan 23 09:53:27 2017 +0100
@@ -375,7 +375,8 @@
   fr._unextended_sp = unextended_sp;
 
   address original_pc = nm->get_original_pc(&fr);
-  assert(nm->insts_contains(original_pc), "original PC must be in nmethod");
+  assert(nm->insts_contains_inclusive(original_pc),
+         "original PC must be in the main code section of the the compiled method (or must be immediately following it)");
 }
 #endif
 
--- a/hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp	Mon Jan 23 09:53:27 2017 +0100
@@ -82,7 +82,8 @@
   address original_pc = CompiledMethod::get_deopt_original_pc(this);
   if (original_pc != NULL) {
     _pc = original_pc;
-    assert(((CompiledMethod*)_cb)->insts_contains(_pc), "original PC must be in CompiledMethod");
+    assert(_cb->as_compiled_method()->insts_contains_inclusive(_pc),
+           "original PC must be in the main code section of the the compiled method (or must be immediately following it)");
     _deopt_state = is_deoptimized;
   } else {
     _deopt_state = not_deoptimized;
--- a/hotspot/src/cpu/arm/vm/frame_arm.cpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/hotspot/src/cpu/arm/vm/frame_arm.cpp	Mon Jan 23 09:53:27 2017 +0100
@@ -364,7 +364,8 @@
   fr._unextended_sp = unextended_sp;
 
   address original_pc = nm->get_original_pc(&fr);
-  assert(nm->insts_contains(original_pc), "original PC must be in nmethod");
+  assert(nm->insts_contains_inclusive(original_pc),
+         "original PC must be in the main code section of the the compiled method (or must be immediately following it)");
   assert(nm->is_method_handle_return(original_pc) == is_method_handle_return, "must be");
 }
 #endif
--- a/hotspot/src/cpu/arm/vm/frame_arm.inline.hpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/hotspot/src/cpu/arm/vm/frame_arm.inline.hpp	Mon Jan 23 09:53:27 2017 +0100
@@ -75,7 +75,8 @@
   address original_pc = CompiledMethod::get_deopt_original_pc(this);
   if (original_pc != NULL) {
     _pc = original_pc;
-    assert(_cb->as_compiled_method()->insts_contains(_pc), "original PC must be in CompiledMethod");
+    assert(_cb->as_compiled_method()->insts_contains_inclusive(_pc),
+           "original PC must be in the main code section of the the compiled method (or must be immediately following it)");
     _deopt_state = is_deoptimized;
   } else {
     _deopt_state = not_deoptimized;
--- a/hotspot/src/cpu/x86/vm/frame_x86.cpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp	Mon Jan 23 09:53:27 2017 +0100
@@ -376,7 +376,8 @@
   fr._unextended_sp = unextended_sp;
 
   address original_pc = nm->get_original_pc(&fr);
-  assert(nm->insts_contains(original_pc), "original PC must be in CompiledMethod");
+  assert(nm->insts_contains_inclusive(original_pc),
+         "original PC must be in the main code section of the the compiled method (or must be immediately following it)");
 }
 #endif
 
--- a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp	Mon Jan 23 09:53:27 2017 +0100
@@ -75,7 +75,8 @@
   address original_pc = CompiledMethod::get_deopt_original_pc(this);
   if (original_pc != NULL) {
     _pc = original_pc;
-    assert(((CompiledMethod*)_cb)->insts_contains(_pc), "original PC must be in CompiledMethod");
+    assert(_cb->as_compiled_method()->insts_contains_inclusive(_pc),
+           "original PC must be in the main code section of the the compiled method (or must be immediately following it)");
     _deopt_state = is_deoptimized;
   } else {
     if (_cb->is_deoptimization_stub()) {
--- a/hotspot/src/share/vm/code/compiledMethod.hpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/hotspot/src/share/vm/code/compiledMethod.hpp	Mon Jan 23 09:53:27 2017 +0100
@@ -250,7 +250,11 @@
 
   address insts_begin() const { return code_begin(); }
   address insts_end() const { return stub_begin(); }
+  // Returns true if a given address is in the 'insts' section. The method
+  // insts_contains_inclusive() is end-inclusive.
   bool insts_contains(address addr) const { return insts_begin() <= addr && addr < insts_end(); }
+  bool insts_contains_inclusive(address addr) const { return insts_begin() <= addr && addr <= insts_end(); }
+
   int insts_size() const { return insts_end() - insts_begin(); }
 
   virtual address consts_begin() const = 0;