diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/gc/allocator/rosalloc.cc | 8 | ||||
-rw-r--r-- | runtime/gc/allocator/rosalloc.h | 5 | ||||
-rw-r--r-- | runtime/mem_map.cc | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/runtime/gc/allocator/rosalloc.cc b/runtime/gc/allocator/rosalloc.cc index 55262f2..656c55b 100644 --- a/runtime/gc/allocator/rosalloc.cc +++ b/runtime/gc/allocator/rosalloc.cc @@ -529,7 +529,7 @@ size_t RosAlloc::FreeInternal(Thread* self, void* ptr) { } size_t RosAlloc::Free(Thread* self, void* ptr) { - ReaderMutexLock rmu(self, bulk_free_lock_); + WriterMutexLock rmu(self, bulk_free_lock_); return FreeInternal(self, ptr); } @@ -1642,7 +1642,7 @@ void RosAlloc::SetFootprintLimit(size_t new_capacity) { void RosAlloc::RevokeThreadLocalRuns(Thread* thread) { Thread* self = Thread::Current(); // Avoid race conditions on the bulk free bit maps with BulkFree() (GC). - WriterMutexLock wmu(self, bulk_free_lock_); + ReaderMutexLock wmu(self, bulk_free_lock_); for (size_t idx = 0; idx < kNumThreadLocalSizeBrackets; idx++) { MutexLock mu(self, *size_bracket_locks_[idx]); Run* thread_local_run = reinterpret_cast<Run*>(thread->GetRosAllocRun(idx)); @@ -1720,7 +1720,7 @@ void RosAlloc::AssertThreadLocalRunsAreRevoked(Thread* thread) { if (kIsDebugBuild) { Thread* self = Thread::Current(); // Avoid race conditions on the bulk free bit maps with BulkFree() (GC). - WriterMutexLock wmu(self, bulk_free_lock_); + ReaderMutexLock wmu(self, bulk_free_lock_); for (size_t idx = 0; idx < kNumThreadLocalSizeBrackets; idx++) { MutexLock mu(self, *size_bracket_locks_[idx]); Run* thread_local_run = reinterpret_cast<Run*>(thread->GetRosAllocRun(idx)); @@ -1867,7 +1867,7 @@ void RosAlloc::Verify() { CHECK(Locks::mutator_lock_->IsExclusiveHeld(self)) << "The mutator locks isn't exclusively locked at RosAlloc::Verify()"; MutexLock mu(self, *Locks::thread_list_lock_); - WriterMutexLock wmu(self, bulk_free_lock_); + ReaderMutexLock wmu(self, bulk_free_lock_); std::vector<Run*> runs; { MutexLock mu(self, lock_); diff --git a/runtime/gc/allocator/rosalloc.h b/runtime/gc/allocator/rosalloc.h index a439188..13f61ec 100644 --- a/runtime/gc/allocator/rosalloc.h +++ b/runtime/gc/allocator/rosalloc.h @@ -45,10 +45,7 @@ class RosAlloc { byte magic_num_; // The magic number used for debugging only. bool IsFree() const { - if (kIsDebugBuild) { - return magic_num_ == kMagicNumFree; - } - return true; + return !kIsDebugBuild || magic_num_ == kMagicNumFree; } size_t ByteSize(RosAlloc* rosalloc) const EXCLUSIVE_LOCKS_REQUIRED(rosalloc->lock_) { const byte* fpr_base = reinterpret_cast<const byte*>(this); diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc index 6c1c867..8d987df 100644 --- a/runtime/mem_map.cc +++ b/runtime/mem_map.cc @@ -39,6 +39,10 @@ #endif #endif +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif + namespace art { static std::ostream& operator<<( |