mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
This commit is contained in:
parent
689ca370d4
commit
359d6e7b0b
111 changed files with 517 additions and 503 deletions
|
@ -365,7 +365,7 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map()
|
|||
}
|
||||
|
||||
for (auto& region : global_data.physical_regions)
|
||||
global_data.system_memory_info.physical_pages += region.size();
|
||||
global_data.system_memory_info.physical_pages += region->size();
|
||||
|
||||
register_reserved_ranges();
|
||||
for (auto& range : global_data.reserved_memory_ranges) {
|
||||
|
@ -384,8 +384,8 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map()
|
|||
}
|
||||
|
||||
for (auto& region : global_data.physical_regions) {
|
||||
dmesgln("MM: User physical region: {} - {} (size {:#x})", region.lower(), region.upper().offset(-1), PAGE_SIZE * region.size());
|
||||
region.initialize_zones();
|
||||
dmesgln("MM: User physical region: {} - {} (size {:#x})", region->lower(), region->upper().offset(-1), PAGE_SIZE * region->size());
|
||||
region->initialize_zones();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -425,8 +425,8 @@ UNMAP_AFTER_INIT void MemoryManager::initialize_physical_pages()
|
|||
Optional<size_t> found_region_index;
|
||||
for (size_t i = 0; i < global_data.physical_regions.size(); ++i) {
|
||||
auto& region = global_data.physical_regions[i];
|
||||
if (region.size() >= physical_page_array_pages_and_page_tables_count) {
|
||||
found_region = ®ion;
|
||||
if (region->size() >= physical_page_array_pages_and_page_tables_count) {
|
||||
found_region = region;
|
||||
found_region_index = i;
|
||||
break;
|
||||
}
|
||||
|
@ -894,10 +894,10 @@ void MemoryManager::deallocate_physical_page(PhysicalAddress paddr)
|
|||
return m_global_data.with([&](auto& global_data) {
|
||||
// Are we returning a user page?
|
||||
for (auto& region : global_data.physical_regions) {
|
||||
if (!region.contains(paddr))
|
||||
if (!region->contains(paddr))
|
||||
continue;
|
||||
|
||||
region.return_page(paddr);
|
||||
region->return_page(paddr);
|
||||
--global_data.system_memory_info.physical_pages_used;
|
||||
|
||||
// Always return pages to the uncommitted pool. Pages that were
|
||||
|
@ -925,7 +925,7 @@ RefPtr<PhysicalPage> MemoryManager::find_free_physical_page(bool committed)
|
|||
global_data.system_memory_info.physical_pages_uncommitted--;
|
||||
}
|
||||
for (auto& region : global_data.physical_regions) {
|
||||
page = region.take_free_page();
|
||||
page = region->take_free_page();
|
||||
if (!page.is_null()) {
|
||||
++global_data.system_memory_info.physical_pages_used;
|
||||
break;
|
||||
|
@ -1020,7 +1020,7 @@ ErrorOr<Vector<NonnullRefPtr<PhysicalPage>>> MemoryManager::allocate_contiguous_
|
|||
return ENOMEM;
|
||||
|
||||
for (auto& physical_region : global_data.physical_regions) {
|
||||
auto physical_pages = physical_region.take_contiguous_free_pages(page_count);
|
||||
auto physical_pages = physical_region->take_contiguous_free_pages(page_count);
|
||||
if (!physical_pages.is_empty()) {
|
||||
global_data.system_memory_info.physical_pages_uncommitted -= page_count;
|
||||
global_data.system_memory_info.physical_pages_used += page_count;
|
||||
|
|
|
@ -292,7 +292,7 @@ private:
|
|||
|
||||
SystemMemoryInfo system_memory_info;
|
||||
|
||||
NonnullOwnPtrVector<PhysicalRegion> physical_regions;
|
||||
Vector<NonnullOwnPtr<PhysicalRegion>> physical_regions;
|
||||
OwnPtr<PhysicalRegion> physical_pages_region;
|
||||
|
||||
RegionTree region_tree;
|
||||
|
|
|
@ -46,7 +46,7 @@ void PhysicalRegion::initialize_zones()
|
|||
while (remaining_pages >= pages_per_zone) {
|
||||
m_zones.append(adopt_nonnull_own_or_enomem(new (nothrow) PhysicalZone(base_address, pages_per_zone)).release_value_but_fixme_should_propagate_errors());
|
||||
base_address = base_address.offset(pages_per_zone * PAGE_SIZE);
|
||||
m_usable_zones.append(m_zones.last());
|
||||
m_usable_zones.append(*m_zones.last());
|
||||
remaining_pages -= pages_per_zone;
|
||||
++zone_count;
|
||||
}
|
||||
|
@ -131,10 +131,10 @@ void PhysicalRegion::return_page(PhysicalAddress paddr)
|
|||
zone_index = m_large_zones + (paddr.get() - small_zone_base) / small_zone_size;
|
||||
|
||||
auto& zone = m_zones[zone_index];
|
||||
VERIFY(zone.contains(paddr));
|
||||
zone.deallocate_block(paddr, 0);
|
||||
if (m_full_zones.contains(zone))
|
||||
m_usable_zones.append(zone);
|
||||
VERIFY(zone->contains(paddr));
|
||||
zone->deallocate_block(paddr, 0);
|
||||
if (m_full_zones.contains(*zone))
|
||||
m_usable_zones.append(*zone);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ private:
|
|||
static constexpr size_t large_zone_size = 16 * MiB;
|
||||
static constexpr size_t small_zone_size = 1 * MiB;
|
||||
|
||||
NonnullOwnPtrVector<PhysicalZone> m_zones;
|
||||
Vector<NonnullOwnPtr<PhysicalZone>> m_zones;
|
||||
|
||||
size_t m_large_zones { 0 };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue