Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Ian Rogers | 1d54e73 | 2013-05-02 21:10:01 -0700 | [diff] [blame] | 17 | #include "large_object_space.h" |
| 18 | |
Ian Rogers | 700a402 | 2014-05-19 16:49:03 -0700 | [diff] [blame] | 19 | #include <memory> |
| 20 | |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 21 | #include "gc/accounting/space_bitmap-inl.h" |
Elliott Hughes | 07ed66b | 2012-12-12 18:34:25 -0800 | [diff] [blame] | 22 | #include "base/logging.h" |
Hiroshi Yamauchi | 967a0ad | 2013-09-10 16:24:21 -0700 | [diff] [blame] | 23 | #include "base/mutex-inl.h" |
Elliott Hughes | 1aa246d | 2012-12-13 09:29:36 -0800 | [diff] [blame] | 24 | #include "base/stl_util.h" |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 25 | #include "image.h" |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 26 | #include "os.h" |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 27 | #include "space-inl.h" |
Brian Carlstrom | a3d2718 | 2013-11-05 23:22:27 -0800 | [diff] [blame] | 28 | #include "thread-inl.h" |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 29 | #include "utils.h" |
| 30 | |
| 31 | namespace art { |
Ian Rogers | 1d54e73 | 2013-05-02 21:10:01 -0700 | [diff] [blame] | 32 | namespace gc { |
| 33 | namespace space { |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 34 | |
Mathieu Chartier | 0767c9a | 2014-03-26 12:53:19 -0700 | [diff] [blame] | 35 | class ValgrindLargeObjectMapSpace FINAL : public LargeObjectMapSpace { |
| 36 | public: |
| 37 | explicit ValgrindLargeObjectMapSpace(const std::string& name) : LargeObjectMapSpace(name) { |
| 38 | } |
| 39 | |
| 40 | virtual mirror::Object* Alloc(Thread* self, size_t num_bytes, size_t* bytes_allocated, |
Hiroshi Yamauchi | 4460a84 | 2015-03-09 11:57:48 -0700 | [diff] [blame^] | 41 | size_t* usable_size, size_t* bytes_tl_bulk_allocated) |
| 42 | OVERRIDE { |
Mathieu Chartier | 0767c9a | 2014-03-26 12:53:19 -0700 | [diff] [blame] | 43 | mirror::Object* obj = |
| 44 | LargeObjectMapSpace::Alloc(self, num_bytes + kValgrindRedZoneBytes * 2, bytes_allocated, |
Hiroshi Yamauchi | 4460a84 | 2015-03-09 11:57:48 -0700 | [diff] [blame^] | 45 | usable_size, bytes_tl_bulk_allocated); |
Mathieu Chartier | 0767c9a | 2014-03-26 12:53:19 -0700 | [diff] [blame] | 46 | mirror::Object* object_without_rdz = reinterpret_cast<mirror::Object*>( |
| 47 | reinterpret_cast<uintptr_t>(obj) + kValgrindRedZoneBytes); |
| 48 | VALGRIND_MAKE_MEM_NOACCESS(reinterpret_cast<void*>(obj), kValgrindRedZoneBytes); |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 49 | VALGRIND_MAKE_MEM_NOACCESS(reinterpret_cast<uint8_t*>(object_without_rdz) + num_bytes, |
Mathieu Chartier | 0767c9a | 2014-03-26 12:53:19 -0700 | [diff] [blame] | 50 | kValgrindRedZoneBytes); |
| 51 | if (usable_size != nullptr) { |
| 52 | *usable_size = num_bytes; // Since we have redzones, shrink the usable size. |
| 53 | } |
| 54 | return object_without_rdz; |
| 55 | } |
| 56 | |
| 57 | virtual size_t AllocationSize(mirror::Object* obj, size_t* usable_size) OVERRIDE { |
| 58 | mirror::Object* object_with_rdz = reinterpret_cast<mirror::Object*>( |
| 59 | reinterpret_cast<uintptr_t>(obj) - kValgrindRedZoneBytes); |
| 60 | return LargeObjectMapSpace::AllocationSize(object_with_rdz, usable_size); |
| 61 | } |
| 62 | |
| 63 | virtual size_t Free(Thread* self, mirror::Object* obj) OVERRIDE { |
| 64 | mirror::Object* object_with_rdz = reinterpret_cast<mirror::Object*>( |
| 65 | reinterpret_cast<uintptr_t>(obj) - kValgrindRedZoneBytes); |
| 66 | VALGRIND_MAKE_MEM_UNDEFINED(object_with_rdz, AllocationSize(obj, nullptr)); |
| 67 | return LargeObjectMapSpace::Free(self, object_with_rdz); |
| 68 | } |
| 69 | |
| 70 | bool Contains(const mirror::Object* obj) const OVERRIDE { |
| 71 | mirror::Object* object_with_rdz = reinterpret_cast<mirror::Object*>( |
| 72 | reinterpret_cast<uintptr_t>(obj) - kValgrindRedZoneBytes); |
| 73 | return LargeObjectMapSpace::Contains(object_with_rdz); |
| 74 | } |
| 75 | |
| 76 | private: |
| 77 | static constexpr size_t kValgrindRedZoneBytes = kPageSize; |
| 78 | }; |
| 79 | |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 80 | void LargeObjectSpace::SwapBitmaps() { |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 81 | live_bitmap_.swap(mark_bitmap_); |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 82 | // Swap names to get more descriptive diagnostics. |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 83 | std::string temp_name = live_bitmap_->GetName(); |
| 84 | live_bitmap_->SetName(mark_bitmap_->GetName()); |
| 85 | mark_bitmap_->SetName(temp_name); |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 86 | } |
| 87 | |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 88 | LargeObjectSpace::LargeObjectSpace(const std::string& name, uint8_t* begin, uint8_t* end) |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 89 | : DiscontinuousSpace(name, kGcRetentionPolicyAlwaysCollect), |
| 90 | num_bytes_allocated_(0), num_objects_allocated_(0), total_bytes_allocated_(0), |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 91 | total_objects_allocated_(0), begin_(begin), end_(end) { |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | |
| 95 | void LargeObjectSpace::CopyLiveToMarked() { |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 96 | mark_bitmap_->CopyFrom(live_bitmap_.get()); |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | LargeObjectMapSpace::LargeObjectMapSpace(const std::string& name) |
Mathieu Chartier | 6f365cc | 2014-04-23 12:42:27 -0700 | [diff] [blame] | 100 | : LargeObjectSpace(name, nullptr, nullptr), |
Brian Carlstrom | 0cd7ec2 | 2013-07-17 23:40:20 -0700 | [diff] [blame] | 101 | lock_("large object map space lock", kAllocSpaceLock) {} |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 102 | |
| 103 | LargeObjectMapSpace* LargeObjectMapSpace::Create(const std::string& name) { |
Mathieu Chartier | da44d77 | 2014-04-01 15:01:46 -0700 | [diff] [blame] | 104 | if (Runtime::Current()->RunningOnValgrind()) { |
Mathieu Chartier | 0767c9a | 2014-03-26 12:53:19 -0700 | [diff] [blame] | 105 | return new ValgrindLargeObjectMapSpace(name); |
| 106 | } else { |
| 107 | return new LargeObjectMapSpace(name); |
| 108 | } |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 109 | } |
| 110 | |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 111 | mirror::Object* LargeObjectMapSpace::Alloc(Thread* self, size_t num_bytes, |
Hiroshi Yamauchi | 4460a84 | 2015-03-09 11:57:48 -0700 | [diff] [blame^] | 112 | size_t* bytes_allocated, size_t* usable_size, |
| 113 | size_t* bytes_tl_bulk_allocated) { |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 114 | std::string error_msg; |
Vladimir Marko | 5c42c29 | 2015-02-25 12:02:49 +0000 | [diff] [blame] | 115 | MemMap* mem_map = MemMap::MapAnonymous("large object space allocation", nullptr, num_bytes, |
| 116 | PROT_READ | PROT_WRITE, true, false, &error_msg); |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 117 | if (UNLIKELY(mem_map == NULL)) { |
| 118 | LOG(WARNING) << "Large object allocation failed: " << error_msg; |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 119 | return NULL; |
| 120 | } |
| 121 | MutexLock mu(self, lock_); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 122 | mirror::Object* obj = reinterpret_cast<mirror::Object*>(mem_map->Begin()); |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 123 | large_objects_.push_back(obj); |
| 124 | mem_maps_.Put(obj, mem_map); |
Mathieu Chartier | 2dbe627 | 2014-09-16 10:43:23 -0700 | [diff] [blame] | 125 | const size_t allocation_size = mem_map->BaseSize(); |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 126 | DCHECK(bytes_allocated != nullptr); |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 127 | begin_ = std::min(begin_, reinterpret_cast<uint8_t*>(obj)); |
| 128 | uint8_t* obj_end = reinterpret_cast<uint8_t*>(obj) + allocation_size; |
Mathieu Chartier | 6f365cc | 2014-04-23 12:42:27 -0700 | [diff] [blame] | 129 | if (end_ == nullptr || obj_end > end_) { |
| 130 | end_ = obj_end; |
| 131 | } |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 132 | *bytes_allocated = allocation_size; |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 133 | if (usable_size != nullptr) { |
| 134 | *usable_size = allocation_size; |
| 135 | } |
Hiroshi Yamauchi | 4460a84 | 2015-03-09 11:57:48 -0700 | [diff] [blame^] | 136 | DCHECK(bytes_tl_bulk_allocated != nullptr); |
| 137 | *bytes_tl_bulk_allocated = allocation_size; |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 138 | num_bytes_allocated_ += allocation_size; |
| 139 | total_bytes_allocated_ += allocation_size; |
| 140 | ++num_objects_allocated_; |
| 141 | ++total_objects_allocated_; |
| 142 | return obj; |
| 143 | } |
| 144 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 145 | size_t LargeObjectMapSpace::Free(Thread* self, mirror::Object* ptr) { |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 146 | MutexLock mu(self, lock_); |
| 147 | MemMaps::iterator found = mem_maps_.find(ptr); |
Mathieu Chartier | d07a913 | 2014-05-23 16:42:20 -0700 | [diff] [blame] | 148 | if (UNLIKELY(found == mem_maps_.end())) { |
| 149 | Runtime::Current()->GetHeap()->DumpSpaces(LOG(ERROR)); |
| 150 | LOG(FATAL) << "Attempted to free large object " << ptr << " which was not live"; |
| 151 | } |
Mathieu Chartier | 2dbe627 | 2014-09-16 10:43:23 -0700 | [diff] [blame] | 152 | const size_t map_size = found->second->BaseSize(); |
| 153 | DCHECK_GE(num_bytes_allocated_, map_size); |
| 154 | size_t allocation_size = map_size; |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 155 | num_bytes_allocated_ -= allocation_size; |
| 156 | --num_objects_allocated_; |
| 157 | delete found->second; |
| 158 | mem_maps_.erase(found); |
| 159 | return allocation_size; |
| 160 | } |
| 161 | |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 162 | size_t LargeObjectMapSpace::AllocationSize(mirror::Object* obj, size_t* usable_size) { |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 163 | MutexLock mu(Thread::Current(), lock_); |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 164 | auto found = mem_maps_.find(obj); |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 165 | CHECK(found != mem_maps_.end()) << "Attempted to get size of a large object which is not live"; |
Ian Rogers | 6a3c1fc | 2014-10-31 00:33:20 -0700 | [diff] [blame] | 166 | size_t alloc_size = found->second->BaseSize(); |
| 167 | if (usable_size != nullptr) { |
| 168 | *usable_size = alloc_size; |
| 169 | } |
| 170 | return alloc_size; |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 171 | } |
| 172 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 173 | size_t LargeObjectSpace::FreeList(Thread* self, size_t num_ptrs, mirror::Object** ptrs) { |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 174 | size_t total = 0; |
| 175 | for (size_t i = 0; i < num_ptrs; ++i) { |
| 176 | if (kDebugSpaces) { |
| 177 | CHECK(Contains(ptrs[i])); |
| 178 | } |
| 179 | total += Free(self, ptrs[i]); |
| 180 | } |
| 181 | return total; |
| 182 | } |
| 183 | |
| 184 | void LargeObjectMapSpace::Walk(DlMallocSpace::WalkCallback callback, void* arg) { |
| 185 | MutexLock mu(Thread::Current(), lock_); |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 186 | for (auto it = mem_maps_.begin(); it != mem_maps_.end(); ++it) { |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 187 | MemMap* mem_map = it->second; |
| 188 | callback(mem_map->Begin(), mem_map->End(), mem_map->Size(), arg); |
| 189 | callback(NULL, NULL, 0, arg); |
| 190 | } |
| 191 | } |
| 192 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 193 | bool LargeObjectMapSpace::Contains(const mirror::Object* obj) const { |
Ian Rogers | a3dd0b3 | 2013-03-19 19:30:59 -0700 | [diff] [blame] | 194 | Thread* self = Thread::Current(); |
| 195 | if (lock_.IsExclusiveHeld(self)) { |
| 196 | // We hold lock_ so do the check. |
| 197 | return mem_maps_.find(const_cast<mirror::Object*>(obj)) != mem_maps_.end(); |
| 198 | } else { |
| 199 | MutexLock mu(self, lock_); |
| 200 | return mem_maps_.find(const_cast<mirror::Object*>(obj)) != mem_maps_.end(); |
| 201 | } |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 202 | } |
| 203 | |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 204 | // Keeps track of allocation sizes + whether or not the previous allocation is free. |
| 205 | // Used to coalesce free blocks and find the best fit block for an allocation. |
| 206 | class AllocationInfo { |
| 207 | public: |
| 208 | AllocationInfo() : prev_free_(0), alloc_size_(0) { |
| 209 | } |
| 210 | // Return the number of pages that the allocation info covers. |
| 211 | size_t AlignSize() const { |
| 212 | return alloc_size_ & ~kFlagFree; |
| 213 | } |
| 214 | // Returns the allocation size in bytes. |
| 215 | size_t ByteSize() const { |
| 216 | return AlignSize() * FreeListSpace::kAlignment; |
| 217 | } |
| 218 | // Updates the allocation size and whether or not it is free. |
| 219 | void SetByteSize(size_t size, bool free) { |
| 220 | DCHECK_ALIGNED(size, FreeListSpace::kAlignment); |
| 221 | alloc_size_ = (size / FreeListSpace::kAlignment) | (free ? kFlagFree : 0U); |
| 222 | } |
| 223 | bool IsFree() const { |
| 224 | return (alloc_size_ & kFlagFree) != 0; |
| 225 | } |
| 226 | // Finds and returns the next non free allocation info after ourself. |
| 227 | AllocationInfo* GetNextInfo() { |
| 228 | return this + AlignSize(); |
| 229 | } |
| 230 | const AllocationInfo* GetNextInfo() const { |
| 231 | return this + AlignSize(); |
| 232 | } |
| 233 | // Returns the previous free allocation info by using the prev_free_ member to figure out |
| 234 | // where it is. This is only used for coalescing so we only need to be able to do it if the |
| 235 | // previous allocation info is free. |
| 236 | AllocationInfo* GetPrevFreeInfo() { |
| 237 | DCHECK_NE(prev_free_, 0U); |
| 238 | return this - prev_free_; |
| 239 | } |
| 240 | // Returns the address of the object associated with this allocation info. |
| 241 | mirror::Object* GetObjectAddress() { |
| 242 | return reinterpret_cast<mirror::Object*>(reinterpret_cast<uintptr_t>(this) + sizeof(*this)); |
| 243 | } |
| 244 | // Return how many kAlignment units there are before the free block. |
| 245 | size_t GetPrevFree() const { |
| 246 | return prev_free_; |
| 247 | } |
| 248 | // Returns how many free bytes there is before the block. |
| 249 | size_t GetPrevFreeBytes() const { |
| 250 | return GetPrevFree() * FreeListSpace::kAlignment; |
| 251 | } |
| 252 | // Update the size of the free block prior to the allocation. |
| 253 | void SetPrevFreeBytes(size_t bytes) { |
| 254 | DCHECK_ALIGNED(bytes, FreeListSpace::kAlignment); |
| 255 | prev_free_ = bytes / FreeListSpace::kAlignment; |
| 256 | } |
| 257 | |
| 258 | private: |
| 259 | // Used to implement best fit object allocation. Each allocation has an AllocationInfo which |
| 260 | // contains the size of the previous free block preceding it. Implemented in such a way that we |
| 261 | // can also find the iterator for any allocation info pointer. |
| 262 | static constexpr uint32_t kFlagFree = 0x8000000; |
| 263 | // Contains the size of the previous free block with kAlignment as the unit. If 0 then the |
| 264 | // allocation before us is not free. |
| 265 | // These variables are undefined in the middle of allocations / free blocks. |
| 266 | uint32_t prev_free_; |
| 267 | // Allocation size of this object in kAlignment as the unit. |
| 268 | uint32_t alloc_size_; |
| 269 | }; |
| 270 | |
| 271 | size_t FreeListSpace::GetSlotIndexForAllocationInfo(const AllocationInfo* info) const { |
| 272 | DCHECK_GE(info, allocation_info_); |
| 273 | DCHECK_LT(info, reinterpret_cast<AllocationInfo*>(allocation_info_map_->End())); |
| 274 | return info - allocation_info_; |
| 275 | } |
| 276 | |
| 277 | AllocationInfo* FreeListSpace::GetAllocationInfoForAddress(uintptr_t address) { |
| 278 | return &allocation_info_[GetSlotIndexForAddress(address)]; |
| 279 | } |
| 280 | |
| 281 | const AllocationInfo* FreeListSpace::GetAllocationInfoForAddress(uintptr_t address) const { |
| 282 | return &allocation_info_[GetSlotIndexForAddress(address)]; |
| 283 | } |
| 284 | |
| 285 | inline bool FreeListSpace::SortByPrevFree::operator()(const AllocationInfo* a, |
| 286 | const AllocationInfo* b) const { |
| 287 | if (a->GetPrevFree() < b->GetPrevFree()) return true; |
| 288 | if (a->GetPrevFree() > b->GetPrevFree()) return false; |
| 289 | if (a->AlignSize() < b->AlignSize()) return true; |
| 290 | if (a->AlignSize() > b->AlignSize()) return false; |
| 291 | return reinterpret_cast<uintptr_t>(a) < reinterpret_cast<uintptr_t>(b); |
| 292 | } |
| 293 | |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 294 | FreeListSpace* FreeListSpace::Create(const std::string& name, uint8_t* requested_begin, size_t size) { |
Brian Carlstrom | 4274889 | 2013-07-18 18:04:08 -0700 | [diff] [blame] | 295 | CHECK_EQ(size % kAlignment, 0U); |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 296 | std::string error_msg; |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 297 | MemMap* mem_map = MemMap::MapAnonymous(name.c_str(), requested_begin, size, |
Vladimir Marko | 5c42c29 | 2015-02-25 12:02:49 +0000 | [diff] [blame] | 298 | PROT_READ | PROT_WRITE, true, false, &error_msg); |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 299 | CHECK(mem_map != NULL) << "Failed to allocate large object space mem map: " << error_msg; |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 300 | return new FreeListSpace(name, mem_map, mem_map->Begin(), mem_map->End()); |
| 301 | } |
| 302 | |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 303 | FreeListSpace::FreeListSpace(const std::string& name, MemMap* mem_map, uint8_t* begin, uint8_t* end) |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 304 | : LargeObjectSpace(name, begin, end), |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 305 | mem_map_(mem_map), |
| 306 | lock_("free list space lock", kAllocSpaceLock) { |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 307 | const size_t space_capacity = end - begin; |
| 308 | free_end_ = space_capacity; |
| 309 | CHECK_ALIGNED(space_capacity, kAlignment); |
| 310 | const size_t alloc_info_size = sizeof(AllocationInfo) * (space_capacity / kAlignment); |
| 311 | std::string error_msg; |
Vladimir Marko | 5c42c29 | 2015-02-25 12:02:49 +0000 | [diff] [blame] | 312 | allocation_info_map_.reset( |
| 313 | MemMap::MapAnonymous("large object free list space allocation info map", |
| 314 | nullptr, alloc_info_size, PROT_READ | PROT_WRITE, |
| 315 | false, false, &error_msg)); |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 316 | CHECK(allocation_info_map_.get() != nullptr) << "Failed to allocate allocation info map" |
| 317 | << error_msg; |
| 318 | allocation_info_ = reinterpret_cast<AllocationInfo*>(allocation_info_map_->Begin()); |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 319 | } |
| 320 | |
Brian Carlstrom | 0cd7ec2 | 2013-07-17 23:40:20 -0700 | [diff] [blame] | 321 | FreeListSpace::~FreeListSpace() {} |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 322 | |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 323 | void FreeListSpace::Walk(DlMallocSpace::WalkCallback callback, void* arg) { |
| 324 | MutexLock mu(Thread::Current(), lock_); |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 325 | const uintptr_t free_end_start = reinterpret_cast<uintptr_t>(end_) - free_end_; |
| 326 | AllocationInfo* cur_info = &allocation_info_[0]; |
| 327 | const AllocationInfo* end_info = GetAllocationInfoForAddress(free_end_start); |
| 328 | while (cur_info < end_info) { |
| 329 | if (!cur_info->IsFree()) { |
| 330 | size_t alloc_size = cur_info->ByteSize(); |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 331 | uint8_t* byte_start = reinterpret_cast<uint8_t*>(GetAddressForAllocationInfo(cur_info)); |
| 332 | uint8_t* byte_end = byte_start + alloc_size; |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 333 | callback(byte_start, byte_end, alloc_size, arg); |
| 334 | callback(nullptr, nullptr, 0, arg); |
| 335 | } |
| 336 | cur_info = cur_info->GetNextInfo(); |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 337 | } |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 338 | CHECK_EQ(cur_info, end_info); |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 339 | } |
| 340 | |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 341 | void FreeListSpace::RemoveFreePrev(AllocationInfo* info) { |
| 342 | CHECK_GT(info->GetPrevFree(), 0U); |
| 343 | auto it = free_blocks_.lower_bound(info); |
| 344 | CHECK(it != free_blocks_.end()); |
| 345 | CHECK_EQ(*it, info); |
| 346 | free_blocks_.erase(it); |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 347 | } |
| 348 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 349 | size_t FreeListSpace::Free(Thread* self, mirror::Object* obj) { |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 350 | MutexLock mu(self, lock_); |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 351 | DCHECK(Contains(obj)) << reinterpret_cast<void*>(Begin()) << " " << obj << " " |
| 352 | << reinterpret_cast<void*>(End()); |
| 353 | DCHECK_ALIGNED(obj, kAlignment); |
| 354 | AllocationInfo* info = GetAllocationInfoForAddress(reinterpret_cast<uintptr_t>(obj)); |
| 355 | DCHECK(!info->IsFree()); |
| 356 | const size_t allocation_size = info->ByteSize(); |
| 357 | DCHECK_GT(allocation_size, 0U); |
| 358 | DCHECK_ALIGNED(allocation_size, kAlignment); |
| 359 | info->SetByteSize(allocation_size, true); // Mark as free. |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 360 | // Look at the next chunk. |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 361 | AllocationInfo* next_info = info->GetNextInfo(); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 362 | // Calculate the start of the end free block. |
| 363 | uintptr_t free_end_start = reinterpret_cast<uintptr_t>(end_) - free_end_; |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 364 | size_t prev_free_bytes = info->GetPrevFreeBytes(); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 365 | size_t new_free_size = allocation_size; |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 366 | if (prev_free_bytes != 0) { |
| 367 | // Coalesce with previous free chunk. |
| 368 | new_free_size += prev_free_bytes; |
| 369 | RemoveFreePrev(info); |
| 370 | info = info->GetPrevFreeInfo(); |
| 371 | // The previous allocation info must not be free since we are supposed to always coalesce. |
| 372 | DCHECK_EQ(info->GetPrevFreeBytes(), 0U) << "Previous allocation was free"; |
Ian Rogers | 22a2086 | 2013-03-16 16:34:57 -0700 | [diff] [blame] | 373 | } |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 374 | uintptr_t next_addr = GetAddressForAllocationInfo(next_info); |
| 375 | if (next_addr >= free_end_start) { |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 376 | // Easy case, the next chunk is the end free region. |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 377 | CHECK_EQ(next_addr, free_end_start); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 378 | free_end_ += new_free_size; |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 379 | } else { |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 380 | AllocationInfo* new_free_info; |
| 381 | if (next_info->IsFree()) { |
| 382 | AllocationInfo* next_next_info = next_info->GetNextInfo(); |
| 383 | // Next next info can't be free since we always coalesce. |
| 384 | DCHECK(!next_next_info->IsFree()); |
| 385 | DCHECK(IsAligned<kAlignment>(next_next_info->ByteSize())); |
| 386 | new_free_info = next_next_info; |
| 387 | new_free_size += next_next_info->GetPrevFreeBytes(); |
| 388 | RemoveFreePrev(next_next_info); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 389 | } else { |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 390 | new_free_info = next_info; |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 391 | } |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 392 | new_free_info->SetPrevFreeBytes(new_free_size); |
| 393 | free_blocks_.insert(new_free_info); |
| 394 | info->SetByteSize(new_free_size, true); |
| 395 | DCHECK_EQ(info->GetNextInfo(), new_free_info); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 396 | } |
| 397 | --num_objects_allocated_; |
| 398 | DCHECK_LE(allocation_size, num_bytes_allocated_); |
| 399 | num_bytes_allocated_ -= allocation_size; |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 400 | madvise(obj, allocation_size, MADV_DONTNEED); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 401 | if (kIsDebugBuild) { |
| 402 | // Can't disallow reads since we use them to find next chunks during coalescing. |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 403 | mprotect(obj, allocation_size, PROT_READ); |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 404 | } |
| 405 | return allocation_size; |
| 406 | } |
| 407 | |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 408 | size_t FreeListSpace::AllocationSize(mirror::Object* obj, size_t* usable_size) { |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 409 | DCHECK(Contains(obj)); |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 410 | AllocationInfo* info = GetAllocationInfoForAddress(reinterpret_cast<uintptr_t>(obj)); |
| 411 | DCHECK(!info->IsFree()); |
| 412 | size_t alloc_size = info->ByteSize(); |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 413 | if (usable_size != nullptr) { |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 414 | *usable_size = alloc_size; |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 415 | } |
| 416 | return alloc_size; |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 417 | } |
| 418 | |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 419 | mirror::Object* FreeListSpace::Alloc(Thread* self, size_t num_bytes, size_t* bytes_allocated, |
Hiroshi Yamauchi | 4460a84 | 2015-03-09 11:57:48 -0700 | [diff] [blame^] | 420 | size_t* usable_size, size_t* bytes_tl_bulk_allocated) { |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 421 | MutexLock mu(self, lock_); |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 422 | const size_t allocation_size = RoundUp(num_bytes, kAlignment); |
| 423 | AllocationInfo temp_info; |
| 424 | temp_info.SetPrevFreeBytes(allocation_size); |
| 425 | temp_info.SetByteSize(0, false); |
| 426 | AllocationInfo* new_info; |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 427 | // Find the smallest chunk at least num_bytes in size. |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 428 | auto it = free_blocks_.lower_bound(&temp_info); |
| 429 | if (it != free_blocks_.end()) { |
| 430 | AllocationInfo* info = *it; |
| 431 | free_blocks_.erase(it); |
| 432 | // Fit our object in the previous allocation info free space. |
| 433 | new_info = info->GetPrevFreeInfo(); |
| 434 | // Remove the newly allocated block from the info and update the prev_free_. |
| 435 | info->SetPrevFreeBytes(info->GetPrevFreeBytes() - allocation_size); |
| 436 | if (info->GetPrevFreeBytes() > 0) { |
| 437 | AllocationInfo* new_free = info - info->GetPrevFree(); |
| 438 | new_free->SetPrevFreeBytes(0); |
| 439 | new_free->SetByteSize(info->GetPrevFreeBytes(), true); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 440 | // If there is remaining space, insert back into the free set. |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 441 | free_blocks_.insert(info); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 442 | } |
| 443 | } else { |
| 444 | // Try to steal some memory from the free space at the end of the space. |
| 445 | if (LIKELY(free_end_ >= allocation_size)) { |
| 446 | // Fit our object at the start of the end free block. |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 447 | new_info = GetAllocationInfoForAddress(reinterpret_cast<uintptr_t>(End()) - free_end_); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 448 | free_end_ -= allocation_size; |
| 449 | } else { |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 450 | return nullptr; |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 451 | } |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 452 | } |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 453 | DCHECK(bytes_allocated != nullptr); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 454 | *bytes_allocated = allocation_size; |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 455 | if (usable_size != nullptr) { |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 456 | *usable_size = allocation_size; |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 457 | } |
Hiroshi Yamauchi | 4460a84 | 2015-03-09 11:57:48 -0700 | [diff] [blame^] | 458 | DCHECK(bytes_tl_bulk_allocated != nullptr); |
| 459 | *bytes_tl_bulk_allocated = allocation_size; |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 460 | // Need to do these inside of the lock. |
| 461 | ++num_objects_allocated_; |
| 462 | ++total_objects_allocated_; |
| 463 | num_bytes_allocated_ += allocation_size; |
| 464 | total_bytes_allocated_ += allocation_size; |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 465 | mirror::Object* obj = reinterpret_cast<mirror::Object*>(GetAddressForAllocationInfo(new_info)); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 466 | // We always put our object at the start of the free block, there can not be another free block |
| 467 | // before it. |
| 468 | if (kIsDebugBuild) { |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 469 | mprotect(obj, allocation_size, PROT_READ | PROT_WRITE); |
Hiroshi Yamauchi | 50b2928 | 2013-07-30 13:58:37 -0700 | [diff] [blame] | 470 | } |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 471 | new_info->SetPrevFreeBytes(0); |
| 472 | new_info->SetByteSize(allocation_size, false); |
| 473 | return obj; |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 474 | } |
| 475 | |
Brian Carlstrom | 2ce745c | 2013-07-17 17:44:30 -0700 | [diff] [blame] | 476 | void FreeListSpace::Dump(std::ostream& os) const { |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 477 | MutexLock mu(Thread::Current(), const_cast<Mutex&>(lock_)); |
Mathieu Chartier | 128c52c | 2012-10-16 14:12:41 -0700 | [diff] [blame] | 478 | os << GetName() << " -" |
| 479 | << " begin: " << reinterpret_cast<void*>(Begin()) |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 480 | << " end: " << reinterpret_cast<void*>(End()) << "\n"; |
| 481 | uintptr_t free_end_start = reinterpret_cast<uintptr_t>(end_) - free_end_; |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 482 | const AllocationInfo* cur_info = |
| 483 | GetAllocationInfoForAddress(reinterpret_cast<uintptr_t>(Begin())); |
| 484 | const AllocationInfo* end_info = GetAllocationInfoForAddress(free_end_start); |
| 485 | while (cur_info < end_info) { |
| 486 | size_t size = cur_info->ByteSize(); |
| 487 | uintptr_t address = GetAddressForAllocationInfo(cur_info); |
| 488 | if (cur_info->IsFree()) { |
| 489 | os << "Free block at address: " << reinterpret_cast<const void*>(address) |
| 490 | << " of length " << size << " bytes\n"; |
| 491 | } else { |
| 492 | os << "Large object at address: " << reinterpret_cast<const void*>(address) |
| 493 | << " of length " << size << " bytes\n"; |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 494 | } |
Mathieu Chartier | af4edbd | 2014-09-08 17:42:48 -0700 | [diff] [blame] | 495 | cur_info = cur_info->GetNextInfo(); |
Mathieu Chartier | eb5710e | 2013-07-25 15:19:42 -0700 | [diff] [blame] | 496 | } |
| 497 | if (free_end_) { |
| 498 | os << "Free block at address: " << reinterpret_cast<const void*>(free_end_start) |
| 499 | << " of length " << free_end_ << " bytes\n"; |
| 500 | } |
Mathieu Chartier | 128c52c | 2012-10-16 14:12:41 -0700 | [diff] [blame] | 501 | } |
| 502 | |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 503 | void LargeObjectSpace::SweepCallback(size_t num_ptrs, mirror::Object** ptrs, void* arg) { |
| 504 | SweepCallbackContext* context = static_cast<SweepCallbackContext*>(arg); |
| 505 | space::LargeObjectSpace* space = context->space->AsLargeObjectSpace(); |
| 506 | Thread* self = context->self; |
| 507 | Locks::heap_bitmap_lock_->AssertExclusiveHeld(self); |
| 508 | // If the bitmaps aren't swapped we need to clear the bits since the GC isn't going to re-swap |
| 509 | // the bitmaps as an optimization. |
| 510 | if (!context->swap_bitmaps) { |
| 511 | accounting::LargeObjectBitmap* bitmap = space->GetLiveBitmap(); |
| 512 | for (size_t i = 0; i < num_ptrs; ++i) { |
| 513 | bitmap->Clear(ptrs[i]); |
Mathieu Chartier | db7f37d | 2014-01-10 11:09:06 -0800 | [diff] [blame] | 514 | } |
| 515 | } |
Mathieu Chartier | 10fb83a | 2014-06-15 15:15:43 -0700 | [diff] [blame] | 516 | context->freed.objects += num_ptrs; |
| 517 | context->freed.bytes += space->FreeList(self, num_ptrs, ptrs); |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 518 | } |
| 519 | |
Mathieu Chartier | 10fb83a | 2014-06-15 15:15:43 -0700 | [diff] [blame] | 520 | collector::ObjectBytePair LargeObjectSpace::Sweep(bool swap_bitmaps) { |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 521 | if (Begin() >= End()) { |
Mathieu Chartier | 10fb83a | 2014-06-15 15:15:43 -0700 | [diff] [blame] | 522 | return collector::ObjectBytePair(0, 0); |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 523 | } |
| 524 | accounting::LargeObjectBitmap* live_bitmap = GetLiveBitmap(); |
| 525 | accounting::LargeObjectBitmap* mark_bitmap = GetMarkBitmap(); |
| 526 | if (swap_bitmaps) { |
| 527 | std::swap(live_bitmap, mark_bitmap); |
| 528 | } |
Mathieu Chartier | 10fb83a | 2014-06-15 15:15:43 -0700 | [diff] [blame] | 529 | AllocSpace::SweepCallbackContext scc(swap_bitmaps, this); |
Mathieu Chartier | bbd695c | 2014-04-16 09:48:48 -0700 | [diff] [blame] | 530 | accounting::LargeObjectBitmap::SweepWalk(*live_bitmap, *mark_bitmap, |
| 531 | reinterpret_cast<uintptr_t>(Begin()), |
| 532 | reinterpret_cast<uintptr_t>(End()), SweepCallback, &scc); |
Mathieu Chartier | 10fb83a | 2014-06-15 15:15:43 -0700 | [diff] [blame] | 533 | return scc.freed; |
Mathieu Chartier | db7f37d | 2014-01-10 11:09:06 -0800 | [diff] [blame] | 534 | } |
| 535 | |
Mathieu Chartier | b363f66 | 2014-07-16 13:28:58 -0700 | [diff] [blame] | 536 | void LargeObjectSpace::LogFragmentationAllocFailure(std::ostream& /*os*/, |
| 537 | size_t /*failed_alloc_bytes*/) { |
| 538 | UNIMPLEMENTED(FATAL); |
| 539 | } |
| 540 | |
Ian Rogers | 1d54e73 | 2013-05-02 21:10:01 -0700 | [diff] [blame] | 541 | } // namespace space |
| 542 | } // namespace gc |
| 543 | } // namespace art |