Skip to content

Commit 3f8819c

Browse files
committed
8261501: Shenandoah: reconsider heap statistics memory ordering
Reviewed-by: rkennke
1 parent 3cbd16d commit 3f8819c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp

+8-9
Original file line numberDiff line numberDiff line change
@@ -620,12 +620,11 @@ void ShenandoahHeap::post_initialize() {
620620
}
621621

622622
size_t ShenandoahHeap::used() const {
623-
return Atomic::load_acquire(&_used);
623+
return Atomic::load(&_used);
624624
}
625625

626626
size_t ShenandoahHeap::committed() const {
627-
OrderAccess::acquire();
628-
return _committed;
627+
return Atomic::load(&_committed);
629628
}
630629

631630
void ShenandoahHeap::increase_committed(size_t bytes) {
@@ -639,20 +638,20 @@ void ShenandoahHeap::decrease_committed(size_t bytes) {
639638
}
640639

641640
void ShenandoahHeap::increase_used(size_t bytes) {
642-
Atomic::add(&_used, bytes);
641+
Atomic::add(&_used, bytes, memory_order_relaxed);
643642
}
644643

645644
void ShenandoahHeap::set_used(size_t bytes) {
646-
Atomic::release_store_fence(&_used, bytes);
645+
Atomic::store(&_used, bytes);
647646
}
648647

649648
void ShenandoahHeap::decrease_used(size_t bytes) {
650649
assert(used() >= bytes, "never decrease heap size by more than we've left");
651-
Atomic::sub(&_used, bytes);
650+
Atomic::sub(&_used, bytes, memory_order_relaxed);
652651
}
653652

654653
void ShenandoahHeap::increase_allocated(size_t bytes) {
655-
Atomic::add(&_bytes_allocated_since_gc_start, bytes);
654+
Atomic::add(&_bytes_allocated_since_gc_start, bytes, memory_order_relaxed);
656655
}
657656

658657
void ShenandoahHeap::notify_mutator_alloc_words(size_t words, bool waste) {
@@ -1883,11 +1882,11 @@ address ShenandoahHeap::gc_state_addr() {
18831882
}
18841883

18851884
size_t ShenandoahHeap::bytes_allocated_since_gc_start() {
1886-
return Atomic::load_acquire(&_bytes_allocated_since_gc_start);
1885+
return Atomic::load(&_bytes_allocated_since_gc_start);
18871886
}
18881887

18891888
void ShenandoahHeap::reset_bytes_allocated_since_gc_start() {
1890-
Atomic::release_store_fence(&_bytes_allocated_since_gc_start, (size_t)0);
1889+
Atomic::store(&_bytes_allocated_since_gc_start, (size_t)0);
18911890
}
18921891

18931892
void ShenandoahHeap::set_degenerated_gc_in_progress(bool in_progress) {

0 commit comments

Comments
 (0)