Validator CLI option to enable just-in-time compilation of BPF (#13789)
* Adds a CLI option to the validator to enable just-in-time compilation of BPF. * Refactoring to use bpf_loader_program instead of feature_set to pass JIT flag from the validator CLI to the executor.
This commit is contained in:
committed by
GitHub
parent
3425e98a6b
commit
a706706572
@ -66,7 +66,10 @@ pub fn load(
|
||||
compression,
|
||||
genesis_config,
|
||||
process_options.debug_keys.clone(),
|
||||
Some(&crate::builtins::get(genesis_config.cluster_type)),
|
||||
Some(&crate::builtins::get(
|
||||
genesis_config.cluster_type,
|
||||
process_options.bpf_jit,
|
||||
)),
|
||||
)
|
||||
.expect("Load from snapshot failed");
|
||||
|
||||
|
@ -311,6 +311,7 @@ pub type ProcessCallback = Arc<dyn Fn(&Bank) + Sync + Send>;
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
pub struct ProcessOptions {
|
||||
pub bpf_jit: bool,
|
||||
pub poh_verify: bool,
|
||||
pub full_leader_cache: bool,
|
||||
pub dev_halt_at_slot: Option<Slot>,
|
||||
@ -342,7 +343,10 @@ pub fn process_blockstore(
|
||||
account_paths,
|
||||
&opts.frozen_accounts,
|
||||
opts.debug_keys.clone(),
|
||||
Some(&crate::builtins::get(genesis_config.cluster_type)),
|
||||
Some(&crate::builtins::get(
|
||||
genesis_config.cluster_type,
|
||||
opts.bpf_jit,
|
||||
)),
|
||||
);
|
||||
let bank0 = Arc::new(bank0);
|
||||
info!("processing ledger for slot 0...");
|
||||
|
@ -4,42 +4,42 @@ use solana_runtime::{
|
||||
};
|
||||
use solana_sdk::{feature_set, genesis_config::ClusterType, pubkey::Pubkey};
|
||||
|
||||
macro_rules! to_builtin {
|
||||
($b:expr) => {
|
||||
Builtin::new(&$b.0, $b.1, $b.2)
|
||||
};
|
||||
}
|
||||
|
||||
/// Builtin programs that are always available
|
||||
fn genesis_builtins(cluster_type: ClusterType) -> Vec<Builtin> {
|
||||
let builtins = if cluster_type != ClusterType::MainnetBeta {
|
||||
fn genesis_builtins(cluster_type: ClusterType, bpf_jit: bool) -> Vec<Builtin> {
|
||||
if cluster_type != ClusterType::MainnetBeta {
|
||||
vec![
|
||||
solana_bpf_loader_deprecated_program!(),
|
||||
solana_bpf_loader_program!(),
|
||||
to_builtin!(solana_bpf_loader_deprecated_program!()),
|
||||
if bpf_jit {
|
||||
to_builtin!(solana_bpf_loader_program_with_jit!())
|
||||
} else {
|
||||
to_builtin!(solana_bpf_loader_program!())
|
||||
},
|
||||
]
|
||||
} else {
|
||||
// Remove this `else` block and the `cluster_type` argument to this function once
|
||||
// `feature_set::bpf_loader2_program::id()` is active on Mainnet Beta
|
||||
vec![solana_bpf_loader_deprecated_program!()]
|
||||
};
|
||||
|
||||
builtins
|
||||
.into_iter()
|
||||
.map(|b| Builtin::new(&b.0, b.1, b.2))
|
||||
.collect()
|
||||
vec![to_builtin!(solana_bpf_loader_deprecated_program!())]
|
||||
}
|
||||
}
|
||||
|
||||
/// Builtin programs activated dynamically by feature
|
||||
fn feature_builtins() -> Vec<(Builtin, Pubkey, ActivationType)> {
|
||||
let builtins = vec![(
|
||||
solana_bpf_loader_program!(),
|
||||
vec![(
|
||||
to_builtin!(solana_bpf_loader_program!()),
|
||||
feature_set::bpf_loader2_program::id(),
|
||||
ActivationType::NewProgram,
|
||||
)];
|
||||
|
||||
builtins
|
||||
.into_iter()
|
||||
.map(|(b, p, t)| (Builtin::new(&b.0, b.1, b.2), p, t))
|
||||
.collect()
|
||||
)]
|
||||
}
|
||||
|
||||
pub(crate) fn get(cluster_type: ClusterType) -> Builtins {
|
||||
pub(crate) fn get(cluster_type: ClusterType, bpf_jit: bool) -> Builtins {
|
||||
Builtins {
|
||||
genesis_builtins: genesis_builtins(cluster_type),
|
||||
genesis_builtins: genesis_builtins(cluster_type, bpf_jit),
|
||||
feature_builtins: feature_builtins(),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user