Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
generate TransactionExecutorCache from loaded programs
Browse files Browse the repository at this point in the history
  • Loading branch information
pgarg66 committed Mar 20, 2023
1 parent 2f383d4 commit f3b5c26
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4035,6 +4035,7 @@ impl Bank {
}

/// Get any cached executors needed by the transaction
#[cfg(test)]
fn get_tx_executor_cache(
&self,
accounts: &[TransactionAccount],
Expand Down Expand Up @@ -4189,15 +4190,8 @@ impl Bank {
timings: &mut ExecuteTimings,
error_counters: &mut TransactionErrorMetrics,
log_messages_bytes_limit: Option<usize>,
tx_executor_cache: Rc<RefCell<TransactionExecutorCache>>,
) -> TransactionExecutionResult {
let mut get_tx_executor_cache_time = Measure::start("get_tx_executor_cache_time");
let tx_executor_cache = self.get_tx_executor_cache(&loaded_transaction.accounts);
get_tx_executor_cache_time.stop();
saturating_add_assign!(
timings.execute_accessories.get_executors_us,
get_tx_executor_cache_time.as_us()
);

let prev_accounts_data_len = self.load_accounts_data_size();
let transaction_accounts = std::mem::take(&mut loaded_transaction.accounts);
let mut transaction_context = TransactionContext::new(
Expand Down Expand Up @@ -4585,6 +4579,10 @@ impl Bank {
let (executable_programs_in_tx_batch, loaded_programs_map) =
self.replenish_executor_cache(&program_owners_refs, sanitized_txs, &mut check_results);

let tx_executor_cache = Rc::new(RefCell::new(TransactionExecutorCache::new(
loaded_programs_map.clone().into_iter(),
)));

let mut load_time = Measure::start("accounts_load");
let mut loaded_transactions = self.rc.accounts.load_accounts(
&self.ancestors,
Expand Down Expand Up @@ -4654,6 +4652,7 @@ impl Bank {
timings,
&mut error_counters,
log_messages_bytes_limit,
tx_executor_cache.clone(),
)
}
})
Expand Down

0 comments on commit f3b5c26

Please sign in to comment.