Adopted lfsr_btree_commit, replacing all other btree operations.

Note this required changing the INLINED tag to REG in most of the tests,
because our mtree now explicitly requires some sort of NAME tag.

We can also finally see the impact on code and RAM from this restructure:

                                 code          stack
  before (push/set/pop/split):  21750           1928
  after (commit):               20970 (-3.7%)   1744 (-10.6%)

Not too shabby if I say so myself.
This commit is contained in:
Christopher Haster
2023-08-15 00:51:42 -05:00
parent a4c3a12f68
commit fb2fdb536c
3 changed files with 187 additions and 189 deletions
+3 -3
View File
@@ -123,7 +123,7 @@ code = '''
// keep creating new metadata entries until we run out of space
int err = lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
LFSR_ATTR(mdir.mid.rid, INLINED, +1,
LFSR_ATTR(mdir.mid.rid, REG, +1,
BUF(&alphas[count % 26], 1))));
assert(!err || err == LFS_ERR_NOSPC);
if (err == LFS_ERR_NOSPC) {
@@ -131,7 +131,7 @@ code = '''
}
uint8_t buffer[4];
lfsr_mdir_get(&lfs, &mdir, mdir.mid.rid, LFSR_TAG_INLINED,
lfsr_mdir_get(&lfs, &mdir, mdir.mid.rid, LFSR_TAG_REG,
buffer, 4) => 1;
assert(memcmp(buffer, &alphas[count % 26], 1) == 0);
@@ -153,7 +153,7 @@ code = '''
mdir.mid.rid < (lfs_ssize_t)mdir.u.m.weight;
mdir.mid.rid++) {
uint8_t buffer[4];
lfsr_mdir_get(&lfs, &mdir, mdir.mid.rid, LFSR_TAG_INLINED,
lfsr_mdir_get(&lfs, &mdir, mdir.mid.rid, LFSR_TAG_REG,
buffer, 4) => 1;
assert(memcmp(buffer, &alphas[i % 26], 1) == 0);
i += 1;