Unreviewed, rolling out r197955.
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2016 05:39:35 +0000 (05:39 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2016 05:39:35 +0000 (05:39 +0000)
I decided to go in another direction

Reverted changeset:

"bmalloc: Rename SmallPage to SmallRun"
https://bugs.webkit.org/show_bug.cgi?id=155320
http://trac.webkit.org/changeset/197955

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198198 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
Source/bmalloc/bmalloc/Allocator.cpp
Source/bmalloc/bmalloc/Heap.cpp
Source/bmalloc/bmalloc/Heap.h
Source/bmalloc/bmalloc/LineMetadata.h
Source/bmalloc/bmalloc/SmallChunk.h
Source/bmalloc/bmalloc/SmallPage.h [moved from Source/bmalloc/bmalloc/SmallRun.h with 88% similarity]
Source/bmalloc/bmalloc/VMHeap.cpp
Source/bmalloc/bmalloc/VMHeap.h

index a6d182d..a8dd510 100644 (file)
@@ -1,3 +1,15 @@
+2016-03-14  Geoffrey Garen  <ggaren@apple.com>
+
+        Unreviewed, rolling out r197955.
+
+        I decided to go in another direction
+
+        Reverted changeset:
+
+        "bmalloc: Rename SmallPage to SmallRun"
+        https://bugs.webkit.org/show_bug.cgi?id=155320
+        http://trac.webkit.org/changeset/197955
+
 2016-03-10  Geoffrey Garen  <ggaren@apple.com>
 
         bmalloc: Rename SmallPage to SmallRun
index e946b97..f1ff74c 100644 (file)
@@ -43,7 +43,7 @@
                14DD789C18F48D4A00950702 /* BumpAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1413E462189DE1CD00546D68 /* BumpAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14DD78BB18F48D6B00950702 /* SmallChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA8C18CD36A7002201E4 /* SmallChunk.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14DD78BC18F48D6B00950702 /* SmallLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 1452478618BC757C00F80098 /* SmallLine.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               14DD78BD18F48D6B00950702 /* SmallRun.h in Headers */ = {isa = PBXBuildFile; fileRef = 143E29ED18CAE90500FE8A0F /* SmallRun.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               14DD78BD18F48D6B00950702 /* SmallPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 143E29ED18CAE90500FE8A0F /* SmallPage.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14DD78C518F48D7500950702 /* Algorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 1421A87718EE462A00B4DD68 /* Algorithm.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14DD78C618F48D7500950702 /* AsyncTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 1417F65218BA88A00076FA3F /* AsyncTask.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14DD78C718F48D7500950702 /* BAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 1413E468189EEDE400546D68 /* BAssert.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -91,7 +91,7 @@
                1421A87718EE462A00B4DD68 /* Algorithm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Algorithm.h; path = bmalloc/Algorithm.h; sourceTree = "<group>"; };
                143CB81A19022BC900B16A45 /* StaticMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticMutex.cpp; path = bmalloc/StaticMutex.cpp; sourceTree = "<group>"; };
                143CB81B19022BC900B16A45 /* StaticMutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StaticMutex.h; path = bmalloc/StaticMutex.h; sourceTree = "<group>"; };
-               143E29ED18CAE90500FE8A0F /* SmallRun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmallRun.h; path = bmalloc/SmallRun.h; sourceTree = "<group>"; };
+               143E29ED18CAE90500FE8A0F /* SmallPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmallPage.h; path = bmalloc/SmallPage.h; sourceTree = "<group>"; };
                143EF9AD1A9FABF6004F5C77 /* FreeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FreeList.cpp; path = bmalloc/FreeList.cpp; sourceTree = "<group>"; };
                143EF9AE1A9FABF6004F5C77 /* FreeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FreeList.h; path = bmalloc/FreeList.h; sourceTree = "<group>"; };
                1440AFC81A95142400837FAA /* SuperChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SuperChunk.h; path = bmalloc/SuperChunk.h; sourceTree = "<group>"; };
                        children = (
                                147AAA8C18CD36A7002201E4 /* SmallChunk.h */,
                                1452478618BC757C00F80098 /* SmallLine.h */,
-                               143E29ED18CAE90500FE8A0F /* SmallRun.h */,
+                               143E29ED18CAE90500FE8A0F /* SmallPage.h */,
                        );
                        name = "heap: small";
                        sourceTree = "<group>";
                                1400274918F89C1300115C97 /* Heap.h in Headers */,
                                140FA00319CE429C00FFD3C8 /* BumpRange.h in Headers */,
                                14DD78C518F48D7500950702 /* Algorithm.h in Headers */,
-                               14DD78BD18F48D6B00950702 /* SmallRun.h in Headers */,
+                               14DD78BD18F48D6B00950702 /* SmallPage.h in Headers */,
                                14DD788E18F48CCD00950702 /* BoundaryTag.h in Headers */,
                                146041E71C7FF2EF00E9F94E /* SortedVector.h in Headers */,
                                14DD78C818F48D7500950702 /* FixedVector.h in Headers */,
index c099d75..23514eb 100644 (file)
@@ -114,8 +114,8 @@ void* Allocator::reallocate(void* object, size_t newSize)
     size_t oldSize = 0;
     switch (objectType(object)) {
     case Small: {
-        SmallRun* run = SmallRun::get(SmallLine::get(object));
-        oldSize = objectSize(run->sizeClass());
+        SmallPage* page = SmallPage::get(SmallLine::get(object));
+        oldSize = objectSize(page->sizeClass());
         break;
     }
     case Large: {
index 6f923cd..c6cc510 100644 (file)
@@ -30,7 +30,7 @@
 #include "PerProcess.h"
 #include "SmallChunk.h"
 #include "SmallLine.h"
-#include "SmallRun.h"
+#include "SmallPage.h"
 #include <thread>
 
 namespace bmalloc {
@@ -40,16 +40,16 @@ Heap::Heap(std::lock_guard<StaticMutex>&)
     , m_isAllocatingPages(false)
     , m_scavenger(*this, &Heap::concurrentScavenge)
 {
-    initializeSmallRunMetadata();
+    initializeLineMetadata();
 }
 
-void Heap::initializeSmallRunMetadata()
+void Heap::initializeLineMetadata()
 {
-    // We assume that m_smallRunMetadata is zero-filled.
+    // We assume that m_smallLineMetadata is zero-filled.
 
     for (size_t size = alignment; size <= smallMax; size += alignment) {
         size_t sizeClass = bmalloc::sizeClass(size);
-        auto& metadata = m_smallRunMetadata[sizeClass];
+        auto& metadata = m_smallLineMetadata[sizeClass];
 
         size_t object = 0;
         size_t line = 0;
@@ -84,17 +84,17 @@ void Heap::scavenge(std::unique_lock<StaticMutex>& lock, std::chrono::millisecon
 {
     waitUntilFalse(lock, sleepDuration, m_isAllocatingPages);
 
-    scavengeSmallRuns(lock, sleepDuration);
+    scavengeSmallPages(lock, sleepDuration);
     scavengeLargeObjects(lock, sleepDuration);
     scavengeXLargeObjects(lock, sleepDuration);
 
     sleep(lock, sleepDuration);
 }
 
-void Heap::scavengeSmallRuns(std::unique_lock<StaticMutex>& lock, std::chrono::milliseconds sleepDuration)
+void Heap::scavengeSmallPages(std::unique_lock<StaticMutex>& lock, std::chrono::milliseconds sleepDuration)
 {
-    while (!m_smallRuns.isEmpty()) {
-        m_vmHeap.deallocateSmallRun(lock, m_smallRuns.pop());
+    while (!m_smallPages.isEmpty()) {
+        m_vmHeap.deallocateSmallPage(lock, m_smallPages.pop());
         waitUntilFalse(lock, sleepDuration, m_isAllocatingPages);
     }
 }
@@ -126,22 +126,22 @@ void Heap::scavengeXLargeObjects(std::unique_lock<StaticMutex>& lock, std::chron
 void Heap::allocateSmallBumpRanges(std::lock_guard<StaticMutex>& lock, size_t sizeClass, BumpAllocator& allocator, BumpRangeCache& rangeCache)
 {
     BASSERT(!rangeCache.size());
-    SmallRun* run = allocateSmallRun(lock, sizeClass);
-    SmallLine* lines = run->begin();
-    BASSERT(run->hasFreeLines(lock));
+    SmallPage* page = allocateSmallPage(lock, sizeClass);
+    SmallLine* lines = page->begin();
+    BASSERT(page->hasFreeLines(lock));
 
     // Find a free line.
     for (size_t lineNumber = 0; lineNumber < smallLineCount; ++lineNumber) {
         if (lines[lineNumber].refCount(lock))
             continue;
 
-        LineMetadata& lineMetadata = m_smallRunMetadata[sizeClass][lineNumber];
+        LineMetadata& lineMetadata = m_smallLineMetadata[sizeClass][lineNumber];
         if (!lineMetadata.objectCount)
             continue;
 
-        // In a fragmented run, some free ranges might not fit in the cache.
+        // In a fragmented page, some free ranges might not fit in the cache.
         if (rangeCache.size() == rangeCache.capacity()) {
-            m_smallRunsWithFreeLines[sizeClass].push(run);
+            m_smallPagesWithFreeLines[sizeClass].push(page);
             BASSERT(allocator.canAllocate());
             return;
         }
@@ -149,20 +149,20 @@ void Heap::allocateSmallBumpRanges(std::lock_guard<StaticMutex>& lock, size_t si
         char* begin = lines[lineNumber].begin() + lineMetadata.startOffset;
         unsigned short objectCount = lineMetadata.objectCount;
         lines[lineNumber].ref(lock, lineMetadata.objectCount);
-        run->ref(lock);
+        page->ref(lock);
 
         // Merge with subsequent free lines.
         while (++lineNumber < smallLineCount) {
             if (lines[lineNumber].refCount(lock))
                 break;
 
-            LineMetadata& lineMetadata = m_smallRunMetadata[sizeClass][lineNumber];
+            LineMetadata& lineMetadata = m_smallLineMetadata[sizeClass][lineNumber];
             if (!lineMetadata.objectCount)
                 continue;
 
             objectCount += lineMetadata.objectCount;
             lines[lineNumber].ref(lock, lineMetadata.objectCount);
-            run->ref(lock);
+            page->ref(lock);
         }
 
         if (!allocator.canAllocate())
@@ -172,45 +172,46 @@ void Heap::allocateSmallBumpRanges(std::lock_guard<StaticMutex>& lock, size_t si
     }
 
     BASSERT(allocator.canAllocate());
-    run->setHasFreeLines(lock, false);
+    page->setHasFreeLines(lock, false);
 }
 
-SmallRun* Heap::allocateSmallRun(std::lock_guard<StaticMutex>& lock, size_t sizeClass)
+SmallPage* Heap::allocateSmallPage(std::lock_guard<StaticMutex>& lock, size_t sizeClass)
 {
-    if (!m_smallRunsWithFreeLines[sizeClass].isEmpty())
-        return m_smallRunsWithFreeLines[sizeClass].pop();
+    if (!m_smallPagesWithFreeLines[sizeClass].isEmpty())
+        return m_smallPagesWithFreeLines[sizeClass].pop();
 
-    SmallRun* run = [this, &lock]() {
-        if (!m_smallRuns.isEmpty())
-            return m_smallRuns.pop();
+    SmallPage* page = [this, &lock]() {
+        if (!m_smallPages.isEmpty())
+            return m_smallPages.pop();
 
         m_isAllocatingPages = true;
-        return m_vmHeap.allocateSmallRun(lock);
+        SmallPage* page = m_vmHeap.allocateSmallPage(lock);
+        return page;
     }();
 
-    run->setSizeClass(sizeClass);
-    return run;
+    page->setSizeClass(sizeClass);
+    return page;
 }
 
 void Heap::deallocateSmallLine(std::lock_guard<StaticMutex>& lock, SmallLine* line)
 {
     BASSERT(!line->refCount(lock));
-    SmallRun* run = SmallRun::get(line);
-    run->deref(lock);
+    SmallPage* page = SmallPage::get(line);
+    page->deref(lock);
 
-    if (!run->hasFreeLines(lock)) {
-        run->setHasFreeLines(lock, true);
-        m_smallRunsWithFreeLines[run->sizeClass()].push(run);
+    if (!page->hasFreeLines(lock)) {
+        page->setHasFreeLines(lock, true);
+        m_smallPagesWithFreeLines[page->sizeClass()].push(page);
 
-        BASSERT(run->refCount(lock));
+        BASSERT(page->refCount(lock));
         return;
     }
 
-    if (run->refCount(lock))
+    if (page->refCount(lock))
         return;
 
-    m_smallRunsWithFreeLines[run->sizeClass()].remove(run);
-    m_smallRuns.push(run);
+    m_smallPagesWithFreeLines[page->sizeClass()].remove(page);
+    m_smallPages.push(page);
     m_scavenger.run();
 }
 
index bed6cdc..1e680af 100644 (file)
@@ -34,7 +34,7 @@
 #include "SegregatedFreeList.h"
 #include "SmallChunk.h"
 #include "SmallLine.h"
-#include "SmallRun.h"
+#include "SmallPage.h"
 #include "VMHeap.h"
 #include "Vector.h"
 #include "XLargeMap.h"
@@ -72,9 +72,9 @@ public:
 private:
     ~Heap() = delete;
     
-    void initializeSmallRunMetadata();
+    void initializeLineMetadata();
 
-    SmallRun* allocateSmallRun(std::lock_guard<StaticMutex>&, size_t sizeClass);
+    SmallPage* allocateSmallPage(std::lock_guard<StaticMutex>&, size_t sizeClass);
 
     void deallocateSmallLine(std::lock_guard<StaticMutex>&, SmallLine*);
     void deallocateLarge(std::lock_guard<StaticMutex>&, const LargeObject&);
@@ -88,15 +88,15 @@ private:
     XLargeRange splitAndAllocate(XLargeRange&, size_t alignment, size_t);
 
     void concurrentScavenge();
-    void scavengeSmallRuns(std::unique_lock<StaticMutex>&, std::chrono::milliseconds);
+    void scavengeSmallPages(std::unique_lock<StaticMutex>&, std::chrono::milliseconds);
     void scavengeLargeObjects(std::unique_lock<StaticMutex>&, std::chrono::milliseconds);
     void scavengeXLargeObjects(std::unique_lock<StaticMutex>&, std::chrono::milliseconds);
 
-    std::array<RunMetadata, smallMax / alignment> m_smallRunMetadata;
+    std::array<std::array<LineMetadata, smallLineCount>, smallMax / alignment> m_smallLineMetadata;
 
-    std::array<List<SmallRun>, smallMax / alignment> m_smallRunsWithFreeLines;
+    std::array<List<SmallPage>, smallMax / alignment> m_smallPagesWithFreeLines;
 
-    List<SmallRun> m_smallRuns;
+    List<SmallPage> m_smallPages;
 
     SegregatedFreeList m_largeObjects;
     
index 5549cd0..1593347 100644 (file)
@@ -33,8 +33,6 @@ struct LineMetadata {
     unsigned short objectCount;
 };
 
-typedef std::array<LineMetadata, smallLineCount> RunMetadata;
-
 } // namespace bmalloc
 
 #endif // LineMetadata_h
index 27aff42..d38a914 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "Sizes.h"
 #include "SmallLine.h"
-#include "SmallRun.h"
+#include "SmallPage.h"
 #include "VMAllocate.h"
 
 namespace bmalloc {
@@ -39,15 +39,15 @@ public:
 
     static SmallChunk* get(void*);
 
-    SmallRun* begin() { return SmallRun::get(SmallLine::get(m_memory)); }
-    SmallRun* end() { return m_runs.end(); }
+    SmallPage* begin() { return SmallPage::get(SmallLine::get(m_memory)); }
+    SmallPage* end() { return m_pages.end(); }
     
     SmallLine* lines() { return m_lines.begin(); }
-    SmallRun* runs() { return m_runs.begin(); }
+    SmallPage* pages() { return m_pages.begin(); }
     
 private:
     std::array<SmallLine, smallChunkSize / smallLineSize> m_lines;
-    std::array<SmallRun, smallChunkSize / vmPageSize> m_runs;
+    std::array<SmallPage, smallChunkSize / vmPageSize> m_pages;
     char m_memory[] __attribute__((aligned(2 * smallMax + 0)));
 };
 
@@ -63,11 +63,11 @@ inline SmallChunk::SmallChunk(std::lock_guard<StaticMutex>& lock)
     for (SmallLine* line = m_lines.begin(); line < SmallLine::get(m_memory); ++line) {
         line->ref(lock, 1);
 
-        SmallRun* page = SmallRun::get(line);
+        SmallPage* page = SmallPage::get(line);
         page->ref(lock);
     }
 
-    for (SmallRun* page = begin(); page != end(); ++page)
+    for (SmallPage* page = begin(); page != end(); ++page)
         page->setHasFreeLines(lock, true);
 }
 
@@ -98,23 +98,23 @@ inline char* SmallLine::end()
     return begin() + smallLineSize;
 }
 
-inline SmallRun* SmallRun::get(SmallLine* line)
+inline SmallPage* SmallPage::get(SmallLine* line)
 {
     SmallChunk* chunk = SmallChunk::get(line);
     size_t lineNumber = line - chunk->lines();
-    size_t runNumber = lineNumber * smallLineSize / vmPageSize;
-    return &chunk->runs()[runNumber];
+    size_t pageNumber = lineNumber * smallLineSize / vmPageSize;
+    return &chunk->pages()[pageNumber];
 }
 
-inline SmallLine* SmallRun::begin()
+inline SmallLine* SmallPage::begin()
 {
     SmallChunk* chunk = SmallChunk::get(this);
-    size_t runNumber = this - chunk->runs();
-    size_t lineNumber = runNumber * smallLineCount;
+    size_t pageNumber = this - chunk->pages();
+    size_t lineNumber = pageNumber * smallLineCount;
     return &chunk->lines()[lineNumber];
 }
 
-inline SmallLine* SmallRun::end()
+inline SmallLine* SmallPage::end()
 {
     return begin() + smallLineCount;
 }
similarity index 88%
rename from Source/bmalloc/bmalloc/SmallRun.h
rename to Source/bmalloc/bmalloc/SmallPage.h
index 2a09a1b..21aa461 100644 (file)
@@ -23,8 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef SmallRun_h
-#define SmallRun_h
+#ifndef SmallPage_h
+#define SmallPage_h
 
 #include "BAssert.h"
 #include "List.h"
 
 namespace bmalloc {
 
-class SmallRun : public ListNode<SmallRun> {
+class SmallPage : public ListNode<SmallPage> {
 public:
     static const unsigned char maxRefCount = std::numeric_limits<unsigned char>::max();
-    static_assert(smallLineCount < maxRefCount, "maximum line count must fit in SmallRun");
+    static_assert(smallLineCount < maxRefCount, "maximum line count must fit in SmallPage");
     
-    static SmallRun* get(SmallLine*);
+    static SmallPage* get(SmallLine*);
 
-    SmallRun()
+    SmallPage()
         : m_hasFreeLines(true)
     {
     }
@@ -65,13 +65,13 @@ private:
     unsigned char m_sizeClass;
 };
 
-inline void SmallRun::ref(std::lock_guard<StaticMutex>&)
+inline void SmallPage::ref(std::lock_guard<StaticMutex>&)
 {
     BASSERT(m_refCount < maxRefCount);
     ++m_refCount;
 }
 
-inline bool SmallRun::deref(std::lock_guard<StaticMutex>&)
+inline bool SmallPage::deref(std::lock_guard<StaticMutex>&)
 {
     BASSERT(m_refCount);
     --m_refCount;
@@ -80,4 +80,4 @@ inline bool SmallRun::deref(std::lock_guard<StaticMutex>&)
 
 } // namespace bmalloc
 
-#endif // SmallRun_h
+#endif // SmallPage_h
index b9148b8..0f9f4dd 100644 (file)
@@ -44,7 +44,7 @@ void VMHeap::allocateSmallChunk(std::lock_guard<StaticMutex>& lock)
     // We initialize chunks lazily to avoid dirtying their metadata pages.
     SmallChunk* smallChunk = new (m_smallChunks.pop()->smallChunk()) SmallChunk(lock);
     for (auto* it = smallChunk->begin(); it < smallChunk->end(); ++it)
-        m_smallRuns.push(it);
+        m_smallPages.push(it);
 }
 
 LargeObject VMHeap::allocateLargeChunk(std::lock_guard<StaticMutex>& lock)
index cf28f29..d73f0af 100644 (file)
@@ -50,11 +50,11 @@ class VMHeap {
 public:
     VMHeap();
 
-    SmallRun* allocateSmallRun(std::lock_guard<StaticMutex>&);
+    SmallPage* allocateSmallPage(std::lock_guard<StaticMutex>&);
     LargeObject allocateLargeObject(std::lock_guard<StaticMutex>&, size_t);
     LargeObject allocateLargeObject(std::lock_guard<StaticMutex>&, size_t, size_t, size_t);
 
-    void deallocateSmallRun(std::unique_lock<StaticMutex>&, SmallRun*);
+    void deallocateSmallPage(std::unique_lock<StaticMutex>&, SmallPage*);
     void deallocateLargeObject(std::unique_lock<StaticMutex>&, LargeObject);
     
 private:
@@ -62,7 +62,7 @@ private:
     LargeObject allocateLargeChunk(std::lock_guard<StaticMutex>&);
     void allocateSuperChunk(std::lock_guard<StaticMutex>&);
 
-    List<SmallRun> m_smallRuns;
+    List<SmallPage> m_smallPages;
     SegregatedFreeList m_largeObjects;
 
     Vector<SuperChunk*> m_smallChunks;
@@ -73,14 +73,14 @@ private:
 #endif
 };
 
-inline SmallRun* VMHeap::allocateSmallRun(std::lock_guard<StaticMutex>& lock)
+inline SmallPage* VMHeap::allocateSmallPage(std::lock_guard<StaticMutex>& lock)
 {
-    if (m_smallRuns.isEmpty())
+    if (m_smallPages.isEmpty())
         allocateSmallChunk(lock);
 
-    SmallRun* run = m_smallRuns.pop();
-    vmAllocatePhysicalPages(run->begin()->begin(), vmPageSize);
-    return run;
+    SmallPage* page = m_smallPages.pop();
+    vmAllocatePhysicalPages(page->begin()->begin(), vmPageSize);
+    return page;
 }
 
 inline LargeObject VMHeap::allocateLargeObject(std::lock_guard<StaticMutex>& lock, size_t size)
@@ -101,13 +101,13 @@ inline LargeObject VMHeap::allocateLargeObject(std::lock_guard<StaticMutex>& loc
     return allocateLargeChunk(lock);
 }
 
-inline void VMHeap::deallocateSmallRun(std::unique_lock<StaticMutex>& lock, SmallRun* run)
+inline void VMHeap::deallocateSmallPage(std::unique_lock<StaticMutex>& lock, SmallPage* page)
 {
     lock.unlock();
-    vmDeallocatePhysicalPages(run->begin()->begin(), vmPageSize);
+    vmDeallocatePhysicalPages(page->begin()->begin(), vmPageSize);
     lock.lock();
     
-    m_smallRuns.push(run);
+    m_smallPages.push(page);
 }
 
 inline void VMHeap::deallocateLargeObject(std::unique_lock<StaticMutex>& lock, LargeObject largeObject)