1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use solana_runtime::{
bank::{Builtin, Builtins},
builtins::ActivationType,
};
use solana_sdk::{feature_set, pubkey::Pubkey};
macro_rules! to_builtin {
($b:expr) => {
Builtin::new(&$b.0, $b.1, $b.2)
};
}
fn genesis_builtins(bpf_jit: bool) -> Vec<Builtin> {
vec![
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!())
},
]
}
fn feature_builtins(bpf_jit: bool) -> Vec<(Builtin, Pubkey, ActivationType)> {
vec![(
if bpf_jit {
to_builtin!(solana_bpf_loader_upgradeable_program_with_jit!())
} else {
to_builtin!(solana_bpf_loader_upgradeable_program!())
},
feature_set::bpf_loader_upgradeable_program::id(),
ActivationType::NewProgram,
)]
}
pub(crate) fn get(bpf_jit: bool) -> Builtins {
Builtins {
genesis_builtins: genesis_builtins(bpf_jit),
feature_builtins: feature_builtins(bpf_jit),
}
}