Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.
Permalink
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
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
@@ -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
//
private:
@@ -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();

0 comments on commit e29ee5b

Please sign in to comment.