Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8936a255410e4f7e56028fc8f759a8040c1a0489
https://github.com/WebKit/WebKit/commit/8936a255410e4f7e56028fc8f759a8040c1a0489
Author: Mark Lam <[email protected]>
Date: 2026-01-31 (Sat, 31 Jan 2026)
Changed paths:
M Source/bmalloc/bmalloc/TZoneHeap.h
M Source/bmalloc/bmalloc/TZoneHeapManager.cpp
M Source/bmalloc/bmalloc/TZoneHeapManager.h
Log Message:
-----------
Refactor TZoneHeap and TZoneHeapManager to better express the concepts.
https://bugs.webkit.org/show_bug.cgi?id=306696
rdar://169338245
Reviewed by Keith Miller.
This change only contains renaming of labels (i.e. type, field, and local
variable names).
The only changes not related to label renaming are:
a. the re-factoring out of TZoneDescriptorHashTrait (see (4) below).
b. the replacement of one print string that says "size classes" with
"descriptors".
Details:
1. Renamed the following:
SizeAndAlignment::Value -> TZoneDescriptor
- this will allow us to add more / alternate attributes into how we sort
TZone types
later in a subsequent patch (and not just be limited to size and
alignment).
See comment about Category in the organization of TZones heaps in
TZoneHeapManager.h.
TZoneHeapManager::TZoneBucket -> TZoneHeapManager::Bucket
TZoneHeapManager::TZoneTypeBuckets -> TZoneHeapManager::Group
TZoneHeapManager::TZoneTypeBuckets::numberOfTypesThisSizeClass ->
TZoneHeapManager::Group::numberOfTypesInGroup
TZoneHeapManager::m_typeSizes -> TZoneHeapManager::m_registeredDescriptors
TZoneHeapManager::m_heapRefsBySizeAndAlignment ->
TZoneHeapManager::m_groupByDescriptor
SIZE_TZONE_TYPE_BUCKETS -> TZONE_GROUP_SIZE
- the previous names were unnecessarily long, or were not easy to grok
(e.g. what exactly
are TypeBuckets?). So, here we remove unnecessary the "TZone" prefix for
embedded classes,
and gave the group of Buckets concept a better name i.e. Group. The rest
of the renaming
fall out from these.
2. Added a comment in TZoneHeapManager.h to better describe the way TZone heaps
are organized.
3. In TZoneHeapManager::dumpRegisteredTypes(), renamed some local variables to
say what they
actually mean, and also to be more consistent with other local variable
naming in the same
function:
largestSizeClassCount -> typeCountHighWatermark
largestSizeClass -> typeCountHighWatermarkDescriptor
- largestSizeClass is actually the type / descriptor (refered to as
"SizeClass") that
corresponds to the high watermark count. The old names read like
largestSizeClassCount
is the number of instances of the largestSizeClass. This is misleading,
and fails to
communicate the true intent of these variables.
numBucketsThisSizeClass -> bucketCount
- there's also a re-computation of this same value but stored in a local
named bucketCount
later in the function. So, I just renamed numBucketsThisSizeClass, and
removed the
duplicate local.
4. Broke the SizeAndAlignment::hash() method out into a
TZoneDescriptorHashTrait class where
it belongs.
No new tests because this is only a refactoring change with no behavior change.
* Source/bmalloc/bmalloc/TZoneHeap.h:
(bmalloc::api::SizeAndAlignment::encode):
(bmalloc::api::SizeAndAlignment::decodeSize):
(bmalloc::api::SizeAndAlignment::decodeAlignment):
(bmalloc::api::TZoneDescriptorHashTrait::hash):
(bmalloc::api::SizeAndAlignment::hash): Deleted.
* Source/bmalloc/bmalloc/TZoneHeapManager.cpp:
(bmalloc::api::TZoneHeapManager::dumpRegisteredTypes):
(bmalloc::api::TZoneHeapManager::bucketCountForSizeClass):
(bmalloc::api::TZoneHeapManager::bucketForKey):
(bmalloc::api::TZoneHeapManager::populateGroupBuckets):
(bmalloc::api::TZoneHeapManager::heapRefForTZoneType):
(bmalloc::api::TZoneHeapManager::TZoneHeapManager::heapRefForTZoneTypeDifferentSize):
(bmalloc::api::TZoneHeapManager::tzoneBucketForKey): Deleted.
(bmalloc::api::TZoneHeapManager::populateBucketsForSizeClass): Deleted.
* Source/bmalloc/bmalloc/TZoneHeapManager.h:
Canonical link: https://commits.webkit.org/306589@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications