зеркало из https://github.com/mozilla/pjs.git
Bug 696211 - Align ChunkInfo by inserting padding in Chunk; r=billm
We get a 2% speedup on EarlyBoyer if ChunkInfo (hot all over the GC allocator paths) is not split across a cache line. An easy and guaranteed effective way to do this is to just pad Chunk out to the full 1MiB allocation. This makes ChunkInfo abut the end of the 1MiB allocation, rather than whereever the Arenas and ChunkBitmap happen to end. Since GC Chunks are aligned at 1MiB address boundaries, this ensures that ChunkInfo is inside of a cache line.
This commit is contained in:
Родитель
d549e39f57
Коммит
1752d62659
|
@ -615,12 +615,22 @@ struct ChunkBitmap {
|
|||
|
||||
JS_STATIC_ASSERT(ArenaBitmapBytes * ArenasPerChunk == sizeof(ChunkBitmap));
|
||||
|
||||
const size_t ChunkPadSize = GC_CHUNK_SIZE
|
||||
- (sizeof(Arena) * ArenasPerChunk)
|
||||
- sizeof(ChunkBitmap)
|
||||
- sizeof(ChunkInfo);
|
||||
JS_STATIC_ASSERT(ChunkPadSize < BytesPerArena);
|
||||
|
||||
/*
|
||||
* Chunks contain arenas and associated data structures (mark bitmap, delayed
|
||||
* marking state).
|
||||
*/
|
||||
struct Chunk {
|
||||
Arena arenas[ArenasPerChunk];
|
||||
|
||||
/* Pad to full size to ensure cache alignment of ChunkInfo. */
|
||||
uint8 padding[ChunkPadSize];
|
||||
|
||||
ChunkBitmap bitmap;
|
||||
ChunkInfo info;
|
||||
|
||||
|
@ -667,8 +677,7 @@ struct Chunk {
|
|||
inline void init();
|
||||
};
|
||||
|
||||
JS_STATIC_ASSERT(sizeof(Chunk) <= GC_CHUNK_SIZE);
|
||||
JS_STATIC_ASSERT(sizeof(Chunk) + BytesPerArena > GC_CHUNK_SIZE);
|
||||
JS_STATIC_ASSERT(sizeof(Chunk) == GC_CHUNK_SIZE);
|
||||
|
||||
class ChunkPool {
|
||||
Chunk *emptyChunkListHead;
|
||||
|
|
Загрузка…
Ссылка в новой задаче