Lines Matching refs:run

98     LOG(INFO) << "RosAlloc::RosAlloc() : Inserted run 0x" << std::hex
115 // Find the lowest address free page run that's large enough.
125 LOG(INFO) << "RosAlloc::AllocPages() : Erased run 0x"
140 LOG(INFO) << "RosAlloc::AllocPages() : Inserted run 0x" << std::hex
160 // There is a free page run at the end.
165 // There is no free page run at the end.
183 // There was a free page run at the end. Expand its size.
189 // Otherwise, insert a new free page run at the end.
199 LOG(INFO) << "RosAlloc::AlloPages() : Grew the heap by inserting run 0x"
211 // And retry the last free page run.
224 LOG(INFO) << "RosAlloc::AllocPages() : Erased run 0x" << std::hex << reinterpret_cast<intptr_t>(fpr)
237 LOG(INFO) << "RosAlloc::AllocPages() : Inserted run 0x" << std::hex
337 // Turn it into a free run.
349 LOG(INFO) << __PRETTY_FUNCTION__ << "RosAlloc::FreePages() : trying to coalesce a free page run 0x"
360 LOG(INFO) << "RosAlloc::FreePages() : trying to coalesce with a higher free page run 0x"
369 // Clear magic num since this is no longer the start of a free page run.
375 LOG(INFO) << "RosAlloc::FreePages() : (coalesce) Erased run 0x" << std::hex
402 LOG(INFO) << "RosAlloc::FreePages() : trying to coalesce with a lower free page run 0x"
413 LOG(INFO) << "RosAlloc::FreePages() : (coalesce) Erased run 0x" << std::hex
419 // Clear magic num since this is no longer the start of a free page run.
447 LOG(INFO) << "RosAlloc::FreePages() : Inserted run 0x" << std::hex << reinterpret_cast<intptr_t>(fpr)
489 Run* run = nullptr;
505 // Find the beginning of the run.
512 run = reinterpret_cast<Run*>(base_ + pm_idx * kPageSize);
513 DCHECK_EQ(run->magic_num_, kMagicNum);
526 DCHECK(run != nullptr);
527 return FreeFromRun(self, ptr, run);
551 // Take ownership of the cache lines if we are likely to be thread local run.
571 // Get the lowest address non-full run from the binary tree.
574 // If there's one, use it as the current run.
582 // If there's none, allocate a new run and use it as the current run.
591 // The current run got full. Try to refill it.
596 LOG(INFO) << __PRETTY_FUNCTION__ << " : Inserted run 0x" << std::hex
605 // Failed to allocate a new run, make sure that it is the dedicated full run.
616 // Must succeed now with a new run.
654 // Use a thread-local run.
666 // The allocation must fail if the run is invalid.
668 << "allocated from an invalid run";
670 // The run got full. Try to free slots.
685 // No slots got freed. Try to refill the thread-local run.
692 LOG(INFO) << "RosAlloc::AllocFromRun() : Inserted run 0x" << std::hex
717 // Must succeed now with a new run.
726 // Use the (shared) current run.
741 size_t RosAlloc::FreeFromRun(Thread* self, void* ptr, Run* run) {
742 DCHECK_EQ(run->magic_num_, kMagicNum);
743 DCHECK_LT(run, ptr);
744 DCHECK_LT(ptr, run->End());
745 const size_t idx = run->size_bracket_idx_;
750 run_was_full = run->IsFull();
755 if (LIKELY(run->IsThreadLocal())) {
756 // It's a thread-local run. Just mark the thread-local free bit map and return.
757 DCHECK_LT(run->size_bracket_idx_, kNumThreadLocalSizeBrackets);
758 DCHECK(non_full_runs_[idx].find(run) == non_full_runs_[idx].end());
759 DCHECK(full_runs_[idx].find(run) == full_runs_[idx].end());
760 run->MarkThreadLocalFreeBitMap(ptr);
762 LOG(INFO) << "RosAlloc::FreeFromRun() : Freed a slot in a thread local run 0x" << std::hex
763 << reinterpret_cast<intptr_t>(run);
765 // A thread local run will be kept as a thread local even if it's become all free.
768 // Free the slot in the run.
769 run->FreeSlot(ptr);
771 if (run->IsAllFree()) {
772 // It has just become completely free. Free the pages of this run.
773 std::set<Run*>::iterator pos = non_full_runs->find(run);
777 LOG(INFO) << "RosAlloc::FreeFromRun() : Erased run 0x" << std::hex
778 << reinterpret_cast<intptr_t>(run) << " from non_full_runs_";
781 if (run == current_runs_[idx]) {
784 DCHECK(non_full_runs_[idx].find(run) == non_full_runs_[idx].end());
785 DCHECK(full_runs_[idx].find(run) == full_runs_[idx].end());
786 run->ZeroHeader();
789 FreePages(self, run, true);
792 // It is not completely free. If it wasn't the current run or
793 // already in the non-full run set (i.e., it was full) insert it
794 // into the non-full run set.
795 if (run != current_runs_[idx]) {
798 std::set<Run*>::iterator pos = non_full_runs->find(run);
801 DCHECK(full_runs->find(run) != full_runs->end());
803 full_runs->erase(run);
805 LOG(INFO) << "RosAlloc::FreeFromRun() : Erased run 0x" << std::hex
806 << reinterpret_cast<intptr_t>(run) << " from full_runs_";
809 non_full_runs->insert(run);
810 DCHECK(!run->IsFull());
812 LOG(INFO) << "RosAlloc::FreeFromRun() : Inserted run 0x" << std::hex
813 << reinterpret_cast<intptr_t>(run)
1170 Run* run = nullptr;
1180 run = reinterpret_cast<Run*>(base_ + pm_idx * kPageSize);
1183 // Find the beginning of the run.
1188 run = reinterpret_cast<Run*>(base_ + pi * kPageSize);
1207 run = reinterpret_cast<Run*>(base_ + pm_idx * kPageSize);
1210 // Find the beginning of the run.
1215 run = reinterpret_cast<Run*>(base_ + pi * kPageSize);
1223 DCHECK(run != nullptr);
1224 DCHECK_EQ(run->magic_num_, kMagicNum);
1226 freed_bytes += run->MarkBulkFreeBitMap(ptr);
1228 if (!run->to_be_bulk_freed_) {
1229 run->to_be_bulk_freed_ = true;
1230 runs.push_back(run);
1233 runs.insert(run);
1241 for (Run* run : runs) {
1243 DCHECK(run->to_be_bulk_freed_);
1244 run->to_be_bulk_freed_ = false;
1246 size_t idx = run->size_bracket_idx_;
1248 if (run->IsThreadLocal()) {
1249 DCHECK_LT(run->size_bracket_idx_, kNumThreadLocalSizeBrackets);
1250 DCHECK(non_full_runs_[idx].find(run) == non_full_runs_[idx].end());
1251 DCHECK(full_runs_[idx].find(run) == full_runs_[idx].end());
1252 run->UnionBulkFreeBitMapToThreadLocalFreeBitMap();
1254 LOG(INFO) << "RosAlloc::BulkFree() : Freed slot(s) in a thread local run 0x"
1255 << std::hex << reinterpret_cast<intptr_t>(run);
1257 DCHECK(run->IsThreadLocal());
1258 // A thread local run will be kept as a thread local even if
1261 bool run_was_full = run->IsFull();
1262 run->MergeBulkFreeBitMapIntoAllocBitMap();
1264 LOG(INFO) << "RosAlloc::BulkFree() : Freed slot(s) in a run 0x" << std::hex
1265 << reinterpret_cast<intptr_t>(run);
1267 // Check if the run should be moved to non_full_runs_ or
1272 if (run->IsAllFree()) {
1274 // run.
1275 bool run_was_current = run == current_runs_[idx];
1277 DCHECK(full_runs->find(run) == full_runs->end());
1278 DCHECK(non_full_runs->find(run) == non_full_runs->end());
1279 // If it was a current run, reuse it.
1281 // If it was full, remove it from the full run set (debug
1284 std::unordered_set<Run*, hash_run, eq_run>::iterator pos = full_runs->find(run);
1288 LOG(INFO) << "RosAlloc::BulkFree() : Erased run 0x" << std::hex
1289 << reinterpret_cast<intptr_t>(run)
1292 DCHECK(full_runs->find(run) == full_runs->end());
1295 // If it was in a non full run set, remove it from the set.
1296 DCHECK(full_runs->find(run) == full_runs->end());
1297 DCHECK(non_full_runs->find(run) != non_full_runs->end());
1298 non_full_runs->erase(run);
1300 LOG(INFO) << "RosAlloc::BulkFree() : Erased run 0x" << std::hex
1301 << reinterpret_cast<intptr_t>(run)
1304 DCHECK(non_full_runs->find(run) == non_full_runs->end());
1307 run->ZeroHeader();
1309 FreePages(self, run, true);
1312 // It is not completely free. If it wasn't the current run or
1313 // already in the non-full run set (i.e., it was full) insert
1314 // it into the non-full run set.
1315 if (run == current_runs_[idx]) {
1316 DCHECK(non_full_runs->find(run) == non_full_runs->end());
1317 DCHECK(full_runs->find(run) == full_runs->end());
1318 // If it was a current run, keep it.
1320 // If it was full, remove it from the full run set (debug
1321 // only) and insert into the non-full run set.
1322 DCHECK(full_runs->find(run) != full_runs->end());
1323 DCHECK(non_full_runs->find(run) == non_full_runs->end());
1325 full_runs->erase(run);
1327 LOG(INFO) << "RosAlloc::BulkFree() : Erased run 0x" << std::hex
1328 << reinterpret_cast<intptr_t>(run)
1332 non_full_runs->insert(run);
1334 LOG(INFO) << "RosAlloc::BulkFree() : Inserted run 0x" << std::hex
1335 << reinterpret_cast<intptr_t>(run)
1339 // If it was not full, so leave it in the non full run set.
1340 DCHECK(full_runs->find(run) == full_runs->end());
1341 DCHECK(non_full_runs->find(run) != non_full_runs->end());
1366 // Encountered a fresh free page run.
1379 // Reset at the end of the current free page run.
1386 // Still part of the current free page run.
1395 // Reset at the end of the current free page run.
1417 Run* run = reinterpret_cast<Run*>(base_ + i * kPageSize);
1418 size_t idx = run->size_bracket_idx_;
1422 << " is_thread_local=" << run->is_thread_local_
1423 << " is_all_free=" << (run->IsAllFree() ? 1 : 0)
1468 // Find the beginning of the run.
1474 Run* run = reinterpret_cast<Run*>(base_ + pm_idx * kPageSize);
1475 DCHECK_EQ(run->magic_num_, kMagicNum);
1476 size_t idx = run->size_bracket_idx_;
1478 - (reinterpret_cast<byte*>(run) + headerSizes[idx]);
1496 // Remove the last free page run, if any.
1554 // The start of a free page run.
1561 // In the debug build, the first page of a free page run
1602 // The start of a run.
1603 Run* run = reinterpret_cast<Run*>(base_ + i * kPageSize);
1604 DCHECK_EQ(run->magic_num_, kMagicNum);
1605 // The dedicated full run doesn't contain any real allocations, don't visit the slots in
1607 run->InspectAllSlots(handler, arg);
1608 size_t num_pages = numOfPages[run->size_bracket_idx_];
1662 // Note the thread local run may not be full here.
1674 void RosAlloc::RevokeRun(Thread* self, size_t idx, Run* run) {
1676 DCHECK(run != dedicated_full_run_);
1677 if (run->IsFull()) {
1679 full_runs_[idx].insert(run);
1680 DCHECK(full_runs_[idx].find(run) != full_runs_[idx].end());
1682 LOG(INFO) << __PRETTY_FUNCTION__ << " : Inserted run 0x" << std::hex
1683 << reinterpret_cast<intptr_t>(run)
1687 } else if (run->IsAllFree()) {
1688 run->ZeroHeader();
1690 FreePages(self, run, true);
1692 non_full_runs_[idx].insert(run);
1693 DCHECK(non_full_runs_[idx].find(run) != non_full_runs_[idx].end());
1695 LOG(INFO) << __PRETTY_FUNCTION__ << " : Inserted run 0x" << std::hex
1696 << reinterpret_cast<intptr_t>(run)
1850 // fail 100% of the time you attempt to allocate into the dedicated full run.
1889 // The start of a free page run.
1893 << "An empty page must belong to the free page run set";
1896 << "A free page run size isn't page-aligned : " << fpr_size;
1899 << "A free page run size must be > 0 : " << fpr_size;
1904 << " and the free page run size : page index range : "
1938 // The start of a run.
1939 Run* run = reinterpret_cast<Run*>(base_ + i * kPageSize);
1940 DCHECK_EQ(run->magic_num_, kMagicNum);
1941 size_t idx = run->size_bracket_idx_;
1950 << " and the run size : page index range " << i << " to " << (i + num_pages)
1954 runs.push_back(run);
1984 // The dedicated full run is currently marked as thread local.
1990 for (auto& run : runs) {
1991 run->Verify(self, this);
2006 << "Mismatch in the end address of the run " << Dump();
2010 // Make sure all the bits at the end of the run are set so that we don't allocate there.
2014 // Check the thread local runs, the current runs, and the run sets.
2016 // If it's a thread local run, then it must be pointed to by an owner thread.
2026 << "A thread local run has more than one owner thread " << Dump();
2028 << "A mismatching size bracket index in a thread local run " << Dump();
2033 CHECK(owner_found) << "A thread local run has no owner thread " << Dump();
2037 << "A non-thread-local run's thread local free bitmap isn't clean "
2039 // Check if it's a current run for the size bucket.
2050 // be a current run.
2052 << "A current run points to a run with a wrong size bracket index " << Dump();
2055 // If it's neither a thread local or current run, then it must be
2056 // in a run set.
2060 // If it's all free, it must be a free page run rather than a run.
2061 CHECK(!IsAllFree()) << "A free run must be in a free page run set " << Dump();
2063 // If it's not full, it must in the non-full run set.
2065 << "A non-full run isn't in the non-full run set " << Dump();
2067 // If it's full, it must in the full run set (debug build only.)
2071 << " A full run isn't in the full run set " << Dump();
2085 // If a thread local run, slots may be marked freed in the
2093 << "A run slot contains a large object " << Dump();
2097 << "A run slot contains an object with wrong size " << Dump();
2118 // This is currently the start of a free page run.
2125 // page run with an empty page run.
2128 // free page run before we acquire lock_. In that case free_page_runs_.find will not find
2129 // a run starting at fpr. To handle this race, we skip reclaiming the page range and go
2164 // In the debug build, the first page of a free page run