8306687: Relax memory ordering constraints on metaspace atomic counters

Reviewed-by: shade, minqi
This commit is contained in:
Zhengyu Gu 2023-04-25 17:55:57 +00:00
parent 33d6614150
commit 5f4965d422

View File

@ -93,22 +93,22 @@ public:
AbstractAtomicCounter() : _c(0) {}
T get() const { return _c; }
T get() const { return Atomic::load(&_c); }
void increment() {
Atomic::inc(&_c);
Atomic::inc(&_c, memory_order_relaxed);
}
void decrement() {
Atomic::dec(&_c);
Atomic::dec(&_c, memory_order_relaxed);
}
void increment_by(T v) {
Atomic::add(&_c, v);
Atomic::add(&_c, v, memory_order_relaxed);
}
void decrement_by(T v) {
Atomic::sub(&_c, v);
Atomic::sub(&_c, v, memory_order_relaxed);
}
#ifdef ASSERT