Skip to content

Commit

Permalink
Removes the CLI argument "no-bpf-jit" and its plumbering through out …
Browse files Browse the repository at this point in the history
…the validator code base.
  • Loading branch information
Lichtso committed Apr 25, 2023
1 parent 21f8196 commit c52a945
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 94 deletions.
10 changes: 1 addition & 9 deletions ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1462,10 +1462,6 @@ fn main() {
.long("no-snapshot")
.takes_value(false)
.help("Do not start from a local snapshot if present");
let no_bpf_jit_arg = Arg::with_name("no_bpf_jit")
.long("no-bpf-jit")
.takes_value(false)
.help("Disable the just-in-time compiler and instead use the interpreter for BP");
let accounts_index_bins = Arg::with_name("accounts_index_bins")
.long("accounts-index-bins")
.value_name("BINS")
Expand Down Expand Up @@ -1960,7 +1956,6 @@ fn main() {
.arg(&hard_forks_arg)
.arg(&accounts_db_test_hash_calculation_arg)
.arg(&no_os_memory_stats_reporting_arg)
.arg(&no_bpf_jit_arg)
.arg(&allow_dead_slots_arg)
.arg(&max_genesis_archive_unpacked_size_arg)
.arg(&debug_key_arg)
Expand Down Expand Up @@ -2948,10 +2943,7 @@ fn main() {
accounts_db_test_hash_calculation: arg_matches
.is_present("accounts_db_test_hash_calculation"),
accounts_db_skip_shrink: arg_matches.is_present("accounts_db_skip_shrink"),
runtime_config: RuntimeConfig {
bpf_jit: !arg_matches.is_present("no_bpf_jit"),
..RuntimeConfig::default()
},
runtime_config: RuntimeConfig::default(),
..ProcessOptions::default()
};
let print_accounts_stats = arg_matches.is_present("print_accounts_stats");
Expand Down
4 changes: 1 addition & 3 deletions ledger/src/bank_forks_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ fn bank_forks_from_snapshot(
genesis_config,
&process_options.runtime_config,
process_options.debug_keys.clone(),
Some(&crate::builtins::get(
process_options.runtime_config.bpf_jit,
)),
Some(&crate::builtins::get(true)),
process_options.account_indexes.clone(),
process_options.limit_load_slot_count_from_snapshot,
process_options.shrink_ratio,
Expand Down
2 changes: 1 addition & 1 deletion ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ pub(crate) fn process_blockstore_for_bank_0(
Arc::new(opts.runtime_config.clone()),
account_paths,
opts.debug_keys.clone(),
Some(&crate::builtins::get(opts.runtime_config.bpf_jit)),
Some(&crate::builtins::get(true)),
opts.account_indexes.clone(),
opts.shrink_ratio,
false,
Expand Down
1 change: 0 additions & 1 deletion program-runtime/src/loaded_programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ impl LoadedProgram {
maybe_expiration_slot: Option<Slot>,
elf_bytes: &[u8],
account_size: usize,
_use_jit: bool,
metrics: &mut LoadProgramMetrics,
) -> Result<Self, Box<dyn std::error::Error>> {
let mut load_elf_time = Measure::start("load_elf_time");
Expand Down
17 changes: 2 additions & 15 deletions program-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ pub struct ProgramTest {
builtin_programs: BuiltinPrograms,
compute_max_units: Option<u64>,
prefer_bpf: bool,
use_bpf_jit: bool,
deactivate_feature_set: HashSet<Pubkey>,
transaction_account_lock_limit: Option<usize>,
}
Expand Down Expand Up @@ -478,7 +477,6 @@ impl Default for ProgramTest {
builtin_programs: BuiltinPrograms::default(),
compute_max_units: None,
prefer_bpf,
use_bpf_jit: false,
deactivate_feature_set,
transaction_account_lock_limit: None,
}
Expand Down Expand Up @@ -525,11 +523,6 @@ impl ProgramTest {
self.compute_max_units = Some(bpf_compute_max_units);
}

/// Execute the SBF program with JIT if true, interpreted if false
pub fn use_bpf_jit(&mut self, use_bpf_jit: bool) {
self.use_bpf_jit = use_bpf_jit;
}

/// Add an account to the test environment
pub fn add_account(&mut self, address: Pubkey, account: Account) {
self.accounts
Expand Down Expand Up @@ -785,7 +778,6 @@ impl ProgramTest {
let mut bank = Bank::new_with_runtime_config_for_tests(
&genesis_config,
Arc::new(RuntimeConfig {
bpf_jit: self.use_bpf_jit,
compute_budget: self.compute_max_units.map(|max_units| ComputeBudget {
compute_unit_limit: max_units,
..ComputeBudget::default()
Expand All @@ -802,13 +794,8 @@ impl ProgramTest {
};
}
add_builtin!(solana_bpf_loader_deprecated_program!());
if self.use_bpf_jit {
add_builtin!(solana_bpf_loader_program_with_jit!());
add_builtin!(solana_bpf_loader_upgradeable_program_with_jit!());
} else {
add_builtin!(solana_bpf_loader_program!());
add_builtin!(solana_bpf_loader_upgradeable_program!());
}
add_builtin!(solana_bpf_loader_program!());
add_builtin!(solana_bpf_loader_upgradeable_program!());

// Add commonly-used SPL programs as a convenience to the user
for (program_id, account) in programs::spl_programs(&Rent::default()).iter() {
Expand Down
29 changes: 6 additions & 23 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ pub fn load_program_from_bytes(
loader_key: &Pubkey,
account_size: usize,
deployment_slot: Slot,
use_jit: bool,
reject_deployment_of_broken_elfs: bool,
debugging_features: bool,
) -> Result<LoadedProgram, InstructionError> {
Expand All @@ -99,13 +98,11 @@ pub fn load_program_from_bytes(
})?;
register_syscalls_time.stop();
load_program_metrics.register_syscalls_us = register_syscalls_time.as_us();

let effective_slot = if feature_set.is_active(&delay_visibility_of_program_deployment::id()) {
deployment_slot.saturating_add(1)
} else {
deployment_slot
};

let loaded_program = LoadedProgram::new(
loader_key,
loader,
Expand All @@ -114,7 +111,6 @@ pub fn load_program_from_bytes(
None,
programdata,
account_size,
use_jit,
load_program_metrics,
)
.map_err(|err| {
Expand Down Expand Up @@ -160,7 +156,6 @@ pub fn load_program_from_account(
tx_executor_cache: Option<RefMut<TransactionExecutorCache>>,
program: &BorrowedAccount,
programdata: &BorrowedAccount,
use_jit: bool,
debugging_features: bool,
) -> Result<(Arc<LoadedProgram>, Option<LoadProgramMetrics>), InstructionError> {
if !check_loader_id(program.get_owner()) {
Expand Down Expand Up @@ -208,7 +203,6 @@ pub fn load_program_from_account(
program.get_owner(),
program.get_data().len().saturating_add(programdata_size),
deployment_slot,
use_jit,
false, /* reject_deployment_of_broken_elfs */
debugging_features,
)?);
Expand All @@ -226,7 +220,7 @@ pub fn load_program_from_account(
}

macro_rules! deploy_program {
($invoke_context:expr, $use_jit:expr, $program_id:expr, $loader_key:expr,
($invoke_context:expr, $program_id:expr, $loader_key:expr,
$account_size:expr, $slot:expr, $drop:expr, $new_programdata:expr $(,)?) => {{
let delay_visibility_of_program_deployment = $invoke_context
.feature_set
Expand All @@ -241,7 +235,6 @@ macro_rules! deploy_program {
$loader_key,
$account_size,
$slot,
$use_jit,
true, /* reject_deployment_of_broken_elfs */
false, /* debugging_features */
)?;
Expand Down Expand Up @@ -447,7 +440,7 @@ pub fn process_instruction(
_memory_mapping: &mut MemoryMapping,
result: &mut ProgramResult,
) {
*result = process_instruction_inner(invoke_context, false).into();
*result = process_instruction_inner(invoke_context).into();
}

pub fn process_instruction_jit(
Expand All @@ -460,12 +453,11 @@ pub fn process_instruction_jit(
_memory_mapping: &mut MemoryMapping,
result: &mut ProgramResult,
) {
*result = process_instruction_inner(invoke_context, true).into();
*result = process_instruction_inner(invoke_context).into();
}

fn process_instruction_inner(
invoke_context: &mut InvokeContext,
use_jit: bool,
) -> Result<u64, Box<dyn std::error::Error>> {
let log_collector = invoke_context.get_log_collector();
let transaction_context = &invoke_context.transaction_context;
Expand Down Expand Up @@ -562,12 +554,12 @@ fn process_instruction_inner(
if native_programs_consume_cu {
invoke_context.consume_checked(2_370)?;
}
process_loader_upgradeable_instruction(invoke_context, use_jit)
process_loader_upgradeable_instruction(invoke_context)
} else if bpf_loader::check_id(program_id) {
if native_programs_consume_cu {
invoke_context.consume_checked(570)?;
}
process_loader_instruction(invoke_context, use_jit)
process_loader_instruction(invoke_context)
} else if bpf_loader_deprecated::check_id(program_id) {
if native_programs_consume_cu {
invoke_context.consume_checked(1_140)?;
Expand Down Expand Up @@ -609,7 +601,6 @@ fn process_instruction_inner(
Some(invoke_context.tx_executor_cache.borrow_mut()),
&program_account,
programdata_account.as_ref().unwrap_or(&program_account),
use_jit,
false, /* debugging_features */
)?;
drop(program_account);
Expand Down Expand Up @@ -639,7 +630,6 @@ fn process_instruction_inner(

fn process_loader_upgradeable_instruction(
invoke_context: &mut InvokeContext,
use_jit: bool,
) -> Result<(), InstructionError> {
let log_collector = invoke_context.get_log_collector();
let transaction_context = &invoke_context.transaction_context;
Expand Down Expand Up @@ -823,7 +813,6 @@ fn process_loader_upgradeable_instruction(
instruction_context.try_borrow_instruction_account(transaction_context, 3)?;
deploy_program!(
invoke_context,
use_jit,
new_program_id,
&owner_id,
UpgradeableLoaderState::size_of_program().saturating_add(programdata_len),
Expand Down Expand Up @@ -1012,7 +1001,6 @@ fn process_loader_upgradeable_instruction(
instruction_context.try_borrow_instruction_account(transaction_context, 2)?;
deploy_program!(
invoke_context,
use_jit,
new_program_id,
program_id,
UpgradeableLoaderState::size_of_program().saturating_add(programdata_len),
Expand Down Expand Up @@ -1502,10 +1490,7 @@ fn common_close_account(
Ok(())
}

fn process_loader_instruction(
invoke_context: &mut InvokeContext,
use_jit: bool,
) -> Result<(), InstructionError> {
fn process_loader_instruction(invoke_context: &mut InvokeContext) -> Result<(), InstructionError> {
let transaction_context = &invoke_context.transaction_context;
let instruction_context = transaction_context.get_current_instruction_context()?;
let instruction_data = instruction_context.get_instruction_data();
Expand Down Expand Up @@ -1535,7 +1520,6 @@ fn process_loader_instruction(
}
deploy_program!(
invoke_context,
use_jit,
*program.get_key(),
program.get_owner(),
program.get_data().len(),
Expand Down Expand Up @@ -4044,7 +4028,6 @@ mod tests {
file.read_to_end(&mut elf).unwrap();
deploy_program!(
invoke_context,
false,
program_id,
&bpf_loader_upgradeable::id(),
elf.len(),
Expand Down
8 changes: 1 addition & 7 deletions programs/loader-v3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ pub fn load_program_from_account(
compute_budget: &ComputeBudget,
log_collector: Option<Rc<RefCell<LogCollector>>>,
program: &BorrowedAccount,
use_jit: bool,
debugging_features: bool,
) -> Result<(Arc<LoadedProgram>, LoadProgramMetrics), InstructionError> {
let mut load_program_metrics = LoadProgramMetrics {
Expand Down Expand Up @@ -118,7 +117,6 @@ pub fn load_program_from_account(
None,
programdata,
program.get_data().len(),
use_jit,
&mut load_program_metrics,
)
.map_err(|err| {
Expand Down Expand Up @@ -404,7 +402,6 @@ pub fn process_instruction_truncate(

pub fn process_instruction_deploy(
invoke_context: &mut InvokeContext,
use_jit: bool,
) -> Result<(), InstructionError> {
let log_collector = invoke_context.get_log_collector();
let transaction_context = &invoke_context.transaction_context;
Expand Down Expand Up @@ -454,7 +451,6 @@ pub fn process_instruction_deploy(
invoke_context.get_compute_budget(),
invoke_context.get_log_collector(),
buffer,
use_jit,
false, /* debugging_features */
)?;
load_program_metrics.submit_datapoint(&mut invoke_context.timings);
Expand Down Expand Up @@ -552,7 +548,6 @@ pub fn process_instruction(
pub fn process_instruction_inner(
invoke_context: &mut InvokeContext,
) -> Result<u64, Box<dyn std::error::Error>> {
let use_jit = true;
let log_collector = invoke_context.get_log_collector();
let transaction_context = &invoke_context.transaction_context;
let instruction_context = transaction_context.get_current_instruction_context()?;
Expand All @@ -572,7 +567,7 @@ pub fn process_instruction_inner(
LoaderV3Instruction::Truncate { offset } => {
process_instruction_truncate(invoke_context, offset)
}
LoaderV3Instruction::Deploy => process_instruction_deploy(invoke_context, use_jit),
LoaderV3Instruction::Deploy => process_instruction_deploy(invoke_context),
LoaderV3Instruction::Retract => process_instruction_retract(invoke_context),
LoaderV3Instruction::TransferAuthority => {
process_instruction_transfer_authority(invoke_context)
Expand Down Expand Up @@ -600,7 +595,6 @@ pub fn process_instruction_inner(
invoke_context.get_compute_budget(),
invoke_context.get_log_collector(),
&program,
use_jit,
false, /* debugging_features */
)?;
load_program_metrics.submit_datapoint(&mut invoke_context.timings);
Expand Down
5 changes: 2 additions & 3 deletions rbpf-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,8 @@ before execting it in the virtual machine.",
&bpf_loader::id(),
contents.len(),
Slot::default(),
false, /* use_jit */
true, /* reject_deployment_of_broken_elfs */
true, /* debugging_features */
true, /* reject_deployment_of_broken_elfs */
true, /* debugging_features */
);
match result {
Ok(loaded_program) => match loaded_program.program {
Expand Down
6 changes: 1 addition & 5 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1215,10 +1215,7 @@ impl Bank {
) -> Self {
Self::new_with_paths_for_tests(
genesis_config,
Arc::new(RuntimeConfig {
bpf_jit: true,
..RuntimeConfig::default()
}),
Arc::new(RuntimeConfig::default()),
Vec::new(),
account_indexes,
shrink_ratio,
Expand Down Expand Up @@ -4191,7 +4188,6 @@ impl Bank {
None,
&program,
programdata.as_ref().unwrap_or(&program),
self.runtime_config.bpf_jit,
false, /* debugging_features */
)
.map(|(loaded_program, _create_executor_metrics)| loaded_program)
Expand Down
1 change: 0 additions & 1 deletion runtime/src/runtime_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use solana_program_runtime::compute_budget::ComputeBudget;
/// Encapsulates flags that can be used to tweak the runtime behavior.
#[derive(AbiExample, Debug, Default, Clone)]
pub struct RuntimeConfig {
pub bpf_jit: bool,
pub compute_budget: Option<ComputeBudget>,
pub log_messages_bytes_limit: Option<usize>,
pub transaction_account_lock_limit: Option<usize>,
Expand Down
Loading

0 comments on commit c52a945

Please sign in to comment.