diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2013-12-17 17:19:53 -0800 |
---|---|---|
committer | Hiroshi Yamauchi <yamauchi@google.com> | 2013-12-18 11:26:15 -0800 |
commit | e48780b8278240dec2d3164512f7d3317a5495c1 (patch) | |
tree | addc42318a8747927a7ff5d10e786648574e34c3 /runtime/gc/space | |
parent | 0bf1f266869776c2dd21b3242599d74ac80855f0 (diff) | |
download | art-e48780b8278240dec2d3164512f7d3317a5495c1.tar.gz |
Remove some unnecessary code from dlmalloc_space/rosalloc_space.
Removed GetTotalBytesAllocated(), GetTotalObjectsAllocated(), and
InternalAllocationSize().
No performance improvement observed.
Change-Id: Ie20433a0fd328fc7f61d4afd54d18fbdc4aa4a17
Diffstat (limited to 'runtime/gc/space')
-rw-r--r-- | runtime/gc/space/dlmalloc_space.cc | 17 | ||||
-rw-r--r-- | runtime/gc/space/dlmalloc_space.h | 12 | ||||
-rw-r--r-- | runtime/gc/space/malloc_space.h | 2 | ||||
-rw-r--r-- | runtime/gc/space/rosalloc_space.cc | 15 | ||||
-rw-r--r-- | runtime/gc/space/rosalloc_space.h | 11 |
5 files changed, 7 insertions, 50 deletions
diff --git a/runtime/gc/space/dlmalloc_space.cc b/runtime/gc/space/dlmalloc_space.cc index 10e9ed8cf5..a4e6edadef 100644 --- a/runtime/gc/space/dlmalloc_space.cc +++ b/runtime/gc/space/dlmalloc_space.cc @@ -38,7 +38,7 @@ static const bool kPrefetchDuringDlMallocFreeList = true; DlMallocSpace::DlMallocSpace(const std::string& name, MemMap* mem_map, void* mspace, byte* begin, byte* end, byte* limit, size_t growth_limit) : MallocSpace(name, mem_map, begin, end, limit, growth_limit), - total_bytes_freed_(0), total_objects_freed_(0), mspace_(mspace), mspace_for_alloc_(mspace) { + mspace_(mspace), mspace_for_alloc_(mspace) { CHECK(mspace != NULL); } @@ -148,9 +148,7 @@ size_t DlMallocSpace::Free(Thread* self, mirror::Object* ptr) { CHECK(ptr != NULL); CHECK(Contains(ptr)) << "Free (" << ptr << ") not in bounds of heap " << *this; } - const size_t bytes_freed = InternalAllocationSize(ptr); - total_bytes_freed_ += bytes_freed; - ++total_objects_freed_; + const size_t bytes_freed = AllocationSizeNonvirtual(ptr); if (kRecentFreeCount > 0) { RegisterRecentFree(ptr); } @@ -170,7 +168,7 @@ size_t DlMallocSpace::FreeList(Thread* self, size_t num_ptrs, mirror::Object** p // The head of chunk for the allocation is sizeof(size_t) behind the allocation. __builtin_prefetch(reinterpret_cast<char*>(ptrs[i + look_ahead]) - sizeof(size_t)); } - bytes_freed += InternalAllocationSize(ptr); + bytes_freed += AllocationSizeNonvirtual(ptr); } if (kRecentFreeCount > 0) { @@ -196,8 +194,6 @@ size_t DlMallocSpace::FreeList(Thread* self, size_t num_ptrs, mirror::Object** p { MutexLock mu(self, lock_); - total_bytes_freed_ += bytes_freed; - total_objects_freed_ += num_ptrs; mspace_bulk_free(mspace_, reinterpret_cast<void**>(ptrs), num_ptrs); return bytes_freed; } @@ -211,13 +207,8 @@ extern "C" void* art_heap_morecore(void* mspace, intptr_t increment) { return heap->GetNonMovingSpace()->MoreCore(increment); } -// Virtual functions can't get inlined. -inline size_t DlMallocSpace::InternalAllocationSize(const mirror::Object* obj) { - return AllocationSizeNonvirtual(obj); -} - size_t DlMallocSpace::AllocationSize(const mirror::Object* obj) { - return InternalAllocationSize(obj); + return AllocationSizeNonvirtual(obj); } size_t DlMallocSpace::Trim() { diff --git a/runtime/gc/space/dlmalloc_space.h b/runtime/gc/space/dlmalloc_space.h index d18d4ad2a0..501c014bcd 100644 --- a/runtime/gc/space/dlmalloc_space.h +++ b/runtime/gc/space/dlmalloc_space.h @@ -86,12 +86,6 @@ class DlMallocSpace : public MallocSpace { uint64_t GetBytesAllocated(); uint64_t GetObjectsAllocated(); - uint64_t GetTotalBytesAllocated() { - return GetBytesAllocated() + total_bytes_freed_; - } - uint64_t GetTotalObjectsAllocated() { - return GetObjectsAllocated() + total_objects_freed_; - } // Returns the class of a recently freed object. mirror::Class* FindRecentFreedObject(const mirror::Object* obj); @@ -112,8 +106,6 @@ class DlMallocSpace : public MallocSpace { byte* limit, size_t growth_limit); private: - size_t InternalAllocationSize(const mirror::Object* obj); - mirror::Object* AllocWithoutGrowthLocked(Thread* self, size_t num_bytes, size_t* bytes_allocated) EXCLUSIVE_LOCKS_REQUIRED(lock_); @@ -122,10 +114,6 @@ class DlMallocSpace : public MallocSpace { } static void* CreateMspace(void* base, size_t morecore_start, size_t initial_size); - // Approximate number of bytes and objects which have been deallocated in the space. - size_t total_bytes_freed_; - size_t total_objects_freed_; - // The boundary tag overhead. static const size_t kChunkOverhead = kWordSize; diff --git a/runtime/gc/space/malloc_space.h b/runtime/gc/space/malloc_space.h index 0f882d33e1..760fcdd7c3 100644 --- a/runtime/gc/space/malloc_space.h +++ b/runtime/gc/space/malloc_space.h @@ -132,8 +132,6 @@ class MallocSpace : public ContinuousMemMapAllocSpace { virtual uint64_t GetBytesAllocated() = 0; virtual uint64_t GetObjectsAllocated() = 0; - virtual uint64_t GetTotalBytesAllocated() = 0; - virtual uint64_t GetTotalObjectsAllocated() = 0; // Returns the old mark bitmap. accounting::SpaceBitmap* BindLiveToMarkBitmap(); diff --git a/runtime/gc/space/rosalloc_space.cc b/runtime/gc/space/rosalloc_space.cc index 1f8e324823..9ddc14b78d 100644 --- a/runtime/gc/space/rosalloc_space.cc +++ b/runtime/gc/space/rosalloc_space.cc @@ -146,9 +146,7 @@ size_t RosAllocSpace::Free(Thread* self, mirror::Object* ptr) { CHECK(ptr != NULL); CHECK(Contains(ptr)) << "Free (" << ptr << ") not in bounds of heap " << *this; } - const size_t bytes_freed = InternalAllocationSize(ptr); - total_bytes_freed_atomic_.fetch_add(bytes_freed); - ++total_objects_freed_atomic_; + const size_t bytes_freed = AllocationSizeNonvirtual(ptr); if (kRecentFreeCount > 0) { MutexLock mu(self, lock_); RegisterRecentFree(ptr); @@ -168,7 +166,7 @@ size_t RosAllocSpace::FreeList(Thread* self, size_t num_ptrs, mirror::Object** p if (kPrefetchDuringRosAllocFreeList && i + look_ahead < num_ptrs) { __builtin_prefetch(reinterpret_cast<char*>(ptrs[i + look_ahead])); } - bytes_freed += InternalAllocationSize(ptr); + bytes_freed += AllocationSizeNonvirtual(ptr); } if (kRecentFreeCount > 0) { @@ -193,8 +191,6 @@ size_t RosAllocSpace::FreeList(Thread* self, size_t num_ptrs, mirror::Object** p } rosalloc_->BulkFree(self, reinterpret_cast<void**>(ptrs), num_ptrs); - total_bytes_freed_atomic_.fetch_add(bytes_freed); - total_objects_freed_atomic_.fetch_add(num_ptrs); return bytes_freed; } @@ -206,13 +202,8 @@ extern "C" void* art_heap_rosalloc_morecore(allocator::RosAlloc* rosalloc, intpt return heap->GetNonMovingSpace()->MoreCore(increment); } -// Virtual functions can't get inlined. -inline size_t RosAllocSpace::InternalAllocationSize(const mirror::Object* obj) { - return AllocationSizeNonvirtual(obj); -} - size_t RosAllocSpace::AllocationSize(const mirror::Object* obj) { - return InternalAllocationSize(obj); + return AllocationSizeNonvirtual(obj); } size_t RosAllocSpace::Trim() { diff --git a/runtime/gc/space/rosalloc_space.h b/runtime/gc/space/rosalloc_space.h index 6311580d14..5df9d88a2f 100644 --- a/runtime/gc/space/rosalloc_space.h +++ b/runtime/gc/space/rosalloc_space.h @@ -83,12 +83,6 @@ class RosAllocSpace : public MallocSpace { uint64_t GetBytesAllocated(); uint64_t GetObjectsAllocated(); - uint64_t GetTotalBytesAllocated() { - return GetBytesAllocated() + total_bytes_freed_atomic_; - } - uint64_t GetTotalObjectsAllocated() { - return GetObjectsAllocated() + total_objects_freed_atomic_; - } void RevokeThreadLocalBuffers(Thread* thread); void RevokeAllThreadLocalBuffers(); @@ -112,7 +106,6 @@ class RosAllocSpace : public MallocSpace { byte* begin, byte* end, byte* limit, size_t growth_limit); private: - size_t InternalAllocationSize(const mirror::Object* obj); mirror::Object* AllocWithoutGrowthLocked(Thread* self, size_t num_bytes, size_t* bytes_allocated); void* CreateAllocator(void* base, size_t morecore_start, size_t initial_size) { @@ -125,10 +118,6 @@ class RosAllocSpace : public MallocSpace { void* arg) LOCKS_EXCLUDED(Locks::runtime_shutdown_lock_, Locks::thread_list_lock_); - // Approximate number of bytes and objects which have been deallocated in the space. - AtomicInteger total_bytes_freed_atomic_; - AtomicInteger total_objects_freed_atomic_; - // Underlying rosalloc. art::gc::allocator::RosAlloc* const rosalloc_; |