255 _cur_stack_depth = UNKNOWN_STACK_DEPTH; 256 } 257 if (_cur_stack_depth != UNKNOWN_STACK_DEPTH) { 258 ++_cur_stack_depth; 259 } 260 } 261 262 void JvmtiThreadState::decr_cur_stack_depth() { 263 guarantee(JavaThread::current() == get_thread(), "must be current thread"); 264 265 if (!is_interp_only_mode()) { 266 _cur_stack_depth = UNKNOWN_STACK_DEPTH; 267 } 268 if (_cur_stack_depth != UNKNOWN_STACK_DEPTH) { 269 --_cur_stack_depth; 270 assert(_cur_stack_depth >= 0, "incr/decr_cur_stack_depth mismatch"); 271 } 272 } 273 274 int JvmtiThreadState::cur_stack_depth() { 275 guarantee(SafepointSynchronize::is_at_safepoint() || 276 (JavaThread *)Thread::current() == get_thread(), 277 "must be current thread or at safepoint"); 278 279 if (!is_interp_only_mode() || _cur_stack_depth == UNKNOWN_STACK_DEPTH) { 280 _cur_stack_depth = count_frames(); 281 } else { 282 // heavy weight assert 283 assert(_cur_stack_depth == count_frames(), 284 "cur_stack_depth out of sync"); 285 } 286 return _cur_stack_depth; 287 } 288 289 bool JvmtiThreadState::may_be_walked() { 290 return (get_thread()->is_being_ext_suspended() || (JavaThread::current() == get_thread())); 291 } 292 293 294 void JvmtiThreadState::process_pending_step_for_popframe() { 295 // We are single stepping as the last part of the PopFrame() dance 296 // so we have some house keeping to do. 297 | 255 _cur_stack_depth = UNKNOWN_STACK_DEPTH; 256 } 257 if (_cur_stack_depth != UNKNOWN_STACK_DEPTH) { 258 ++_cur_stack_depth; 259 } 260 } 261 262 void JvmtiThreadState::decr_cur_stack_depth() { 263 guarantee(JavaThread::current() == get_thread(), "must be current thread"); 264 265 if (!is_interp_only_mode()) { 266 _cur_stack_depth = UNKNOWN_STACK_DEPTH; 267 } 268 if (_cur_stack_depth != UNKNOWN_STACK_DEPTH) { 269 --_cur_stack_depth; 270 assert(_cur_stack_depth >= 0, "incr/decr_cur_stack_depth mismatch"); 271 } 272 } 273 274 int JvmtiThreadState::cur_stack_depth() { 275 Thread *current = Thread::current(); 276 guarantee(current == get_thread() || current == get_thread()->active_handshaker(), 277 "must be current thread or direct handshake"); 278 279 if (!is_interp_only_mode() || _cur_stack_depth == UNKNOWN_STACK_DEPTH) { 280 _cur_stack_depth = count_frames(); 281 } else { 282 // heavy weight assert 283 assert(_cur_stack_depth == count_frames(), 284 "cur_stack_depth out of sync"); 285 } 286 return _cur_stack_depth; 287 } 288 289 bool JvmtiThreadState::may_be_walked() { 290 return (get_thread()->is_being_ext_suspended() || (JavaThread::current() == get_thread())); 291 } 292 293 294 void JvmtiThreadState::process_pending_step_for_popframe() { 295 // We are single stepping as the last part of the PopFrame() dance 296 // so we have some house keeping to do. 297 |