Revmc
JIT and AOT compiler for the Ethereum Virtual Machine, built on Revm.
Install / Use
/learn @paradigmxyz/RevmcREADME
revmc
Experimental JIT and AOT compiler for the Ethereum Virtual Machine.
The compiler implementation is abstracted over an intermediate representation backend. It performs very well, as demonstrated below from our criterion benchmarks, and exposes an intuitive API via Revm.
The compiler backend is abstracted behind a trait (revmc-backend), with an LLVM implementation (revmc-llvm) providing full test coverage.
Requirements
- Latest stable Rust version
LLVM backend
- Linux or macOS, Windows is not supported
- LLVM 22
- On Debian-based Linux distros: see apt.llvm.org
- On Arch-based Linux distros:
pacman -S llvm - On macOS:
brew install llvm@22 - The following environment variables may be required:
prefix=$(llvm-config --prefix) # or #prefix=$(llvm-config-22 --prefix) # on macOS: #prefix=$(brew --prefix llvm@22) export LLVM_SYS_221_PREFIX=$prefix
Usage
The compiler is implemented as a library and can be used as such through the revmc crate.
A minimal runtime is required to run AOT-compiled bytecodes. A default runtime implementation is
provided through symbols exported in the revmc-builtins crate and must be exported in the final
binary. This can be achieved with the following build script:
fn main() {
revmc_build::emit();
}
You can check out the examples directory for example usage.
Testing
The Ethereum state tests are included as a git submodule.
The submodule is configured with update = none so it won't be cloned automatically.
To check it out:
git submodule update --init --checkout --depth 1 tests/ethereum-tests
Then run the state tests:
# All three modes (interpreter baseline, JIT, AOT):
cargo nextest run -p revmc -E 'test(statetest::)'
# A specific mode:
cargo nextest run -p revmc -E 'test(statetest::jit)'
# A specific test subdirectory:
SUBDIR=stSelfBalance cargo nextest run -p revmc -E 'test(statetest::jit)'
Credits
The initial compiler implementation was inspired by paradigmxyz/jitevm.
