Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 1.96 KB

README.md

File metadata and controls

66 lines (46 loc) · 1.96 KB

monoruby

Rust codecov

another toy Ruby implementation with a fast JIT compiler written in Rust.

Features

  • register-based bytecode.
  • bytecode executer (virtual machine) written in x86-64 assembly (yes, we currently support only x86-64!).
  • a compact and fast JIT compiler. (internally using self-made dynamic assembler monoasm)

Status of this project

This project still remains in early-alpha stage. Currently, only the functionalities described below are implemented.

  • classes: Integer, Float, String, Symbol, Class
  • superclass and singleton class and methods
  • local variables
  • if-then-elsif-end statement
  • for-in statement
  • while statement
  • method definition

Benchmark

  • measured by benchmark-driver with '--repeat-count 3' option.
  • shown in iteration/sec (the higher, the better).
impl \ bench app_fib (fib 40) so_mandelbrot
monoruby --jit 1.401 1.339
monoruby 0.174 0.910
ruby(3.2.0dev) 0.202 0.673
ruby --yjit 0.816 0.897
ruby --mjit 0.566 0.754

How to run

To build monoruby, You'll need installation of Rust. Please be aware that only nightly version of Rust works for monoruby.

To run ruby program file on monoruby,

% cargo run app_fib.rb

or

% cargo run --release -- app_fib.rb

one liner

% cargo run -- -e "puts 100"

You can launch REPL, omitting file name.

% cargo run