diff options
| -rw-r--r-- | runtime/gc/accounting/space_bitmap-inl.h | 3 | ||||
| -rw-r--r-- | runtime/gc/space/bump_pointer_space-inl.h | 7 |
2 files changed, 4 insertions, 6 deletions
diff --git a/runtime/gc/accounting/space_bitmap-inl.h b/runtime/gc/accounting/space_bitmap-inl.h index 1dde18da4a..01c70facdf 100644 --- a/runtime/gc/accounting/space_bitmap-inl.h +++ b/runtime/gc/accounting/space_bitmap-inl.h @@ -18,7 +18,6 @@ #define ART_RUNTIME_GC_ACCOUNTING_SPACE_BITMAP_INL_H_ #include "base/logging.h" -#include "cutils/atomic-inline.h" #include "utils.h" namespace art { @@ -40,7 +39,7 @@ inline bool SpaceBitmap::AtomicTestAndSet(const mirror::Object* obj) { if ((old_word & mask) != 0) { return true; } - } while (UNLIKELY(android_atomic_cas(old_word, old_word | mask, address) != 0)); + } while (!__sync_bool_compare_and_swap(address, old_word, old_word | mask)); return false; } diff --git a/runtime/gc/space/bump_pointer_space-inl.h b/runtime/gc/space/bump_pointer_space-inl.h index ac20972a70..74a027462e 100644 --- a/runtime/gc/space/bump_pointer_space-inl.h +++ b/runtime/gc/space/bump_pointer_space-inl.h @@ -34,10 +34,9 @@ inline mirror::Object* BumpPointerSpace::AllocNonvirtualWithoutAccounting(size_t if (UNLIKELY(new_end > growth_end_)) { return nullptr; } - // TODO: Use a cas which always equals the size of pointers. - } while (android_atomic_cas(reinterpret_cast<int32_t>(old_end), - reinterpret_cast<int32_t>(new_end), - reinterpret_cast<volatile int32_t*>(&end_)) != 0); + } while (!__sync_bool_compare_and_swap(reinterpret_cast<volatile intptr_t*>(&end_), + reinterpret_cast<intptr_t>(old_end), + reinterpret_cast<intptr_t>(new_end))); return reinterpret_cast<mirror::Object*>(old_end); } |