Commit Graph

10 Commits

Author SHA1 Message Date
Christopher Haster 8d4991df6a Added the option to error on no valid commit to dbgrbyd.py
Considered adding --ignore-errors to watch.py, but it doesn't really
make sense with watch.py's implementation. watch.py would need to not update
in realtime, which conflicts with other use cases.
2023-02-12 13:19:46 -06:00
Christopher Haster 5cdda57373 Added the ability to remove rbyd tags via tombstoning
It's quite lucky a spare bit is free in the tag encoding, this means we
don't need a reserved length value as originally planned. We end up using
all of the bits that overlap the alt pointer encoding, which is nice and
unexpected.
2023-02-12 13:16:55 -06:00
Christopher Haster d6ad74555b Made dbgrbyd.py a bit more resilient to truncated data 2023-02-12 13:14:54 -06:00
Christopher Haster b48f7fcfb0 Added some more debug utilities to dbgrbyd.py, mainly --rbyd and --jumps
Not only is this a genuinely useful debugging tool, it looks very cool:

  $ ./scripts/dbgrbyd.py disk 4096 0 -j
  mdir 0x0, rev 1, size 73
  off       tag                     data (truncated)
  00000004: gstate x01 4            aa aa aa aa              ....      <----.
  0000000b: altblt x98 x4                                              -' | |
  0000000e: gstate x04 4            bb bb bb bb              ....      <------.
  00000015: altrlt x98 x4                                              -|-' | |
  00000018: altbgt x7ee8 xe                                            -'   | |
  0000001c: gstate x02 4            cc cc cc cc              ....      <.   | |
  00000023: altrlt x98 x4                                              -|---' |
  00000026: altrlt x80 x1c                                             -'     |
  00000029: altbgt x7e68 xe                                            -------'
  0000002d: gstate x03 4            dd dd dd dd              ....
  00000034: fcrc 5                  05 3f aa db 01           .?...
  0000003b: crc0 8                  5c 12 29 d9 1b 1b 1b 1b  \.).....
2023-02-12 13:02:59 -06:00
Christopher Haster fe28837861 Rbyd trees with 4-leaves now working, fixed lfs_rtag_flip bug
- This is when flips starts happening during lfs_rbyd_append
- lfs_rtag_flip had an off-by-one math mistake
2023-02-12 12:58:55 -06:00
Christopher Haster c5fec90465 Rbyd rflips are now working, quite nicely actually
It turns out statefulness works quite well with this algorithm (The
prototype was in Haskell, which created some artificial problems. I
think it may have just been too high-level a language for this
near-instruction-level algorithm).
2023-02-12 12:58:29 -06:00
Christopher Haster 05276cef9a Added a bias to alt weights so in-between tags prefer larger tags
This bias makes it so that tag lookups always find a tag strictly >= the
requested tag, unless we are at the end of the tree.

This makes tree traversal trivial, which is quite nice.

Need to remove ntag now, it's no longer needed.
2023-02-12 12:49:19 -06:00
Christopher Haster 024aaeba56 Some small tweaks
- Moved alt encoding 0x1 => 0x4, which can lead to slightly better
  lookup tables, the perturb bit takes the same place as the color bit,
  which means both can be ignored in readonly operations.

- Dropped lfs_rbyd_fetchmatch, asking each lfs_rbyd_fetch to include NULL
  isn't that bad.

New encoding:

  tags:
  iiii iiiiiii iiiiiTT TTTTTTt ttt0tpv
                   ^--------^------^^^- 16-bit id
                            '------|||- 8-bit type2
                                   '||- 5-bit type1
                                    '|- perturb bit
                                     '- valid bit
  llll lllllll lllllll lllllll lllllll
                                     ^- n-bit length

  alts:
  wwww wwwwwww wwwwwww wwwwwww www1dcv
                                 ^^^-^- 28-bit weight
                                  '|-|- color bit
                                   '-|- direction bit
                                     '- valid bit
  jjjj jjjjjjj jjjjjjj jjjjjjj jjjjjjj
                                     ^- n-bit jump
2023-02-12 12:40:19 -06:00
Christopher Haster 9a0e3fc749 More rbyd tests, multi-commit now working 2023-02-12 12:39:17 -06:00
Christopher Haster ad00ca79e2 Added dbgrbyd.py script, fixed some small things in rbyd commit
- We need to actually write the perturb bit
- It helps to encode the crc's leb128 length field correctly
2023-02-12 12:38:07 -06:00