https://bugs.webkit.org/show_bug.cgi?id=155320
Reviewed by Alex Christensen.
A page is a fixed-size set of lines.
A run is an variable-sized set of lines.
We want to start using runs because:
(a) we want to support varying the hardware page size by OS;
(b) we want to support allocations larger than our current page size.
* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/Allocator.cpp:
(bmalloc::Allocator::reallocate):
* bmalloc/Heap.cpp:
(bmalloc::Heap::Heap):
(bmalloc::Heap::initializeSmallRunMetadata):
(bmalloc::Heap::scavenge):
(bmalloc::Heap::scavengeSmallRuns):
(bmalloc::Heap::allocateSmallBumpRanges):
(bmalloc::Heap::allocateSmallRun):
(bmalloc::Heap::deallocateSmallLine):
(bmalloc::Heap::initializeLineMetadata): Deleted.
(bmalloc::Heap::scavengeSmallPages): Deleted.
(bmalloc::Heap::allocateSmallPage): Deleted.
* bmalloc/Heap.h:
* bmalloc/LineMetadata.h:
* bmalloc/SmallChunk.h:
(bmalloc::SmallChunk::begin):
(bmalloc::SmallChunk::end):
(bmalloc::SmallChunk::lines):
(bmalloc::SmallChunk::runs):
(bmalloc::SmallChunk::SmallChunk):
(bmalloc::SmallLine::end):
(bmalloc::SmallRun::get):
(bmalloc::SmallRun::begin):
(bmalloc::SmallRun::end):
(bmalloc::SmallChunk::pages): Deleted.
(bmalloc::SmallPage::get): Deleted.
(bmalloc::SmallPage::begin): Deleted.
(bmalloc::SmallPage::end): Deleted.
* bmalloc/SmallPage.h: Removed.
* bmalloc/SmallRun.h: Copied from Source/bmalloc/bmalloc/SmallPage.h.
(bmalloc::SmallRun::SmallRun):
(bmalloc::SmallRun::ref):
(bmalloc::SmallRun::deref):
(bmalloc::SmallPage::SmallPage): Deleted.
(bmalloc::SmallPage::ref): Deleted.
(bmalloc::SmallPage::deref): Deleted.
* bmalloc/VMHeap.cpp:
(bmalloc::VMHeap::allocateSmallChunk):
(bmalloc::VMHeap::allocateLargeChunk):
* bmalloc/VMHeap.h:
(bmalloc::VMHeap::allocateSmallRun):
(bmalloc::VMHeap::allocateLargeObject):
(bmalloc::VMHeap::deallocateSmallRun):
(bmalloc::VMHeap::deallocateLargeObject):
(bmalloc::VMHeap::allocateSmallPage): Deleted.
(bmalloc::VMHeap::deallocateSmallPage): Deleted.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197955
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2016-03-10 Geoffrey Garen <ggaren@apple.com>
+
+ bmalloc: Rename SmallPage to SmallRun
+ https://bugs.webkit.org/show_bug.cgi?id=155320
+
+ Reviewed by Alex Christensen.
+
+ A page is a fixed-size set of lines.
+
+ A run is an variable-sized set of lines.
+
+ We want to start using runs because:
+
+ (a) we want to support varying the hardware page size by OS;
+
+ (b) we want to support allocations larger than our current page size.
+
+ * bmalloc.xcodeproj/project.pbxproj:
+ * bmalloc/Allocator.cpp:
+ (bmalloc::Allocator::reallocate):
+ * bmalloc/Heap.cpp:
+ (bmalloc::Heap::Heap):
+ (bmalloc::Heap::initializeSmallRunMetadata):
+ (bmalloc::Heap::scavenge):
+ (bmalloc::Heap::scavengeSmallRuns):
+ (bmalloc::Heap::allocateSmallBumpRanges):
+ (bmalloc::Heap::allocateSmallRun):
+ (bmalloc::Heap::deallocateSmallLine):
+ (bmalloc::Heap::initializeLineMetadata): Deleted.
+ (bmalloc::Heap::scavengeSmallPages): Deleted.
+ (bmalloc::Heap::allocateSmallPage): Deleted.
+ * bmalloc/Heap.h:
+ * bmalloc/LineMetadata.h:
+ * bmalloc/SmallChunk.h:
+ (bmalloc::SmallChunk::begin):
+ (bmalloc::SmallChunk::end):
+ (bmalloc::SmallChunk::lines):
+ (bmalloc::SmallChunk::runs):
+ (bmalloc::SmallChunk::SmallChunk):
+ (bmalloc::SmallLine::end):
+ (bmalloc::SmallRun::get):
+ (bmalloc::SmallRun::begin):
+ (bmalloc::SmallRun::end):
+ (bmalloc::SmallChunk::pages): Deleted.
+ (bmalloc::SmallPage::get): Deleted.
+ (bmalloc::SmallPage::begin): Deleted.
+ (bmalloc::SmallPage::end): Deleted.
+ * bmalloc/SmallPage.h: Removed.
+ * bmalloc/SmallRun.h: Copied from Source/bmalloc/bmalloc/SmallPage.h.
+ (bmalloc::SmallRun::SmallRun):
+ (bmalloc::SmallRun::ref):
+ (bmalloc::SmallRun::deref):
+ (bmalloc::SmallPage::SmallPage): Deleted.
+ (bmalloc::SmallPage::ref): Deleted.
+ (bmalloc::SmallPage::deref): Deleted.
+ * bmalloc/VMHeap.cpp:
+ (bmalloc::VMHeap::allocateSmallChunk):
+ (bmalloc::VMHeap::allocateLargeChunk):
+ * bmalloc/VMHeap.h:
+ (bmalloc::VMHeap::allocateSmallRun):
+ (bmalloc::VMHeap::allocateLargeObject):
+ (bmalloc::VMHeap::deallocateSmallRun):
+ (bmalloc::VMHeap::deallocateLargeObject):
+ (bmalloc::VMHeap::allocateSmallPage): Deleted.
+ (bmalloc::VMHeap::deallocateSmallPage): Deleted.
+
2016-03-08 Geoffrey Garen <ggaren@apple.com>
Unreviewed, rolling in r197722.
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 /* SmallPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 143E29ED18CAE90500FE8A0F /* SmallPage.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 14DD78BD18F48D6B00950702 /* SmallRun.h in Headers */ = {isa = PBXBuildFile; fileRef = 143E29ED18CAE90500FE8A0F /* SmallRun.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, ); }; };
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 /* SmallPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmallPage.h; path = bmalloc/SmallPage.h; sourceTree = "<group>"; };
+ 143E29ED18CAE90500FE8A0F /* SmallRun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmallRun.h; path = bmalloc/SmallRun.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 /* SmallPage.h */,
+ 143E29ED18CAE90500FE8A0F /* SmallRun.h */,
);
name = "heap: small";
sourceTree = "<group>";
1400274918F89C1300115C97 /* Heap.h in Headers */,
140FA00319CE429C00FFD3C8 /* BumpRange.h in Headers */,
14DD78C518F48D7500950702 /* Algorithm.h in Headers */,
- 14DD78BD18F48D6B00950702 /* SmallPage.h in Headers */,
+ 14DD78BD18F48D6B00950702 /* SmallRun.h in Headers */,
14DD788E18F48CCD00950702 /* BoundaryTag.h in Headers */,
146041E71C7FF2EF00E9F94E /* SortedVector.h in Headers */,
14DD78C818F48D7500950702 /* FixedVector.h in Headers */,
size_t oldSize = 0;
switch (objectType(object)) {
case Small: {
- SmallPage* page = SmallPage::get(SmallLine::get(object));
- oldSize = objectSize(page->sizeClass());
+ SmallRun* run = SmallRun::get(SmallLine::get(object));
+ oldSize = objectSize(run->sizeClass());
break;
}
case Large: {
#include "PerProcess.h"
#include "SmallChunk.h"
#include "SmallLine.h"
-#include "SmallPage.h"
+#include "SmallRun.h"
#include <thread>
namespace bmalloc {
, m_isAllocatingPages(false)
, m_scavenger(*this, &Heap::concurrentScavenge)
{
- initializeLineMetadata();
+ initializeSmallRunMetadata();
}
-void Heap::initializeLineMetadata()
+void Heap::initializeSmallRunMetadata()
{
- // We assume that m_smallLineMetadata is zero-filled.
+ // We assume that m_smallRunMetadata is zero-filled.
for (size_t size = alignment; size <= smallMax; size += alignment) {
size_t sizeClass = bmalloc::sizeClass(size);
- auto& metadata = m_smallLineMetadata[sizeClass];
+ auto& metadata = m_smallRunMetadata[sizeClass];
size_t object = 0;
size_t line = 0;
{
waitUntilFalse(lock, sleepDuration, m_isAllocatingPages);
- scavengeSmallPages(lock, sleepDuration);
+ scavengeSmallRuns(lock, sleepDuration);
scavengeLargeObjects(lock, sleepDuration);
scavengeXLargeObjects(lock, sleepDuration);
sleep(lock, sleepDuration);
}
-void Heap::scavengeSmallPages(std::unique_lock<StaticMutex>& lock, std::chrono::milliseconds sleepDuration)
+void Heap::scavengeSmallRuns(std::unique_lock<StaticMutex>& lock, std::chrono::milliseconds sleepDuration)
{
- while (!m_smallPages.isEmpty()) {
- m_vmHeap.deallocateSmallPage(lock, m_smallPages.pop());
+ while (!m_smallRuns.isEmpty()) {
+ m_vmHeap.deallocateSmallRun(lock, m_smallRuns.pop());
waitUntilFalse(lock, sleepDuration, m_isAllocatingPages);
}
}
void Heap::allocateSmallBumpRanges(std::lock_guard<StaticMutex>& lock, size_t sizeClass, BumpAllocator& allocator, BumpRangeCache& rangeCache)
{
BASSERT(!rangeCache.size());
- SmallPage* page = allocateSmallPage(lock, sizeClass);
- SmallLine* lines = page->begin();
- BASSERT(page->hasFreeLines(lock));
+ SmallRun* run = allocateSmallRun(lock, sizeClass);
+ SmallLine* lines = run->begin();
+ BASSERT(run->hasFreeLines(lock));
// Find a free line.
for (size_t lineNumber = 0; lineNumber < smallLineCount; ++lineNumber) {
if (lines[lineNumber].refCount(lock))
continue;
- LineMetadata& lineMetadata = m_smallLineMetadata[sizeClass][lineNumber];
+ LineMetadata& lineMetadata = m_smallRunMetadata[sizeClass][lineNumber];
if (!lineMetadata.objectCount)
continue;
- // In a fragmented page, some free ranges might not fit in the cache.
+ // In a fragmented run, some free ranges might not fit in the cache.
if (rangeCache.size() == rangeCache.capacity()) {
- m_smallPagesWithFreeLines[sizeClass].push(page);
+ m_smallRunsWithFreeLines[sizeClass].push(run);
BASSERT(allocator.canAllocate());
return;
}
char* begin = lines[lineNumber].begin() + lineMetadata.startOffset;
unsigned short objectCount = lineMetadata.objectCount;
lines[lineNumber].ref(lock, lineMetadata.objectCount);
- page->ref(lock);
+ run->ref(lock);
// Merge with subsequent free lines.
while (++lineNumber < smallLineCount) {
if (lines[lineNumber].refCount(lock))
break;
- LineMetadata& lineMetadata = m_smallLineMetadata[sizeClass][lineNumber];
+ LineMetadata& lineMetadata = m_smallRunMetadata[sizeClass][lineNumber];
if (!lineMetadata.objectCount)
continue;
objectCount += lineMetadata.objectCount;
lines[lineNumber].ref(lock, lineMetadata.objectCount);
- page->ref(lock);
+ run->ref(lock);
}
if (!allocator.canAllocate())
}
BASSERT(allocator.canAllocate());
- page->setHasFreeLines(lock, false);
+ run->setHasFreeLines(lock, false);
}
-SmallPage* Heap::allocateSmallPage(std::lock_guard<StaticMutex>& lock, size_t sizeClass)
+SmallRun* Heap::allocateSmallRun(std::lock_guard<StaticMutex>& lock, size_t sizeClass)
{
- if (!m_smallPagesWithFreeLines[sizeClass].isEmpty())
- return m_smallPagesWithFreeLines[sizeClass].pop();
+ if (!m_smallRunsWithFreeLines[sizeClass].isEmpty())
+ return m_smallRunsWithFreeLines[sizeClass].pop();
- SmallPage* page = [this, &lock]() {
- if (!m_smallPages.isEmpty())
- return m_smallPages.pop();
+ SmallRun* run = [this, &lock]() {
+ if (!m_smallRuns.isEmpty())
+ return m_smallRuns.pop();
m_isAllocatingPages = true;
- SmallPage* page = m_vmHeap.allocateSmallPage(lock);
- return page;
+ return m_vmHeap.allocateSmallRun(lock);
}();
- page->setSizeClass(sizeClass);
- return page;
+ run->setSizeClass(sizeClass);
+ return run;
}
void Heap::deallocateSmallLine(std::lock_guard<StaticMutex>& lock, SmallLine* line)
{
BASSERT(!line->refCount(lock));
- SmallPage* page = SmallPage::get(line);
- page->deref(lock);
+ SmallRun* run = SmallRun::get(line);
+ run->deref(lock);
- if (!page->hasFreeLines(lock)) {
- page->setHasFreeLines(lock, true);
- m_smallPagesWithFreeLines[page->sizeClass()].push(page);
+ if (!run->hasFreeLines(lock)) {
+ run->setHasFreeLines(lock, true);
+ m_smallRunsWithFreeLines[run->sizeClass()].push(run);
- BASSERT(page->refCount(lock));
+ BASSERT(run->refCount(lock));
return;
}
- if (page->refCount(lock))
+ if (run->refCount(lock))
return;
- m_smallPagesWithFreeLines[page->sizeClass()].remove(page);
- m_smallPages.push(page);
+ m_smallRunsWithFreeLines[run->sizeClass()].remove(run);
+ m_smallRuns.push(run);
m_scavenger.run();
}
#include "SegregatedFreeList.h"
#include "SmallChunk.h"
#include "SmallLine.h"
-#include "SmallPage.h"
+#include "SmallRun.h"
#include "VMHeap.h"
#include "Vector.h"
#include "XLargeMap.h"
private:
~Heap() = delete;
- void initializeLineMetadata();
+ void initializeSmallRunMetadata();
- SmallPage* allocateSmallPage(std::lock_guard<StaticMutex>&, size_t sizeClass);
+ SmallRun* allocateSmallRun(std::lock_guard<StaticMutex>&, size_t sizeClass);
void deallocateSmallLine(std::lock_guard<StaticMutex>&, SmallLine*);
void deallocateLarge(std::lock_guard<StaticMutex>&, const LargeObject&);
XLargeRange splitAndAllocate(XLargeRange&, size_t alignment, size_t);
void concurrentScavenge();
- void scavengeSmallPages(std::unique_lock<StaticMutex>&, std::chrono::milliseconds);
+ void scavengeSmallRuns(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<std::array<LineMetadata, smallLineCount>, smallMax / alignment> m_smallLineMetadata;
+ std::array<RunMetadata, smallMax / alignment> m_smallRunMetadata;
- std::array<List<SmallPage>, smallMax / alignment> m_smallPagesWithFreeLines;
+ std::array<List<SmallRun>, smallMax / alignment> m_smallRunsWithFreeLines;
- List<SmallPage> m_smallPages;
+ List<SmallRun> m_smallRuns;
SegregatedFreeList m_largeObjects;
unsigned short objectCount;
};
+typedef std::array<LineMetadata, smallLineCount> RunMetadata;
+
} // namespace bmalloc
#endif // LineMetadata_h
#include "Sizes.h"
#include "SmallLine.h"
-#include "SmallPage.h"
+#include "SmallRun.h"
#include "VMAllocate.h"
namespace bmalloc {
static SmallChunk* get(void*);
- SmallPage* begin() { return SmallPage::get(SmallLine::get(m_memory)); }
- SmallPage* end() { return m_pages.end(); }
+ SmallRun* begin() { return SmallRun::get(SmallLine::get(m_memory)); }
+ SmallRun* end() { return m_runs.end(); }
SmallLine* lines() { return m_lines.begin(); }
- SmallPage* pages() { return m_pages.begin(); }
+ SmallRun* runs() { return m_runs.begin(); }
private:
std::array<SmallLine, smallChunkSize / smallLineSize> m_lines;
- std::array<SmallPage, smallChunkSize / vmPageSize> m_pages;
+ std::array<SmallRun, smallChunkSize / vmPageSize> m_runs;
char m_memory[] __attribute__((aligned(2 * smallMax + 0)));
};
for (SmallLine* line = m_lines.begin(); line < SmallLine::get(m_memory); ++line) {
line->ref(lock, 1);
- SmallPage* page = SmallPage::get(line);
+ SmallRun* page = SmallRun::get(line);
page->ref(lock);
}
- for (SmallPage* page = begin(); page != end(); ++page)
+ for (SmallRun* page = begin(); page != end(); ++page)
page->setHasFreeLines(lock, true);
}
return begin() + smallLineSize;
}
-inline SmallPage* SmallPage::get(SmallLine* line)
+inline SmallRun* SmallRun::get(SmallLine* line)
{
SmallChunk* chunk = SmallChunk::get(line);
size_t lineNumber = line - chunk->lines();
- size_t pageNumber = lineNumber * smallLineSize / vmPageSize;
- return &chunk->pages()[pageNumber];
+ size_t runNumber = lineNumber * smallLineSize / vmPageSize;
+ return &chunk->runs()[runNumber];
}
-inline SmallLine* SmallPage::begin()
+inline SmallLine* SmallRun::begin()
{
SmallChunk* chunk = SmallChunk::get(this);
- size_t pageNumber = this - chunk->pages();
- size_t lineNumber = pageNumber * smallLineCount;
+ size_t runNumber = this - chunk->runs();
+ size_t lineNumber = runNumber * smallLineCount;
return &chunk->lines()[lineNumber];
}
-inline SmallLine* SmallPage::end()
+inline SmallLine* SmallRun::end()
{
return begin() + smallLineCount;
}
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SmallPage_h
-#define SmallPage_h
+#ifndef SmallRun_h
+#define SmallRun_h
#include "BAssert.h"
#include "List.h"
namespace bmalloc {
-class SmallPage : public ListNode<SmallPage> {
+class SmallRun : public ListNode<SmallRun> {
public:
static const unsigned char maxRefCount = std::numeric_limits<unsigned char>::max();
- static_assert(smallLineCount < maxRefCount, "maximum line count must fit in SmallPage");
+ static_assert(smallLineCount < maxRefCount, "maximum line count must fit in SmallRun");
- static SmallPage* get(SmallLine*);
+ static SmallRun* get(SmallLine*);
- SmallPage()
+ SmallRun()
: m_hasFreeLines(true)
{
}
unsigned char m_sizeClass;
};
-inline void SmallPage::ref(std::lock_guard<StaticMutex>&)
+inline void SmallRun::ref(std::lock_guard<StaticMutex>&)
{
BASSERT(m_refCount < maxRefCount);
++m_refCount;
}
-inline bool SmallPage::deref(std::lock_guard<StaticMutex>&)
+inline bool SmallRun::deref(std::lock_guard<StaticMutex>&)
{
BASSERT(m_refCount);
--m_refCount;
} // namespace bmalloc
-#endif // SmallPage_h
+#endif // SmallRun_h
// 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_smallPages.push(it);
+ m_smallRuns.push(it);
}
LargeObject VMHeap::allocateLargeChunk(std::lock_guard<StaticMutex>& lock)
public:
VMHeap();
- SmallPage* allocateSmallPage(std::lock_guard<StaticMutex>&);
+ SmallRun* allocateSmallRun(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 deallocateSmallPage(std::unique_lock<StaticMutex>&, SmallPage*);
+ void deallocateSmallRun(std::unique_lock<StaticMutex>&, SmallRun*);
void deallocateLargeObject(std::unique_lock<StaticMutex>&, LargeObject);
private:
LargeObject allocateLargeChunk(std::lock_guard<StaticMutex>&);
void allocateSuperChunk(std::lock_guard<StaticMutex>&);
- List<SmallPage> m_smallPages;
+ List<SmallRun> m_smallRuns;
SegregatedFreeList m_largeObjects;
Vector<SuperChunk*> m_smallChunks;
#endif
};
-inline SmallPage* VMHeap::allocateSmallPage(std::lock_guard<StaticMutex>& lock)
+inline SmallRun* VMHeap::allocateSmallRun(std::lock_guard<StaticMutex>& lock)
{
- if (m_smallPages.isEmpty())
+ if (m_smallRuns.isEmpty())
allocateSmallChunk(lock);
- SmallPage* page = m_smallPages.pop();
- vmAllocatePhysicalPages(page->begin()->begin(), vmPageSize);
- return page;
+ SmallRun* run = m_smallRuns.pop();
+ vmAllocatePhysicalPages(run->begin()->begin(), vmPageSize);
+ return run;
}
inline LargeObject VMHeap::allocateLargeObject(std::lock_guard<StaticMutex>& lock, size_t size)
return allocateLargeChunk(lock);
}
-inline void VMHeap::deallocateSmallPage(std::unique_lock<StaticMutex>& lock, SmallPage* page)
+inline void VMHeap::deallocateSmallRun(std::unique_lock<StaticMutex>& lock, SmallRun* run)
{
lock.unlock();
- vmDeallocatePhysicalPages(page->begin()->begin(), vmPageSize);
+ vmDeallocatePhysicalPages(run->begin()->begin(), vmPageSize);
lock.lock();
- m_smallPages.push(page);
+ m_smallRuns.push(run);
}
inline void VMHeap::deallocateLargeObject(std::unique_lock<StaticMutex>& lock, LargeObject largeObject)