Skip to content


Browse files Browse the repository at this point in the history
8261448: Preserve GC stack watermark across safepoints in StackWalk
Reviewed-by: eosterlund, stefank
  • Loading branch information
rkennke committed Feb 22, 2021
1 parent 26c1db9 commit c20fb5d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hotspot/share/prims/stackwalk.cpp
Expand Up @@ -38,6 +38,7 @@
#include "runtime/globals.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/keepStackGCProcessed.hpp"
#include "runtime/stackWatermarkSet.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/vframe.inline.hpp"
Expand Down Expand Up @@ -406,6 +407,7 @@ oop StackWalk::fetchFirstBatch(BaseFrameStream& stream, Handle stackStream,
int end_index = start_index;
int numFrames = 0;
if (!stream.at_end()) {
KeepStackGCProcessedMark keep_stack(THREAD->as_Java_thread());
numFrames = fill_in_frames(mode, stream, frame_count, start_index,
frames_array, end_index, CHECK_NULL);
if (numFrames < 1) {
Expand Down Expand Up @@ -488,7 +490,7 @@ jint StackWalk::fetchNextBatch(Handle stackStream, jlong mode, jlong magic,
// an accurate hint suggesting the depth of the stack walk, and 2) we are not just
// peeking at a few frames. Take the cost of flushing out any pending deferred GC
// processing of the stack.
StackWatermarkSet::finish_processing(jt, NULL /* context */, StackWatermarkKind::gc);
KeepStackGCProcessedMark keep_stack(jt);; // advance past the last frame decoded in previous batch
if (!stream.at_end()) {
int n = fill_in_frames(mode, stream, frame_count, start_index,
Expand Down

1 comment on commit c20fb5d

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.