Skip to content

Commit 5df0d94

Browse files
banks: remove footprint and align params from templatized bank fields
1 parent dc7d000 commit 5df0d94

File tree

2 files changed

+51
-52
lines changed

2 files changed

+51
-52
lines changed

src/flamenco/runtime/fd_bank.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ fd_bank_lthash_end_locking_modify( fd_bank_t * bank ) {
303303

304304
/* Bank accesssors */
305305

306-
#define X(type, name, footprint, align) \
306+
#define X(type, name) \
307307
type const * \
308308
fd_bank_##name##_query( fd_bank_t const * bank ) { \
309309
return (type const *)fd_type_pun_const( bank->data->non_cow.name ); \

src/flamenco/runtime/fd_bank.h

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -198,55 +198,54 @@ FD_PROTOTYPES_BEGIN
198198
If the fields are not templatized, their accessor and modifier
199199
patterns vary and are documented below.
200200
*/
201-
202-
#define FD_BANKS_ITER(X) \
203-
/* type, name, footprint, align */ \
204-
X(fd_blockhashes_t, block_hash_queue, sizeof(fd_blockhashes_t), alignof(fd_blockhashes_t) ) /* Block hash queue */ \
205-
X(fd_fee_rate_governor_t, fee_rate_governor, sizeof(fd_fee_rate_governor_t), alignof(fd_fee_rate_governor_t) ) /* Fee rate governor */ \
206-
X(ulong, rbh_lamports_per_sig, sizeof(ulong), alignof(ulong) ) /* Recent Block Hashes lamports per signature */ \
207-
X(ulong, slot, sizeof(ulong), alignof(ulong) ) /* Slot */ \
208-
X(ulong, parent_slot, sizeof(ulong), alignof(ulong) ) /* Parent slot */ \
209-
X(ulong, capitalization, sizeof(ulong), alignof(ulong) ) /* Capitalization */ \
210-
X(ulong, transaction_count, sizeof(ulong), alignof(ulong) ) /* Transaction count */ \
211-
X(ulong, parent_signature_cnt, sizeof(ulong), alignof(ulong) ) /* Parent signature count */ \
212-
X(ulong, tick_height, sizeof(ulong), alignof(ulong) ) /* Tick height */ \
213-
X(ulong, max_tick_height, sizeof(ulong), alignof(ulong) ) /* Max tick height */ \
214-
X(ulong, hashes_per_tick, sizeof(ulong), alignof(ulong) ) /* Hashes per tick */ \
215-
X(fd_w_u128_t, ns_per_slot, sizeof(fd_w_u128_t), alignof(fd_w_u128_t) ) /* NS per slot */ \
216-
X(ulong, ticks_per_slot, sizeof(ulong), alignof(ulong) ) /* Ticks per slot */ \
217-
X(ulong, genesis_creation_time, sizeof(ulong), alignof(ulong) ) /* Genesis creation time */ \
218-
X(double, slots_per_year, sizeof(double), alignof(double) ) /* Slots per year */ \
219-
X(fd_inflation_t, inflation, sizeof(fd_inflation_t), alignof(fd_inflation_t) ) /* Inflation */ \
220-
X(ulong, cluster_type, sizeof(ulong), alignof(ulong) ) /* Cluster type */ \
221-
X(ulong, total_epoch_stake, sizeof(ulong), alignof(ulong) ) /* Total epoch stake */ \
222-
/* This is only used for the get_epoch_stake syscall. */ \
223-
/* If we are executing in epoch E, this is the total */ \
224-
/* stake at the end of epoch E-1. */ \
225-
X(ulong, block_height, sizeof(ulong), alignof(ulong) ) /* Block height */ \
226-
X(ulong, execution_fees, sizeof(ulong), alignof(ulong) ) /* Execution fees */ \
227-
X(ulong, priority_fees, sizeof(ulong), alignof(ulong) ) /* Priority fees */ \
228-
X(ulong, tips, sizeof(ulong), alignof(ulong) ) /* Tips collected */ \
229-
X(ulong, signature_count, sizeof(ulong), alignof(ulong) ) /* Signature count */ \
230-
X(fd_hash_t, poh, sizeof(fd_hash_t), alignof(fd_hash_t) ) /* PoH */ \
231-
X(fd_sol_sysvar_last_restart_slot_t, last_restart_slot, sizeof(fd_sol_sysvar_last_restart_slot_t), alignof(fd_sol_sysvar_last_restart_slot_t) ) /* Last restart slot */ \
232-
X(fd_hash_t, bank_hash, sizeof(fd_hash_t), alignof(fd_hash_t) ) /* Bank hash */ \
233-
X(fd_hash_t, prev_bank_hash, sizeof(fd_hash_t), alignof(fd_hash_t) ) /* Previous bank hash */ \
234-
X(fd_hash_t, genesis_hash, sizeof(fd_hash_t), alignof(fd_hash_t) ) /* Genesis hash */ \
235-
X(fd_epoch_schedule_t, epoch_schedule, sizeof(fd_epoch_schedule_t), alignof(fd_epoch_schedule_t) ) /* Epoch schedule */ \
236-
X(fd_rent_t, rent, sizeof(fd_rent_t), alignof(fd_rent_t) ) /* Rent */ \
237-
X(fd_sysvar_cache_t, sysvar_cache, sizeof(fd_sysvar_cache_t), alignof(fd_sysvar_cache_t) ) /* Sysvar cache */ \
238-
/* then there can be 100k unique leaders in the worst */ \
239-
/* case. We also can assume 432k slots per epoch. */ \
240-
X(fd_features_t, features, sizeof(fd_features_t), alignof(fd_features_t) ) /* Features */ \
241-
X(ulong, txn_count, sizeof(ulong), alignof(ulong) ) /* Transaction count */ \
242-
X(ulong, nonvote_txn_count, sizeof(ulong), alignof(ulong) ) /* Nonvote transaction count */ \
243-
X(ulong, failed_txn_count, sizeof(ulong), alignof(ulong) ) /* Failed transaction count */ \
244-
X(ulong, nonvote_failed_txn_count, sizeof(ulong), alignof(ulong) ) /* Nonvote failed transaction count */ \
245-
X(ulong, total_compute_units_used, sizeof(ulong), alignof(ulong) ) /* Total compute units used */ \
246-
X(ulong, slots_per_epoch, sizeof(ulong), alignof(ulong) ) /* Slots per epoch */ \
247-
X(ulong, shred_cnt, sizeof(ulong), alignof(ulong) ) /* Shred count */ \
248-
X(ulong, epoch, sizeof(ulong), alignof(ulong) ) /* Epoch */ \
249-
X(int, has_identity_vote, sizeof(int), alignof(int) ) /* Has identity vote */
201+
#define FD_BANKS_ITER(X) \
202+
/* type, name */ \
203+
X(fd_blockhashes_t, block_hash_queue ) /* Block hash queue */ \
204+
X(fd_fee_rate_governor_t, fee_rate_governor ) /* Fee rate governor */ \
205+
X(ulong, rbh_lamports_per_sig ) /* Recent Block Hashes lamports per signature */ \
206+
X(ulong, slot ) /* Slot */ \
207+
X(ulong, parent_slot ) /* Parent slot */ \
208+
X(ulong, capitalization ) /* Capitalization */ \
209+
X(ulong, transaction_count ) /* Transaction count */ \
210+
X(ulong, parent_signature_cnt ) /* Parent signature count */ \
211+
X(ulong, tick_height ) /* Tick height */ \
212+
X(ulong, max_tick_height ) /* Max tick height */ \
213+
X(ulong, hashes_per_tick ) /* Hashes per tick */ \
214+
X(fd_w_u128_t, ns_per_slot ) /* NS per slot */ \
215+
X(ulong, ticks_per_slot ) /* Ticks per slot */ \
216+
X(ulong, genesis_creation_time ) /* Genesis creation time */ \
217+
X(double, slots_per_year ) /* Slots per year */ \
218+
X(fd_inflation_t, inflation ) /* Inflation */ \
219+
X(ulong, cluster_type ) /* Cluster type */ \
220+
X(ulong, total_epoch_stake ) /* Total epoch stake */ \
221+
/* This is only used for the get_epoch_stake syscall. */ \
222+
/* If we are executing in epoch E, this is the total */ \
223+
/* stake at the end of epoch E-1. */ \
224+
X(ulong, block_height ) /* Block height */ \
225+
X(ulong, execution_fees ) /* Execution fees */ \
226+
X(ulong, priority_fees ) /* Priority fees */ \
227+
X(ulong, tips ) /* Tips collected */ \
228+
X(ulong, signature_count ) /* Signature count */ \
229+
X(fd_hash_t, poh ) /* PoH */ \
230+
X(fd_sol_sysvar_last_restart_slot_t, last_restart_slot ) /* Last restart slot */ \
231+
X(fd_hash_t, bank_hash ) /* Bank hash */ \
232+
X(fd_hash_t, prev_bank_hash ) /* Previous bank hash */ \
233+
X(fd_hash_t, genesis_hash ) /* Genesis hash */ \
234+
X(fd_epoch_schedule_t, epoch_schedule ) /* Epoch schedule */ \
235+
X(fd_rent_t, rent ) /* Rent */ \
236+
X(fd_sysvar_cache_t, sysvar_cache ) /* Sysvar cache */ \
237+
/* then there can be 100k unique leaders in the worst */ \
238+
/* case. We also can assume 432k slots per epoch. */ \
239+
X(fd_features_t, features ) /* Features */ \
240+
X(ulong, txn_count ) /* Transaction count */ \
241+
X(ulong, nonvote_txn_count ) /* Nonvote transaction count */ \
242+
X(ulong, failed_txn_count ) /* Failed transaction count */ \
243+
X(ulong, nonvote_failed_txn_count ) /* Nonvote failed transaction count */ \
244+
X(ulong, total_compute_units_used ) /* Total compute units used */ \
245+
X(ulong, slots_per_epoch ) /* Slots per epoch */ \
246+
X(ulong, shred_cnt ) /* Shred count */ \
247+
X(ulong, epoch ) /* Epoch */ \
248+
X(int, has_identity_vote ) /* Has identity vote */
250249

251250
/* Defining pools for any CoW fields. */
252251

@@ -369,7 +368,7 @@ struct fd_bank_data {
369368
struct {
370369
fd_lthash_value_t lthash;
371370

372-
#define X(type, name, footprint, align) uchar name[footprint] __attribute__((aligned(align)));
371+
#define X(type, name) uchar name[sizeof(type)] __attribute__((aligned(alignof(type))));
373372
FD_BANKS_ITER(X)
374373
#undef X
375374
} non_cow;
@@ -666,7 +665,7 @@ fd_bank_lthash_locking_modify( fd_bank_t * bank );
666665
void
667666
fd_bank_lthash_end_locking_modify( fd_bank_t * bank );
668667

669-
#define X(type, name, footprint, align) \
668+
#define X(type, name) \
670669
void fd_bank_##name##_set( fd_bank_t * bank, type value ); \
671670
type fd_bank_##name##_get( fd_bank_t const * bank ); \
672671
type const * fd_bank_##name##_query( fd_bank_t const * bank ); \

0 commit comments

Comments
 (0)