Refactor CasField32
Remove excessive copy paste and add arguments to cover different
types of CAS operations.
Test: test-art-host
Change-Id: I3f58a5f84156aa0491b9e5145f3891f16217e05c
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index c4d2fdd..10fa8c5 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -1551,7 +1551,7 @@
// above IsInToSpace() evaluates to true and we change the color from gray to white here in this
// else block.
if (kUseBakerReadBarrier) {
- bool success = to_ref->AtomicSetReadBarrierState</*kCasRelease*/true>(
+ bool success = to_ref->AtomicSetReadBarrierState<std::memory_order_release>(
ReadBarrier::GrayState(),
ReadBarrier::WhiteState());
DCHECK(success) << "Must succeed as we won the race.";
@@ -2490,7 +2490,10 @@
LockWord new_lock_word = LockWord::FromForwardingAddress(reinterpret_cast<size_t>(to_ref));
// Try to atomically write the fwd ptr.
- bool success = from_ref->CasLockWordWeakRelaxed(old_lock_word, new_lock_word);
+ bool success = from_ref->CasLockWord(old_lock_word,
+ new_lock_word,
+ CASMode::kWeak,
+ std::memory_order_relaxed);
if (LIKELY(success)) {
// The CAS succeeded.
DCHECK(thread_running_gc_ != nullptr);