commit 649b1ba949341625ce7d2faf57c032d89356f377
parent acf68cbd78a47b21d80decda80e9077200640cc6
Author: Paul Bone <paul@bone.id.au>
Date: Thu, 16 Oct 2025 22:26:49 +0000
Bug 1984011 - pt 6. Give ArenaCollection a constexpr constructor r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D262272
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/memory/build/mozjemalloc.cpp b/memory/build/mozjemalloc.cpp
@@ -918,6 +918,8 @@ struct ArenaTreeTrait {
// used by the standard API.
class ArenaCollection {
public:
+ constexpr ArenaCollection() {}
+
bool Init() MOZ_REQUIRES(gInitLock) MOZ_EXCLUDES(mLock) {
arena_params_t params;
// The main arena allows more dirty pages than the default for other arenas.
@@ -1187,8 +1189,8 @@ class ArenaCollection {
return aArenaId & MAIN_THREAD_ARENA_BIT;
}
- arena_t* mDefaultArena;
- arena_id_t mLastPublicArenaId MOZ_GUARDED_BY(mLock);
+ arena_t* mDefaultArena = nullptr;
+ arena_id_t mLastPublicArenaId MOZ_GUARDED_BY(mLock) = 0;
// Accessing mArenas and mPrivateArenas can only be done while holding mLock.
Tree mArenas MOZ_GUARDED_BY(mLock);
@@ -1228,7 +1230,7 @@ class ArenaCollection {
Atomic<bool> mIsDeferredPurgeEnabled;
};
-MOZ_RUNINIT static ArenaCollection gArenas;
+MOZ_CONSTINIT static ArenaCollection gArenas;
// Protects huge allocation-related data structures.
static Mutex huge_mtx;