/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// Largest sub-page size class, or zero if there are none
GLOBAL(size_t, gMaxSubPageClass,
gPageSize / 2 >= kMinSubPageClass ? gPageSize / 2 : 0)
// Number of sub-page bins.
GLOBAL(uint8_t, gNumSubPageClasses, []() GLOBAL_CONSTEXPR -> uint8_t { if GLOBAL_CONSTEXPR (gMaxSubPageClass != 0) {
return mozilla::FloorLog2(gMaxSubPageClass) - LOG2(kMinSubPageClass) + 1;
}
return 0;
}())
// For system calls that allocate pages we use this to round-up to a real // page boundary.
GLOBAL(size_t, gPagesPerRealPage,
gPageSize < gRealPageSize ? gRealPageSize / gPageSize : 1);
// Number of pages in a chunk.
GLOBAL(size_t, gChunkNumPages, kChunkSize >> gPageSize2Pow)
// Number of pages necessary for a chunk header plus a guard page.
GLOBAL(size_t, gChunkHeaderNumPages,
gPagesPerRealPage +
(std::max(PAGE_CEILING(sizeof(arena_chunk_t) +
sizeof(arena_chunk_map_t) * gChunkNumPages),
REAL_PAGE_CEILING(sizeof(arena_chunk_t) +
sizeof(arena_chunk_map_t) *
gChunkNumPages)) >>
gPageSize2Pow));
// One chunk, minus the header, minus a guard page
GLOBAL(size_t, gMaxLargeClass,
kChunkSize - gRealPageSize - (gChunkHeaderNumPages << gPageSize2Pow))
// The minimum run size and minimum regions per run control how often run // allocation is required and reduce the amount of slow path executions. //
GLOBAL(size_t, gMinimumRunSize, std::max(gPageSize, 16_KiB))
// Various checks that regard configuration.
GLOBAL_ASSERT(1ULL << gPageSize2Pow == gPageSize, "Page size is not a power of two");
GLOBAL_ASSERT(1ULL << gRealPageSize2Pow == gRealPageSize, "Real page size is not a power of two");
GLOBAL_ASSERT(kQuantum >= sizeof(void*));
GLOBAL_ASSERT(kQuantum <= kQuantumWide);
GLOBAL_ASSERT(!kNumQuantumWideClasses ||
kQuantumWide <= (kMinSubPageClass - kMaxQuantumClass));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.