How solana-labs/rbpf works
solana_rbpf is a Rust user-space eBPF virtual machine. Its principal workflow is to configure a loader and built-ins, create an executable from bytecode or ELF, optionally JIT-compile it, map memory and create an instruction-meter context, then execute it in the interpreter or JIT. Separate capabilities include assembly and disassembly, verification, debugging, and syscall support. The workflow links are documented in the README; source-level links are limited to relationships visible in the supplied excerpts or SOURCE INDEX, so unsampled implementation details are not inferred.
Main entry points: program.rs Executable and built-ins · elf.rs ELF loader · jit.rs x86 JIT compiler · vm.rs Virtual machine
Components 18
Program authoring
- Assembly parser
src/asm_parser.rs - Assembler
src/assembler.rs - Instruction builder
src/insn_builder.rs - Disassembler
src/disassembler.rs - Debugger
src/debugger.rs
Loading and analysis
- ELF parser
src/elf_parser/mod.rs - ELF loader
src/elf.rs - Verifier
src/verifier.rs - Static analysis
src/static_analysis.rs - Executable and built-ins
src/program.rs
VM runtime
- Syscall registry
src/syscalls.rs - Memory mapping
src/memory_region.rs - Aligned memory
src/aligned_memory.rs - Virtual machine
src/vm.rs
Execution engines
- Interpreter
src/interpreter.rs - x86 JIT compiler
src/jit.rs - x86 instruction emission
src/x86.rs
Other components
- Application user
Connections 15
- Application user → Executable and built-ins: configures loader
- Application user → ELF loader: loads ELF
- Application user → Executable and built-ins: creates executable
- ELF loader → ELF parser: parses ELF
src/elf.rs - ELF loader → Executable and built-ins: builds executable
- ELF loader → x86 JIT compiler: references JIT
src/elf.rs - Application user → Verifier: verifies program
- Application user → x86 JIT compiler: compiles executable
- x86 JIT compiler → Static analysis: uses analysis
src/jit.rs - Application user → Memory mapping: maps memory
- Application user → Virtual machine: creates VM
- Executable and built-ins → Virtual machine: uses VM types
src/program.rs - Executable and built-ins → Syscall registry: uses syscall registry
src/program.rs - Application user → Interpreter: runs interpreter
- Application user → x86 JIT compiler: runs compiled code