LunarWaveVM is a Lua 5.4 virtual machine written in Rust.
 
 
Go to file
_ c452116c0a 📝 doc 2023-10-04 21:04:42 -05:00
lunar_wave_cli 🚧 wip: decode Instructions lazily 2023-10-03 15:59:06 -05:00
lunar_wave_vm 📈 performance: incrementing PC right after fetch seems to get it under 2900 ms 2023-10-04 18:29:58 -05:00
pictures 📝 doc: roadmap 2023-09-27 13:58:37 -05:00
.gitignore 📝 doc: benchmark results 2023-10-01 02:00:23 -05:00
COPYING.txt 📝 doc: license 2023-09-27 14:03:21 -05:00
Cargo.lock ♻️ refactor: extract `State::eval` for testing bugs the REPL finds 2023-10-01 23:07:52 -05:00
Cargo.toml test: fix up some bugs to support an embedding example 2023-10-01 19:50:50 -05:00
README.md 📝 doc: benchmark results 2023-10-01 02:00:23 -05:00
notes.md 📝 doc 2023-10-04 21:04:42 -05:00

README.md

LunarWaveVM is a Lua 5.4 virtual machine written in Rust.

A star field with an orange crab-shaped nebula facing a dark purple moon with a bright magenta crescent.

luac5.4 -o - test_vectors/fizz_buzz.lua | cargo run -- --pipe-bytecode

1
2
3       Fizz
4
5       Buzz
6       Fizz
7

...
44
45      FizzBuzz
46
47
48      Fizz
49
50      Buzz

Roadmap

  • Loading simple pre-compiled bytecode programs
  • Hash tables
  • Fizzbuzz
  • Closures
  • Error handling
  • Garbage collection
  • Long strings
  • Using arrays internally for tables
  • Compiling Lua source code to bytecode

Benchmark

9x slower than PUC Lua, 90x slower than LuaJIT.

Based only on the n-body simulation from the computer language benchmarks, because it's easy to run.

time target/release/lunar_wave_vm --script test_vectors/n_body.lua -- 500000; time lua test_vectors/n_body.lua 500000; time luajit test_vectors/n_body.lua 500000;
-0.169075164
-0.169096567
[src/main.rs:110] x = []

real	0m10.543s
user	0m10.535s
sys	0m0.000s
-0.169075164
-0.169096567

real	0m1.173s
user	0m1.165s
sys	0m0.004s
-0.169075164
-0.169096567

real	0m0.117s
user	0m0.116s
sys	0m0.000s