Skip to content
Browse files
8257641: Shenandoah: Query is_at_shenandoah_safepoint() from control …
…thread should return false

Reviewed-by: shade
  • Loading branch information
zhengyu123 committed Dec 3, 2020
1 parent 55f5542 commit e29ee5b8a5a6c098871df885439412d872f669e8
Showing with 8 additions and 1 deletion.
  1. +1 −0 src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp
  2. +7 −1 src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp
@@ -122,6 +122,7 @@ class ShenandoahHeap : public CollectedHeap {
friend class ShenandoahGCSession;
friend class ShenandoahGCStateResetter;
friend class ShenandoahParallelObjectIterator;
friend class ShenandoahSafepoint;
// ---------- Locks that guard important data structures in Heap
@@ -147,9 +147,15 @@ class ShenandoahSafepoint : public AllStatic {
static inline bool is_at_shenandoah_safepoint() {
if (!SafepointSynchronize::is_at_safepoint()) return false;

Thread* const thr = Thread::current();
// Shenandoah GC specific safepoints are scheduled by control thread.
// So if we are enter here from control thread, then we are definitely not
// at Shenandoah safepoint, but at something else.
if (thr == ShenandoahHeap::heap()->control_thread()) return false;

// This is not VM thread, cannot see what VM thread is doing,
// so pretend this is a proper Shenandoah safepoint
if (!Thread::current()->is_VM_thread()) return true;
if (!thr->is_VM_thread()) return true;

// Otherwise check we are at proper operation type
VM_Operation* vm_op = VMThread::vm_operation();

1 comment on commit e29ee5b


This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on e29ee5b Dec 3, 2020

Please sign in to comment.