Mon, 26 Jun 2017 02:04:40 -0700
8161598: Kitchensink fails: assert(nm->insts_contains(original_pc)) failed: original PC must be in nmethod/CompiledMethod
Reviewed-by: dlong
1.1 --- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp Mon Jun 19 22:49:52 2017 +0000 1.2 +++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp Mon Jun 26 02:04:40 2017 -0700 1.3 @@ -98,7 +98,7 @@ 1.4 } 1.5 pop(rax); 1.6 #endif 1.7 - reset_last_Java_frame(thread, true, align_stack); 1.8 + reset_last_Java_frame(thread, true); 1.9 1.10 // discard thread and arguments 1.11 NOT_LP64(addptr(rsp, num_rt_args()*BytesPerWord)); 1.12 @@ -882,7 +882,7 @@ 1.13 } 1.14 __ pop(rax); 1.15 #endif 1.16 - __ reset_last_Java_frame(thread, true, false); 1.17 + __ reset_last_Java_frame(thread, true); 1.18 #ifndef _LP64 1.19 __ pop(rcx); // discard thread arg 1.20 __ pop(rcx); // discard dummy
2.1 --- a/src/cpu/x86/vm/frame_x86.cpp Mon Jun 19 22:49:52 2017 +0000 2.2 +++ b/src/cpu/x86/vm/frame_x86.cpp Mon Jun 26 02:04:40 2017 -0700 2.3 @@ -370,13 +370,16 @@ 2.4 JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor(); 2.5 assert(!entry_frame_is_first(), "next Java fp must be non zero"); 2.6 assert(jfa->last_Java_sp() > sp(), "must be above this frame on stack"); 2.7 + // Since we are walking the stack now this nested anchor is obviously walkable 2.8 + // even if it wasn't when it was stacked. 2.9 + if (!jfa->walkable()) { 2.10 + // Capture _last_Java_pc (if needed) and mark anchor walkable. 2.11 + jfa->capture_last_Java_pc(); 2.12 + } 2.13 map->clear(); 2.14 assert(map->include_argument_oops(), "should be set by clear"); 2.15 - if (jfa->last_Java_pc() != NULL ) { 2.16 - frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc()); 2.17 - return fr; 2.18 - } 2.19 - frame fr(jfa->last_Java_sp(), jfa->last_Java_fp()); 2.20 + assert(jfa->last_Java_pc() != NULL, "not walkable"); 2.21 + frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc()); 2.22 return fr; 2.23 } 2.24 2.25 @@ -714,3 +717,21 @@ 2.26 init((intptr_t*)sp, (intptr_t*)fp, (address)pc); 2.27 } 2.28 #endif 2.29 + 2.30 +void JavaFrameAnchor::make_walkable(JavaThread* thread) { 2.31 + // last frame set? 2.32 + if (last_Java_sp() == NULL) return; 2.33 + // already walkable? 2.34 + if (walkable()) return; 2.35 + assert(Thread::current() == (Thread*)thread, "not current thread"); 2.36 + assert(last_Java_sp() != NULL, "not called from Java code?"); 2.37 + assert(last_Java_pc() == NULL, "already walkable"); 2.38 + capture_last_Java_pc(); 2.39 + assert(walkable(), "something went wrong"); 2.40 +} 2.41 + 2.42 +void JavaFrameAnchor::capture_last_Java_pc() { 2.43 + assert(_last_Java_sp != NULL, "no last frame set"); 2.44 + assert(_last_Java_pc == NULL, "already walkable"); 2.45 + _last_Java_pc = (address)_last_Java_sp[-1]; 2.46 +}
3.1 --- a/src/cpu/x86/vm/frame_x86.inline.hpp Mon Jun 19 22:49:52 2017 +0000 3.2 +++ b/src/cpu/x86/vm/frame_x86.inline.hpp Mon Jun 26 02:04:40 2017 -0700 3.3 @@ -96,6 +96,7 @@ 3.4 // call a specialized frame constructor instead of this one. 3.5 // Then we could use the assert below. However this assert is of somewhat dubious 3.6 // value. 3.7 + // UPDATE: this constructor is only used by trace_method_handle_stub() now. 3.8 // assert(_pc != NULL, "no pc?"); 3.9 3.10 _cb = CodeCache::find_blob(_pc);
4.1 --- a/src/cpu/x86/vm/javaFrameAnchor_x86.hpp Mon Jun 19 22:49:52 2017 +0000 4.2 +++ b/src/cpu/x86/vm/javaFrameAnchor_x86.hpp Mon Jun 26 02:04:40 2017 -0700 4.3 @@ -62,10 +62,9 @@ 4.4 _last_Java_sp = src->_last_Java_sp; 4.5 } 4.6 4.7 - // Always walkable 4.8 - bool walkable(void) { return true; } 4.9 - // Never any thing to do since we are always walkable and can find address of return addresses 4.10 - void make_walkable(JavaThread* thread) { } 4.11 + bool walkable(void) { return _last_Java_sp != NULL && _last_Java_pc != NULL; } 4.12 + void make_walkable(JavaThread* thread); 4.13 + void capture_last_Java_pc(void); 4.14 4.15 intptr_t* last_Java_sp(void) const { return _last_Java_sp; } 4.16
5.1 --- a/src/cpu/x86/vm/macroAssembler_x86.cpp Mon Jun 19 22:49:52 2017 +0000 5.2 +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp Mon Jun 26 02:04:40 2017 -0700 5.3 @@ -748,8 +748,7 @@ 5.4 } 5.5 } 5.6 5.7 -void MacroAssembler::reset_last_Java_frame(bool clear_fp, 5.8 - bool clear_pc) { 5.9 +void MacroAssembler::reset_last_Java_frame(bool clear_fp) { 5.10 // we must set sp to zero to clear frame 5.11 movptr(Address(r15_thread, JavaThread::last_Java_sp_offset()), NULL_WORD); 5.12 // must clear fp, so that compiled frames are not confused; it is 5.13 @@ -758,9 +757,8 @@ 5.14 movptr(Address(r15_thread, JavaThread::last_Java_fp_offset()), NULL_WORD); 5.15 } 5.16 5.17 - if (clear_pc) { 5.18 - movptr(Address(r15_thread, JavaThread::last_Java_pc_offset()), NULL_WORD); 5.19 - } 5.20 + // Always clear the pc because it could have been set by make_walkable() 5.21 + movptr(Address(r15_thread, JavaThread::last_Java_pc_offset()), NULL_WORD); 5.22 } 5.23 5.24 void MacroAssembler::set_last_Java_frame(Register last_java_sp, 5.25 @@ -2561,7 +2559,7 @@ 5.26 } 5.27 // reset last Java frame 5.28 // Only interpreter should have to clear fp 5.29 - reset_last_Java_frame(java_thread, true, false); 5.30 + reset_last_Java_frame(java_thread, true); 5.31 5.32 #ifndef CC_INTERP 5.33 // C++ interp handles this in the interpreter 5.34 @@ -3808,7 +3806,7 @@ 5.35 pusha(); 5.36 } 5.37 5.38 -void MacroAssembler::reset_last_Java_frame(Register java_thread, bool clear_fp, bool clear_pc) { 5.39 +void MacroAssembler::reset_last_Java_frame(Register java_thread, bool clear_fp) { 5.40 // determine java_thread register 5.41 if (!java_thread->is_valid()) { 5.42 java_thread = rdi; 5.43 @@ -3820,8 +3818,8 @@ 5.44 movptr(Address(java_thread, JavaThread::last_Java_fp_offset()), NULL_WORD); 5.45 } 5.46 5.47 - if (clear_pc) 5.48 - movptr(Address(java_thread, JavaThread::last_Java_pc_offset()), NULL_WORD); 5.49 + // Always clear the pc because it could have been set by make_walkable() 5.50 + movptr(Address(java_thread, JavaThread::last_Java_pc_offset()), NULL_WORD); 5.51 5.52 } 5.53
6.1 --- a/src/cpu/x86/vm/macroAssembler_x86.hpp Mon Jun 19 22:49:52 2017 +0000 6.2 +++ b/src/cpu/x86/vm/macroAssembler_x86.hpp Mon Jun 26 02:04:40 2017 -0700 6.3 @@ -289,10 +289,10 @@ 6.4 Register last_java_fp, 6.5 address last_java_pc); 6.6 6.7 - void reset_last_Java_frame(Register thread, bool clear_fp, bool clear_pc); 6.8 + void reset_last_Java_frame(Register thread, bool clear_fp); 6.9 6.10 // thread in the default location (r15_thread on 64bit) 6.11 - void reset_last_Java_frame(bool clear_fp, bool clear_pc); 6.12 + void reset_last_Java_frame(bool clear_fp); 6.13 6.14 // Stores 6.15 void store_check(Register obj); // store check for obj - register is destroyed afterwards
7.1 --- a/src/cpu/x86/vm/runtime_x86_32.cpp Mon Jun 19 22:49:52 2017 +0000 7.2 +++ b/src/cpu/x86/vm/runtime_x86_32.cpp Mon Jun 26 02:04:40 2017 -0700 7.3 @@ -116,7 +116,7 @@ 7.4 // No registers to map, rbp is known implicitly 7.5 oop_maps->add_gc_map( __ pc() - start, new OopMap( framesize, 0 )); 7.6 __ get_thread(rcx); 7.7 - __ reset_last_Java_frame(rcx, false, false); 7.8 + __ reset_last_Java_frame(rcx, false); 7.9 7.10 // Restore callee-saved registers 7.11 __ movptr(rbp, Address(rsp, rbp_off * wordSize));
8.1 --- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Mon Jun 19 22:49:52 2017 +0000 8.2 +++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Mon Jun 26 02:04:40 2017 -0700 8.3 @@ -1333,7 +1333,7 @@ 8.4 __ increment(rsp, wordSize); 8.5 8.6 __ get_thread(thread); 8.7 - __ reset_last_Java_frame(thread, false, true); 8.8 + __ reset_last_Java_frame(thread, false); 8.9 8.10 save_or_restore_arguments(masm, stack_slots, total_in_args, 8.11 arg_save_area, NULL, in_regs, in_sig_bt); 8.12 @@ -2251,7 +2251,7 @@ 8.13 8.14 // We can finally stop using that last_Java_frame we setup ages ago 8.15 8.16 - __ reset_last_Java_frame(thread, false, true); 8.17 + __ reset_last_Java_frame(thread, false); 8.18 8.19 // Unpack oop result 8.20 if (ret_type == T_OBJECT || ret_type == T_ARRAY) { 8.21 @@ -2951,7 +2951,7 @@ 8.22 __ pop(rcx); 8.23 8.24 __ get_thread(rcx); 8.25 - __ reset_last_Java_frame(rcx, false, false); 8.26 + __ reset_last_Java_frame(rcx, false); 8.27 8.28 // Load UnrollBlock into EDI 8.29 __ mov(rdi, rax); 8.30 @@ -3117,7 +3117,7 @@ 8.31 __ push(rax); 8.32 8.33 __ get_thread(rcx); 8.34 - __ reset_last_Java_frame(rcx, false, false); 8.35 + __ reset_last_Java_frame(rcx, false); 8.36 8.37 // Collect return values 8.38 __ movptr(rax,Address(rsp, (RegisterSaver::raxOffset() + additional_words + 1)*wordSize)); 8.39 @@ -3219,7 +3219,7 @@ 8.40 8.41 __ get_thread(rcx); 8.42 8.43 - __ reset_last_Java_frame(rcx, false, false); 8.44 + __ reset_last_Java_frame(rcx, false); 8.45 8.46 // Load UnrollBlock into EDI 8.47 __ movptr(rdi, rax); 8.48 @@ -3331,7 +3331,7 @@ 8.49 oop_maps->add_gc_map( __ pc()-start, new OopMap( framesize, 0 ) ); 8.50 8.51 __ get_thread(rdi); 8.52 - __ reset_last_Java_frame(rdi, true, false); 8.53 + __ reset_last_Java_frame(rdi, true); 8.54 8.55 // Pop self-frame. 8.56 __ leave(); // Epilog! 8.57 @@ -3426,7 +3426,7 @@ 8.58 8.59 // Clear last_Java_sp again 8.60 __ get_thread(java_thread); 8.61 - __ reset_last_Java_frame(java_thread, false, false); 8.62 + __ reset_last_Java_frame(java_thread, false); 8.63 8.64 __ cmpptr(Address(java_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); 8.65 __ jcc(Assembler::equal, noException); 8.66 @@ -3501,7 +3501,7 @@ 8.67 __ addptr(rsp, wordSize); 8.68 8.69 // clear last_Java_sp 8.70 - __ reset_last_Java_frame(thread, true, false); 8.71 + __ reset_last_Java_frame(thread, true); 8.72 // check for pending exceptions 8.73 Label pending; 8.74 __ cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD);
9.1 --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Mon Jun 19 22:49:52 2017 +0000 9.2 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Mon Jun 26 02:04:40 2017 -0700 9.3 @@ -1388,7 +1388,7 @@ 9.4 __ mov(rsp, r12); // restore sp 9.5 __ reinit_heapbase(); 9.6 9.7 - __ reset_last_Java_frame(false, true); 9.8 + __ reset_last_Java_frame(false); 9.9 9.10 save_or_restore_arguments(masm, stack_slots, total_in_args, 9.11 arg_save_area, NULL, in_regs, in_sig_bt); 9.12 @@ -2497,7 +2497,7 @@ 9.13 restore_native_result(masm, ret_type, stack_slots); 9.14 } 9.15 9.16 - __ reset_last_Java_frame(false, true); 9.17 + __ reset_last_Java_frame(false); 9.18 9.19 // Unpack oop result 9.20 if (ret_type == T_OBJECT || ret_type == T_ARRAY) { 9.21 @@ -3435,7 +3435,7 @@ 9.22 // find any register it might need. 9.23 oop_maps->add_gc_map(__ pc() - start, map); 9.24 9.25 - __ reset_last_Java_frame(false, false); 9.26 + __ reset_last_Java_frame(false); 9.27 9.28 // Load UnrollBlock* into rdi 9.29 __ mov(rdi, rax); 9.30 @@ -3592,7 +3592,7 @@ 9.31 new OopMap( frame_size_in_words, 0 )); 9.32 9.33 // Clear fp AND pc 9.34 - __ reset_last_Java_frame(true, true); 9.35 + __ reset_last_Java_frame(true); 9.36 9.37 // Collect return values 9.38 __ movdbl(xmm0, Address(rsp, RegisterSaver::xmm0_offset_in_bytes())); 9.39 @@ -3662,7 +3662,7 @@ 9.40 9.41 oop_maps->add_gc_map(__ pc() - start, map); 9.42 9.43 - __ reset_last_Java_frame(false, false); 9.44 + __ reset_last_Java_frame(false); 9.45 9.46 // Load UnrollBlock* into rdi 9.47 __ mov(rdi, rax); 9.48 @@ -3775,7 +3775,7 @@ 9.49 oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0)); 9.50 9.51 // Clear fp AND pc 9.52 - __ reset_last_Java_frame(true, true); 9.53 + __ reset_last_Java_frame(true); 9.54 9.55 // Pop self-frame. 9.56 __ leave(); // Epilog 9.57 @@ -3858,7 +3858,7 @@ 9.58 9.59 Label noException; 9.60 9.61 - __ reset_last_Java_frame(false, false); 9.62 + __ reset_last_Java_frame(false); 9.63 9.64 __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); 9.65 __ jcc(Assembler::equal, noException); 9.66 @@ -3928,7 +3928,7 @@ 9.67 // rax contains the address we are going to jump to assuming no exception got installed 9.68 9.69 // clear last_Java_sp 9.70 - __ reset_last_Java_frame(false, false); 9.71 + __ reset_last_Java_frame(false); 9.72 // check for pending exceptions 9.73 Label pending; 9.74 __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); 9.75 @@ -4309,7 +4309,7 @@ 9.76 9.77 oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0)); 9.78 9.79 - __ reset_last_Java_frame(false, true); 9.80 + __ reset_last_Java_frame(false); 9.81 9.82 // Restore callee-saved registers 9.83
10.1 --- a/src/cpu/x86/vm/stubGenerator_x86_32.cpp Mon Jun 19 22:49:52 2017 +0000 10.2 +++ b/src/cpu/x86/vm/stubGenerator_x86_32.cpp Mon Jun 26 02:04:40 2017 -0700 10.3 @@ -2901,7 +2901,7 @@ 10.4 // however can use the register value directly if it is callee saved. 10.5 __ get_thread(java_thread); 10.6 10.7 - __ reset_last_Java_frame(java_thread, true, false); 10.8 + __ reset_last_Java_frame(java_thread, true); 10.9 10.10 __ leave(); // required for proper stackwalking of RuntimeStub frame 10.11
11.1 --- a/src/cpu/x86/vm/stubGenerator_x86_64.cpp Mon Jun 19 22:49:52 2017 +0000 11.2 +++ b/src/cpu/x86/vm/stubGenerator_x86_64.cpp Mon Jun 26 02:04:40 2017 -0700 11.3 @@ -3923,7 +3923,7 @@ 11.4 11.5 oop_maps->add_gc_map(the_pc - start, map); 11.6 11.7 - __ reset_last_Java_frame(true, true); 11.8 + __ reset_last_Java_frame(true); 11.9 11.10 __ leave(); // required for proper stackwalking of RuntimeStub frame 11.11
12.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Mon Jun 19 22:49:52 2017 +0000 12.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Mon Jun 26 02:04:40 2017 -0700 12.3 @@ -1289,7 +1289,7 @@ 12.4 // change thread state 12.5 __ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_Java); 12.6 12.7 - __ reset_last_Java_frame(thread, true, true); 12.8 + __ reset_last_Java_frame(thread, true); 12.9 12.10 // reset handle block 12.11 __ movptr(t, Address(thread, JavaThread::active_handles_offset())); 12.12 @@ -1819,7 +1819,7 @@ 12.13 __ set_last_Java_frame(thread, noreg, rbp, __ pc()); 12.14 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::popframe_move_outgoing_args), thread, rax, rbx); 12.15 __ get_thread(thread); 12.16 - __ reset_last_Java_frame(thread, true, true); 12.17 + __ reset_last_Java_frame(thread, true); 12.18 // Restore the last_sp and null it out 12.19 __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); 12.20 __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD);
13.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Mon Jun 19 22:49:52 2017 +0000 13.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Mon Jun 26 02:04:40 2017 -0700 13.3 @@ -1262,7 +1262,7 @@ 13.4 __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_Java); 13.5 13.6 // reset_last_Java_frame 13.7 - __ reset_last_Java_frame(true, true); 13.8 + __ reset_last_Java_frame(r15_thread, true); 13.9 13.10 // reset handle block 13.11 __ movptr(t, Address(r15_thread, JavaThread::active_handles_offset())); 13.12 @@ -1837,7 +1837,7 @@ 13.13 // PC must point into interpreter here 13.14 __ set_last_Java_frame(noreg, rbp, __ pc()); 13.15 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::popframe_move_outgoing_args), r15_thread, c_rarg1, c_rarg2); 13.16 - __ reset_last_Java_frame(true, true); 13.17 + __ reset_last_Java_frame(r15_thread, true); 13.18 // Restore the last_sp and null it out 13.19 __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); 13.20 __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
14.1 --- a/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp Mon Jun 19 22:49:52 2017 +0000 14.2 +++ b/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp Mon Jun 26 02:04:40 2017 -0700 14.3 @@ -44,7 +44,7 @@ 14.4 14.5 // If we have a last_Java_frame, then we should use it even if 14.6 // isInJava == true. It should be more reliable than ucontext info. 14.7 - if (jt->has_last_Java_frame()) { 14.8 + if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { 14.9 *fr_addr = jt->pd_last_frame(); 14.10 return true; 14.11 }
15.1 --- a/src/os_cpu/bsd_x86/vm/thread_bsd_x86.hpp Mon Jun 19 22:49:52 2017 +0000 15.2 +++ b/src/os_cpu/bsd_x86/vm/thread_bsd_x86.hpp Mon Jun 26 02:04:40 2017 -0700 15.3 @@ -32,12 +32,8 @@ 15.4 15.5 frame pd_last_frame() { 15.6 assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); 15.7 - if (_anchor.last_Java_pc() != NULL) { 15.8 - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); 15.9 - } else { 15.10 - // This will pick up pc from sp 15.11 - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp()); 15.12 - } 15.13 + assert(_anchor.last_Java_pc() != NULL, "not walkable"); 15.14 + return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); 15.15 } 15.16 15.17 public:
16.1 --- a/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp Mon Jun 19 22:49:52 2017 +0000 16.2 +++ b/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp Mon Jun 26 02:04:40 2017 -0700 16.3 @@ -45,7 +45,7 @@ 16.4 16.5 // If we have a last_Java_frame, then we should use it even if 16.6 // isInJava == true. It should be more reliable than ucontext info. 16.7 - if (jt->has_last_Java_frame()) { 16.8 + if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { 16.9 *fr_addr = jt->pd_last_frame(); 16.10 return true; 16.11 }
17.1 --- a/src/os_cpu/linux_x86/vm/thread_linux_x86.hpp Mon Jun 19 22:49:52 2017 +0000 17.2 +++ b/src/os_cpu/linux_x86/vm/thread_linux_x86.hpp Mon Jun 26 02:04:40 2017 -0700 17.3 @@ -32,12 +32,8 @@ 17.4 17.5 frame pd_last_frame() { 17.6 assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); 17.7 - if (_anchor.last_Java_pc() != NULL) { 17.8 - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); 17.9 - } else { 17.10 - // This will pick up pc from sp 17.11 - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp()); 17.12 - } 17.13 + assert(_anchor.last_Java_pc() != NULL, "not walkable"); 17.14 + return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); 17.15 } 17.16 17.17 public:
18.1 --- a/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp Mon Jun 19 22:49:52 2017 +0000 18.2 +++ b/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp Mon Jun 26 02:04:40 2017 -0700 18.3 @@ -44,9 +44,8 @@ 18.4 assert(this->is_Java_thread(), "must be JavaThread"); 18.5 JavaThread* jt = (JavaThread *)this; 18.6 18.7 - // last_Java_frame is always walkable and safe use it if we have it 18.8 - 18.9 - if (jt->has_last_Java_frame()) { 18.10 + // There is small window where last_Java_frame is not walkable or safe 18.11 + if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { 18.12 *fr_addr = jt->pd_last_frame(); 18.13 return true; 18.14 }
19.1 --- a/src/os_cpu/solaris_x86/vm/thread_solaris_x86.hpp Mon Jun 19 22:49:52 2017 +0000 19.2 +++ b/src/os_cpu/solaris_x86/vm/thread_solaris_x86.hpp Mon Jun 26 02:04:40 2017 -0700 19.3 @@ -30,12 +30,8 @@ 19.4 19.5 frame pd_last_frame() { 19.6 assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); 19.7 - if (_anchor.last_Java_pc() != NULL) { 19.8 - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); 19.9 - } else { 19.10 - // This will pick up pc from sp 19.11 - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp()); 19.12 - } 19.13 + assert(_anchor.last_Java_pc() != NULL, "not walkable"); 19.14 + return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); 19.15 } 19.16 19.17 public:
20.1 --- a/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp Mon Jun 19 22:49:52 2017 +0000 20.2 +++ b/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp Mon Jun 26 02:04:40 2017 -0700 20.3 @@ -47,7 +47,7 @@ 20.4 20.5 // If we have a last_Java_frame, then we should use it even if 20.6 // isInJava == true. It should be more reliable than CONTEXT info. 20.7 - if (jt->has_last_Java_frame()) { 20.8 + if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { 20.9 *fr_addr = jt->pd_last_frame(); 20.10 return true; 20.11 }
21.1 --- a/src/os_cpu/windows_x86/vm/thread_windows_x86.hpp Mon Jun 19 22:49:52 2017 +0000 21.2 +++ b/src/os_cpu/windows_x86/vm/thread_windows_x86.hpp Mon Jun 26 02:04:40 2017 -0700 21.3 @@ -32,12 +32,8 @@ 21.4 21.5 frame pd_last_frame() { 21.6 assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); 21.7 - if (_anchor.last_Java_pc() != NULL) { 21.8 - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); 21.9 - } else { 21.10 - // This will pick up pc from sp 21.11 - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp()); 21.12 - } 21.13 + assert(_anchor.last_Java_pc() != NULL, "not walkable"); 21.14 + return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); 21.15 } 21.16 21.17 public: