diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-08-07 20:12:50 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-08-07 20:12:50 +0200 |
commit | b67200dfead19f571e6c2c1bedb3eb57ff72dc87 (patch) | |
tree | b1ea4cfca8df7b471fcff43264bfac6e5683bf0a /Kernel/VM/VMObject.cpp | |
parent | 5096eaa8455fdacec8e0e23ee5ff76ec06490493 (diff) | |
download | serenity-b67200dfead19f571e6c2c1bedb3eb57ff72dc87.zip |
Kernel: Use a FixedArray for VMObject::m_physical_pages
This makes VMObject 8 bytes smaller since we can use the array size as
the page count.
The size() is now also computed from the page count instead of being
a separate value. This makes sizes always be a multiple of PAGE_SIZE,
which is sane.
Diffstat (limited to 'Kernel/VM/VMObject.cpp')
-rw-r--r-- | Kernel/VM/VMObject.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Kernel/VM/VMObject.cpp b/Kernel/VM/VMObject.cpp index e7885ffc4d..24c3b71352 100644 --- a/Kernel/VM/VMObject.cpp +++ b/Kernel/VM/VMObject.cpp @@ -4,18 +4,15 @@ #include <Kernel/VM/VMObject.h> VMObject::VMObject(const VMObject& other) - : m_size(other.m_size) - , m_physical_pages(other.m_physical_pages) + : m_physical_pages(other.m_physical_pages) { MM.register_vmo(*this); } -VMObject::VMObject(size_t size, ShouldFillPhysicalPages should_fill_physical_pages) - : m_size(size) +VMObject::VMObject(size_t size) + : m_physical_pages(ceil_div(size, PAGE_SIZE)) { MM.register_vmo(*this); - if (should_fill_physical_pages == ShouldFillPhysicalPages::Yes) - m_physical_pages.resize(page_count()); } VMObject::~VMObject() |