tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit acf68cbd78a47b21d80decda80e9077200640cc6
parent bc281b7f56d822280813210d70908f7d34c94bfa
Author: Paul Bone <paul@bone.id.au>
Date:   Thu, 16 Oct 2025 22:26:49 +0000

Bug 1984011 - pt 5. Give AddressRadixTree a constexpr constructor r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D262271

Diffstat:
Mmemory/build/Chunk.cpp | 3++-
Mmemory/build/RadixTree.h | 5++++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/memory/build/Chunk.cpp b/memory/build/Chunk.cpp @@ -483,7 +483,8 @@ static void* chunk_alloc_mmap(size_t size, size_t alignment) { return ret; } -AddressRadixTree<(sizeof(void*) << 3) - LOG2(kChunkSize)> gChunkRTree; +MOZ_CONSTINIT AddressRadixTree<(sizeof(void*) << 3) - LOG2(kChunkSize)> + gChunkRTree; // Protects chunk-related data structures. static Mutex chunks_mtx; diff --git a/memory/build/RadixTree.h b/memory/build/RadixTree.h @@ -44,9 +44,12 @@ class AddressRadixTree { Mutex mLock MOZ_UNANNOTATED; // We guard only the single slot creations and assume read-only is safe // at any time. - void** mRoot; + void** mRoot = nullptr; public: + // Note that the constructor does not initialise the mutex. + constexpr AddressRadixTree() {} + bool Init() MOZ_REQUIRES(gInitLock) MOZ_EXCLUDES(mLock); inline void* Get(void* aAddr) MOZ_EXCLUDES(mLock);