Only skip free list from maybeDecreaseCapacity
All checks were successful
Tests / Release [gcc] total: 932, passed: 932
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 931, passed: 931
Tests / Coverage total: 930, passed: 930
weaselab/conflict-set/pipeline/head This commit looks good
All checks were successful
Tests / Release [gcc] total: 932, passed: 932
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 931, passed: 931
Tests / Coverage total: 930, passed: 930
weaselab/conflict-set/pipeline/head This commit looks good
This commit is contained in:
@@ -744,7 +744,8 @@ Node *nextLogical(Node *node) {
|
||||
}
|
||||
|
||||
// Invalidates `self`, replacing it with a node of at least capacity.
|
||||
// Does not return nodes to freelists.
|
||||
// Does not return nodes to freelists when kUseFreeList is false.
|
||||
template <bool kUseFreeList>
|
||||
void makeCapacityAtLeast(Node *&self, int capacity, NodeAllocators *allocators,
|
||||
ConflictSet::Impl *impl) {
|
||||
switch (self->type) {
|
||||
@@ -755,7 +756,11 @@ void makeCapacityAtLeast(Node *&self, int capacity, NodeAllocators *allocators,
|
||||
kNodeCopySize);
|
||||
memcpy(newSelf->partialKey(), self0->partialKey(), self->partialKeyLen);
|
||||
getInTree(self, impl) = newSelf;
|
||||
free(self0);
|
||||
if constexpr (kUseFreeList) {
|
||||
allocators->node0.release(self0);
|
||||
} else {
|
||||
free(self0);
|
||||
}
|
||||
self = newSelf;
|
||||
} break;
|
||||
case Type::Node4: {
|
||||
@@ -771,7 +776,11 @@ void makeCapacityAtLeast(Node *&self, int capacity, NodeAllocators *allocators,
|
||||
}
|
||||
getInTree(self, impl) = newSelf;
|
||||
setChildrenParents(newSelf);
|
||||
free(self4);
|
||||
if constexpr (kUseFreeList) {
|
||||
allocators->node4.release(self4);
|
||||
} else {
|
||||
free(self4);
|
||||
}
|
||||
self = newSelf;
|
||||
} break;
|
||||
case Type::Node16: {
|
||||
@@ -787,7 +796,11 @@ void makeCapacityAtLeast(Node *&self, int capacity, NodeAllocators *allocators,
|
||||
}
|
||||
getInTree(self, impl) = newSelf;
|
||||
setChildrenParents(newSelf);
|
||||
free(self16);
|
||||
if constexpr (kUseFreeList) {
|
||||
allocators->node16.release(self16);
|
||||
} else {
|
||||
free(self16);
|
||||
}
|
||||
self = newSelf;
|
||||
} break;
|
||||
case Type::Node48: {
|
||||
@@ -807,7 +820,11 @@ void makeCapacityAtLeast(Node *&self, int capacity, NodeAllocators *allocators,
|
||||
0, 256);
|
||||
getInTree(self, impl) = newSelf;
|
||||
setChildrenParents(newSelf);
|
||||
free(self48);
|
||||
if constexpr (kUseFreeList) {
|
||||
allocators->node48.release(self48);
|
||||
} else {
|
||||
free(self48);
|
||||
}
|
||||
self = newSelf;
|
||||
} break;
|
||||
case Type::Node256: {
|
||||
@@ -821,7 +838,11 @@ void makeCapacityAtLeast(Node *&self, int capacity, NodeAllocators *allocators,
|
||||
[&](int c) { newSelf->children[c] = self256->children[c]; }, 0, 256);
|
||||
getInTree(self, impl) = newSelf;
|
||||
setChildrenParents(newSelf);
|
||||
free(self256);
|
||||
if constexpr (kUseFreeList) {
|
||||
allocators->node256.release(self256);
|
||||
} else {
|
||||
free(self256);
|
||||
}
|
||||
self = newSelf;
|
||||
} break;
|
||||
}
|
||||
@@ -837,7 +858,8 @@ void maybeDecreaseCapacity(Node *&self, NodeAllocators *allocators,
|
||||
if (self->partialKeyCapacity <= maxCapacity) {
|
||||
return;
|
||||
}
|
||||
makeCapacityAtLeast(self, maxCapacity, allocators, impl);
|
||||
makeCapacityAtLeast</*kUseFreeList*/ false>(self, maxCapacity, allocators,
|
||||
impl);
|
||||
}
|
||||
|
||||
// TODO fuse into erase child so we don't need to repeat branches on type
|
||||
@@ -868,7 +890,8 @@ void maybeDownsize(Node *self, NodeAllocators *allocators,
|
||||
|
||||
if (minCapacity > child->partialKeyCapacity) {
|
||||
const bool update = child == dontInvalidate;
|
||||
makeCapacityAtLeast(child, minCapacity, allocators, impl);
|
||||
makeCapacityAtLeast</*kUseFreeList*/ true>(child, minCapacity,
|
||||
allocators, impl);
|
||||
if (update) {
|
||||
dontInvalidate = child;
|
||||
}
|
||||
|
Reference in New Issue
Block a user