30
30
31
31
#define FD_FOREST_MAGIC (0xf17eda2ce7b1c0UL) /* firedancer forest version 0 */
32
32
33
- #define SET_NAME fd_forest_ele_idxs
33
+ #define SET_NAME fd_forest_blk_idxs
34
34
#define SET_MAX FD_SHRED_BLK_MAX
35
35
#include "../../util/tmpl/fd_set.c"
36
36
37
-
38
- /* fd_forest_ele_t implements a left-child, right-sibling n-ary
37
+ /* fd_forest_blk_t implements a left-child, right-sibling n-ary
39
38
tree. Each ele maintains the `pool` index of its left-most child
40
39
(`child_idx`), its immediate-right sibling (`sibling_idx`), and its
41
40
parent (`parent_idx`).
42
41
43
42
This tree structure is gaddr-safe and supports accesses and
44
43
operations from processes with separate local forest joins. */
45
44
46
- struct __attribute__((aligned (128UL ))) fd_forest_ele {
45
+ struct __attribute__((aligned (128UL ))) fd_forest_blk {
47
46
ulong slot ; /* map key */
48
47
ulong parent_slot ; /* map key of the parent. invariant: if parent is populated, parent_slot is populated. the converse is not necessarily true. */
49
48
ulong next ; /* internal use by fd_pool, fd_map_chain */
@@ -55,32 +54,32 @@ struct __attribute__((aligned(128UL))) fd_forest_ele {
55
54
uint buffered_idx ; /* highest contiguous buffered shred idx */
56
55
uint complete_idx ; /* shred_idx with SLOT_COMPLETE_FLAG ie. last shred idx in the slot */
57
56
58
- fd_forest_ele_idxs_t fecs [fd_forest_ele_idxs_word_cnt ]; /* last shred idx of every FEC set */
59
- fd_forest_ele_idxs_t idxs [fd_forest_ele_idxs_word_cnt ]; /* data shred idxs */
57
+ fd_forest_blk_idxs_t fecs [fd_forest_blk_idxs_word_cnt ]; /* last shred idx of every FEC set */
58
+ fd_forest_blk_idxs_t idxs [fd_forest_blk_idxs_word_cnt ]; /* data shred idxs */
60
59
};
61
- typedef struct fd_forest_ele fd_forest_ele_t ;
60
+ typedef struct fd_forest_blk fd_forest_blk_t ;
62
61
63
62
#define POOL_NAME fd_forest_pool
64
- #define POOL_T fd_forest_ele_t
63
+ #define POOL_T fd_forest_blk_t
65
64
#include "../../util/tmpl/fd_pool.c"
66
65
67
66
#define MAP_NAME fd_forest_ancestry
68
- #define MAP_ELE_T fd_forest_ele_t
67
+ #define MAP_ELE_T fd_forest_blk_t
69
68
#define MAP_KEY slot
70
69
#include "../../util/tmpl/fd_map_chain.c"
71
70
72
71
#define MAP_NAME fd_forest_frontier
73
- #define MAP_ELE_T fd_forest_ele_t
72
+ #define MAP_ELE_T fd_forest_blk_t
74
73
#define MAP_KEY slot
75
74
#include "../../util/tmpl/fd_map_chain.c"
76
75
77
76
#define MAP_NAME fd_forest_orphaned
78
- #define MAP_ELE_T fd_forest_ele_t
77
+ #define MAP_ELE_T fd_forest_blk_t
79
78
#define MAP_KEY slot
80
79
#include "../../util/tmpl/fd_map_chain.c"
81
80
82
81
#define MAP_NAME fd_forest_subtrees
83
- #define MAP_ELE_T fd_forest_ele_t
82
+ #define MAP_ELE_T fd_forest_blk_t
84
83
#define MAP_KEY slot
85
84
#include "../../util/tmpl/fd_map_chain.c"
86
85
@@ -139,7 +138,7 @@ struct __attribute__((aligned(128UL))) fd_forest {
139
138
ulong ver_gaddr ; /* wksp gaddr of version fseq, incremented on write ops */
140
139
ulong pool_gaddr ; /* wksp gaddr of fd_pool */
141
140
ulong ancestry_gaddr ; /* wksp_gaddr of fd_forest_ancestry */
142
- ulong frontier_gaddr ; /* leaves that needs repair) */
141
+ ulong frontier_gaddr ; /* leaves that needs repair */
143
142
ulong subtrees_gaddr ; /* head of orphaned trees */
144
143
ulong orphaned_gaddr ; /* map of parent_slot to singly-linked list of ele orphaned by that parent slot */
145
144
@@ -273,12 +272,12 @@ fd_forest_ver_const( fd_forest_t const * forest ) {
273
272
/* fd_forest_{pool, pool_const} returns a pointer in the caller's address
274
273
space to forest's element pool. */
275
274
276
- FD_FN_PURE static inline fd_forest_ele_t *
275
+ FD_FN_PURE static inline fd_forest_blk_t *
277
276
fd_forest_pool ( fd_forest_t * forest ) {
278
277
return fd_wksp_laddr_fast ( fd_forest_wksp ( forest ), forest -> pool_gaddr );
279
278
}
280
279
281
- FD_FN_PURE static inline fd_forest_ele_t const *
280
+ FD_FN_PURE static inline fd_forest_blk_t const *
282
281
fd_forest_pool_const ( fd_forest_t const * forest ) {
283
282
return fd_wksp_laddr_fast ( fd_forest_wksp ( forest ), forest -> pool_gaddr );
284
283
}
@@ -370,35 +369,34 @@ fd_forest_root_slot( fd_forest_t const * forest ) {
370
369
return fd_forest_pool_ele_const ( fd_forest_pool_const ( forest ), forest -> root )-> slot ;
371
370
}
372
371
373
- fd_forest_ele_t *
372
+ fd_forest_blk_t *
374
373
fd_forest_query ( fd_forest_t * forest , ulong slot );
375
374
376
375
/* Operations */
377
376
378
- /* fd_forest_block_insert inserts a new block into the forest.
379
- Assumes slot >= forest->smr, and the ele pool has a free
380
- element (if handholding is enabled, explicitly checks and errors).
381
- This block insert is idempotent, and can be called multiple times
382
- with the same slot.
383
- Returns the inserted forest ele. */
377
+ /* fd_forest_blk_insert inserts a new block into the forest. Assumes
378
+ slot >= forest->smr, and the blk pool has a free element (if
379
+ handholding is enabled, explicitly checks and errors). This blk
380
+ insert is idempotent, and can be called multiple times with the same
381
+ slot. Returns the inserted forest ele. */
384
382
385
- fd_forest_ele_t *
386
- fd_forest_block_insert ( fd_forest_t * forest , ulong slot , ulong parent_slot );
383
+ fd_forest_blk_t *
384
+ fd_forest_blk_insert ( fd_forest_t * forest , ulong slot , ulong parent_slot );
387
385
388
386
/* fd_forest_shred_insert inserts a new shred into the forest.
389
387
Assumes slot is already in forest, and should typically be called
390
388
directly after fd_forest_block_insert. Returns the forest ele
391
389
corresponding to the shred slot. */
392
390
393
- fd_forest_ele_t *
391
+ fd_forest_blk_t *
394
392
fd_forest_data_shred_insert ( fd_forest_t * forest , ulong slot , ulong parent_slot , uint shred_idx , uint fec_set_idx , int slot_complete );
395
393
396
394
/* fd_forest_publish publishes slot as the new forest root, setting
397
395
the subtree beginning from slot as the new forest tree (ie. slot
398
396
and all its descendants). Prunes all eles not in slot's forest.
399
397
Assumes slot is present in forest. Returns the new root. */
400
398
401
- fd_forest_ele_t const *
399
+ fd_forest_blk_t const *
402
400
fd_forest_publish ( fd_forest_t * forest , ulong slot );
403
401
404
402
struct fd_forest_iter {
@@ -466,7 +464,7 @@ fd_forest_frontier_print( fd_forest_t const * forest );
466
464
starting from the grandparent of the most recently executed slot:
467
465
468
466
```
469
- fd_forest_ele_t const * ele = fd_forest_query( slot );
467
+ fd_forest_blk_t const * ele = fd_forest_query( slot );
470
468
fd_forest_print( forest, fd_forest_parent( fd_forest_parent( ele ) ) )
471
469
```
472
470
0 commit comments