Unreviewed, rolling out r198679.
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Mar 2016 20:30:54 +0000 (20:30 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Mar 2016 20:30:54 +0000 (20:30 +0000)
This change caused flaky LayoutTest crashes

Reverted changeset:

"bmalloc: Renamed LargeChunk => Chunk"
https://bugs.webkit.org/show_bug.cgi?id=155894
http://trac.webkit.org/changeset/198679

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

17 files changed:
Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
Source/bmalloc/bmalloc/Allocator.cpp
Source/bmalloc/bmalloc/BoundaryTag.h
Source/bmalloc/bmalloc/Deallocator.cpp
Source/bmalloc/bmalloc/FreeList.cpp
Source/bmalloc/bmalloc/Heap.cpp
Source/bmalloc/bmalloc/LargeChunk.h [moved from Source/bmalloc/bmalloc/Chunk.h with 77% similarity]
Source/bmalloc/bmalloc/LargeObject.h
Source/bmalloc/bmalloc/Object.h
Source/bmalloc/bmalloc/ObjectType.cpp
Source/bmalloc/bmalloc/Sizes.h
Source/bmalloc/bmalloc/SmallAllocator.h [new file with mode: 0644]
Source/bmalloc/bmalloc/VMHeap.cpp
Source/bmalloc/bmalloc/VMHeap.h
Source/bmalloc/bmalloc/Zone.cpp
Source/bmalloc/bmalloc/Zone.h

index 0186ffa..9c48cf3 100644 (file)
@@ -1,3 +1,15 @@
+2016-03-25  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r198679.
+
+        This change caused flaky LayoutTest crashes
+
+        Reverted changeset:
+
+        "bmalloc: Renamed LargeChunk => Chunk"
+        https://bugs.webkit.org/show_bug.cgi?id=155894
+        http://trac.webkit.org/changeset/198679
+
 2016-03-25  Geoffrey Garen  <ggaren@apple.com>
 
         bmalloc: stress_aligned fails when allocating a zero-sized object with XLarge alignment
index 7ff77d0..efeee50 100644 (file)
                144C07F41C7B70260051BB6A /* XLargeMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 144C07F21C7B70260051BB6A /* XLargeMap.cpp */; };
                144C07F51C7B70260051BB6A /* XLargeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 144C07F31C7B70260051BB6A /* XLargeMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
                146041E71C7FF2EF00E9F94E /* SortedVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 146041E61C7FF2EF00E9F94E /* SortedVector.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               147DC6E31CA5B70B00724E8D /* Chunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147DC6E21CA5B70B00724E8D /* Chunk.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14895D911A3A319C0006235D /* Environment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14895D8F1A3A319C0006235D /* Environment.cpp */; };
                14895D921A3A319C0006235D /* Environment.h in Headers */ = {isa = PBXBuildFile; fileRef = 14895D901A3A319C0006235D /* Environment.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14C6216F1A9A9A6200E72293 /* LargeObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C6216E1A9A9A6200E72293 /* LargeObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14C919C918FCC59F0028DB43 /* BPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C919C818FCC59F0028DB43 /* BPlatform.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14CC394C18EA8858004AFE34 /* libbmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14F271BE18EA3963008C152F /* libbmalloc.a */; };
                14D2CD9B1AA12CFB00770440 /* VMState.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D2CD9A1AA12CFB00770440 /* VMState.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               14DD788C18F48CAE00950702 /* LargeChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA8818CD17CE002201E4 /* LargeChunk.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14DD788D18F48CC600950702 /* BeginTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 1417F64518B54A700076FA3F /* BeginTag.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14DD788E18F48CCD00950702 /* BoundaryTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 1485655E18A43AF900ED6942 /* BoundaryTag.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14DD789018F48CEB00950702 /* Sizes.h in Headers */ = {isa = PBXBuildFile; fileRef = 145F6874179DF84100D65598 /* Sizes.h */; settings = {ATTRIBUTES = (Private, ); }; };
                146BEE2118C845AE0002D5A2 /* SegregatedFreeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SegregatedFreeList.cpp; path = bmalloc/SegregatedFreeList.cpp; sourceTree = "<group>"; };
                1479E21217A1A255006D4E9D /* Vector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = Vector.h; path = bmalloc/Vector.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
                1479E21417A1A63E006D4E9D /* VMAllocate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = VMAllocate.h; path = bmalloc/VMAllocate.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
-               147DC6E21CA5B70B00724E8D /* Chunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Chunk.h; path = bmalloc/Chunk.h; sourceTree = "<group>"; };
+               147AAA8818CD17CE002201E4 /* LargeChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LargeChunk.h; path = bmalloc/LargeChunk.h; sourceTree = "<group>"; };
                1485655E18A43AF900ED6942 /* BoundaryTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BoundaryTag.h; path = bmalloc/BoundaryTag.h; sourceTree = "<group>"; };
                1485656018A43DBA00ED6942 /* ObjectType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjectType.h; path = bmalloc/ObjectType.h; sourceTree = "<group>"; };
                14895D8F1A3A319C0006235D /* Environment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Environment.cpp; path = bmalloc/Environment.cpp; sourceTree = "<group>"; };
                                1417F64618B54A700076FA3F /* EndTag.h */,
                                143EF9AD1A9FABF6004F5C77 /* FreeList.cpp */,
                                143EF9AE1A9FABF6004F5C77 /* FreeList.h */,
