Skip to content


Browse files Browse the repository at this point in the history
8253778: ShenandoahSafepoint::is_at_shenandoah_safepoint should not a…
…ccess VMThread state from other threads

Reviewed-by: jiefu, rehn, rkennke
  • Loading branch information
shipilev committed Sep 30, 2020
1 parent 4c65365 commit 8331e63
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp
Expand Up @@ -141,10 +141,17 @@ class ShenandoahGCPauseMark : public StackObj {

class ShenandoahSafepoint : public AllStatic {
// check if Shenandoah GC safepoint is in progress
// Check if Shenandoah GC safepoint is in progress. This is nominally
// equivalent to calling SafepointSynchronize::is_at_safepoint(), but
// it also checks the Shenandoah specifics, when it can.
static inline bool is_at_shenandoah_safepoint() {
if (!SafepointSynchronize::is_at_safepoint()) 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;

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

Expand Down

1 comment on commit 8331e63

Copy link

@bridgekeeper bridgekeeper bot commented on 8331e63 Sep 30, 2020

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.