Skip to content

Commit

Permalink
Fix jit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Ste authored and LucasSte committed Oct 14, 2024
1 parent 624aac3 commit 3dab2a0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion benches/vm_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extern crate test;
use solana_rbpf::{
ebpf,
memory_region::MemoryRegion,
program::{FunctionRegistry, SBPFVersion},
program::{FunctionRegistry, SBPFVersion, SyscallRegistry},
vm::Config,
};
use solana_rbpf::{
Expand Down Expand Up @@ -88,6 +88,7 @@ fn bench_jit_vs_interpreter(
Arc::new(BuiltinProgram::new_loader(
config,
FunctionRegistry::default(),
SyscallRegistry::default(),
)),
)
.unwrap();
Expand Down
7 changes: 5 additions & 2 deletions src/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,9 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
mod tests {
use super::*;
use crate::{
program::{BuiltinFunction, BuiltinProgram, FunctionRegistry, SBPFVersion},
program::{
BuiltinFunction, BuiltinProgram, FunctionRegistry, SBPFVersion, SyscallRegistry,
},
syscalls,
vm::TestContextObject,
};
Expand Down Expand Up @@ -1748,7 +1750,8 @@ mod tests {
function_registry
.register_function_hashed(*b"gather_bytes", syscalls::SyscallGatherBytes::vm)
.unwrap();
let loader = BuiltinProgram::new_loader(config, function_registry);
let syscall_registry = SyscallRegistry::default();
let loader = BuiltinProgram::new_loader(config, function_registry, syscall_registry);
let mut function_registry = FunctionRegistry::default();
function_registry
.register_function(8, *b"function_foo", 8)
Expand Down
2 changes: 1 addition & 1 deletion src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl<T: Copy + PartialEq> FunctionRegistry<T> {
}
}

/// A syscall registry to operate with static syscalls represented by integers.
/// A registry to operate with static syscalls represented by integers.
#[derive(PartialEq, Eq)]
pub struct SyscallRegistry<T> {
look_up: Vec<(Vec<u8>, T)>,
Expand Down
1 change: 1 addition & 0 deletions tests/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3454,6 +3454,7 @@ fn execute_generated_program(prog: &[u8]) -> bool {
..Config::default()
},
FunctionRegistry::default(),
SyscallRegistry::default(),
)),
SBPFVersion::V2,
FunctionRegistry::default(),
Expand Down
4 changes: 2 additions & 2 deletions tests/exercise_instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use solana_rbpf::{
assembler::assemble,
ebpf,
memory_region::MemoryRegion,
program::{BuiltinFunction, BuiltinProgram, FunctionRegistry, SBPFVersion},
program::{BuiltinFunction, BuiltinProgram, FunctionRegistry, SBPFVersion, SyscallRegistry},
static_analysis::Analysis,
verifier::RequisiteVerifier,
vm::{Config, ContextObject, TestContextObject},
Expand Down Expand Up @@ -124,7 +124,7 @@ macro_rules! test_interpreter_and_jit_asm {
config.enable_instruction_tracing = true;
let mut function_registry = FunctionRegistry::<BuiltinFunction<TestContextObject>>::default();
$(test_interpreter_and_jit!(register, function_registry, $location => $syscall_function);)*
let loader = Arc::new(BuiltinProgram::new_loader(config, function_registry));
let loader = Arc::new(BuiltinProgram::new_loader(config, function_registry, SyscallRegistry::default()));
let mut executable = assemble($source, loader).unwrap();
test_interpreter_and_jit!(executable, $mem, $context_object);
}
Expand Down

0 comments on commit 3dab2a0

Please sign in to comment.