mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
Replace zones with individually tracked physical pages.
It's just a simple struct { ref_count, paddr }. This will allow me to implement lazy zeroing and COW pages.
This commit is contained in:
parent
b5c5286ee1
commit
72cdc62155
10 changed files with 161 additions and 127 deletions
17
AK/Vector.h
17
AK/Vector.h
|
@ -75,6 +75,13 @@ public:
|
|||
other.m_impl = nullptr;
|
||||
}
|
||||
|
||||
Vector(const Vector& other)
|
||||
{
|
||||
ensureCapacity(other.size());
|
||||
for (size_t i = 0; i < other.size(); ++i)
|
||||
unchecked_append(other[i]);
|
||||
}
|
||||
|
||||
Vector& operator=(Vector&& other)
|
||||
{
|
||||
if (this != &other) {
|
||||
|
@ -140,16 +147,22 @@ public:
|
|||
Vector<T> tmp = move(other);
|
||||
ensureCapacity(size() + tmp.size());
|
||||
for (auto&& v : tmp) {
|
||||
uncheckedAppend(move(v));
|
||||
unchecked_append(move(v));
|
||||
}
|
||||
}
|
||||
|
||||
void uncheckedAppend(T&& value)
|
||||
void unchecked_append(T&& value)
|
||||
{
|
||||
new (m_impl->slot(m_impl->m_size)) T(move(value));
|
||||
++m_impl->m_size;
|
||||
}
|
||||
|
||||
void unchecked_append(const T& value)
|
||||
{
|
||||
new (m_impl->slot(m_impl->m_size)) T(value);
|
||||
++m_impl->m_size;
|
||||
}
|
||||
|
||||
void append(T&& value)
|
||||
{
|
||||
ensureCapacity(size() + 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue