makeCapacityAtLeast -> freeAndMakeCapacityAtLeast

This commit is contained in:
2024-03-13 14:01:47 -07:00
parent 12540b8713
commit e818648cdc

View File

@@ -803,8 +803,9 @@ Node *nextLogical(Node *node) {
// Invalidates `self`, replacing it with a node of at least capacity.
// Does not return nodes to freelists when kUseFreeList is false.
template <bool kUseFreeList>
void makeCapacityAtLeast(Node *&self, int capacity, NodeAllocators *allocators,
ConflictSet::Impl *impl) {
void freeAndMakeCapacityAtLeast(Node *&self, int capacity,
NodeAllocators *allocators,
ConflictSet::Impl *impl) {
switch (self->type) {
case Type_Node0: {
auto *self0 = (Node0 *)self;
@@ -915,8 +916,8 @@ void maybeDecreaseCapacity(Node *&self, NodeAllocators *allocators,
if (self->partialKeyCapacity <= maxCapacity) {
return;
}
makeCapacityAtLeast</*kUseFreeList*/ false>(self, maxCapacity, allocators,
impl);
freeAndMakeCapacityAtLeast</*kUseFreeList*/ false>(self, maxCapacity,
allocators, impl);
}
// TODO fuse into erase child so we don't need to repeat branches on type
@@ -947,8 +948,8 @@ void maybeDownsize(Node *self, NodeAllocators *allocators,
if (minCapacity > child->partialKeyCapacity) {
const bool update = child == dontInvalidate;
makeCapacityAtLeast</*kUseFreeList*/ true>(child, minCapacity,
allocators, impl);
freeAndMakeCapacityAtLeast</*kUseFreeList*/ true>(child, minCapacity,
allocators, impl);
if (update) {
dontInvalidate = child;
}