Skip to content

Commit c20fb5d

Browse files
committed
8261448: Preserve GC stack watermark across safepoints in StackWalk
Reviewed-by: eosterlund, stefank
1 parent 26c1db9 commit c20fb5d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/hotspot/share/prims/stackwalk.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "runtime/globals.hpp"
3939
#include "runtime/handles.inline.hpp"
4040
#include "runtime/javaCalls.hpp"
41+
#include "runtime/keepStackGCProcessed.hpp"
4142
#include "runtime/stackWatermarkSet.hpp"
4243
#include "runtime/thread.inline.hpp"
4344
#include "runtime/vframe.inline.hpp"
@@ -406,6 +407,7 @@ oop StackWalk::fetchFirstBatch(BaseFrameStream& stream, Handle stackStream,
406407
int end_index = start_index;
407408
int numFrames = 0;
408409
if (!stream.at_end()) {
410+
KeepStackGCProcessedMark keep_stack(THREAD->as_Java_thread());
409411
numFrames = fill_in_frames(mode, stream, frame_count, start_index,
410412
frames_array, end_index, CHECK_NULL);
411413
if (numFrames < 1) {
@@ -488,7 +490,7 @@ jint StackWalk::fetchNextBatch(Handle stackStream, jlong mode, jlong magic,
488490
// an accurate hint suggesting the depth of the stack walk, and 2) we are not just
489491
// peeking at a few frames. Take the cost of flushing out any pending deferred GC
490492
// processing of the stack.
491-
StackWatermarkSet::finish_processing(jt, NULL /* context */, StackWatermarkKind::gc);
493+
KeepStackGCProcessedMark keep_stack(jt);
492494
stream.next(); // advance past the last frame decoded in previous batch
493495
if (!stream.at_end()) {
494496
int n = fill_in_frames(mode, stream, frame_count, start_index,

0 commit comments

Comments
 (0)