Skip to content

Commit 8331e63

Browse files
committed
8253778: ShenandoahSafepoint::is_at_shenandoah_safepoint should not access VMThread state from other threads
Reviewed-by: jiefu, rehn, rkennke
1 parent 4c65365 commit 8331e63

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,17 @@ class ShenandoahGCPauseMark : public StackObj {
141141

142142
class ShenandoahSafepoint : public AllStatic {
143143
public:
144-
// check if Shenandoah GC safepoint is in progress
144+
// Check if Shenandoah GC safepoint is in progress. This is nominally
145+
// equivalent to calling SafepointSynchronize::is_at_safepoint(), but
146+
// it also checks the Shenandoah specifics, when it can.
145147
static inline bool is_at_shenandoah_safepoint() {
146148
if (!SafepointSynchronize::is_at_safepoint()) return false;
147149

150+
// This is not VM thread, cannot see what VM thread is doing,
151+
// so pretend this is a proper Shenandoah safepoint
152+
if (!Thread::current()->is_VM_thread()) return true;
153+
154+
// Otherwise check we are at proper operation type
148155
VM_Operation* vm_op = VMThread::vm_operation();
149156
if (vm_op == NULL) return false;
150157

0 commit comments

Comments
 (0)