Fully adopted lazy attr encoding

This fully adopts LFSR_RATTR__ and friends:

- LFSR_RATTR      -> LFSR_RATTR__ or LFSR_RATTR_DATA__
- LFSR_RATTR_BUF  -> LFSR_RATTR__
- LFSR_RATTR_CAT  -> LFSR_RATTR_CAT__
- LFSR_RATTR_NOOP -> LFSR_RATTR_NOOP__
- LFSR_RATTR_NAME -> LFSR_RATTR_NAME__

Note the new LFSR_RATTR__ macro also lets us a drop the special rattr
macros, at the cost of a bit less type safety:

- LFSR_RATTR_RATTRS      -> LFSR_RATTR__
- LFSR_RATTR_MOVE        -> LFSR_RATTR__
- LFSR_RATTR_GRM         -> LFSR_RATTR__ (we weren't using this?)
- LFSR_RATTR_SHRUBCOMMIT -> LFSR_RATTR__

Curiously, this ended up adding ~88 bytes to lfsr_file_carve:

  function (0 added, 0 removed)      osize    nsize    dsize
  lfsr_file_carve                     1228     1316      +88 (+7.2%)
  lfsr_mdir_commit                    2144     2152       +8 (+0.4%)
  lfsr_mdir_commit__                  1192     1188       -4 (-0.3%)
  lfsr_file_truncate                   184      182       -2 (-1.1%)
  lfsr_mount                            98       96       -2 (-2.0%)
  TOTAL                              35508    35596      +88 (+0.2%)

I'm really not sure why, all I can think of is maybe the change from a
forced-inline function to a macro added a bunch of compiler noise?

Still, 80 bytes is not worth two competing LFSR_RATTR APIs. Though
it may be worth looking into this in the future.

Total code changes:

           code          stack          ctx
  before: 35508           2472          636
  after:  35596 (+0.2%)   2472 (+0.0%)  636 (+0.0%)
This commit is contained in:
Christopher Haster
2025-02-10 04:53:35 -06:00
parent 9c199ce7c0
commit 919113f6c4
8 changed files with 2156 additions and 2224 deletions
+6 -6
View File
@@ -76,9 +76,9 @@ code = '''
// add to btree
lfsr_btree_commit(&lfs, &btree, bid, LFSR_RATTRS(
LFSR_RATTR(
LFSR_RATTR__(
LFSR_TAG_DATA, +1,
LFSR_DATA_BUF(&(uint8_t){'a'+(i % 26)}, 1)))) => 0;
&(uint8_t){'a'+(i % 26)}, 1))) => 0;
// add to sim
memmove(&sim[bid+1], &sim[bid], sim_size-bid);
@@ -1851,9 +1851,9 @@ code = '''
// add to btree
lfsr_btree_commit(&lfs, &btree, bid, LFSR_RATTRS(
LFSR_RATTR(
LFSR_RATTR__(
LFSR_TAG_DATA, +1,
LFSR_DATA_BUF(&(uint8_t){'a'+(i % 26)}, 1)))) => 0;
&(uint8_t){'a'+(i % 26)}, 1))) => 0;
// add to sim
memmove(&sim[bid+1], &sim[bid], sim_size-bid);
@@ -3626,9 +3626,9 @@ code = '''
// add to btree
lfsr_btree_commit(&lfs, &btree, bid, LFSR_RATTRS(
LFSR_RATTR(
LFSR_RATTR__(
LFSR_TAG_DATA, +1,
LFSR_DATA_BUF(&(uint8_t){'a'+(i % 26)}, 1)))) => 0;
&(uint8_t){'a'+(i % 26)}, 1))) => 0;
// add to sim
memmove(&sim[bid+1], &sim[bid], sim_size-bid);