8225441: Cleanup ShenandoahHeap::atomic_compare_exchange_oop
Reviewed-by: rkennke
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Fri Jun 07 11:47:53 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Fri Jun 07 11:48:01 2019 +0200
@@ -690,8 +690,8 @@
template <class T>
inline oop update_with_forwarded_not_null(T* p, oop obj);
- inline oop atomic_compare_exchange_oop(oop n, narrowOop* addr, oop c);
- inline oop atomic_compare_exchange_oop(oop n, oop* addr, oop c);
+ static inline oop cas_oop(oop n, narrowOop* addr, oop c);
+ static inline oop cas_oop(oop n, oop* addr, oop c);
void trash_humongous_region_at(ShenandoahHeapRegion *r);
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Fri Jun 07 11:47:53 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp Fri Jun 07 11:48:01 2019 +0200
@@ -116,7 +116,7 @@
if (oopDesc::equals_raw(forwarded_oop, heap_oop)) {
forwarded_oop = evacuate_object(heap_oop, Thread::current());
}
- oop prev = atomic_compare_exchange_oop(forwarded_oop, p, heap_oop);
+ oop prev = cas_oop(forwarded_oop, p, heap_oop);
if (oopDesc::equals_raw(prev, heap_oop)) {
return forwarded_oop;
} else {
@@ -129,11 +129,11 @@
}
}
-inline oop ShenandoahHeap::atomic_compare_exchange_oop(oop n, oop* addr, oop c) {
+inline oop ShenandoahHeap::cas_oop(oop n, oop* addr, oop c) {
return (oop) Atomic::cmpxchg(n, addr, c);
}
-inline oop ShenandoahHeap::atomic_compare_exchange_oop(oop n, narrowOop* addr, oop c) {
+inline oop ShenandoahHeap::cas_oop(oop n, narrowOop* addr, oop c) {
narrowOop cmp = CompressedOops::encode(c);
narrowOop val = CompressedOops::encode(n);
return CompressedOops::decode((narrowOop) Atomic::cmpxchg(val, addr, cmp));
@@ -157,7 +157,7 @@
// If this fails, another thread wrote to p before us, it will be logged in SATB and the
// reference be updated later.
- oop witness = atomic_compare_exchange_oop(forwarded_oop, p, heap_oop);
+ oop witness = cas_oop(forwarded_oop, p, heap_oop);
if (!oopDesc::equals_raw(witness, heap_oop)) {
// CAS failed, someone had beat us to it. Normally, we would return the failure witness,
--- a/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.inline.hpp Fri Jun 07 11:47:53 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.inline.hpp Fri Jun 07 11:48:01 2019 +0200
@@ -54,7 +54,7 @@
}
shenandoah_assert_forwarded_except(p, obj, _heap->cancelled_gc());
// Update reference.
- _heap->atomic_compare_exchange_oop(forw, p, obj);
+ ShenandoahHeap::cas_oop(forw, p, obj);
obj = forw;
}