Skip to content

Commit

Permalink
Add a default constructor to seqset nodes. (#636)
Browse files Browse the repository at this point in the history
This allows them to exist as fields without invalidating the set.

This should make it possible to remove the undefined behaviour in the
creation of FrontendSlabMetadata, which is currently created via a
reinterpret_cast from a different-typed allocation.
FrontendSlabMetadata has a SeqSet::Node field that is in an unspecified
state on construction and which is valid only when inserted into a
SeqSet.
  • Loading branch information
davidchisnall authored Sep 18, 2023
1 parent 2a7670e commit 126e77f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/snmalloc/ds_core/seqset.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ namespace snmalloc
constexpr Node(Node* next, Node* prev) : next(next), prev(prev) {}

public:
/// Default constructor, creates an invalid node.
constexpr Node() : Node(nullptr, nullptr) {}

void invariant()
{
SNMALLOC_ASSERT(next != nullptr);
Expand Down

0 comments on commit 126e77f

Please sign in to comment.