/jit-brainfuck

C++ JIT for Brainfuck (https://github.com/spencertipping/jit-tutorial)

Primary LanguageBrainfuck

Brainfuck JIT

A simple JIT written in C++ for brainfuck. This extends https://github.com/spencertipping/jit-tutorial to support brainfuck.

Building

make
./jit mandelbrot.bf

Features

  • Simple macro assembler for generating machine code
  • Supports calling back in to C++ (I had no idea the stack needed to be aligned to 16 bytes, that was a pain to debug)
  • Uses tonnes of memory

Debugging

  • There is a debug flag in the top of main.cc to enable dumping the machine code.
  • In gdb, break before jit entry, then do layout asm or layout split to see the generated code. ni and si will let you jump over or into the assembly.