Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not pass SBPFVersion by reference #623

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions benches/memory_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ macro_rules! bench_gapped_randomized_access_with_1024_entries {
)];
let config = Config::default();
let memory_mapping =
$mem::new(memory_regions, &config, &SBPFVersion::V2).unwrap();
$mem::new(memory_regions, &config, SBPFVersion::V2).unwrap();
let mut prng = new_prng!();
bencher.iter(|| {
assert!(memory_mapping
Expand Down Expand Up @@ -111,7 +111,7 @@ macro_rules! bench_randomized_access_with_0001_entry {
let content = vec![0; 1024 * 2];
let memory_regions = vec![MemoryRegion::new_readonly(&content[..], 0x100000000)];
let config = Config::default();
let memory_mapping = $mem::new(memory_regions, &config, &SBPFVersion::V2).unwrap();
let memory_mapping = $mem::new(memory_regions, &config, SBPFVersion::V2).unwrap();
let mut prng = new_prng!();
bencher.iter(|| {
let _ = memory_mapping.map(
Expand Down Expand Up @@ -145,7 +145,7 @@ macro_rules! bench_randomized_access_with_n_entries {
let (memory_regions, end_address) =
generate_memory_regions($n, MemoryState::Readable, Some(&mut prng));
let config = Config::default();
let memory_mapping = $mem::new(memory_regions, &config, &SBPFVersion::V2).unwrap();
let memory_mapping = $mem::new(memory_regions, &config, SBPFVersion::V2).unwrap();
bencher.iter(|| {
let _ = memory_mapping.map(
AccessType::Load,
Expand Down Expand Up @@ -194,7 +194,7 @@ macro_rules! bench_randomized_mapping_with_n_entries {
let (memory_regions, _end_address) =
generate_memory_regions($n, MemoryState::Readable, Some(&mut prng));
let config = Config::default();
let memory_mapping = $mem::new(memory_regions, &config, &SBPFVersion::V2).unwrap();
let memory_mapping = $mem::new(memory_regions, &config, SBPFVersion::V2).unwrap();
bencher.iter(|| {
let _ = memory_mapping.map(AccessType::Load, 0x100000000, 1);
});
Expand Down Expand Up @@ -243,7 +243,7 @@ macro_rules! bench_mapping_with_n_entries {
let (memory_regions, _end_address) =
generate_memory_regions($n, MemoryState::Readable, None);
let config = Config::default();
let memory_mapping = $mem::new(memory_regions, &config, &SBPFVersion::V2).unwrap();
let memory_mapping = $mem::new(memory_regions, &config, SBPFVersion::V2).unwrap();
bencher.iter(|| {
let _ = memory_mapping.map(AccessType::Load, 0x100000000, 1);
});
Expand Down Expand Up @@ -301,7 +301,7 @@ fn do_bench_mapping_operation(bencher: &mut Bencher, op: MemoryOperation, vm_add
MemoryRegion::new_writable(&mut mem2, 0x100000000 + 8),
],
&config,
&SBPFVersion::V2,
SBPFVersion::V2,
)
.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/dumb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fuzz_target!(|data: DumbFuzzData| {
let function_registry = FunctionRegistry::default();
let syscall_registry = FunctionRegistry::<BuiltinFunction<TestContextObject>>::default();

if RequisiteVerifier::verify(&prog, &config, &SBPFVersion::V2, &function_registry, &syscall_registry).is_err() {
if RequisiteVerifier::verify(&prog, &config, SBPFVersion::V2, &function_registry, &syscall_registry).is_err() {
// verify please
return;
}
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/smart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fuzz_target!(|data: FuzzData| {
if RequisiteVerifier::verify(
prog.into_bytes(),
&config,
&SBPFVersion::V2,
SBPFVersion::V2,
&function_registry,
&syscall_registry,
)
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/smart_jit_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fuzz_target!(|data: FuzzData| {
if RequisiteVerifier::verify(
prog.into_bytes(),
&config,
&SBPFVersion::V2,
SBPFVersion::V2,
&function_registry,
&syscall_registry,
)
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/smarter_jit_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fuzz_target!(|data: FuzzData| {
if RequisiteVerifier::verify(
prog.into_bytes(),
&config,
&SBPFVersion::V2,
SBPFVersion::V2,
&function_registry,
&syscall_registry,
)
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/verify_semantic_aware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fuzz_target!(|data: FuzzData| {
RequisiteVerifier::verify(
prog.into_bytes(),
&config,
&SBPFVersion::V2,
SBPFVersion::V2,
&function_registry,
&syscall_registry,
)
Expand Down
2 changes: 1 addition & 1 deletion src/disassembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub fn disassemble_instruction<C: ContextObject>(
cfg_nodes: &BTreeMap<usize, CfgNode>,
function_registry: &FunctionRegistry<usize>,
loader: &BuiltinProgram<C>,
sbpf_version: &SBPFVersion,
sbpf_version: SBPFVersion,
) -> String {
let name;
let desc;
Expand Down
4 changes: 2 additions & 2 deletions src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ impl<C: ContextObject> Executable<C> {
}

/// Get the executable sbpf_version
pub fn get_sbpf_version(&self) -> &SBPFVersion {
&self.sbpf_version
pub fn get_sbpf_version(&self) -> SBPFVersion {
self.sbpf_version
}

/// Get the .text section virtual address and bytes
Expand Down
Loading