changeset 12601:c576bd949a9d

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
author zmajo
date Mon, 23 Jan 2017 09:53:27 +0100
parents f5776d683ae5
children 3c57e5f8dfca 84b87a6130f9
files src/cpu/aarch64/vm/frame_aarch64.cpp src/cpu/aarch64/vm/frame_aarch64.inline.hpp src/cpu/arm/vm/frame_arm.cpp src/cpu/arm/vm/frame_arm.inline.hpp src/cpu/x86/vm/frame_x86.cpp src/cpu/x86/vm/frame_x86.inline.hpp src/share/vm/code/compiledMethod.hpp
diffstat 7 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/aarch64/vm/frame_aarch64.cpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/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/src/cpu/aarch64/vm/frame_aarch64.inline.hpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/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/src/cpu/arm/vm/frame_arm.cpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/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/src/cpu/arm/vm/frame_arm.inline.hpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/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/src/cpu/x86/vm/frame_x86.cpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/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/src/cpu/x86/vm/frame_x86.inline.hpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/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/src/share/vm/code/compiledMethod.hpp	Sun Jan 22 22:18:49 2017 -0800
+++ b/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;