1.1 --- a/src/cpu/x86/vm/frame_x86.cpp Mon Jun 19 22:49:52 2017 +0000 1.2 +++ b/src/cpu/x86/vm/frame_x86.cpp Mon Jun 26 02:04:40 2017 -0700 1.3 @@ -370,13 +370,16 @@ 1.4 JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor(); 1.5 assert(!entry_frame_is_first(), "next Java fp must be non zero"); 1.6 assert(jfa->last_Java_sp() > sp(), "must be above this frame on stack"); 1.7 + // Since we are walking the stack now this nested anchor is obviously walkable 1.8 + // even if it wasn't when it was stacked. 1.9 + if (!jfa->walkable()) { 1.10 + // Capture _last_Java_pc (if needed) and mark anchor walkable. 1.11 + jfa->capture_last_Java_pc(); 1.12 + } 1.13 map->clear(); 1.14 assert(map->include_argument_oops(), "should be set by clear"); 1.15 - if (jfa->last_Java_pc() != NULL ) { 1.16 - frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc()); 1.17 - return fr; 1.18 - } 1.19 - frame fr(jfa->last_Java_sp(), jfa->last_Java_fp()); 1.20 + assert(jfa->last_Java_pc() != NULL, "not walkable"); 1.21 + frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc()); 1.22 return fr; 1.23 } 1.24 1.25 @@ -714,3 +717,21 @@ 1.26 init((intptr_t*)sp, (intptr_t*)fp, (address)pc); 1.27 } 1.28 #endif 1.29 + 1.30 +void JavaFrameAnchor::make_walkable(JavaThread* thread) { 1.31 + // last frame set? 1.32 + if (last_Java_sp() == NULL) return; 1.33 + // already walkable? 1.34 + if (walkable()) return; 1.35 + assert(Thread::current() == (Thread*)thread, "not current thread"); 1.36 + assert(last_Java_sp() != NULL, "not called from Java code?"); 1.37 + assert(last_Java_pc() == NULL, "already walkable"); 1.38 + capture_last_Java_pc(); 1.39 + assert(walkable(), "something went wrong"); 1.40 +} 1.41 + 1.42 +void JavaFrameAnchor::capture_last_Java_pc() { 1.43 + assert(_last_Java_sp != NULL, "no last frame set"); 1.44 + assert(_last_Java_pc == NULL, "already walkable"); 1.45 + _last_Java_pc = (address)_last_Java_sp[-1]; 1.46 +}