Reverted inlined lfsr_data_t representation
See previous commit for more details on why this doesn't work:
1. Losing the simple/compiler friendly lfsr_data_t costs more code/stack
than we save inlined small pieces of data (dids, leb128s, flags,
etc).
2. Inlined lfsr_data_t is fundamentally incompatible with the new
lightweight lfsr_rat_t representation for simple data.
Though I did add a comment, and marked lfsr_data_fromslice as inline.
The compiler was apparently already inlining lfsr_data_fromslice (and
it's a valuable optimization!), but making this explicit helps document/
influence future changes.
Code changes:
code stack ctx
before: 38128 2672 752
after: 38060 (-0.2%) 2608 (-2.4%) 752 (+0.0%)
This commit is contained in:
@@ -613,15 +613,16 @@ typedef struct lfsr_omdir {
|
||||
//} lfs_mdir_t;
|
||||
|
||||
// either an on-disk or in-device data pointer
|
||||
//
|
||||
// note, it's enticing to make this fancier, but we benefit quite a lot
|
||||
// from the compiler being able to aggresively optimize this struct
|
||||
//
|
||||
typedef struct lfsr_data {
|
||||
// the top bits of size indicate the exact encoding:
|
||||
// top2(size)=0b00 => in-RAM buffer
|
||||
// top2(size)=0b01 => inlined data
|
||||
// top2(size)=0b1x => on-disk reference
|
||||
// sign(size)=0 => in-RAM buffer
|
||||
// sign(size)=1 => on-disk reference
|
||||
lfs_size_t size;
|
||||
union {
|
||||
const uint8_t *buffer;
|
||||
uint8_t imm[8];
|
||||
struct {
|
||||
lfs_block_t block;
|
||||
lfs_size_t off;
|
||||
|
||||
Reference in New Issue
Block a user