8383879: assert(_cur_stack_depth == num_frames) failed: cur_stack_depth out of sync _cur_stack_depth: 9 num_frames: 10

Reviewed-by: cjplummer, dcubed, sspitsyn, dholmes
This commit is contained in:
Leonid Mesnik 2026-06-17 00:33:27 +00:00
parent 10cd1c2c3f
commit 2d65ea61d9
2 changed files with 4 additions and 2 deletions

View File

@ -2312,6 +2312,7 @@ SetForceEarlyReturn::doit(Thread *target) {
// Set pending step flag for this early return.
// It is cleared when next step event is posted.
_state->set_pending_step_for_earlyret();
_state->invalidate_cur_stack_depth();
}
void

View File

@ -409,7 +409,8 @@ int JvmtiThreadState::cur_stack_depth() {
guarantee(get_thread()->is_handshake_safe_for(current),
"must be current thread or direct handshake");
if (!is_interp_only_mode() || _cur_stack_depth == UNKNOWN_STACK_DEPTH) {
if (!is_interp_only_mode() || _cur_stack_depth == UNKNOWN_STACK_DEPTH
|| is_pending_step_for_earlyret() || is_pending_step_for_popframe()) {
_cur_stack_depth = count_frames();
} else {
#ifdef ASSERT
@ -474,7 +475,7 @@ void JvmtiThreadState::process_pending_step_for_popframe() {
void JvmtiThreadState::update_for_pop_top_frame() {
// remove any frame pop notification request for the top frame
// in any environment
int popframe_number = cur_stack_depth();
int popframe_number = count_frames();
{
JvmtiEnvThreadStateIterator it(this);
for (JvmtiEnvThreadState* ets = it.first(); ets != nullptr; ets = it.next(ets)) {