2020#define MAP_KEY_HASH (k0 ,seed ) fd_funk_xid_key_pair_hash((k0),(seed))
2121#define MAP_IDX_T uint
2222#define MAP_NEXT map_next
23- #define MAP_MEMO map_hash
2423#define MAP_MAGIC (0xf173da2ce77ecdb0UL) /* Firedancer rec db version 0 */
25- #define MAP_MEMOIZE 1
2624#define MAP_IMPL_STYLE 2
2725#include "../util/tmpl/fd_map_chain_para.c"
2826
@@ -176,7 +174,7 @@ fd_funk_rec_query_try_global( fd_funk_t const * funk,
176174 !fd_funk_rec_map_iter_done ( iter );
177175 iter = fd_funk_rec_map_iter_next ( iter ) ) {
178176 fd_funk_rec_t const * ele = fd_funk_rec_map_iter_ele_const ( iter );
179- if ( FD_LIKELY ( hash == ele -> map_hash ) && FD_LIKELY ( fd_funk_rec_key_eq ( key , ele -> pair .key ) ) ) {
177+ if ( FD_LIKELY ( fd_funk_rec_key_eq ( key , ele -> pair .key ) ) ) {
180178
181179 /* For cur_txn in path from [txn] to [root] where root is NULL */
182180
@@ -293,10 +291,8 @@ fd_funk_rec_prepare( fd_funk_t * funk,
293291 fd_funk_val_init ( rec );
294292 if ( txn == NULL ) {
295293 fd_funk_txn_xid_set_root ( rec -> pair .xid );
296- rec -> txn_cidx = fd_funk_txn_cidx ( FD_FUNK_TXN_IDX_NULL );
297294 } else {
298295 fd_funk_txn_xid_copy ( rec -> pair .xid , & txn -> xid );
299- rec -> txn_cidx = fd_funk_txn_cidx ( (ulong )( txn - funk -> txn_pool -> ele ) );
300296 prepare -> rec_head_idx = & txn -> rec_head_idx ;
301297 prepare -> rec_tail_idx = & txn -> rec_tail_idx ;
302298 }
@@ -485,7 +481,7 @@ fd_funk_rec_remove( fd_funk_t * funk,
485481 if ( rec_out ) * rec_out = rec ;
486482
487483 /* Access the flags atomically */
488- ulong old_flags ;
484+ uint old_flags ;
489485 for (;;) {
490486 old_flags = rec -> flags ;
491487 if ( FD_UNLIKELY ( old_flags & FD_FUNK_REC_FLAG_ERASE ) ) {
547543fd_funk_rec_verify ( fd_funk_t * funk ) {
548544 fd_funk_rec_map_t * rec_map = funk -> rec_map ;
549545 fd_funk_rec_pool_t * rec_pool = funk -> rec_pool ;
550- fd_funk_txn_pool_t * txn_pool = funk -> txn_pool ;
551- ulong txn_max = fd_funk_txn_pool_ele_max ( txn_pool );
552546 ulong rec_max = fd_funk_rec_pool_ele_max ( rec_pool );
553547
554548# define TEST (c ) do { \
@@ -570,10 +564,9 @@ fd_funk_rec_verify( fd_funk_t * funk ) {
570564 /* Make sure every record either links up with the last published
571565 transaction or an in-prep transaction and the flags are sane. */
572566
573- fd_funk_txn_xid_t const * xid = fd_funk_rec_xid ( rec );
574- ulong txn_idx = fd_funk_txn_idx ( rec -> txn_cidx );
567+ fd_funk_txn_xid_t const * xid = fd_funk_rec_xid ( rec );
575568
576- if ( fd_funk_txn_idx_is_null ( txn_idx ) ) { /* This is a record from the last published transaction */
569+ if ( fd_funk_txn_xid_eq_root ( xid ) ) { /* This is a record from the last published transaction */
577570
578571 TEST ( fd_funk_txn_xid_eq_root ( xid ) );
579572 /* No record linked list at the root txn */
@@ -582,10 +575,7 @@ fd_funk_rec_verify( fd_funk_t * funk ) {
582575
583576 } else { /* This is a record from an in-prep transaction */
584577
585- TEST ( txn_idx < txn_max );
586- fd_funk_txn_t const * txn = fd_funk_txn_query ( xid , funk -> txn_map );
587- TEST ( txn );
588- TEST ( txn == (funk -> txn_pool -> ele + txn_idx ) );
578+ TEST ( fd_funk_txn_query ( xid , funk -> txn_map ) );
589579
590580 }
591581 }
@@ -609,10 +599,9 @@ fd_funk_rec_verify( fd_funk_t * funk ) {
609599 for ( fd_funk_txn_all_iter_new ( funk , txn_iter ); !fd_funk_txn_all_iter_done ( txn_iter ); fd_funk_txn_all_iter_next ( txn_iter ) ) {
610600 fd_funk_txn_t const * txn = fd_funk_txn_all_iter_ele_const ( txn_iter );
611601
612- ulong txn_idx = (ulong )(txn - txn_pool -> ele );
613- uint rec_idx = txn -> rec_head_idx ;
602+ uint rec_idx = txn -> rec_head_idx ;
614603 while ( !fd_funk_rec_idx_is_null ( rec_idx ) ) {
615- TEST ( (rec_idx < rec_max ) && ( fd_funk_txn_idx ( rec_pool -> ele [ rec_idx ]. txn_cidx ) == txn_idx ) && rec_pool -> ele [ rec_idx ].tag == 0U );
604+ TEST ( (rec_idx < rec_max ) && rec_pool -> ele [ rec_idx ].tag == 0U );
616605 rec_pool -> ele [ rec_idx ].tag = 1U ;
617606 fd_funk_rec_query_t query [1 ];
618607 fd_funk_rec_t const * rec2 = fd_funk_rec_query_try_global ( funk , & txn -> xid , rec_pool -> ele [ rec_idx ].pair .key , NULL , query );
@@ -632,10 +621,9 @@ fd_funk_rec_verify( fd_funk_t * funk ) {
632621 for ( fd_funk_txn_all_iter_new ( funk , txn_iter ); !fd_funk_txn_all_iter_done ( txn_iter ); fd_funk_txn_all_iter_next ( txn_iter ) ) {
633622 fd_funk_txn_t const * txn = fd_funk_txn_all_iter_ele_const ( txn_iter );
634623
635- ulong txn_idx = (ulong )(txn - txn_pool -> ele );
636- uint rec_idx = txn -> rec_tail_idx ;
624+ uint rec_idx = txn -> rec_tail_idx ;
637625 while ( !fd_funk_rec_idx_is_null ( rec_idx ) ) {
638- TEST ( (rec_idx < rec_max ) && ( fd_funk_txn_idx ( rec_pool -> ele [ rec_idx ]. txn_cidx ) == txn_idx ) && rec_pool -> ele [ rec_idx ].tag == 1U );
626+ TEST ( (rec_idx < rec_max ) && rec_pool -> ele [ rec_idx ].tag == 1U );
639627 rec_pool -> ele [ rec_idx ].tag = 2U ;
640628 uint prev_idx = rec_pool -> ele [ rec_idx ].prev_idx ;
641629 if ( !fd_funk_rec_idx_is_null ( prev_idx ) ) TEST ( rec_pool -> ele [ prev_idx ].next_idx == rec_idx );
0 commit comments