diff -r b6c370a546fc -r a52d1e719c4d hotspot/src/share/vm/runtime/frame.cpp --- 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;