Garnet.js: Implementing the YARV Virtual Machine
summary
Built a TypeScript YARV interpreter that interprets Ruby (does not transpile) and targets Node and browsers, emitting and executing YARV bytecode with a stack VM model. Uses the Prism parser compiled to WASM and Onigmo regex in WASM, wraps Ruby objects as RValue, implements ~107 YARV instructions, and is ~80 KB compressed. It already ran the entire Phlex test suite and many Ruby compatibility tests, handles Ruby’s complex argument calling conventions, and implements much of the stdlib though some nodes and libraries remain unfinished.
AI-written summary · about
chapters (7)
- 0:00Welcome
- 2:27Ruby history and YARV
- 10:32YARV bytecode compilation
- 16:27Garnet.js purpose
- 19:12Ruby objects in Garnet.js
- 21:17Ruby syntax edge cases
- 29:19Contributing to Garnet.js
related talks
36mCompiling Ruby
33mRuby the Hard Way: Writing Bytecode to Optimize Plain Ruby
29mRuby Internals: A Guide For Rails Developers
32mExperiments in sharing Java VM technology with CRuby
29mA Rails Developer’s Guide To The Ruby VM
36mSome Assembly Required
38mRubyX: Compiling Ruby and it's effect on the community
40mCompiling Ruby
