ART: Rename Atomic::CompareExchange methods
Renames Atomic::CompareExchange methods to Atomic::CompareAndSet
equivalents. These methods return a boolean and do not get the witness
value. This makes space for Atomic::CompareAndExchange methods in a
later commit that will return a boolean and get the witness value.
This is pre-work for VarHandle accessors which require both forms.
Bug: 65872996
Test: art/test.py --host -j32
Change-Id: I9c691250e5556cbfde7811381b06d2920247f1a1
diff --git a/runtime/atomic.h b/runtime/atomic.h
index ec3eb6d..2d0290f 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -243,44 +243,44 @@
// Atomically replace the value with desired value if it matches the expected value.
// Participates in total ordering of atomic operations.
- bool CompareExchangeStrongSequentiallyConsistent(T expected_value, T desired_value) {
+ bool CompareAndSetStrongSequentiallyConsistent(T expected_value, T desired_value) {
return this->compare_exchange_strong(expected_value, desired_value, std::memory_order_seq_cst);
}
// The same, except it may fail spuriously.
- bool CompareExchangeWeakSequentiallyConsistent(T expected_value, T desired_value) {
+ bool CompareAndSetWeakSequentiallyConsistent(T expected_value, T desired_value) {
return this->compare_exchange_weak(expected_value, desired_value, std::memory_order_seq_cst);
}
// Atomically replace the value with desired value if it matches the expected value. Doesn't
// imply ordering or synchronization constraints.
- bool CompareExchangeStrongRelaxed(T expected_value, T desired_value) {
+ bool CompareAndSetStrongRelaxed(T expected_value, T desired_value) {
return this->compare_exchange_strong(expected_value, desired_value, std::memory_order_relaxed);
}
// Atomically replace the value with desired value if it matches the expected value. Prior writes
// to other memory locations become visible to the threads that do a consume or an acquire on the
// same location.
- bool CompareExchangeStrongRelease(T expected_value, T desired_value) {
+ bool CompareAndSetStrongRelease(T expected_value, T desired_value) {
return this->compare_exchange_strong(expected_value, desired_value, std::memory_order_release);
}
// The same, except it may fail spuriously.
- bool CompareExchangeWeakRelaxed(T expected_value, T desired_value) {
+ bool CompareAndSetWeakRelaxed(T expected_value, T desired_value) {
return this->compare_exchange_weak(expected_value, desired_value, std::memory_order_relaxed);
}
// Atomically replace the value with desired value if it matches the expected value. Prior writes
// made to other memory locations by the thread that did the release become visible in this
// thread.
- bool CompareExchangeWeakAcquire(T expected_value, T desired_value) {
+ bool CompareAndSetWeakAcquire(T expected_value, T desired_value) {
return this->compare_exchange_weak(expected_value, desired_value, std::memory_order_acquire);
}
// Atomically replace the value with desired value if it matches the expected value. prior writes
// to other memory locations become visible to the threads that do a consume or an acquire on the
// same location.
- bool CompareExchangeWeakRelease(T expected_value, T desired_value) {
+ bool CompareAndSetWeakRelease(T expected_value, T desired_value) {
return this->compare_exchange_weak(expected_value, desired_value, std::memory_order_release);
}