Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8258652: Assert in JvmtiThreadState::cur_stack_depth() can noticeably…
… slow down debugging single stepping

Reviewed-by: sspitsyn, dholmes, amenkov
  • Loading branch information
plummercj committed Jan 14, 2021
1 parent d18d26e commit 4f881ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/hotspot/share/prims/jvmtiThreadState.cpp
@@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/runtime/globals.hpp
Expand Up @@ -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, \
Expand Down

1 comment on commit 4f881ba

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.