8258652: Assert in JvmtiThreadState::cur_stack_depth() can noticeably slow down debugging single stepping

Reviewed-by: sspitsyn, dholmes, amenkov
This commit is contained in:
Chris Plummer 2021-01-14 23:04:07 +00:00
parent d18d26e89d
commit 4f881ba54a
2 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -282,9 +282,14 @@ int JvmtiThreadState::cur_stack_depth() {
if (!is_interp_only_mode() || _cur_stack_depth == UNKNOWN_STACK_DEPTH) {
_cur_stack_depth = count_frames();
} else {
// heavy weight assert
assert(_cur_stack_depth == count_frames(),
"cur_stack_depth out of sync");
#ifdef ASSERT
if (EnableJVMTIStackDepthAsserts) {
// heavy weight assert
jint num_frames = count_frames();
assert(_cur_stack_depth == num_frames, "cur_stack_depth out of sync _cur_stack_depth: %d num_frames: %d",
_cur_stack_depth, num_frames);
}
#endif
}
return _cur_stack_depth;
}

View File

@ -1805,6 +1805,9 @@ const intx ObjectAlignmentInBytes = 8;
notproduct(bool, UseDebuggerErgo2, false, \
"Debugging Only: Limit the number of spawned JVM threads") \
\
notproduct(bool, EnableJVMTIStackDepthAsserts, true, \
"Enable JVMTI asserts related to stack depth checks") \
\
/* flags for performance data collection */ \
\
product(bool, UsePerfData, true, \