Implicitly set the rm-bit in generic grow tags
Our rbyds support changing the weight of a tag without knowing the actual tag. This is useful for btrees, which always make weight changes without knowing if the leading tag is a name or a branch (it depends on the type of btree). But to make this work, it needs the rm-bit to be set. This is because internally the rm-bit indicates we don't want to write-out a tag. Which we don't for grow tags, because, well, they're not real tags. Previously this was done by putting LFSR_TAG_GROW(RM) everywhere a generic grow as needed, but since this is so common we might as well just set the rm-bit in LFSR_TAG_GROW. Note that LFSR_TAG_GROW(tag) (the macro) does not set the rm-bit. This makes the code a bit more readable at the risk of an unintuitive relationship between LFSR_TAG_GROW and LFSR_TAG_GROW(tag).
This commit is contained in:
@@ -49,7 +49,7 @@ code = '''
|
||||
// the struct tag
|
||||
return lfsr_btree_commit(lfs, btree, LFSR_ATTRS(
|
||||
LFSR_ATTR(bid, WIDE(TAG(tag)), 0, DATA(data)),
|
||||
LFSR_ATTR(bid, GROW(RM), weight - weight_, NULL)));
|
||||
LFSR_ATTR(bid, GROW, weight - weight_, NULL)));
|
||||
}
|
||||
|
||||
static int lfsr_btree_pop(lfs_t *lfs, lfsr_btree_t *btree, lfs_size_t bid) {
|
||||
@@ -84,7 +84,7 @@ code = '''
|
||||
}
|
||||
|
||||
return lfsr_btree_commit(lfs, btree, LFSR_ATTRS(
|
||||
LFSR_ATTR(bid, GROW(RM), +weight1-weight_, NULL),
|
||||
LFSR_ATTR(bid, GROW, +weight1-weight_, NULL),
|
||||
LFSR_ATTR(bid-(weight_-1)+weight1-1, TAG(tag1), 0, DATA(data1)),
|
||||
(lfsr_data_size(&name) > 0
|
||||
? LFSR_ATTR(bid-(weight_-1)+weight1,
|
||||
|
||||
@@ -10542,7 +10542,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j*W+W-1, GROW(RM), -D, NULL))) => 0;
|
||||
LFSR_ATTR(j*W+W-1, GROW, -D, NULL))) => 0;
|
||||
assert(rbyd.weight == N*W-D);
|
||||
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -11460,7 +11460,7 @@ code = '''
|
||||
sim_weights[rid] += weight;
|
||||
// update our rbyd
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(weighted_rid+weight_-1, GROW(RM), +weight,
|
||||
LFSR_ATTR(weighted_rid+weight_-1, GROW, +weight,
|
||||
NULL))) => 0;
|
||||
} else if (op == 3) {
|
||||
// get the correct weight from the sim
|
||||
@@ -11472,7 +11472,7 @@ code = '''
|
||||
sim_weights[rid] -= weight;
|
||||
// update our rbyd
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(weighted_rid+weight_-1, GROW(RM), -weight,
|
||||
LFSR_ATTR(weighted_rid+weight_-1, GROW, -weight,
|
||||
NULL))) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user