Lines Matching refs:run

108     LOG(INFO) << "RosAlloc::RosAlloc() : Inserted run 0x" << std::hex
128 // Find the lowest address free page run that's large enough.
138 LOG(INFO) << "RosAlloc::AllocPages() : Erased run 0x"
153 LOG(INFO) << "RosAlloc::AllocPages() : Inserted run 0x" << std::hex
173 // There is a free page run at the end.
178 // There is no free page run at the end.
196 // There was a free page run at the end. Expand its size.
202 // Otherwise, insert a new free page run at the end.
212 LOG(INFO) << "RosAlloc::AlloPages() : Grew the heap by inserting run 0x"
224 // And retry the last free page run.
237 LOG(INFO) << "RosAlloc::AllocPages() : Erased run 0x" << std::hex << reinterpret_cast<intptr_t>(fpr)
250 LOG(INFO) << "RosAlloc::AllocPages() : Inserted run 0x" << std::hex
350 // Turn it into a free run.
362 LOG(INFO) << __PRETTY_FUNCTION__ << "RosAlloc::FreePages() : trying to coalesce a free page run 0x"
373 LOG(INFO) << "RosAlloc::FreePages() : trying to coalesce with a higher free page run 0x"
382 // Clear magic num since this is no longer the start of a free page run.
388 LOG(INFO) << "RosAlloc::FreePages() : (coalesce) Erased run 0x" << std::hex
415 LOG(INFO) << "RosAlloc::FreePages() : trying to coalesce with a lower free page run 0x"
426 LOG(INFO) << "RosAlloc::FreePages() : (coalesce) Erased run 0x" << std::hex
432 // Clear magic num since this is no longer the start of a free page run.
460 LOG(INFO) << "RosAlloc::FreePages() : Inserted run 0x" << std::hex << reinterpret_cast<intptr_t>(fpr)
507 Run* run = nullptr;
523 // Find the beginning of the run.
530 run = reinterpret_cast<Run*>(base_ + pm_idx * kPageSize);
531 DCHECK_EQ(run->magic_num_, kMagicNum);
543 DCHECK(run != nullptr);
544 return FreeFromRun(self, ptr, run);
566 // Take ownership of the cache lines if we are likely to be thread local run.
587 // Get the lowest address non-full run from the binary tree.
590 // If there's one, use it as the current run.
598 // If there's none, allocate a new run and use it as the current run.
607 // The current run got full. Try to refill it.
612 LOG(INFO) << __PRETTY_FUNCTION__ << " : Inserted run 0x" << std::hex
621 // Failed to allocate a new run, make sure that it is the dedicated full run.
632 // Must succeed now with a new run.
668 // Use a thread-local run.
680 // The allocation must fail if the run is invalid.
682 << "allocated from an invalid run";
684 // The run got full. Try to free slots.
695 // No slots got freed. Try to refill the thread-local run.
702 LOG(INFO) << "RosAlloc::AllocFromRun() : Inserted run 0x" << std::hex
725 // Account for all the free slots in the new or refreshed thread local run.
728 // Must succeed now with a new run.
744 // Use the (shared) current run.
763 size_t RosAlloc::FreeFromRun(Thread* self, void* ptr, Run* run) {
764 DCHECK_EQ(run->magic_num_, kMagicNum);
765 DCHECK_LT(run, ptr);
766 DCHECK_LT(ptr, run->End());
767 const size_t idx = run->size_bracket_idx_;
772 run_was_full = run->IsFull();
777 if (LIKELY(run->IsThreadLocal())) {
778 // It's a thread-local run. Just mark the thread-local free bit map and return.
779 DCHECK_LT(run->size_bracket_idx_, kNumThreadLocalSizeBrackets);
780 DCHECK(non_full_runs_[idx].find(run) == non_full_runs_[idx].end());
781 DCHECK(full_runs_[idx].find(run) == full_runs_[idx].end());
782 run->AddToThreadLocalFreeList(ptr);
784 LOG(INFO) << "RosAlloc::FreeFromRun() : Freed a slot in a thread local run 0x" << std::hex
785 << reinterpret_cast<intptr_t>(run);
787 // A thread local run will be kept as a thread local even if it's become all free.
790 // Free the slot in the run.
791 run->FreeSlot(ptr);
793 if (run->IsAllFree()) {
794 // It has just become completely free. Free the pages of this run.
795 std::set<Run*>::iterator pos = non_full_runs->find(run);
799 LOG(INFO) << "RosAlloc::FreeFromRun() : Erased run 0x" << std::hex
800 << reinterpret_cast<intptr_t>(run) << " from non_full_runs_";
803 if (run == current_runs_[idx]) {
806 DCHECK(non_full_runs_[idx].find(run) == non_full_runs_[idx].end());
807 DCHECK(full_runs_[idx].find(run) == full_runs_[idx].end());
808 run->ZeroHeaderAndSlotHeaders();
811 FreePages(self, run, true);
814 // It is not completely free. If it wasn't the current run or
815 // already in the non-full run set (i.e., it was full) insert it
816 // into the non-full run set.
817 if (run != current_runs_[idx]) {
819 auto pos = non_full_runs->find(run);
822 DCHECK(full_runs->find(run) != full_runs->end());
824 full_runs->erase(run);
826 LOG(INFO) << "RosAlloc::FreeFromRun() : Erased run 0x" << std::hex
827 << reinterpret_cast<intptr_t>(run) << " from full_runs_";
830 non_full_runs->insert(run);
831 DCHECK(!run->IsFull());
833 LOG(INFO) << "RosAlloc::FreeFromRun() : Inserted run 0x" << std::hex
834 << reinterpret_cast<intptr_t>(run)
955 // Check that the entire run is all zero.
1034 Run* run = nullptr;
1044 run = reinterpret_cast<Run*>(base_ + pm_idx * kPageSize);
1047 // Find the beginning of the run.
1052 run = reinterpret_cast<Run*>(base_ + pi * kPageSize);
1071 run = reinterpret_cast<Run*>(base_ + pm_idx * kPageSize);
1074 // Find the beginning of the run.
1079 run = reinterpret_cast<Run*>(base_ + pi * kPageSize);
1087 DCHECK(run != nullptr);
1088 DCHECK_EQ(run->magic_num_, kMagicNum);
1090 freed_bytes += run->AddToBulkFreeList(ptr);
1092 if (!run->to_be_bulk_freed_) {
1093 run->to_be_bulk_freed_ = true;
1094 runs.push_back(run);
1097 runs.insert(run);
1105 for (Run* run : runs) {
1107 DCHECK(run->to_be_bulk_freed_);
1108 run->to_be_bulk_freed_ = false;
1110 size_t idx = run->size_bracket_idx_;
1112 if (run->IsThreadLocal()) {
1113 DCHECK_LT(run->size_bracket_idx_, kNumThreadLocalSizeBrackets);
1114 DCHECK(non_full_runs_[idx].find(run) == non_full_runs_[idx].end());
1115 DCHECK(full_runs_[idx].find(run) == full_runs_[idx].end());
1116 run->MergeBulkFreeListToThreadLocalFreeList();
1118 LOG(INFO) << "RosAlloc::BulkFree() : Freed slot(s) in a thread local run 0x"
1119 << std::hex << reinterpret_cast<intptr_t>(run);
1121 DCHECK(run->IsThreadLocal());
1122 // A thread local run will be kept as a thread local even if
1125 bool run_was_full = run->IsFull();
1126 run->MergeBulkFreeListToFreeList();
1128 LOG(INFO) << "RosAlloc::BulkFree() : Freed slot(s) in a run 0x" << std::hex
1129 << reinterpret_cast<intptr_t>(run);
1131 // Check if the run should be moved to non_full_runs_ or
1135 if (run->IsAllFree()) {
1137 // run.
1138 bool run_was_current = run == current_runs_[idx];
1140 DCHECK(full_runs->find(run) == full_runs->end());
1141 DCHECK(non_full_runs->find(run) == non_full_runs->end());
1142 // If it was a current run, reuse it.
1144 // If it was full, remove it from the full run set (debug
1147 std::unordered_set<Run*, hash_run, eq_run>::iterator pos = full_runs->find(run);
1151 LOG(INFO) << "RosAlloc::BulkFree() : Erased run 0x" << std::hex
1152 << reinterpret_cast<intptr_t>(run)
1155 DCHECK(full_runs->find(run) == full_runs->end());
1158 // If it was in a non full run set, remove it from the set.
1159 DCHECK(full_runs->find(run) == full_runs->end());
1160 DCHECK(non_full_runs->find(run) != non_full_runs->end());
1161 non_full_runs->erase(run);
1163 LOG(INFO) << "RosAlloc::BulkFree() : Erased run 0x" << std::hex
1164 << reinterpret_cast<intptr_t>(run)
1167 DCHECK(non_full_runs->find(run) == non_full_runs->end());
1170 run->ZeroHeaderAndSlotHeaders();
1172 FreePages(self, run, true);
1175 // It is not completely free. If it wasn't the current run or
1176 // already in the non-full run set (i.e., it was full) insert
1177 // it into the non-full run set.
1178 if (run == current_runs_[idx]) {
1179 DCHECK(non_full_runs->find(run) == non_full_runs->end());
1180 DCHECK(full_runs->find(run) == full_runs->end());
1181 // If it was a current run, keep it.
1183 // If it was full, remove it from the full run set (debug
1184 // only) and insert into the non-full run set.
1185 DCHECK(full_runs->find(run) != full_runs->end());
1186 DCHECK(non_full_runs->find(run) == non_full_runs->end());
1188 full_runs->erase(run);
1190 LOG(INFO) << "RosAlloc::BulkFree() : Erased run 0x" << std::hex
1191 << reinterpret_cast<intptr_t>(run)
1195 non_full_runs->insert(run);
1197 LOG(INFO) << "RosAlloc::BulkFree() : Inserted run 0x" << std::hex
1198 << reinterpret_cast<intptr_t>(run)
1202 // If it was not full, so leave it in the non full run set.
1203 DCHECK(full_runs->find(run) == full_runs->end());
1204 DCHECK(non_full_runs->find(run) != non_full_runs->end());
1229 // Encountered a fresh free page run.
1242 // Reset at the end of the current free page run.
1249 // Still part of the current free page run.
1258 // Reset at the end of the current free page run.
1280 Run* run = reinterpret_cast<Run*>(base_ + i * kPageSize);
1281 size_t idx = run->size_bracket_idx_;
1285 << " is_thread_local=" << run->is_thread_local_
1286 << " is_all_free=" << (run->IsAllFree() ? 1 : 0)
1331 // Find the beginning of the run.
1337 Run* run = reinterpret_cast<Run*>(base_ + pm_idx * kPageSize);
1338 DCHECK_EQ(run->magic_num_, kMagicNum);
1339 size_t idx = run->size_bracket_idx_;
1341 - (reinterpret_cast<uint8_t*>(run) + headerSizes[idx]);
1359 // Remove the last free page run, if any.
1417 // The start of a free page run.
1424 // In the debug build, the first page of a free page run
1465 // The start of a run.
1466 Run* run = reinterpret_cast<Run*>(base_ + i * kPageSize);
1467 DCHECK_EQ(run->magic_num_, kMagicNum);
1468 // The dedicated full run doesn't contain any real allocations, don't visit the slots in
1470 run->InspectAllSlots(handler, arg);
1471 size_t num_pages = numOfPages[run->size_bracket_idx_];
1523 // Note the thread local run may not be full here.
1531 // If thread local run is true, GC thread will help update thread local free list
1533 // either when this thread local run is full or when revoking this run here. In this
1534 // case the free list wll be updated. If thread local run is false, GC thread will help
1548 void RosAlloc::RevokeRun(Thread* self, size_t idx, Run* run) {
1550 DCHECK(run != dedicated_full_run_);
1551 if (run->IsFull()) {
1553 full_runs_[idx].insert(run);
1554 DCHECK(full_runs_[idx].find(run) != full_runs_[idx].end());
1556 LOG(INFO) << __PRETTY_FUNCTION__ << " : Inserted run 0x" << std::hex
1557 << reinterpret_cast<intptr_t>(run)
1561 } else if (run->IsAllFree()) {
1562 run->ZeroHeaderAndSlotHeaders();
1564 FreePages(self, run, true);
1566 non_full_runs_[idx].insert(run);
1567 DCHECK(non_full_runs_[idx].find(run) != non_full_runs_[idx].end());
1569 LOG(INFO) << __PRETTY_FUNCTION__ << " : Inserted run 0x" << std::hex
1570 << reinterpret_cast<intptr_t>(run)
1711 // Set up the dedicated full run so that nobody can successfully allocate from it.
1716 // fail 100% of the time you attempt to allocate into the dedicated full run.
1766 // The start of a free page run.
1770 << "An empty page must belong to the free page run set";
1773 << "A free page run size isn't page-aligned : " << fpr_size;
1776 << "A free page run size must be > 0 : " << fpr_size;
1781 << " and the free page run size : page index range : "
1818 // The start of a run.
1819 Run* run = reinterpret_cast<Run*>(base_ + i * kPageSize);
1820 DCHECK_EQ(run->magic_num_, kMagicNum);
1821 size_t idx = run->size_bracket_idx_;
1830 << " and the run size : page index range " << i << " to " << (i + num_pages)
1834 runs.push_back(run);
1864 // The dedicated full run is currently marked as thread local.
1870 for (auto& run : runs) {
1871 run->Verify(self, this, is_running_on_memory_tool_);
1884 << "Mismatch in the end address of the run " << Dump();
1887 // Check the thread local runs, the current runs, and the run sets.
1889 // If it's a thread local run, then it must be pointed to by an owner thread.
1899 << "A thread local run has more than one owner thread " << Dump();
1901 << "A mismatching size bracket index in a thread local run " << Dump();
1906 CHECK(owner_found) << "A thread local run has no owner thread " << Dump();
1910 << "A non-thread-local run's thread local free list isn't empty "
1912 // Check if it's a current run for the size bracket.
1923 // be a current run.
1925 << "A current run points to a run with a wrong size bracket index " << Dump();
1928 // If it's neither a thread local or current run, then it must be
1929 // in a run set.
1933 // If it's all free, it must be a free page run rather than a run.
1934 CHECK(!IsAllFree()) << "A free run must be in a free page run set " << Dump();
1936 // If it's not full, it must in the non-full run set.
1938 << "A non-full run isn't in the non-full run set " << Dump();
1940 // If it's full, it must in the full run set (debug build only.)
1944 << " A full run isn't in the full run set " << Dump();
1978 << "A run slot contains a large object " << Dump();
1982 << " A run slot contains an object with wrong size " << Dump();
2002 // This is currently the start of a free page run.
2009 // page run with an empty page run.
2012 // free page run before we acquire lock_. In that case free_page_runs_.find will not find
2013 // a run starting at fpr. To handle this race, we skip reclaiming the page range and go
2048 // In the debug build, the first page of a free page run
2143 Run* run = reinterpret_cast<Run*>(base_ + i * kPageSize);
2144 size_t idx = run->size_bracket_idx_;
2149 size_t num_free_slots = run->NumberOfFreeSlots();