Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bfjit

brainfuck interpreter + x86_64 jit

the goal: accuracy first, then speed

platform

  • x86_64 only
  • windows + linux

run

hello:

cargo run --release -- samples/hello.bf

mandelbrot:

cargo run --release -- samples/mandelbrot.bf

modes:

cargo run --release -- samples/hello.bf --interp
cargo run --release -- samples/hello.bf --jit

options:

cargo run --release -- samples/mandelbrot.bf --tape 30000
cargo run --release -- samples/mandelbrot.bf --guard
cargo run --release -- samples/mandelbrot.bf --noguard
cargo run --release -- samples/mandelbrot.bf --dump-ir
cargo run --release -- samples/mandelbrot.bf --dump-asm

benches

fast:

cargo bench --bench bench

heavy (mandelbrot):

$env:BFJIT_HEAVY = "1"
cargo bench --bench bench -- mandelbrot

fuzz

requires nightly:

cargo +nightly fuzz run ir_equiv
cargo +nightly fuzz run bf_equiv

correctness

  • interp is the oracle
  • fuzz targets compare interp vs jit (tape + output)
  • mandelbrot output matches byte-for-byte (interp vs jit)

numbers

mandelbrot on my box:

  • interp: ~5.6s
  • jit: ~0.85s
  • jit compile: ~85us

Releases

Packages

Contributors

Languages