RESOLVED FIXED 156152
bmalloc: segregate small and large objects again, and allocate more objects on the small path
https://bugs.webkit.org/show_bug.cgi?id=156152
Summary bmalloc: segregate small and large objects again, and allocate more objects o...
Geoffrey Garen
Reported 2016-04-03 17:55:39 PDT
bmalloc: segregate small and large objects again, and allocate more objects on the small path
Attachments
Patch (40.41 KB, patch)
2016-04-03 18:31 PDT, Geoffrey Garen
sam: review+
Geoffrey Garen
Comment 1 2016-04-03 18:31:06 PDT
WebKit Commit Bot
Comment 2 2016-04-03 18:32:14 PDT
Attachment 275519 [details] did not pass style-queue: ERROR: Source/bmalloc/bmalloc/Heap.cpp:86: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/bmalloc/bmalloc/Heap.cpp:91: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/bmalloc/bmalloc/Heap.cpp:296: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/bmalloc/bmalloc/Heap.cpp:344: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/bmalloc/bmalloc/Heap.cpp:403: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 5 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
Sam Weinig
Comment 3 2016-04-03 18:52:56 PDT
Comment on attachment 275519 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=275519&action=review > Source/bmalloc/bmalloc/Chunk.h:92 > + // The first few bytes of metadata cover the metadata region, so they're > + // not used. We can steal them to store m_objectType. > + ObjectType m_objectType; > + > + // A chunk is either small or large for its lifetime, so we can union > + // small and large metadata, and then use one or the other at runtime. > + std::array<SmallPage, chunkSize / smallPageSize> m_pages; > + std::array<BoundaryTag, boundaryTagCount> m_boundaryTags; This is neat, but it would be neater if there was an assertion that the object type never overlapped with anything interesting in m_pages or m_boundaryTags.
Geoffrey Garen
Comment 4 2016-04-03 22:21:33 PDT
> This is neat, but it would be neater if there was an assertion that the > object type never overlapped with anything interesting in m_pages or > m_boundaryTags. I wrote this assertion and it demonstrated that we had two problems: (1) Chunk::begin() would provide a pointer that wasn't physical-page-size-aligned on 16kB systems. All pages in this kind of chunk would fail to madvise. (2) If you changed things around so that the first page started at byte 0, which was physical-page-size-aligned, then you would collide with m_objectType. I solved these problems by changing Chunk::begin() to round up to the physical page size, and keeping the first page starting at Chunk::begin(). This wastes a little metadata space on 16kB systems, but not a lot (1.5% vs 1.0%).
Geoffrey Garen
Comment 5 2016-04-03 22:26:37 PDT
Benjamin Poulain
Comment 6 2016-04-04 00:47:22 PDT
From AreWeFastYet, it looks like this could be a 0.5% win on Sunspider.
Note You need to log in before you can comment on or make changes to this bug.