+                               147AAA8818CD17CE002201E4 /* LargeChunk.h */,
                                14C6216E1A9A9A6200E72293 /* LargeObject.h */,
                                146BEE2118C845AE0002D5A2 /* SegregatedFreeList.cpp */,
                                146BEE1E18C841C50002D5A2 /* SegregatedFreeList.h */,
                        isa = PBXGroup;
                        children = (
                                140FA00219CE429C00FFD3C8 /* BumpRange.h */,
-                               147DC6E21CA5B70B00724E8D /* Chunk.h */,
                                14895D8F1A3A319C0006235D /* Environment.cpp */,
                                14895D901A3A319C0006235D /* Environment.h */,
                                14DA320E18875D9F007269E0 /* Heap.cpp */,
                        files = (
                                14DD78CF18F48D7500950702 /* Vector.h in Headers */,
                                14C919C918FCC59F0028DB43 /* BPlatform.h in Headers */,
+                               14DD788C18F48CAE00950702 /* LargeChunk.h in Headers */,
                                14DD789218F48CFC00950702 /* EndTag.h in Headers */,
                                1440AFCB1A95261100837FAA /* Zone.h in Headers */,
                                140FA00519CE4B6800FFD3C8 /* LineMetadata.h in Headers */,
                                14DD78C818F48D7500950702 /* FixedVector.h in Headers */,
                                144C07F51C7B70260051BB6A /* XLargeMap.h in Headers */,
                                14D2CD9B1AA12CFB00770440 /* VMState.h in Headers */,
-                               147DC6E31CA5B70B00724E8D /* Chunk.h in Headers */,
                                14DD78BC18F48D6B00950702 /* SmallLine.h in Headers */,
                                14DD789818F48D4A00950702 /* Allocator.h in Headers */,
                                14DD78CB18F48D7500950702 /* PerProcess.h in Headers */,
index d8840e9..e345b52 100644 (file)
@@ -25,9 +25,9 @@
 
 #include "Allocator.h"
 #include "BAssert.h"
-#include "Chunk.h"
 #include "Deallocator.h"
 #include "Heap.h"
+#include "LargeChunk.h"
 #include "LargeObject.h"
 #include "PerProcess.h"
 #include "Sizes.h"
@@ -91,7 +91,7 @@ void* Allocator::allocate(size_t alignment, size_t size)
         size = std::max(largeMin, roundUpToMultipleOf<largeAlignment>(size));
         alignment = roundUpToMultipleOf<largeAlignment>(alignment);
         size_t unalignedSize = largeMin + alignment - largeAlignment + size;
-        if (unalignedSize <= largeMax && alignment <= chunkSize / 2) {
+        if (unalignedSize <= largeMax && alignment <= largeChunkSize / 2) {
             std::lock_guard<StaticMutex> lock(PerProcess<Heap>::mutex());
             m_deallocator.processObjectLog(lock);
             return PerProcess<Heap>::getFastCase()->allocateLarge(lock, alignment, size, unalignedSize);
index 41e9b5f..5113b51 100644 (file)
@@ -36,12 +36,12 @@ namespace bmalloc {
 
 class BeginTag;
 class EndTag;
-class Chunk;
+class LargeChunk;
 class Range;
 
 class BoundaryTag {
 public:
-    static Range init(Chunk*);
+    static Range init(LargeChunk*);
     static unsigned compactBegin(void*);
 
     bool isFree() { return m_isFree; }
index 1c10339..2543555 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "BAssert.h"
-#include "Chunk.h"
+#include "LargeChunk.h"
 #include "Deallocator.h"
 #include "Heap.h"
 #include "Inline.h"
index adc884a..d6094fe 100644 (file)
@@ -23,8 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+#include "LargeChunk.h"
 #include "FreeList.h"
-#include "Chunk.h"
 #include "Vector.h"
 
 namespace bmalloc {
index 0365a5f..8022675 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "Heap.h"
 #include "BumpAllocator.h"
-#include "Chunk.h"
+#include "LargeChunk.h"
 #include "LargeObject.h"
 #include "PerProcess.h"
 #include "SmallLine.h"
@@ -334,7 +334,7 @@ void* Heap::allocateLarge(std::lock_guard<StaticMutex>& lock, size_t alignment,
     BASSERT(unalignedSize <= largeMax);
     BASSERT(unalignedSize >= largeMin);
     BASSERT(unalignedSize == roundUpToMultipleOf<largeAlignment>(unalignedSize));
-    BASSERT(alignment <= chunkSize / 2);
+    BASSERT(alignment <= largeChunkSize / 2);
     BASSERT(alignment >= largeAlignment);
     BASSERT(isPowerOfTwo(alignment));
 
similarity index 77%
rename from Source/bmalloc/bmalloc/Chunk.h
rename to Source/bmalloc/bmalloc/LargeChunk.h
index fc5c3e1..86df802 100644 (file)
@@ -23,8 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef Chunk_h
-#define Chunk_h
+#ifndef LargeChunk_h
+#define LargeChunk_h
 
 #include "BeginTag.h"
 #include "EndTag.h"
 
 namespace bmalloc {
 
-class Chunk {
+class LargeChunk {
 public:
-    static Chunk* get(void*);
+    static LargeChunk* get(void*);
 
     static BeginTag* beginTag(void*);
     static EndTag* endTag(void*, size_t);
 
-    Chunk(std::lock_guard<StaticMutex>&);
+    LargeChunk(std::lock_guard<StaticMutex>&);
 
     size_t offset(void*);
 
@@ -60,11 +60,11 @@ public:
     SmallPage* pages() { return m_pages.begin(); }
 
     char* begin() { return m_memory; }
-    char* end() { return reinterpret_cast<char*>(this) + chunkSize; }
+    char* end() { return reinterpret_cast<char*>(this) + largeChunkSize; }
 
 private:
-    static const size_t boundaryTagCount = chunkSize / largeMin;
-    static_assert(boundaryTagCount > 2, "Chunk must have space for two sentinel boundary tags");
+    static const size_t boundaryTagCount = largeChunkSize / largeMin;
+    static_assert(boundaryTagCount > 2, "LargeChunk must have space for two sentinel boundary tags");
 
     // Our metadata layout includes a left and right edge sentinel.
     // Metadata takes up enough space to leave at least the first two
@@ -80,28 +80,28 @@ private:
     //
     // We use the X's for boundary tags and the O's for edge sentinels.
 
-    std::array<SmallLine, chunkSize / smallLineSize> m_lines;
-    std::array<SmallPage, chunkSize / vmPageSize> m_pages;
+    std::array<SmallLine, largeChunkSize / smallLineSize> m_lines;
+    std::array<SmallPage, largeChunkSize / vmPageSize> m_pages;
     std::array<BoundaryTag, boundaryTagCount> m_boundaryTags;
     char m_memory[] __attribute__((aligned(2 * smallMax + 0)));
 };
 
-static_assert(sizeof(Chunk) + largeMax <= chunkSize, "largeMax is too big");
+static_assert(sizeof(LargeChunk) + largeMax <= largeChunkSize, "largeMax is too big");
 static_assert(
-    sizeof(Chunk) % vmPageSize + 2 * smallMax <= vmPageSize,
+    sizeof(LargeChunk) % vmPageSize + 2 * smallMax <= vmPageSize,
     "the first page of object memory in a small chunk must be able to allocate smallMax");
 
-inline Chunk::Chunk(std::lock_guard<StaticMutex>& lock)
+inline LargeChunk::LargeChunk(std::lock_guard<StaticMutex>& lock)
 {
     Range range(begin(), end() - begin());
     BASSERT(range.size() <= largeObjectMax);
 
-    BeginTag* beginTag = Chunk::beginTag(range.begin());
+    BeginTag* beginTag = LargeChunk::beginTag(range.begin());
     beginTag->setRange(range);
     beginTag->setFree(true);
     beginTag->setVMState(VMState::Virtual);
 
-    EndTag* endTag = Chunk::endTag(range.begin(), range.size());
+    EndTag* endTag = LargeChunk::endTag(range.begin(), range.size());
     endTag->init(beginTag);
 
     // Mark the left and right edges of our range as allocated. This naturally
@@ -126,21 +126,21 @@ inline Chunk::Chunk(std::lock_guard<StaticMutex>& lock)
     }
 }
 
-inline Chunk* Chunk::get(void* object)
+inline LargeChunk* LargeChunk::get(void* object)
 {
-    return static_cast<Chunk*>(mask(object, chunkMask));
+    return static_cast<LargeChunk*>(mask(object, largeChunkMask));
 }
 
-inline BeginTag* Chunk::beginTag(void* object)
+inline BeginTag* LargeChunk::beginTag(void* object)
 {
-    Chunk* chunk = get(object);
+    LargeChunk* chunk = get(object);
     size_t boundaryTagNumber = (static_cast<char*>(object) - reinterpret_cast<char*>(chunk)) / largeMin - 1; // - 1 to offset from the right sentinel.
     return static_cast<BeginTag*>(&chunk->m_boundaryTags[boundaryTagNumber]);
 }
 
-inline EndTag* Chunk::endTag(void* object, size_t size)
+inline EndTag* LargeChunk::endTag(void* object, size_t size)
 {
-    Chunk* chunk = get(object);
+    LargeChunk* chunk = get(object);
     char* end = static_cast<char*>(object) + size;
 
     // We subtract largeMin before computing the end pointer's boundary tag. An
@@ -151,25 +151,25 @@ inline EndTag* Chunk::endTag(void* object, size_t size)
     return static_cast<EndTag*>(&chunk->m_boundaryTags[boundaryTagNumber]);
 }
 
-inline size_t Chunk::offset(void* object)
+inline size_t LargeChunk::offset(void* object)
 {
     BASSERT(object >= this);
-    BASSERT(object < reinterpret_cast<char*>(this) + chunkSize);
+    BASSERT(object < reinterpret_cast<char*>(this) + largeChunkSize);
     return static_cast<char*>(object) - reinterpret_cast<char*>(this);
 }
 
-inline void* Chunk::object(size_t offset)
+inline void* LargeChunk::object(size_t offset)
 {
     return reinterpret_cast<char*>(this) + offset;
 }
 
-inline SmallPage* Chunk::page(size_t offset)
+inline SmallPage* LargeChunk::page(size_t offset)
 {
     size_t pageNumber = offset / vmPageSize;
     return &m_pages[pageNumber];
 }
 
-inline SmallLine* Chunk::line(size_t offset)
+inline SmallLine* LargeChunk::line(size_t offset)
 {
     size_t lineNumber = offset / smallLineSize;
     return &m_lines[lineNumber];
@@ -177,7 +177,7 @@ inline SmallLine* Chunk::line(size_t offset)
 
 inline char* SmallLine::begin()
 {
-    Chunk* chunk = Chunk::get(this);
+    LargeChunk* chunk = LargeChunk::get(this);
     size_t lineNumber = this - chunk->lines();
     size_t offset = lineNumber * smallLineSize;
     return &reinterpret_cast<char*>(chunk)[offset];
@@ -190,7 +190,7 @@ inline char* SmallLine::end()
 
 inline SmallLine* SmallPage::begin()
 {
-    Chunk* chunk = Chunk::get(this);
+    LargeChunk* chunk = LargeChunk::get(this);
     size_t pageNumber = this - chunk->pages();
     size_t lineNumber = pageNumber * smallLineCount;
     return &chunk->lines()[lineNumber];
@@ -202,16 +202,16 @@ inline SmallLine* SmallPage::end()
 }
 
 inline Object::Object(void* object)
-    : m_chunk(Chunk::get(object))
+    : m_chunk(LargeChunk::get(object))
     , m_offset(m_chunk->offset(object))
 {
 }
 
-inline Object::Object(Chunk* chunk, void* object)
+inline Object::Object(LargeChunk* chunk, void* object)
     : m_chunk(chunk)
     , m_offset(m_chunk->offset(object))
 {
-    BASSERT(chunk == Chunk::get(object));
+    BASSERT(chunk == LargeChunk::get(object));
 }
 
 inline void* Object::begin()
@@ -236,4 +236,4 @@ inline SmallPage* Object::page()
 
 }; // namespace bmalloc
 
-#endif // Chunk
+#endif // LargeChunk
index 70d91b2..cc0bdb7 100644 (file)
@@ -27,8 +27,8 @@
 #define LargeObject_h
 
 #include "BeginTag.h"
-#include "Chunk.h"
 #include "EndTag.h"
+#include "LargeChunk.h"
 #include "Range.h"
 
 namespace bmalloc {
@@ -85,16 +85,16 @@ inline LargeObject::LargeObject()
 }
 
 inline LargeObject::LargeObject(void* object)
-    : m_beginTag(Chunk::beginTag(object))
-    , m_endTag(Chunk::endTag(object, m_beginTag->size()))
+    : m_beginTag(LargeChunk::beginTag(object))
+    , m_endTag(LargeChunk::endTag(object, m_beginTag->size()))
     , m_object(object)
 {
     validate();
 }
 
 inline LargeObject::LargeObject(DoNotValidateTag, void* object)
-    : m_beginTag(Chunk::beginTag(object))
-    , m_endTag(Chunk::endTag(object, m_beginTag->size()))
+    : m_beginTag(LargeChunk::beginTag(object))
+    , m_endTag(LargeChunk::endTag(object, m_beginTag->size()))
     , m_object(object)
 {
 }
@@ -194,7 +194,7 @@ inline LargeObject LargeObject::merge() const
         prev->clear();
         beginTag->clear();
 
-        beginTag = Chunk::beginTag(range.begin());
+        beginTag = LargeChunk::beginTag(range.begin());
     }
 
     BeginTag* next = endTag->next();
@@ -206,7 +206,7 @@ inline LargeObject LargeObject::merge() const
         endTag->clear();
         next->clear();
 
-        endTag = Chunk::endTag(range.begin(), range.size());
+        endTag = LargeChunk::endTag(range.begin(), range.size());
     }
 
     beginTag->setRange(range);
@@ -225,9 +225,9 @@ inline std::pair<LargeObject, LargeObject> LargeObject::split(size_t size) const
     BASSERT(leftover.size() >= largeMin);
 
     BeginTag* splitBeginTag = m_beginTag;
-    EndTag* splitEndTag = Chunk::endTag(split.begin(), size);
+    EndTag* splitEndTag = LargeChunk::endTag(split.begin(), size);
 
-    BeginTag* leftoverBeginTag = Chunk::beginTag(leftover.begin());
+    BeginTag* leftoverBeginTag = LargeChunk::beginTag(leftover.begin());
     EndTag* leftoverEndTag = m_endTag;
 
     splitBeginTag->setRange(split);
index cf1cf71..0c0d2e4 100644 (file)
 
 namespace bmalloc {
 
-class Chunk;
+class LargeChunk;
 class SmallLine;
 class SmallPage;
 
 class Object {
 public:
     Object(void*);
-    Object(Chunk*, void*);
+    Object(LargeChunk*, void*);
     
-    Chunk* chunk() { return m_chunk; }
+    LargeChunk* chunk() { return m_chunk; }
     void* begin();
     void* pageBegin();
 
@@ -45,7 +45,7 @@ public:
     SmallPage* page();
 
 private:
-    Chunk* m_chunk;
+    LargeChunk* m_chunk;
     size_t m_offset;
 };
 
index 562d84f..b1e0fcd 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "ObjectType.h"
 
-#include "Chunk.h"
+#include "LargeChunk.h"
 #include "Object.h"
 
 namespace bmalloc {
index 8feff56..e55a925 100644 (file)
@@ -58,15 +58,15 @@ namespace Sizes {
     static const size_t smallMax = 1 * kB;
     static const size_t maskSizeClassMax = 512;
 
-    static const size_t chunkSize = 2 * MB;
-    static const size_t chunkMask = ~(chunkSize - 1ul);
+    static const size_t largeChunkSize = 2 * MB;
+    static const size_t largeChunkMask = ~(largeChunkSize - 1ul);
 
     static const size_t largeAlignment = 64;
     static const size_t largeMin = smallMax;
-    static const size_t largeObjectMax = chunkSize;
+    static const size_t largeObjectMax = largeChunkSize;
     static const size_t largeMax = largeObjectMax / 2;
 
-    static const size_t xLargeAlignment = chunkSize;
+    static const size_t xLargeAlignment = largeChunkSize;
     static const size_t xLargeMask = ~(xLargeAlignment - 1);
     static const size_t xLargeMax = std::numeric_limits<size_t>::max() - xLargeAlignment; // Make sure that rounding up to xLargeAlignment does not overflow.
 
diff --git a/Source/bmalloc/bmalloc/SmallAllocator.h b/Source/bmalloc/bmalloc/SmallAllocator.h
new file mode 100644 (file)
index 0000000..e69de29
index d179041..5b08700 100644 (file)
@@ -35,16 +35,16 @@ VMHeap::VMHeap()
 {
 }
 
-LargeObject VMHeap::allocateChunk(std::lock_guard<StaticMutex>& lock)
+LargeObject VMHeap::allocateLargeChunk(std::lock_guard<StaticMutex>& lock)
 {
-    Chunk* chunk =
-        new (vmAllocate(chunkSize, chunkSize)) Chunk(lock);
+    LargeChunk* largeChunk =
+        new (vmAllocate(largeChunkSize, largeChunkSize)) LargeChunk(lock);
 
 #if BOS(DARWIN)
-    m_zone.addChunk(chunk);
+    m_zone.addLargeChunk(largeChunk);
 #endif
 
-    return LargeObject(chunk->begin());
+    return LargeObject(largeChunk->begin());
 }
 
 } // namespace bmalloc
index 520e28d..2113c5e 100644 (file)
@@ -27,8 +27,8 @@
 #define VMHeap_h
 
 #include "AsyncTask.h"
-#include "Chunk.h"
 #include "FixedVector.h"
+#include "LargeChunk.h"
 #include "LargeObject.h"
 #include "Range.h"
 #include "SegregatedFreeList.h"
@@ -54,7 +54,7 @@ public:
     void deallocateLargeObject(std::unique_lock<StaticMutex>&, LargeObject);
     
 private:
-    LargeObject allocateChunk(std::lock_guard<StaticMutex>&);
+    LargeObject allocateLargeChunk(std::lock_guard<StaticMutex>&);
 
     SegregatedFreeList m_largeObjects;
 
@@ -69,7 +69,7 @@ inline LargeObject VMHeap::allocateLargeObject(std::lock_guard<StaticMutex>& loc
         return largeObject;
 
     BASSERT(size <= largeMax);
-    return allocateChunk(lock);
+    return allocateLargeChunk(lock);
 }
 
 inline LargeObject VMHeap::allocateLargeObject(std::lock_guard<StaticMutex>& lock, size_t alignment, size_t size, size_t unalignedSize)
@@ -78,7 +78,7 @@ inline LargeObject VMHeap::allocateLargeObject(std::lock_guard<StaticMutex>& loc
         return largeObject;
 
     BASSERT(unalignedSize <= largeMax);
-    return allocateChunk(lock);
+    return allocateLargeChunk(lock);
 }
 
 inline void VMHeap::deallocateLargeObject(std::unique_lock<StaticMutex>& lock, LargeObject largeObject)
index 7fed65a..eb7e8d2 100644 (file)
@@ -88,8 +88,8 @@ static size_t zoneSize(malloc_zone_t*, const void*)
 static kern_return_t enumerator(task_t task, void* context, unsigned type_mask, vm_address_t zone_address, memory_reader_t reader, vm_range_recorder_t recorder)
 {
     Zone remoteZone(task, reader, zone_address);
-    for (auto* chunk : remoteZone.chunks()) {
-        vm_range_t range = { reinterpret_cast<vm_address_t>(chunk), chunkSize };
+    for (auto* largeChunk : remoteZone.largeChunks()) {
+        vm_range_t range = { reinterpret_cast<vm_address_t>(largeChunk), largeChunkSize };
 
         if ((type_mask & MALLOC_PTR_REGION_RANGE_TYPE))
             (*recorder)(task, context, MALLOC_PTR_REGION_RANGE_TYPE, &range, 1);
index 2d197f9..8a29079 100644 (file)
@@ -31,7 +31,7 @@
 
 namespace bmalloc {
 
-class Chunk;
+class LargeChunk;
 
 class Zone : public malloc_zone_t {
 public:
@@ -41,30 +41,30 @@ public:
     Zone();
     Zone(task_t, memory_reader_t, vm_address_t);
 
-    void addChunk(Chunk*);
-    FixedVector<Chunk*, capacity>& chunks() { return m_chunks; }
+    void addLargeChunk(LargeChunk*);
+    FixedVector<LargeChunk*, capacity>& largeChunks() { return m_largeChunks; }
     
 private:
     // This vector has two purposes:
-    //     (1) It stores the list of Chunks so that we can enumerate
-    //         each Chunk and request that it be scanned if reachable.
-    //     (2) It roots a pointer to each Chunk in a global non-malloc
-    //         VM region, making each Chunk appear reachable, and therefore
+    //     (1) It stores the list of LargeChunks so that we can enumerate
+    //         each LargeChunk and request that it be scanned if reachable.
+    //     (2) It roots a pointer to each LargeChunk in a global non-malloc
+    //         VM region, making each LargeChunk appear reachable, and therefore
     //         ensuring that the leaks tool will scan it. (The leaks tool
     //         conservatively scans all writeable VM regions that are not malloc
     //         regions, and then scans malloc regions using the introspection API.)
     // This prevents the leaks tool from reporting false positive leaks for
     // objects pointed to from bmalloc memory -- though it also prevents the
     // leaks tool from finding any leaks in bmalloc memory.
-    FixedVector<Chunk*, capacity> m_chunks;
+    FixedVector<LargeChunk*, capacity> m_largeChunks;
 };
 
-inline void Zone::addChunk(Chunk* chunk)
+inline void Zone::addLargeChunk(LargeChunk* largeChunk)
 {
-    if (m_chunks.size() == m_chunks.capacity())
+    if (m_largeChunks.size() == m_largeChunks.capacity())
         return;
     
-    m_chunks.push(chunk);
+    m_largeChunks.push(largeChunk);
 }
 
 } // namespace bmalloc