Skip to content

Commit

Permalink
8275730: Relax memory constraint on MultiThreadedRefCounter
Browse files Browse the repository at this point in the history
Reviewed-by: mgronlun, minqi
  • Loading branch information
zhengyu123 committed Nov 3, 2021
1 parent 6150633 commit a316c06
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hotspot/share/jfr/utilities/jfrRefCountPointer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ class MultiThreadedRefCounter {
MultiThreadedRefCounter() : _refs(0) {}

void inc() const {
Atomic::add(&_refs, 1);
Atomic::inc(&_refs, memory_order_relaxed);
}

bool dec() const {
return 0 == Atomic::add(&_refs, (-1));
return 0 == Atomic::sub(&_refs, 1, memory_order_relaxed);
}

intptr_t current() const {
return _refs;
return Atomic::load(&_refs);
}
};

Expand Down

1 comment on commit a316c06

@openjdk-notifier
Copy link

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.