diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 4d8a1ac..83fb0c2 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -518,7 +518,7 @@ struct Iterator { }; // Call Stepwise::step for each element of remaining until it returns true. -// Applies a permutation to remaining as a side effect. +// Applies a permutation to `remaining` as a side effect. template void runInterleaved(std::span remaining, int stepLimit = -1) { while (remaining.size() > 0) { @@ -939,7 +939,7 @@ struct __attribute__((__visibility__("hidden"))) ConflictSet::Impl { } struct StepwiseInsert { - // After this phase, the heap invariant may be violated for + // After this phase, the heap invariant may be violated for *current and // (*current)->parent. Node **current; Node *parent; @@ -964,6 +964,7 @@ struct __attribute__((__visibility__("hidden"))) ConflictSet::Impl { // We could interleave the iteration in ::next, but we'd need a careful // analysis for correctness and it's unlikely to be worthwhile. auto *prev = ::next(newNode, false); + // The empty key always exists. If *key is empty then we won't reach here. assert(prev != nullptr); assert(prev->rangeVersion <= writeVersion); newNode->rangeVersion = prev->rangeVersion; @@ -1010,6 +1011,8 @@ struct __attribute__((__visibility__("hidden"))) ConflictSet::Impl { ArenaAlloc(&arena)}; workList.reserve(count); for (int i = 0; i < count; ++i) { + Node *node = *stepwiseInserts[i].current; + assert(node != nullptr); workList.push_back(*stepwiseInserts[i].current); }