Commit 5e761980

5e761980cedbMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 8 months ago · 5 files · +4 added · ~1 modified

Description

Implement Spinel AOT compiler: Prism parser + C codegen

First working AOT compiler that parses Ruby source with libprism, performs simple type inference, and generates C code linked against mruby. Successfully compiles bm_so_mandelbrot.rb to an executable that produces bit-identical output to CRuby.

Performance on mandelbrot (size=600): CRuby: 1.14s mruby interpreter: 3.18s Spinel AOT: 0.06s (19x faster than CRuby, 53x faster than mruby)

The compiler handles: while loops, local variables, Integer/Float/Boolean type inference, arithmetic/comparison/bitwise operators (as direct C ops), string interpolation, puts/print, Integer#chr, break.

Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]

Details

Commit
5e761980cedb
Parent
f134697e738f

.gitignoremodifiedView file

@@ -6,3 +6,13 @@
66 *.a
77 *.so
88 *.dylib
9+*.pbm
10+
11+# Build outputs
12+/spinel
13+/mandelbrot
14+/mandelbrot_aot.c
15+/mandelbrot_dbg
16+
17+# Dependencies (fetched by `make deps`)
18+/lib/prism/