8159284: bigapps/Jetty - assert(jfa->last_Java_sp() > sp()) failed with JFR in use
Summary: Test condition in assert in frame::safe_for_sender() for entry frames and return false.
Reviewed-by: mgronlun, fparain
--- a/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp Tue Aug 02 20:55:27 2016 -0700
+++ b/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp Wed Aug 03 09:40:21 2016 -0400
@@ -110,17 +110,7 @@
// Entry frame checks
if (is_entry_frame()) {
// an entry frame must have a valid fp.
-
- if (!fp_safe) return false;
-
- // Validate the JavaCallWrapper an entry frame must have
-
- address jcw = (address)entry_frame_call_wrapper();
-
- bool jcw_safe = (jcw < thread->stack_base()) && ( jcw > fp);
-
- return jcw_safe;
-
+ return fp_safe && is_entry_frame_valid(thread);
}
intptr_t* sender_sp = NULL;
@@ -210,15 +200,8 @@
}
// construct the potential sender
-
frame sender(sender_sp, sender_unextended_sp, saved_fp, sender_pc);
-
- // Validate the JavaCallWrapper an entry frame must have
- address jcw = (address)sender.entry_frame_call_wrapper();
-
- bool jcw_safe = (jcw < thread->stack_base()) && ( jcw > (address)sender.fp());
-
- return jcw_safe;
+ return sender.is_entry_frame_valid(thread);
}
CompiledMethod* nm = sender_blob->as_compiled_method_or_null();
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp Tue Aug 02 20:55:27 2016 -0700
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp Wed Aug 03 09:40:21 2016 -0400
@@ -225,19 +225,7 @@
// Entry frame checks
if (is_entry_frame()) {
// an entry frame must have a valid fp.
-
- if (!fp_safe) {
- return false;
- }
-
- // Validate the JavaCallWrapper an entry frame must have
-
- address jcw = (address)entry_frame_call_wrapper();
-
- bool jcw_safe = (jcw <= thread->stack_base()) && ( jcw > _FP);
-
- return jcw_safe;
-
+ return fp_safe && is_entry_frame_valid(thread);
}
intptr_t* younger_sp = sp();
@@ -290,14 +278,8 @@
return false;
}
- if( sender.is_entry_frame()) {
- // Validate the JavaCallWrapper an entry frame must have
-
- address jcw = (address)sender.entry_frame_call_wrapper();
-
- bool jcw_safe = (jcw <= thread->stack_base()) && ( jcw > sender_fp);
-
- return jcw_safe;
+ if (sender.is_entry_frame()) {
+ return sender.is_entry_frame_valid(thread);
}
// If the frame size is 0 something (or less) is bad because every nmethod has a non-zero frame size
--- a/hotspot/src/cpu/x86/vm/frame_x86.cpp Tue Aug 02 20:55:27 2016 -0700
+++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp Wed Aug 03 09:40:21 2016 -0400
@@ -108,17 +108,7 @@
// Entry frame checks
if (is_entry_frame()) {
// an entry frame must have a valid fp.
-
- if (!fp_safe) return false;
-
- // Validate the JavaCallWrapper an entry frame must have
-
- address jcw = (address)entry_frame_call_wrapper();
-
- bool jcw_safe = (jcw < thread->stack_base()) && ( jcw > fp);
-
- return jcw_safe;
-
+ return fp_safe && is_entry_frame_valid(thread);
}
intptr_t* sender_sp = NULL;
@@ -209,15 +199,8 @@
}
// construct the potential sender
-
frame sender(sender_sp, sender_unextended_sp, saved_fp, sender_pc);
-
- // Validate the JavaCallWrapper an entry frame must have
- address jcw = (address)sender.entry_frame_call_wrapper();
-
- bool jcw_safe = (jcw < thread->stack_base()) && ( jcw > (address)sender.fp());
-
- return jcw_safe;
+ return sender.is_entry_frame_valid(thread);
}
CompiledMethod* nm = sender_blob->as_compiled_method_or_null();
--- a/hotspot/src/share/vm/runtime/frame.cpp Tue Aug 02 20:55:27 2016 -0700
+++ b/hotspot/src/share/vm/runtime/frame.cpp Wed Aug 03 09:40:21 2016 -0400
@@ -225,6 +225,19 @@
return NULL;
}
+bool frame::is_entry_frame_valid(JavaThread* thread) const {
+ // Validate the JavaCallWrapper an entry frame must have
+ address jcw = (address)entry_frame_call_wrapper();
+ bool jcw_safe = (jcw < thread->stack_base()) && (jcw > (address)fp()); // less than stack base
+ if (!jcw_safe) {
+ return false;
+ }
+
+ // Validate sp saved in the java frame anchor
+ JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor();
+ return (jfa->last_Java_sp() > sp());
+}
+
bool frame::should_be_deoptimized() const {
if (_deopt_state == is_deoptimized ||
!is_compiled_frame() ) return false;
--- a/hotspot/src/share/vm/runtime/frame.hpp Tue Aug 02 20:55:27 2016 -0700
+++ b/hotspot/src/share/vm/runtime/frame.hpp Wed Aug 03 09:40:21 2016 -0400
@@ -166,6 +166,8 @@
frame sender_for_interpreter_frame(RegisterMap* map) const;
frame sender_for_native_frame(RegisterMap* map) const;
+ bool is_entry_frame_valid(JavaThread* thread) const;
+
// All frames:
// A low-level interface for vframes: