~/talk

BYOJ: Build your own JIT with Ruby

Talkat RubyConf TH 2023 · 2023-10-06..10-07· [ruby, compilers-and-language-design]
slides:none on file

Explains building a JIT in Ruby using the Rjit gem and an assembler or Fiddle to emit machine code, handling YARV instructions like put_nil, leave, putobject and opt_plus, mapping stack slots to registers (examples use R8/R9), updating the control frame pointer and execution context and moving the return into the RX register. Demonstrates a working compiler class with compile hooks, reports up to about 2x speedups from RubyBench versus no JIT, and shows a surprising 420 monkeypatch that proves you can alter semantics at the machine level.

AI-written summary · about

  1. 0:00Introduction
  2. 1:07What is a JIT
  3. 2:13Ruby’s JIT evolution
  4. 3:19Stack vs register machines
  5. 6:14Ruby VM instructions
  6. 10:29Custom JIT with RJIT
  7. 12:38Compiling put nil
  8. 16:15JIT simple addition
  9. 18:03JIT performance benchmarks
  10. 18:46RJIT monkey patching
  11. 20:00Closing
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.