Prevented writing useless null tags for unstitched diverged trunks
This can happen if we end up pruning all alts in a diverged trunk. Note this is subtly different than finding no diverged trunk, as we still need to switch to the LFSR_D_DIVERGED* state in order to prune alts on the non-empty diverged trunk. We need a special case here, because there's no way to represent an empty trunk without a reachable null tag. But a reachable null tag would violate our rbyd's right-leaning property and break lookupnext. We already had a special case for this situation, which would skip the alt that would stitch the trunks together, but we were still writing out a null tag for the diverged trunk even if it was empty. We don't need this null tag and it turns out not writing the null tag saves a null tag.
This commit is contained in:
@@ -3277,7 +3277,7 @@ again:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO is this not a_lower_tag?
|
// TODO is this not a_lower_tag?
|
||||||
d_tag = lfsr_tag_key(p_alts[0]);
|
d_tag = p_alts[0];
|
||||||
|
|
||||||
// flush any pending alts
|
// flush any pending alts
|
||||||
err = lfsr_rbyd_p_flush(lfs, rbyd,
|
err = lfsr_rbyd_p_flush(lfs, rbyd,
|
||||||
@@ -3290,6 +3290,7 @@ again:;
|
|||||||
// why does hiding this behind if d_tag=0 not work?
|
// why does hiding this behind if d_tag=0 not work?
|
||||||
//
|
//
|
||||||
// terminate diverged branch with an unreachable tag
|
// terminate diverged branch with an unreachable tag
|
||||||
|
if (d_tag) {
|
||||||
err = lfsr_rbyd_appendattr_(lfs, rbyd,
|
err = lfsr_rbyd_appendattr_(lfs, rbyd,
|
||||||
(lfsr_rbyd_isshrub(rbyd) ? LFSR_TAG_SHRUB : 0)
|
(lfsr_rbyd_isshrub(rbyd) ? LFSR_TAG_SHRUB : 0)
|
||||||
| LFSR_TAG_NULL,
|
| LFSR_TAG_NULL,
|
||||||
@@ -3298,6 +3299,7 @@ again:;
|
|||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// save the found lower rid/tag
|
// save the found lower rid/tag
|
||||||
// d_tag = a_lower_tag; //tag__;
|
// d_tag = a_lower_tag; //tag__;
|
||||||
|
|||||||
Reference in New Issue
Block a user