Compare commits
2 Commits
6b6a9bace9
...
a07c93ffff
| Author | SHA1 | Date | |
|---|---|---|---|
| a07c93ffff | |||
| c68f563017 |
+2
-1
@@ -22,7 +22,8 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|||||||
"MinSizeRel" "RelWithDebInfo")
|
"MinSizeRel" "RelWithDebInfo")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_compile_options(-fdata-sections -ffunction-sections -fstrict-enums)
|
add_compile_options(-fdata-sections -ffunction-sections -Wswitch-enum
|
||||||
|
-Werror=switch-enum)
|
||||||
|
|
||||||
# This is encouraged according to
|
# This is encouraged according to
|
||||||
# https://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq
|
# https://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq
|
||||||
|
|||||||
+37
-12
@@ -382,9 +382,10 @@ uint8_t *Node::partialKey() {
|
|||||||
return ((Node48 *)this)->partialKey();
|
return ((Node48 *)this)->partialKey();
|
||||||
case Type_Node256:
|
case Type_Node256:
|
||||||
return ((Node256 *)this)->partialKey();
|
return ((Node256 *)this)->partialKey();
|
||||||
}
|
default:
|
||||||
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct NodeAllocators {
|
struct NodeAllocators {
|
||||||
BoundedFreeListAllocator<Node0> node0;
|
BoundedFreeListAllocator<Node0> node0;
|
||||||
@@ -478,9 +479,10 @@ Node *&getChildExists(Node *self, uint8_t index) {
|
|||||||
assert(self256->bitSet.test(index));
|
assert(self256->bitSet.test(index));
|
||||||
return self256->children[index].child;
|
return self256->children[index].child;
|
||||||
}
|
}
|
||||||
}
|
default:
|
||||||
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Precondition - an entry for index must exist in the node
|
// Precondition - an entry for index must exist in the node
|
||||||
int64_t &maxVersion(Node *n, ConflictSet::Impl *);
|
int64_t &maxVersion(Node *n, ConflictSet::Impl *);
|
||||||
@@ -510,9 +512,10 @@ Node *getChild(Node *self, uint8_t index) {
|
|||||||
auto *self256 = static_cast<Node256 *>(self);
|
auto *self256 = static_cast<Node256 *>(self);
|
||||||
return self256->children[index].child;
|
return self256->children[index].child;
|
||||||
}
|
}
|
||||||
}
|
default:
|
||||||
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <class NodeT> int getChildGeqSimd(NodeT *self, int child) {
|
template <class NodeT> int getChildGeqSimd(NodeT *self, int child) {
|
||||||
static_assert(std::is_same_v<NodeT, Node3> || std::is_same_v<NodeT, Node16>);
|
static_assert(std::is_same_v<NodeT, Node3> || std::is_same_v<NodeT, Node16>);
|
||||||
@@ -590,9 +593,10 @@ int getChildGeq(Node *self, int child) {
|
|||||||
auto *self48 = static_cast<Node48 *>(self);
|
auto *self48 = static_cast<Node48 *>(self);
|
||||||
return self48->bitSet.firstSetGeq(child);
|
return self48->bitSet.firstSetGeq(child);
|
||||||
}
|
}
|
||||||
}
|
default:
|
||||||
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void setChildrenParents(Node3 *n) {
|
void setChildrenParents(Node3 *n) {
|
||||||
for (int i = 0; i < n->numChildren; ++i) {
|
for (int i = 0; i < n->numChildren; ++i) {
|
||||||
@@ -652,6 +656,8 @@ Node *&getOrCreateChild(Node *&self, uint8_t index,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
default:
|
||||||
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (self->type) {
|
switch (self->type) {
|
||||||
@@ -783,9 +789,10 @@ Node *&getOrCreateChild(Node *&self, uint8_t index,
|
|||||||
self256->bitSet.set(index);
|
self256->bitSet.set(index);
|
||||||
return self256->children[index].child;
|
return self256->children[index].child;
|
||||||
}
|
}
|
||||||
}
|
default:
|
||||||
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Node *nextPhysical(Node *node) {
|
Node *nextPhysical(Node *node) {
|
||||||
int index = -1;
|
int index = -1;
|
||||||
@@ -917,6 +924,8 @@ void freeAndMakeCapacityAtLeast(Node *&self, int capacity,
|
|||||||
}
|
}
|
||||||
self = newSelf;
|
self = newSelf;
|
||||||
} break;
|
} break;
|
||||||
|
default:
|
||||||
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1063,6 +1072,8 @@ void maybeDownsize(Node *self, NodeAllocators *allocators,
|
|||||||
allocators->node256.release(self256);
|
allocators->node256.release(self256);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1111,6 +1122,8 @@ Node *erase(Node *self, NodeAllocators *allocators, ConflictSet::Impl *impl,
|
|||||||
case Type_Node256:
|
case Type_Node256:
|
||||||
allocators->node256.release((Node256 *)self);
|
allocators->node256.release((Node256 *)self);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (parent->type) {
|
switch (parent->type) {
|
||||||
@@ -1158,6 +1171,8 @@ Node *erase(Node *self, NodeAllocators *allocators, ConflictSet::Impl *impl,
|
|||||||
parent256->bitSet.reset(parentsIndex);
|
parent256->bitSet.reset(parentsIndex);
|
||||||
parent256->children[parentsIndex].child = nullptr;
|
parent256->children[parentsIndex].child = nullptr;
|
||||||
} break;
|
} break;
|
||||||
|
default:
|
||||||
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
|
|
||||||
--parent->numChildren;
|
--parent->numChildren;
|
||||||
@@ -1508,6 +1523,8 @@ int64_t maxBetweenExclusive(Node *n, int begin, int end) {
|
|||||||
begin, end);
|
begin, end);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
#if DEBUG_VERBOSE && !defined(NDEBUG)
|
#if DEBUG_VERBOSE && !defined(NDEBUG)
|
||||||
fprintf(stderr, "At `%s', max version in (%02x, %02x) is %" PRId64 "\n",
|
fprintf(stderr, "At `%s', max version in (%02x, %02x) is %" PRId64 "\n",
|
||||||
@@ -1711,7 +1728,7 @@ struct CheckRangeLeftSide {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DownLeftSpine:
|
case DownLeftSpine: {
|
||||||
if (n->entryPresent) {
|
if (n->entryPresent) {
|
||||||
ok = n->entry.rangeVersion <= readVersion;
|
ok = n->entry.rangeVersion <= readVersion;
|
||||||
return true;
|
return true;
|
||||||
@@ -1719,7 +1736,9 @@ struct CheckRangeLeftSide {
|
|||||||
int c = getChildGeq(n, 0);
|
int c = getChildGeq(n, 0);
|
||||||
assert(c >= 0);
|
assert(c >= 0);
|
||||||
n = getChildExists(n, c);
|
n = getChildExists(n, c);
|
||||||
break;
|
} break;
|
||||||
|
default:
|
||||||
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1837,7 +1856,7 @@ struct CheckRangeRightSide {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case DownLeftSpine:
|
case DownLeftSpine: {
|
||||||
if (n->entryPresent) {
|
if (n->entryPresent) {
|
||||||
ok = n->entry.rangeVersion <= readVersion;
|
ok = n->entry.rangeVersion <= readVersion;
|
||||||
return true;
|
return true;
|
||||||
@@ -1845,7 +1864,9 @@ struct CheckRangeRightSide {
|
|||||||
int c = getChildGeq(n, 0);
|
int c = getChildGeq(n, 0);
|
||||||
assert(c >= 0);
|
assert(c >= 0);
|
||||||
n = getChildExists(n, c);
|
n = getChildExists(n, c);
|
||||||
break;
|
} break;
|
||||||
|
default:
|
||||||
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2380,9 +2401,10 @@ int64_t &maxVersion(Node *n, ConflictSet::Impl *impl) {
|
|||||||
assert(n256->bitSet.test(index));
|
assert(n256->bitSet.test(index));
|
||||||
return n256->children[index].childMaxVersion;
|
return n256->children[index].childMaxVersion;
|
||||||
}
|
}
|
||||||
}
|
default:
|
||||||
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Node *&getInTree(Node *n, ConflictSet::Impl *impl) {
|
Node *&getInTree(Node *n, ConflictSet::Impl *impl) {
|
||||||
return n->parent == nullptr ? impl->root
|
return n->parent == nullptr ? impl->root
|
||||||
@@ -2651,6 +2673,8 @@ Iterator firstGeq(Node *n, std::string_view key) {
|
|||||||
case Type_Node256:
|
case Type_Node256:
|
||||||
minNumChildren = kMinChildrenNode256;
|
minNumChildren = kMinChildrenNode256;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
if (node->numChildren + int(node->entryPresent) < minNumChildren) {
|
if (node->numChildren + int(node->entryPresent) < minNumChildren) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@@ -2708,9 +2732,10 @@ int64_t getNodeSize(struct Node *n) {
|
|||||||
return sizeof(Node48);
|
return sizeof(Node48);
|
||||||
case Type_Node256:
|
case Type_Node256:
|
||||||
return sizeof(Node256);
|
return sizeof(Node256);
|
||||||
}
|
default:
|
||||||
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int64_t getSearchPathLength(Node *n) {
|
int64_t getSearchPathLength(Node *n) {
|
||||||
assert(n != nullptr);
|
assert(n != nullptr);
|
||||||
@@ -2772,7 +2797,7 @@ struct __attribute__((visibility("default"))) PeakPrinter {
|
|||||||
printf("Key bytes: %g\n", double(keyBytes));
|
printf("Key bytes: %g\n", double(keyBytes));
|
||||||
printf("Peak key bytes: %g (not sharing common prefixes)\n",
|
printf("Peak key bytes: %g (not sharing common prefixes)\n",
|
||||||
double(peakKeyBytes));
|
double(peakKeyBytes));
|
||||||
printf("Partial capacity bytes: %g\n", double(partialCapacityBytes));
|
printf("Partial key capacity bytes: %g\n", double(partialCapacityBytes));
|
||||||
printf("Peak partial key capacity bytes: %g\n",
|
printf("Peak partial key capacity bytes: %g\n",
|
||||||
double(peakPartialCapacityBytes));
|
double(peakPartialCapacityBytes));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user