Skip to content

Commit 6c933a4

Browse files
rmacnak-googlecommit-bot@chromium.org
authored andcommitted
[vm] Fix some TSAN failures. Migrate remaining uses of AtomicOperations to std::atomic.
Change-Id: I195232311a146248c601ef84640758db59083d12 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121200 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
1 parent c26d596 commit 6c933a4

28 files changed

+199
-697
lines changed

runtime/platform/atomic.h

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -63,67 +63,6 @@ class RelaxedAtomic {
6363
std::atomic<T> value_;
6464
};
6565

66-
class AtomicOperations : public AllStatic {
67-
public:
68-
// Atomically fetch the value at p and increment the value at p.
69-
// Returns the original value at p.
70-
static uintptr_t FetchAndIncrement(uintptr_t* p);
71-
static intptr_t FetchAndIncrement(intptr_t* p);
72-
73-
// Atomically increment the value at p by 'value'.
74-
static void IncrementBy(intptr_t* p, intptr_t value);
75-
static void IncrementInt64By(int64_t* p, int64_t value);
76-
77-
// Atomically fetch the value at p and decrement the value at p.
78-
// Returns the original value at p.
79-
static uintptr_t FetchAndDecrement(uintptr_t* p);
80-
static intptr_t FetchAndDecrement(intptr_t* p);
81-
82-
// Atomically decrement the value at p by 'value'.
83-
static void DecrementBy(intptr_t* p, intptr_t value);
84-
85-
// Atomically compare *ptr to old_value, and if equal, store new_value.
86-
// Returns the original value at ptr.
87-
static uword CompareAndSwapWord(uword* ptr, uword old_value, uword new_value);
88-
static uint32_t CompareAndSwapUint32(uint32_t* ptr,
89-
uint32_t old_value,
90-
uint32_t new_value);
91-
92-
// Performs a load of a word from 'ptr', but without any guarantees about
93-
// memory order (i.e., no load barriers/fences).
94-
template <typename T>
95-
static T LoadRelaxed(T* ptr) {
96-
return *static_cast<volatile T*>(ptr);
97-
}
98-
99-
template <typename T>
100-
static T LoadAcquire(T* ptr);
101-
102-
template <typename T>
103-
static void StoreRelease(T* ptr, T value);
104-
105-
template <typename T>
106-
static T* CompareAndSwapPointer(T** slot, T* old_value, T* new_value) {
107-
return reinterpret_cast<T*>(AtomicOperations::CompareAndSwapWord(
108-
reinterpret_cast<uword*>(slot), reinterpret_cast<uword>(old_value),
109-
reinterpret_cast<uword>(new_value)));
110-
}
111-
};
112-
11366
} // namespace dart
11467

115-
#if defined(HOST_OS_ANDROID)
116-
#include "platform/atomic_android.h"
117-
#elif defined(HOST_OS_FUCHSIA)
118-
#include "platform/atomic_fuchsia.h"
119-
#elif defined(HOST_OS_LINUX)
120-
#include "platform/atomic_linux.h"
121-
#elif defined(HOST_OS_MACOS)
122-
#include "platform/atomic_macos.h"
123-
#elif defined(HOST_OS_WINDOWS)
124-
#include "platform/atomic_win.h"
125-
#else
126-
#error Unknown target os.
127-
#endif
128-
12968
#endif // RUNTIME_PLATFORM_ATOMIC_H_

runtime/platform/atomic_android.h

Lines changed: 0 additions & 73 deletions
This file was deleted.

runtime/platform/atomic_fuchsia.h

Lines changed: 0 additions & 70 deletions
This file was deleted.

runtime/platform/atomic_linux.h

Lines changed: 0 additions & 73 deletions
This file was deleted.

runtime/platform/atomic_macos.h

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)