Skip to content

toy dynamic language executed by virtual machine with JIT compiler

License

Notifications You must be signed in to change notification settings

raviqqe/monoruby

 
 

Repository files navigation

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

About

toy dynamic language executed by virtual machine with JIT compiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 98.9%
  • Other 1.1%