diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 9804a44..5d46c90 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -2670,7 +2670,8 @@ bool checkRangeStartsWith(NodeT *nTyped, TrivialSpan key, int begin, int end, readContext); } - Node *child = getChild(nTyped, remaining[0]); + auto cAndV = getChildAndMaxVersion(nTyped, remaining[0]); + Node *child = cAndV.child; if (child == nullptr) { auto c = getChildGeq(nTyped, remaining[0]); if (c != nullptr) { @@ -2710,7 +2711,7 @@ bool checkRangeStartsWith(NodeT *nTyped, TrivialSpan key, int begin, int end, if (n->entryPresent && n->entry.rangeVersion > readVersion) { return false; } - return maxVersion(n) <= readVersion; + return cAndV.maxVersion <= readVersion; } return true; } @@ -3567,8 +3568,8 @@ PRESERVE_NONE void done_common_prefix_iter(Job *job, Context *context) { // This is a hack --job->lcp; - auto c = getChild(n, job->remaining[0]); - Node *child = c; + auto cAndV = getChildAndMaxVersion(n, job->remaining[0]); + Node *child = cAndV.child; if (child == nullptr) { auto c = getChildGeq(n, job->remaining[0]); if (c != nullptr) { @@ -3587,7 +3588,8 @@ PRESERVE_NONE void done_common_prefix_iter(Job *job, Context *context) { } job->n = child; - job->continuation = rightSideIterTable[c.getType()]; + job->maxV = cAndV.maxVersion; + job->continuation = rightSideIterTable[cAndV.child.getType()]; MUSTTAIL return keepGoing(job, context); } @@ -3732,8 +3734,8 @@ PRESERVE_NONE void done_left_side_iter(Job *job, Context *context) { job->n = job->commonPrefixNode; job->remaining = job->end; - auto c = getChild(job->n, job->remaining[0]); - Node *child = c; + auto cAndV = getChildAndMaxVersion(job->n, job->remaining[0]); + Node *child = cAndV.child; if (child == nullptr) { auto c = getChildGeq(job->n, job->remaining[0]); if (c != nullptr) { @@ -3753,7 +3755,8 @@ PRESERVE_NONE void done_left_side_iter(Job *job, Context *context) { } job->n = child; - job->continuation = rightSideIterTable[c.getType()]; + job->maxV = cAndV.maxVersion; + job->continuation = rightSideIterTable[cAndV.child.getType()]; MUSTTAIL return keepGoing(job, context); } @@ -3799,7 +3802,7 @@ PRESERVE_NONE void right_side_iter(Job *job, Context *context) { MUSTTAIL return complete(job, context); } if ((n->parent != job->commonPrefixNode || i >= job->lcp) && - maxVersion(n) > job->readVersion) { + job->maxV > job->readVersion) { job->setResult(false); MUSTTAIL return complete(job, context); } @@ -3844,8 +3847,8 @@ PRESERVE_NONE void right_side_iter(Job *job, Context *context) { MUSTTAIL return complete(job, context); } - auto c = getChild(job->n, job->remaining[0]); - Node *child = c; + auto cAndV = getChildAndMaxVersion(job->n, job->remaining[0]); + Node *child = cAndV.child; if (child == nullptr) { auto c = getChildGeq(n, job->remaining[0]); if (c != nullptr) { @@ -3865,7 +3868,8 @@ PRESERVE_NONE void right_side_iter(Job *job, Context *context) { } job->n = child; - job->continuation = rightSideIterTable[c.getType()]; + job->maxV = cAndV.maxVersion; + job->continuation = rightSideIterTable[cAndV.child.getType()]; MUSTTAIL return keepGoing(job, context); } @@ -4545,7 +4549,7 @@ bool checkPrefixRead(Node *n, const TrivialSpan key, // n is the first physical node greater than remaining, and there's no // eq node. All physical nodes that start with prefix are reachable from // n. - if (maxVersion(n) > readVersion) { + if (maxV > readVersion) { return false; } goto downLeftSpine; @@ -4620,7 +4624,7 @@ bool checkRangeLeftSide(Node *n, TrivialSpan key, int prefixLen, if (n->entryPresent && n->entry.rangeVersion > readVersion) { return false; } - return maxVersion(n) <= readVersion; + return maxV <= readVersion; } else { n = nextSibling(n); if (n == nullptr) { @@ -4637,7 +4641,7 @@ bool checkRangeLeftSide(Node *n, TrivialSpan key, int prefixLen, if (n->entryPresent && n->entry.rangeVersion > readVersion) { return false; } - return maxVersion(n) <= readVersion; + return maxV <= readVersion; } } if (maxV <= readVersion) {